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.
General¶
- The algorithms from the
algorithms
module now return a tuple of 2-elements : the population and aLogbook
. - Replace every call to DTM by calls to SCOOP.
- Statistics and logging of data are accomplished by two distinct objects:
Statistics
andLogbook
. Read the tutorial on logging statistics. - Replace
EvolutionLogger
byLogbook
. - Replace usage of
tools.mean()
,tools.var()
,tools.std()
, andtools.median()
by their Numpy equivalent. - If the fitness has multiple objectives, add the keyword argument
axis=0
when registering statistical function.
Genetic Algorithms (GA)¶
- Replace every call to the function
cxTwoPoints()
by a call tocxTwoPoint()
. - Remove any import of cTools. If you need a faster implementation of the non-dominated sort, use
sortLogNondominated()
. - 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)¶
- Specify a
name
as the first argument of every call toaddEphemeralConstant()
. - Replace every call to
lambdify()
andevaluate()
by a call tocompile()
. - Remove the pset attribute from every
create()
call when creating a primitive tree class. - In the toolbox, register the primitive set as the
pset
argument of the following mutation operator:mutUniform()
,mutNodeReplacement()
andmutInsert()
. - Replace every call to the function
genRamped()
by a call togenHalfAndHalf()
. - Replace every call to
stringify()
by a call tostr()
or remove the call completely. - Replace every call to
lambdifyADF()
by a call tocompileADF()
. - Replace the decorators
staticDepthLimit()
andstaticSizeLimit()
bystaticLimit()
. To specify a limit on either depth, size or any other attribute, it is now required to specify a key function. SeestaticLimit()
documentation for more information.
Strongly Typed Genetic Programming (STGP)¶
PrimitiveSetTyped
method now requires type arguments to be defined as classes instead of string, for examplefloat
instead of"float"
.
Evolution Strategy (ES)¶
- Replace every call to the function
cxESTwoPoints()
by a call tocxESTwoPoint()
.
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.