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 RealScalarFunctionfprotected SimpleCellFactoryfactoryprotected doublefminprotected doublefminLastprotected Vector[]initialsprotected intiterationprotected intnNoChangesprotected Vectorxmin-
Fields inherited from class dev.nm.solver.multivariate.geneticalgorithm.GeneticAlgorithm
parallel, population, uniform
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSolution(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 booleanisConverged()This genetic algorithm terminates if the minimum does not improve for a fixed number of iterations, or the maximum number of iterations is exceeded.ImmutableVectorminimizer()Get the minimizer (solution) to the minimization problem.doubleminimum()Get the (approximate) minimum found.Vectorsearch(Vector... initials)Search for a solution that optimizes the objective function from the given starting points.voidsetInitials(Vector... initials)Supply the starting points for the search.Objectstep()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:
getFirstGenerationin 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:
isConvergedin classGeneticAlgorithm- Returns:
trueif a convergence is found
-
setInitials
public void setInitials(Vector... initials)
Description copied from interface:IterativeMethodSupply the starting points for the search. This can also initialize the state of the algorithm for a new search.- Specified by:
setInitialsin interfaceIterativeMethod<Vector>- Parameters:
initials- the initial guesses
-
step
public Object step()
Description copied from class:GeneticAlgorithmRun a step in genetic algorithm: produce the next generation of chromosome pool.- Specified by:
stepin interfaceIterativeMethod<Vector>- Overrides:
stepin classGeneticAlgorithm- Returns:
- true
-
search
public Vector search(Vector... initials)
Description copied from interface:IterativeMethodSearch 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:
searchin interfaceIterativeMethod<Vector>- Parameters:
initials- the initial guesses- Returns:
- an (approximate) optimizer
-
minimum
public double minimum()
Description copied from interface:MinimizationSolutionGet the (approximate) minimum found.- Specified by:
minimumin interfaceMinimizationSolution<Vector>- Returns:
- the (approximate) minimum found
-
minimizer
public ImmutableVector minimizer()
Description copied from interface:MinimizationSolutionGet the minimizer (solution) to the minimization problem.- Specified by:
minimizerin interfaceMinimizationSolution<Vector>- Returns:
- the minimizer
-
-