Package org.opt4j.optimizer.sa
Class SimulatedAnnealing
- java.lang.Object
-
- org.opt4j.core.optimizer.AbstractOptimizer
-
- org.opt4j.optimizer.sa.SimulatedAnnealing
-
- All Implemented Interfaces:
Optimizer
public class SimulatedAnnealing extends AbstractOptimizer
TheSimulatedAnnealing
is a standard implementation of the optimization heuristic. This heuristic optimizes a single objective (multi-objective problems are optimized by the sum of all objectives).
-
-
Field Summary
Fields Modifier and Type Field Description protected CoolingSchedule
coolingSchedule
protected Copy<Genotype>
copy
protected Neighbor<Genotype>
neighbor
protected Random
random
-
Fields inherited from class org.opt4j.core.optimizer.AbstractOptimizer
archive, completer, control, iteration, iterationListeners, optimizing, population, stateListeners
-
-
Constructor Summary
Constructors Constructor Description SimulatedAnnealing(Population population, Archive archive, IndividualFactory individualFactory, IndividualCompleter completer, Control control, Rand random, Neighbor<Genotype> neighbor, Copy<Genotype> copy, Iteration iteration, CoolingSchedule coolingSchedule)
Constructs a newSimulatedAnnealing
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
f(Individual individual)
Calculates the sum of theObjectives
of oneIndividual
.void
optimize()
Starts the optimization process.-
Methods inherited from class org.opt4j.core.optimizer.AbstractOptimizer
addOptimizerIterationListener, addOptimizerStateListener, getIteration, injectListeners, isRunning, nextIteration, removeOptimizerIterationListener, removeOptimizerStateListener, startOptimization, stopOptimization
-
-
-
-
Constructor Detail
-
SimulatedAnnealing
@Inject public SimulatedAnnealing(Population population, Archive archive, IndividualFactory individualFactory, IndividualCompleter completer, Control control, Rand random, Neighbor<Genotype> neighbor, Copy<Genotype> copy, Iteration iteration, CoolingSchedule coolingSchedule)
Constructs a newSimulatedAnnealing
.- Parameters:
population
- the populationarchive
- the archiveindividualFactory
- the individual factorycompleter
- the completercontrol
- the controlrandom
- the random number generatorneighbor
- the neighbor operatorcopy
- the copy operatoriteration
- the iteration countercoolingSchedule
- the cooling schedule
-
-
Method Detail
-
optimize
public void optimize() throws TerminationException, StopException
Description copied from interface:Optimizer
Starts the optimization process.- Throws:
TerminationException
- if the optimization is terminatedStopException
- if the optimization is stopped
-
f
protected double f(Individual individual)
Calculates the sum of theObjectives
of oneIndividual
.- Parameters:
individual
- the individual- Returns:
- the sum of the objective values
-
-