Optimizee for simple functions

The fitness function to optimize is the value of the function.

FunctionGeneratorOptimizee

class l2l.optimizees.functions.optimizee.FunctionGeneratorOptimizee(traj, fg_instance, seed)[source]

Bases: l2l.optimizees.optimizee.Optimizee

Implements a simple function optimizee. Functions are generated using the FunctionGenerator. NOTE: Make sure the optimizee_fitness_weights is set to (-1,) to minimize the value of the function

Parameters:
  • traj – The trajectory used to conduct the optimization.
  • fg_instance – Instance of the FunctionGenerator class.
  • seed – The random seed used for generation of optimizee individuals. It uses a copy of the fg_instance and overrides the random generator using one seeded by seed. Note that this random generator is also the one used by the FunctionGeneratorOptimizee itself. NOTE that this seed is converted to an np.uint32.
create_individual()[source]

Creates a random value of parameter within given bounds

bounding_func(individual)[source]

Bounds the individual within the required bounds via coordinate clipping

simulate(traj)[source]

Returns the value of the function chosen during initialization

Parameters:traj (Trajectory) – Trajectory
Returns:a single element tuple containing the value of the chosen function

l2l.optimizees.functions.tools

Contains some tools used by the functions implementation.

l2l.optimizees.functions.tools.plot(fn, random_state)[source]

Implements plotting of 2D functions generated by FunctionGenerator :param fn: Instance of FunctionGenerator