freegs.optimise.optimise#
- freegs.optimise.optimise(eq, controls, measure, maxgen=10, N=10, CR=0.3, F=1.0, monitor=None)[source]#
Use Differential Evolution to optimise an Equilibrium https://en.wikipedia.org/wiki/Differential_evolution
- Parameters:
eq – Equilibrium to be used as starting solution. These are deep copied, and passed as arguments to controls and measure functions
controls –
List of control objects. These objects must have methods:
.set(eq, value)which modifies the given Equilibrium.get(eq)which returns the value from the Equilibrium
measure(eq) – Function which returns a score (value) for a given Equilibrium. The optimiser tries to minimise this value.
maxgen – Maximum number of generations
N – Population size (must be >= 4)
CR – Crossover probability (must be in
[0,1])F – Differential weight (must be in
[0,2])monitor(generation –
A function to be called each generation with the best Equilibrium and the whole population
generation = integer
best = (score, object)
population = [(score, object)]
best –
A function to be called each generation with the best Equilibrium and the whole population
generation = integer
best = (score, object)
population = [(score, object)]
population) –
A function to be called each generation with the best Equilibrium and the whole population
generation = integer
best = (score, object)
population = [(score, object)]
- Returns:
The
Equilibriumwith the lowest measure (score).- Return type: