# Optimizer using Simulated Annealing¶

## SimulatedAnnealingOptimizer¶

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

Class for a generic simulate annealing solver. In the pseudo code the algorithm does:

For n iterations do:
1. Take a step of size noisy step in a random direction
2. If it reduces the cost, keep the solution
3. Otherwise keep with probability exp(- (f_new - f) / T)

NOTE: This expects all parameters of the system to be of floating point

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() SimulatedAnnealingParameters containing the parameters needed by the Optimizer
cooling(temperature, cooling_schedule, temperature_decay, temperature_end, steps_total)[source]
post_process(traj, fitnesses_results)[source]
end(traj)[source]

## SimulatedAnnealingParameters¶

class l2l.optimizers.simulatedannealing.optimizer.SimulatedAnnealingParameters

Bases: tuple

Parameters: n_parallel_runs – Number of individuals per simulation / Number of parallel Simulated Annealing runs noisy_step – Size of the random step temp_decay – A function of the form f(t) = temperature at time t n_iteration – number of iteration to perform stop_criterion – Stop if change in fitness is below this value seed – Random seed cooling_schedule – Which of the available schedules to use
cooling_schedule
n_iteration
n_parallel_runs
noisy_step
seed
stop_criterion
temp_decay