Natural Computing

, Volume 15, Issue 1, pp 181–193 | Cite as

Evolution of new algorithms for the binary knapsack problem

  • Lucas ParadaEmail author
  • Carlos Herrera
  • Mauricio Sepúlveda
  • Víctor Parada


Due to its NP-hard nature, it is still difficult to find an optimal solution for instances of the binary knapsack problem as small as 100 variables. In this paper, we developed a three-level hyper-heuristic framework to generate algorithms for the problem. From elementary components and multiple sets of problem instances, algorithms are generated. The best algorithms are selected to go through a second step process, where they are evaluated with problem instances that differ in size and difficulty. The problem instances are generated according to methods that are found in the literature. In all of the larger problem instances, the generated algorithms have less than 1 % error with respect to the optimal solution. Additionally, generated algorithms are efficient, taking on average fractions of a second to find a solution for any instance, with a standard deviation of 1 s. In terms of structure, hyper-heuristic algorithms are compact in size compared with those in the literature, allowing an in-depth analysis of their structure and their presentation to the scientific world.


Automatic generation of algorithms Combinatorial optimization Evolutionary computation Genetic programming Hyper-heuristic Knapsack problem 



Binary knapsack problem


Genetic programming


Genetic programming platform for evolving tree structures of code


In the knapsack list; data structure used by the evolved algorithms


Out of knapsack list; data structure used by the evolved algorithms


Uncorrelated instance of the binary knapsack problem


Weakly correlated instance of the binary knapsack problem


Strongly correlated instance of the binary knapsack problem


Subset sum instance of the binary knapsack problem


Fitness cases i.e. problem instances of the binary knapsack problem used to evolve algorithms



