Optimizer using Evolutionary Algorithm

GeneticAlgorithmOptimizer

class l2l.optimizers.evolution.optimizer.GeneticAlgorithmOptimizer(traj, optimizee_create_individual, optimizee_fitness_weights, parameters, optimizee_bounding_func=None)[source]

Bases: Optimizer

Implements evolutionary algorithm

Parameters:
  • traj (Trajectory) – Use this trajectory to store the parameters of the specific runs. The parameters should be initialized based on the values in parameters

  • optimizee_create_individual – Function that creates a new individual

  • optimizee_fitness_weights – Fitness weights. The fitness returned by the Optimizee is multiplied by these values (one for each element of the fitness vector)

  • parameters – Instance of namedtuple() GeneticAlgorithmOptimizer containing the parameters needed by the Optimizer

post_process(traj, fitnesses_results)[source]

See post_process()

end(traj)[source]

See end()

GeneticAlgorithmParameters

class l2l.optimizers.evolution.optimizer.GeneticAlgorithmParameters(seed, pop_size, cx_prob, mut_prob, n_iteration, ind_prob, tourn_size, mate_par, mut_par)

Bases: tuple

Parameters:
  • seed – Random seed

  • pop_size – Size of the population

  • cx_prob – Crossover probability

  • mut_prob – Mutation probability

  • n_iteration – Number of generations simulation should run for

  • ind_prob – Probability of mutation of each element in individual

  • tourn_size – Size of the tournamaent used for fitness evaluation and selection

  • mate_par – Parameter used for blending two values during mating

  • mut_par – Standard deviation for the gaussian addition mutation.

cx_prob
ind_prob
mate_par
mut_par
mut_prob
n_iteration
pop_size
seed
tourn_size