Sunday, February 13, 2011

Functional Programming in Evolutionary Algorithms

FP and EAs are two of my main interests in computer science, so naturally I want to see how they can be combined. Genetic programming has a special connection to functional programming in that early genetic programs were lisp expressions. This of course makes sense- the abstract syntax tree is the subject of evolution in this case and lisp is a natural language for this as you program the syntax tree directly.
There are other connections however- many of the important additions to GP have come from functional programming. There have been variations taking imperative constructs as well, but that is not the subject of this post. Some examples are polymorphism, recursion, and the addition of a type system. Some GPs even evolve lambda expressions.
Logic programming has also been applied to GP to evolve statement from a "logic grammar".
Along with the type systems that have been used in GP literature, there has been work allowing a GP to evolve higher order functions.
The use of functions like fold and map is called implicit recursion in GP and gives a nice way to allow recursive structures without the need to evolve higher order functions directly, or add recursive semantics and check for termination, etc.

I would like some day to look into other functional programming techniques in the context of EAs. For example, laziness opens up some possible optimizations. Tournament selection does not necessarily check every individual's fitness (they can be skipped if they are not chosen for any tournaments). In this case we must either add a lazy evaluation strategy, or use a lazy language or one that includes some way of specifying laziness. This has been investigated before, but the language used was Java.
One thing that I thing would be really neat would be using categorical concepts (category theory is another favorite topic of mine, especially where it interacts with functional programming). For example- could we make a monadic GP? A comonadic GP? So far I haven't been able to come up with a reasonable problem to test this out on, but it seems interesting.

1 comment:

  1. I've had an idea for representing populations in an Evolutionary Algorithm in a purely functional way, and I hope I can post about it when I've worked it out enough.

    ReplyDelete