The authors would like to thank the Complex Engineering Systems Institute ICM: P-05-004-F, CONICYT: FBO16, DICYT: 61219-USACH, ECOS/CONICYT: C13E04, STICAMSUD: 13STIC-05.


  1. Affenzeller M, Winkler S, Wagner S, Beham A (2009) Genetic algorithms and genetic programming: modern concepts and practical applications, 1st edn. CRC, Chapman and HallGoogle Scholar
  2. Ahmed A, Shaikh AW, Ali M et al (2011) Hyper-heuristic approach for solving scheduling problem: a case study. Aust J Basic Appl Sci 5(9):190–199Google Scholar
  3. Alinia A, Vakil B, Badamchi Z et al (2012) Hybrid particle swarm optimization transplanted into a hyper-heuristic structure for solving examination timetabling problem. Swarm Evol Comput 7:21–34. doi: 10.1016/j.swevo.2012.06.004 CrossRefGoogle Scholar
  4. Angelelli E, Mansini R, Grazia S (2010) Kernel search: a general heuristic for the multi-dimensional knapsack problem. Comput Oper Res 37(11):2017–2026CrossRefMathSciNetzbMATHGoogle Scholar
  5. Balas E, Zemel E (1980) An algorithm for large zero-one knapsack problems. Oper Res 28(5):1130–1154CrossRefMathSciNetzbMATHGoogle Scholar
  6. Bienstock D (2008) Approximate formulations for 0-1 knapsack sets. Oper Res Lett 36(3):317–320CrossRefMathSciNetzbMATHGoogle Scholar
  7. Bilgin B, Demeester P, Misir M et al (2012) One hyper-heuristic approach to two timetabling problems in health care. J Heuristics 18(3):401–434. doi: 10.1007/s10732-011-9192-0 CrossRefGoogle Scholar
  8. Burke E, Kendall G, Newall J et al (2003) Hyper-heuristics: an emerging direction in modern search technology. Handbook of metaheuristics, pp 457–474Google Scholar
  9. Burke E, Hyde M, Kendall G et al (2010) A classification of hyper-heuristic approaches. In: Handbook of metaheuristics (international series in operations research & management science, vol 146). Nottingham, UK, pp 449–468Google Scholar
  10. Burke E, Hyde M, Kendall G et al (2012) Automating the packing heuristic design process with genetic programming. Evol Comput 20(1):63–89. doi: 10.1162/EVCO_a_00044 CrossRefGoogle Scholar
  11. Darehmiraki M, Mishmast N (2007) Molecular solution to the 0–1 knapsack problem based on DNA computing. Appl Math Comput 187(2):1033–1037CrossRefMathSciNetzbMATHGoogle Scholar
  12. Demeester P, Bilgin B, De Causmaecker P et al (2012) A hyperheuristic approach to examination timetabling problems: benchmarks and a new problem from practice. J Sched 15(1):83–103. doi: 10.1007/s10951-011-0258-5 CrossRefGoogle Scholar
  13. Fortnow L (2009) The status of the P versus NP problem. Commun ACM 52(9):78–86CrossRefGoogle Scholar
  14. Fraser A, Weinbrenner T (1993) GPC++-genetic programming C++ class library. [Online]. Accessed 17 Dec 2013
  15. Garey M, Johnson D (1979) Computers and intractability. A guide to the theory of NP-completeness. A series of books in the mathematical sciences. WH Freeman and Company, San Francisco, CalifGoogle Scholar
  16. Garrido P, Castro C (2012) A flexible and adaptive hyper-heuristic approach for (dynamic) capacitated vehicle routing problems. Fundam Inform 119(1):29–60. doi: 10.3233/FI-2012-726 MathSciNetGoogle Scholar
  17. Gómez JC, Terashima-Marín H (2012) Building general hyper-heuristics for multi-objective cutting stock problems. Computacion y Sistemas 16(3):321–334Google Scholar
  18. Koza J (1992) Genetic programming: on the programming of computers by means of natural selection. The MIT press, MassachusettszbMATHGoogle Scholar
  19. Koza J, Bennett F, Andre D et al (1997) Automated synthesis of analog electrical circuits by means of genetic programming. IEEE Trans Evol Comput 1(2):109–128. doi: 10.1109/4235.687879 CrossRefGoogle Scholar
  20. Koza J, Keane M, Streeter M, Mydlowec W, Yu J, Lanza G (2005) Genetic programming IV: routine human-competitive machine intelligence. Kluwer Academic Publishers, NorwellGoogle Scholar
  21. Kumar R, Singh P (2010) Assessing solution quality of biobjective 0–1 knapsack problem using evolutionary and heuristic algorithms. Appl Soft Comput 10(3):711–718CrossRefGoogle Scholar
  22. Martello S, Toth P (1990). Knapsack problems: algorithms and computer implementations (revised). University of Bologna, Bologna, ItalyGoogle Scholar
  23. Pisinger D (2005) Where are the hard knapsack problems? Comput Oper Res 32(9):2271–2284CrossRefMathSciNetzbMATHGoogle Scholar
  24. Poli R, Langdon W, McPhee N (2008) A field guide to genetic programming. Published via and freely available at
  25. Rajni A, Chana I (2013) Bacterial foraging based hyper-heuristic for resource scheduling in grid computing. Future Gener Comput Syst 29(3):751–762. doi: 10.1016/j.future.2012.09.005 CrossRefGoogle Scholar
  26. Sabar N, Ayob M, Qu R et al (2012) A graph coloring constructive hyper-heuristic for examination timetabling problems. Appl Intell 37(1):1–11. doi: 10.1007/s10489-011-0309-9 CrossRefGoogle Scholar
  27. Taghipour H, Rezaei M, Esmaili H (2013) Solving the 0/1 knapsack problem by a biomolecular DNA computer. Advances in bioinformaticsGoogle Scholar
  28. Ye L, Zhang M (2013) Solutions to the 0-1 knapsack problem based on DNA encoding and computing method. J Comput 8(3):669–675Google Scholar

Copyright information

© Springer Science+Business Media Dordrecht 2015

Authors and Affiliations

  • Lucas Parada
    • 1
    Email author
  • Carlos Herrera
    • 1
  • Mauricio Sepúlveda
    • 2
  • Víctor Parada
    • 2
  1. 1.Departamento de Ingeniería IndustrialUniversidad de ConcepciónConcepciónChile
  2. 2.Departamento de Ingeniería InformáticaUniversidad de Santiago de ChileSantiagoChile

Personalised recommendations