Worst-Case Execution Time Test Generation for Solutions of the Knapsack Problem Using a Genetic Algorithm

  • Maxim Buzdalov
  • Anatoly Shalyto
Conference paper
Part of the Communications in Computer and Information Science book series (CCIS, volume 472)

Abstract

Worst-case execution time test generation can be hard if tested programs use complex heuristics. This is especially true in the case of the knapsack problem, which is often called “the easiest NP-complete problem”. For randomly generated test data, the expected running time of some algorithms for this problem is linear. We present an approach for generation of tests against algorithms for the knapsack problem. This approach is based on genetic algorithms. It is evaluated on five algorithms, including one simple branch-and-bound algorithm, two algorithms by David Pisinger and their partial implementations. The results show that the presented approach performs statistically better than generation of random tests belonging to certain classes. Moreover, a class of tests that are especially hard for one of the algorithms was discovered by the genetic algorithm.

Keywords

knapsack problem test generation genetic algorithms worst-case execution time 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Source code for experiments (a part of this paper), https://github.com/mbuzdalov/papers/tree/master/2014-bicta-knapsacks
  2. 2.
    Alander, J.T., Mantere, T., Moghadampour, G.: Testing Software Response Times Using a Genetic Algorithm. In: Proceedings of the 3rd Nordic Workshop on Genetic Algorithms and their Applications, pp. 293–298 (1997)Google Scholar
  3. 3.
    Alander, J.T., Mantere, T., Turunen, P.: Genetic Algorithm based Software Testing. In: Proceedings of the 3rd International Conference on Artificial Neural Networks and Genetic Algorithms, Norwich, UK, pp. 325–328 (April 1997)Google Scholar
  4. 4.
    Alander, J.T., Mantere, T., Turunen, P., Virolainen, J.: GA in Program Testing. In: Proceedings of the 2nd Nordic Workshop on Genetic Algorithms and their Applications, Vaasa, Finland, August 19-23, pp. 205–210 (1996)Google Scholar
  5. 5.
    Arkhipov, V., Buzdalov, M., Shalyto, A.: Worst-Case Execution Time Test Generation for Augmenting Path Maximum Flow Algorithms using Genetic Algorithms. In: Proceedings of the International Conference on Machine Learning and Applications, vol. 2, pp. 108–111. IEEE Computer Society (2013)Google Scholar
  6. 6.
    Buzdalov, M.: Generation of Tests for Programming Challenge Tasks on Graph Theory using Evolution Strategy. In: Proceedings of the International Conference on Machine Learning and Applications, vol. 2, pp. 62–65. IEEE Computer Society (2012)Google Scholar
  7. 7.
    Buzdalova, A., Buzdalov, M., Parfenov, V.: Generation of Tests for Programming Challenge Tasks Using Helper-Objectives. In: Ruhe, G., Zhang, Y. (eds.) SSBSE 2013. LNCS, vol. 8084, pp. 300–305. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  8. 8.
    Chvatal, V.: Hard Knapsack Problems. Operations Research 28(6), 1402–1411 (1980)MathSciNetCrossRefMATHGoogle Scholar
  9. 9.
    Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York (1979)Google Scholar
  10. 10.
    Gross, H.G.: A Prediction System for Evolutionary Testability Applied to Dynamic Execution Time Analysis. Information and Software Technology 43(14), 855–862 (2001)CrossRefGoogle Scholar
  11. 11.
    Gross, H.G., Jones, B.F., Eyres, D.E.: Structural Performance Measure of Evolutionary Testing Applied to Worst-Case Timing of Real-Time Systems. IEEE Proceedings - Software 147(2), 25–30 (2000)CrossRefGoogle Scholar
  12. 12.
    Gross, H.G., Mayer, N.: Search-based Execution-Time Verification in Object-Oriented and Component-Based Real-Time System Development. In: Proceedings of the 8th IEEE International Workshop on Object-Oriented Real-Time Dependable Systems, pp. 113–120 (2003)Google Scholar
  13. 13.
    Moreno-Scott, J.H., Ortíz-Bayliss, J.C., Terashima-Marín, H., Conant-Pablos, S.E.: Challenging Heuristics: Evolving Binary Constraint Satisfaction Problems. In: Proceedings of Genetic and Evolutionary Computation Conference, pp. 409–416. ACM (2012)Google Scholar
  14. 14.
    Nemhauser, G., Ullmann, Z.: Discrete dynamic programming and capital allocation. Management Science 15(9), 494–505 (1969)MathSciNetCrossRefMATHGoogle Scholar
  15. 15.
    Pisinger, D.: Algorithms for Knapsack Problems. Ph.D. thesis, University of Copenhagen (February 1995)Google Scholar
  16. 16.
    R Core Team: R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria (2013), http://www.R-project.org/
  17. 17.
    Rice, H.G.: Classes of recursively enumerable sets and their decision problems. Transactions of the American Mathematical Society 74(2), 358–366 (1953)MathSciNetCrossRefMATHGoogle Scholar
  18. 18.
    Tlili, M., Wappler, S., Sthamer, H.: Improving Evolutionary Real-Time Testing. In: Proceedings of Genetic and Evolutionary Computation Conference, pp. 1917–1924. ACM (2006)Google Scholar
  19. 19.
    Wegener, J., Mueller, F.: A Comparison of Static Analysis and Evolutionary Testing for the Verification of Timing Constraints. Real-Time Systems 21(3), 241–268 (2001)CrossRefMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2014

Authors and Affiliations

  • Maxim Buzdalov
    • 1
  • Anatoly Shalyto
    • 1
  1. 1.ITMO UniversitySaint-PetersburgRussia

Personalised recommendations