Class SimpleGridMinimizer.Solution
- java.lang.Object
-
- dev.nm.solver.multivariate.geneticalgorithm.GeneticAlgorithm
-
- dev.nm.solver.multivariate.geneticalgorithm.minimizer.simplegrid.SimpleGridMinimizer.Solution
-
- All Implemented Interfaces:
IterativeMethod<Vector>
,IterativeSolution<Vector>
,MinimizationSolution<Vector>
- Direct Known Subclasses:
DEOptim.Solution
- Enclosing class:
- SimpleGridMinimizer
protected class SimpleGridMinimizer.Solution extends GeneticAlgorithm implements IterativeSolution<Vector>
This is the solution to a minimization problem usingSimpleGridMinimizer
.
-
-
Field Summary
Fields Modifier and Type Field Description protected RealScalarFunction
f
protected SimpleCellFactory
factory
protected double
fmin
protected double
fminLast
protected Vector[]
initials
protected int
iteration
protected int
nNoChanges
protected Vector
xmin
-
Fields inherited from class dev.nm.solver.multivariate.geneticalgorithm.GeneticAlgorithm
parallel, population, uniform
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Solution(RealScalarFunction f)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<? extends Chromosome>
getFirstGeneration()
The initial population is generated by putting a uniform mesh/grid/net over the entire region.protected boolean
isConverged()
This genetic algorithm terminates if the minimum does not improve for a fixed number of iterations, or the maximum number of iterations is exceeded.ImmutableVector
minimizer()
Get the minimizer (solution) to the minimization problem.double
minimum()
Get the (approximate) minimum found.Vector
search(Vector... initials)
Search for a solution that optimizes the objective function from the given starting points.void
setInitials(Vector... initials)
Supply the starting points for the search.Object
step()
Run a step in genetic algorithm: produce the next generation of chromosome pool.-
Methods inherited from class dev.nm.solver.multivariate.geneticalgorithm.GeneticAlgorithm
getBest, getChild, getNewPool, getNextGeneration, getOne, nChildren, nPopulation, run
-
-
-
-
Field Detail
-
initials
protected Vector[] initials
-
iteration
protected int iteration
-
nNoChanges
protected int nNoChanges
-
fminLast
protected double fminLast
-
fmin
protected double fmin
-
xmin
protected Vector xmin
-
f
protected final RealScalarFunction f
-
factory
protected final SimpleCellFactory factory
-
-
Constructor Detail
-
Solution
protected Solution(RealScalarFunction f)
-
-
Method Detail
-
getFirstGeneration
protected List<? extends Chromosome> getFirstGeneration()
The initial population is generated by putting a uniform mesh/grid/net over the entire region. The grid points are the chromosomes in the first population. The population size is proportional to the number of available cores. The region bounds are determined from the initial guesses.- Specified by:
getFirstGeneration
in classGeneticAlgorithm
- Returns:
- the first population
-
isConverged
protected boolean isConverged()
This genetic algorithm terminates if- the minimum does not improve for a fixed number of iterations, or
- the maximum number of iterations is exceeded.
- Specified by:
isConverged
in classGeneticAlgorithm
- Returns:
true
if a convergence is found
-
setInitials
public void setInitials(Vector... initials)
Description copied from interface:IterativeMethod
Supply the starting points for the search. This can also initialize the state of the algorithm for a new search.- Specified by:
setInitials
in interfaceIterativeMethod<Vector>
- Parameters:
initials
- the initial guesses
-
step
public Object step()
Description copied from class:GeneticAlgorithm
Run a step in genetic algorithm: produce the next generation of chromosome pool.- Specified by:
step
in interfaceIterativeMethod<Vector>
- Overrides:
step
in classGeneticAlgorithm
- Returns:
- true
-
search
public Vector search(Vector... initials)
Description copied from interface:IterativeMethod
Search for a solution that optimizes the objective function from the given starting points. This method typically calls first#setInitials(S...)
and then iterativelyIterativeMethod.step()
. It implements a default convergence criterion.- Specified by:
search
in interfaceIterativeMethod<Vector>
- Parameters:
initials
- the initial guesses- Returns:
- an (approximate) optimizer
-
minimum
public double minimum()
Description copied from interface:MinimizationSolution
Get the (approximate) minimum found.- Specified by:
minimum
in interfaceMinimizationSolution<Vector>
- Returns:
- the (approximate) minimum found
-
minimizer
public ImmutableVector minimizer()
Description copied from interface:MinimizationSolution
Get the minimizer (solution) to the minimization problem.- Specified by:
minimizer
in interfaceMinimizationSolution<Vector>
- Returns:
- the minimizer
-
-