A New Approach to Solving 0-1 Multiconstraint Knapsack Problems Using Attribute Grammar with Lookahead

  • Muhammad Rezaul Karim
  • Conor Ryan
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6621)


In this paper, we introduce a new approach to genotype-phenotype mapping for Grammatical Evolution (GE) using an attribute grammar (AG) to solve 0-1 multiconstraint knapsack problems.

Previous work on AGs dealt with constraint violations through repeated remapping of non-terminals, which generated many introns, thus decreasing the power of the evolutionary search.

Our approach incorporates a form of lookahead into the mapping process using AG to focus only on feasible solutions and so avoid repeated remapping and introns. The results presented in this paper show that the proposed approach is capable of obtaining high quality solutions for the tested problem instances using fewer evaluations than existing methods.


Problem Instance Knapsack Problem Constraint Satisfaction Problem Constraint Violation Semantic Function 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools, 2nd edn. Addison-Wesley, Reading (2006)zbMATHGoogle Scholar
  2. 2.
    Beasley, J.E.: Or-library: distributing test problems by electronic mail. Journal of the Operational Research Society 41(11), 1069–1072 (1990)CrossRefGoogle Scholar
  3. 3.
    Chu, P.C., Beasley, J.E.: A genetic algorithm for the multidimensional knapsack problem. Journal of Heuristics 4(1), 63–86 (1998)CrossRefzbMATHGoogle Scholar
  4. 4.
    Cleary, R.: Extending Grammatical Evolution with Attribute Grammars: An Application to Knapsack Problems. Master of science thesis in computer science, University of Limerick, Ireland (2005)Google Scholar
  5. 5.
    Cotta, C., Troya, J.M.: A hybrid genetic algorithm for the 0-1 multiple knapsack problem. In: Artificial Neural Nets and Genetic Algorithms 3, pp. 250–254. Springer, New York (1998)CrossRefGoogle Scholar
  6. 6.
    de la Cruz, M., Ortega de la Puente, A., Alfonseca, M.: Attribute grammar evolution. In: Mira, J., Álvarez, J.R. (eds.) IWINAC 2005. LNCS, vol. 3562, pp. 182–191. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  7. 7.
    Gottlieb, J.: On the effectivity of evolutionary algorithms for the multidimensional knapsack problem. In: Fonlupt, C., Hao, J.-K., Lutton, E., Schoenauer, M., Ronald, E. (eds.) AE 1999. LNCS, vol. 1829, pp. 23–37. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  8. 8.
    Gottlieb, J.: Permutation-based evolutionary algorithms for multidimensional knapsack problems. In: Proceedings of the 2000 ACM Symposium on Applied Computing, pp. 408–414. ACM, New York (2000)CrossRefGoogle Scholar
  9. 9.
    Gottlieb, J.: On the feasibility problem of penalty-based evolutionary algorithms for knapsack problems. In: Boers, E.J.W., Gottlieb, J., Lanzi, P.L., Smith, R.E., Cagnoni, S., Hart, E., Raidl, G.R., Tijink, H. (eds.) EvoIASP 2001, EvoWorkshops 2001, EvoFlight 2001, EvoSTIM 2001, EvoCOP 2001, and EvoLearn 2001. LNCS, vol. 2037, pp. 50–59. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  10. 10.
    Gottlieb, J., Raidl, G.R.: The effects of locality on the dynamics of decoder-based evolutionary search. In: Proceedings of the Genetic and Evolutionary Computation Conference 2000, pp. 283–290. Morgan Kaufmann Publishers, San Francisco (2000)Google Scholar
  11. 11.
    Khuri, S., Back, T., Heitkotter, J.: The zero/one multiple knapsack problem and genetic algorithms. In: Proceedings of the 1994 ACM Symposium on Applied Computing, pp. 188–193. ACM Press, New York (1994)CrossRefGoogle Scholar
  12. 12.
    Knuth, D.E.: Semantics of context-free languages. Theory of Computing Systems 2(2), 127–145 (1968)MathSciNetzbMATHGoogle Scholar
  13. 13.
    Kumar, V.: Algorithms for constraint satisfaction problems: A survey. AI Magazine 13(1), 32–44 (1992)Google Scholar
  14. 14.
    O’Neill, M., Cleary, R., Nikolov, N.: Solving knapsack problems with attribute grammars. In: Proceedings of the Third Grammatical Evolution Workshop (2004)Google Scholar
  15. 15.
    Paakki, J.: Attribute grammar paradigms–a high-level methodology in language implementation. ACM Comput. Surv. 27(2), 196–255 (1995)CrossRefGoogle Scholar
  16. 16.
    Paterson, N., Livesey, M.: Evolving caching algorithms in C by genetic programming. In: Koza, J.R., Deb, K., Dorigo, M., Fogel, D.B., Garzon, M., Iba, H., Riolo, R.L. (eds.) Proceedings of the Second Annual Conference on Genetic Programming, pp. 262–267. Morgan Kaufmann, San Francisco (1997)Google Scholar
  17. 17.
    Pisinger, D.: Algorithms for knapsack problems. Ph.D. thesis, University of Copenhagen (1995)Google Scholar
  18. 18.
    Raidl, G.R.: An improved genetic algorithm for the multiconstrained 0-1 knapsack problem. In: Proceeding of the 1998 IEEE International Conference on Evolutionary Computation, pp. 207–211 (1998)Google Scholar
  19. 19.
    Raidl, G.R.: Weight-codings in a genetic algorithm for the multi-constraint knapsack problem. In: Proceedings of the 1999 Congress on Evolutionary Computation, pp. 596–603 (1999)Google Scholar
  20. 20.
    Ryan, C., Azad, R.M.A.: Sensible initialisation in grammatical evolution. In: Barry, A.M. (ed.) Proceedings of the Bird of a Feather Workshops, Genetic and Evolutionary Computation Conference, Chigaco, pp. 142–145 (2003)Google Scholar
  21. 21.
    Ryan, C., Collins, J., O’Neill, M.: Grammatical evolution: Evolving programs for an arbitrary language. In: Proceedings of the First European Workshop on Genetic Programming, pp. 83–95. Springer, Heidelberg (1998)Google Scholar
  22. 22.
    Ryan, C., Nicolau, M., O’Neill, M.: Genetic algorithms using grammatical evolution. In: Foster, J.A., Lutton, E., Miller, J., Ryan, C., Tettamanzi, A.G.B. (eds.) EuroGP 2002. LNCS, vol. 2278, pp. 278–287. Springer, Heidelberg (2002)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Muhammad Rezaul Karim
    • 1
  • Conor Ryan
    • 1
  1. 1.Biocomputing and Developmental Systems Group Department of Computer Science and Information SystemsUniversity of LimerickIreland

Personalised recommendations