Skip to content

Commit

Permalink
Example on using staticLimit as a decorator for Issue DEAP#41
Browse files Browse the repository at this point in the history
  • Loading branch information
professor committed Oct 4, 2014
1 parent 4ef225d commit 69fed89
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/gp/symbreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def evalSymbReg(individual, points):
toolbox.register("expr_mut", gp.genFull, min_=0, max_=2)
toolbox.register("mutate", gp.mutUniform, expr=toolbox.expr_mut, pset=pset)

toolbox.decorate("mate", gp.staticLimit(key=operator.attrgetter('height'), max_value=50))
toolbox.decorate("mutate", gp.staticLimit(key=operator.attrgetter('height'), max_value=50))

def main():
random.seed(318)

Expand Down

0 comments on commit 69fed89

Please sign in to comment.