Optimizee for simple functions

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


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

  • 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.

Creates a random value of parameter within given bounds


Bounds the individual within the required bounds via coordinate clipping


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


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