geneticengine.representations.tree.operators

Classes

FullInitializer

All individuals are created with full trees (maximum depth in all

GrowInitializer

All individuals are created expanding productions until a maximum depth,

PositionIndependentGrowInitializer

All individuals are created expanding productions until a maximum depth,

RampedHalfAndHalfInitializer

Half of the individuals are created with the maximum depth, and the

InjectInitialPopulationWrapper

Starts with an initial population, and relies on another initializer if

Module Contents

class geneticengine.representations.tree.operators.FullInitializer(max_depth)

Bases: geneticengine.algorithms.gp.structure.PopulationInitializer

All individuals are created with full trees (maximum depth in all branches).

Parameters:

max_depth (int)

max_depth
initialize(problem, representation, random, target_size, **kwargs)
Parameters:
Return type:

Iterator[geneticengine.solutions.individual.PhenotypicIndividual]

class geneticengine.representations.tree.operators.GrowInitializer

Bases: geneticengine.algorithms.gp.structure.PopulationInitializer

All individuals are created expanding productions until a maximum depth, but without the requirement of reaching that depth.

initialize(problem, representation, random, target_size, max_tries=1000, **kwargs)
Parameters:
Return type:

Iterator[geneticengine.solutions.individual.PhenotypicIndividual]

class geneticengine.representations.tree.operators.PositionIndependentGrowInitializer(max_depth)

Bases: geneticengine.algorithms.gp.structure.PopulationInitializer

All individuals are created expanding productions until a maximum depth, but without the requirement of reaching that depth.

Parameters:

max_depth (int)

max_depth
grow
full
initialize(problem, representation, random, target_size, **kwargs)
Parameters:
Return type:

Iterator[geneticengine.solutions.individual.PhenotypicIndividual]

class geneticengine.representations.tree.operators.RampedHalfAndHalfInitializer(max_depth)

Bases: geneticengine.algorithms.gp.structure.PopulationInitializer

Half of the individuals are created with the maximum depth, and the other half with different values of maximum depth between the minimum and the maximum.

There’s an equal chance of using full or grow method.

Parameters:

max_depth (int)

max_depth
initialize(problem, representation, random, target_size)
Parameters:
Return type:

Iterator[geneticengine.solutions.individual.PhenotypicIndividual]

class geneticengine.representations.tree.operators.InjectInitialPopulationWrapper(programs, backup)

Bases: geneticengine.algorithms.gp.structure.PopulationInitializer

Starts with an initial population, and relies on another initializer if it’s necessary to fulfill the population size.

Parameters:
programs
backup_initializer
initialize(problem, representation, random, target_size)
Parameters:
Return type:

Iterator[geneticengine.solutions.individual.PhenotypicIndividual]