Natural Computing

, Volume 5, Issue 4, pp 443–462 | Cite as

Grammatical Swarm: The generation of programs by social programming

  • Michael O’Neill
  • Anthony Brabazon


This study examines Social Programming, that is, the construction of programs using a Social Swarm algorithm based on Particle Swarm Optimization. Each individual particle represents choices of program construction rules, where these rules are specified using a Backus–Naur Form grammar. This study represents the first instance of a Particle Swarm Algorithm being used to generate programs. A selection of benchmark problems from the field of Genetic Programming are tackled and performance is compared to Grammatical Evolution. The results demonstrate that it is possible to successfully generate programs using the Grammatical Swarm technique. An analysis of the Grammatical Swarm approach is presented on the dynamics of the search. It is found that restricting the search to the generation of complete programs, or with the use of a ratchet constraint forcing individuals to move only if a fitness improvement has been found, can have detrimental consequences for the swarms performance and dynamics.

Key words:

genetic programming grammatical evolution particle swarm optimization social learning social programming 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. Banzhaf W, Nordin P, Keller RE, Francone FD (1998). Genetic Programming – An Introduction; On the Automatic Evolution of Computer Programs and its Applications. Morgan Kaufmann, San Mateo, CaliforniaGoogle Scholar
  2. Bonabeau E, Dorigo M, Theraulaz G (1999). Swarm Intelligence: From natural to artificial systems. Oxford University Press, OxfordGoogle Scholar
  3. Brabazon A, O’Neill M (2006). Biologically Inspired Algorithms for Financial Modelling. Springer, BerlinGoogle Scholar
  4. Brabazon A, Silva A, de Sousa TF, ONeill M, Matthews R, Costa E (2005) Investigating Strategic inertia using OrgSwarm. Informatica 29:125–141Google Scholar
  5. Kennedy J, Eberhart R, Shi Y (2001). Swarm Intelligence. Morgan Kauff-man, San Mateo, CaliforniaGoogle Scholar
  6. Kennedy J and Eberhart R (1995) Particle swarm optimization, Proceedings of the IEEE International Conference on Neural Networks, December 1995, pp. 1942–1948, IEEE PressGoogle Scholar
  7. Koza JR (1992) Genetic Programming. MIT PressGoogle Scholar
  8. Koza JR (1994) Genetic Programming II: Automatic Discovery of Reusable Programs. MIT PressGoogle Scholar
  9. Koza JR, Andre D, Bennett FH III, Keane M (1999). Genetic Programming 3: Darwinian Invention and Problem Solving. Morgan Kaufmann, San Mateo, CaliforniaGoogle Scholar
  10. Koza JR, Keane M, Streeter MJ, Mydlowec W, Yu J, Lanza G (2003) Genetic Programming IV: Routine Human-Competitive Machine Intelligence. Kluwer Academic PublishersGoogle Scholar
  11. Langdon WB and Poli R (1998) Why ants are hard. In: Genetic Programming 1998: Proceedings of the Third Annual Conference. University of Wisconsin, Madison, Wisconsin, USA, pp. 193–201, Morgan Kaufmann, San Mateo, CaliforniaGoogle Scholar
  12. O’Neill M and Brabazon A (2004) Grammatical Swarm. In: LNCS 3102 Proceedings of the Genetic and Evolutionary Computation Conference GECCO 2004. Seattle, WA, USA, pp. 163–174, Springer, BerlinGoogle Scholar
  13. O’Neill M and Ryan C (2003) Grammatical Evolution: Evolutionary Automatic Programming in an Arbitrary Language. Kluwer Academic PublishersGoogle Scholar
  14. O’Neill M (2001) Automatic Programming in an Arbitrary Language: Evolving Programs in Grammatical Evolution. PhD thesis, University of LimerickGoogle Scholar
  15. O’Neill M, Ryan C (2001). Grammatical Evolution. IEEE Transactions on Evolutionary Computation 5(4):349–358CrossRefGoogle Scholar
  16. O’Neill M, Ryan C, Keijzer M, Cattolico M (2003). Crossover in grammatical evolution. Genetic Programming and Evolvable Machines 4(1):67–93CrossRefGoogle Scholar
  17. Ryan C, Collins JJ, O’Neill M (1998) Grammatical evolution: evolving programs for an arbitrary language. Proceedings of the First European Workshop on GP. pp. 83–95, Springer-Verlag, BerlinGoogle Scholar
  18. Silva A, Neves A, Costa E (2002) An empirical comparison of particle swarm and predator prey optimisation. In: LNAI 2464, Artificial Intelligence and Cognitive Science, the 13th Irish Conference AICS 2002. pp. 103–110, Limerick, Ireland, Springer, BerlinGoogle Scholar

Copyright information

© Springer Science+Business Media, Inc. 2006

Authors and Affiliations

  1. 1.Natural Computing Research & Applications GroupUniversity College DublinDublinIreland

Personalised recommendations