Porting Guide

DEAP development’s high velocity and our refusal to be at the mercy of backward compatibility can sometime induce minor headaches to our users. This concise guide should help you port your code from the latest version minus 0.1 to the current version.


  1. The algorithms from the algorithms module now return a tuple of 2-elements : the population and a Logbook.
  2. Replace every call to DTM by calls to SCOOP.
  3. Statistics and logging of data are accomplished by two distinct objects: Statistics and Logbook. Read the tutorial on logging statistics.
  4. Replace EvolutionLogger by Logbook.
  5. Replace usage of tools.mean(), tools.var(), tools.std(), and tools.median() by their Numpy equivalent.
  6. If the fitness has multiple objectives, add the keyword argument axis=0 when registering statistical function.

Genetic Algorithms (GA)

  1. Replace every call to the function cxTwoPoints() by a call to cxTwoPoint().
  2. Remove any import of cTools. If you need a faster implementation of the non-dominated sort, use sortLogNondominated().
  3. When inheriting from Numpy, you must manually copy the slices and compare individuals with numpy comparators. See the Inheriting from Numpy tutorial.

Genetic Programming (GP)

  1. Specify a name as the first argument of every call to addEphemeralConstant().
  2. Replace every call to lambdify() and evaluate() by a call to compile().
  3. Remove the pset attribute from every create() call when creating a primitive tree class.
  4. In the toolbox, register the primitive set as the pset argument of the following mutation operator: mutUniform(), mutNodeReplacement() and mutInsert().
  5. Replace every call to the function genRamped() by a call to genHalfAndHalf().
  6. Replace every call to stringify() by a call to str() or remove the call completely.
  7. Replace every call to lambdifyADF() by a call to compileADF().
  8. Replace the decorators staticDepthLimit() and staticSizeLimit() by staticLimit(). To specify a limit on either depth, size or any other attribute, it is now required to specify a key function. See staticLimit() documentation for more information.

Strongly Typed Genetic Programming (STGP)

  1. PrimitiveSetTyped method now requires type arguments to be defined as classes instead of string, for example float instead of "float".

Evolution Strategy (ES)

  1. Replace every call to the function cxESTwoPoints() by a call to cxESTwoPoint().

Still having problem?

We have overlooked something and your code is still not working? No problem, contact us on the deap users list at http://groups.google.com/group/deap-users and we will get you out of trouble in no time.