public abstract class AbstractSimplex extends Object implements OptimizationData
SimplexOptimizer
.
AbstractSimplex(double[])
or AbstractSimplex(double[][])
.
The other constructor
will set all steps
to 1, thus building a default configuration from a unit hypercube.
build
method in order
to create the data structure that will be acted on by the other methods of
this class.SimplexOptimizer
Modifier | Constructor and Description |
---|---|
protected |
AbstractSimplex(double[] steps)
The start configuration for simplex is built from a box parallel to
the canonical axes of the space.
|
protected |
AbstractSimplex(double[][] referenceSimplex)
The real initial simplex will be set up by moving the reference
simplex such that its first point is located at the start point of the
optimization.
|
protected |
AbstractSimplex(int n)
Build a unit hypercube simplex.
|
protected |
AbstractSimplex(int n,
double sideLength)
Build a hypercube simplex with the given side length.
|
Modifier and Type | Method and Description |
---|---|
void |
build(double[] startPoint)
Build an initial simplex.
|
void |
evaluate(MultivariateFunction evaluationFunction,
Comparator<PointValuePair> comparator)
Evaluate all the non-evaluated points of the simplex.
|
int |
getDimension()
Get simplex dimension.
|
PointValuePair |
getPoint(int index)
Get the simplex point stored at the requested
index . |
PointValuePair[] |
getPoints()
Get the points of the simplex.
|
int |
getSize()
Get simplex size.
|
abstract void |
iterate(MultivariateFunction evaluationFunction,
Comparator<PointValuePair> comparator)
Compute the next simplex of the algorithm.
|
protected void |
replaceWorstPoint(PointValuePair pointValuePair,
Comparator<PointValuePair> comparator)
Replace the worst point of the simplex by a new point.
|
protected void |
setPoint(int index,
PointValuePair point)
Store a new point at location
index . |
protected void |
setPoints(PointValuePair[] points)
Replace all points.
|
protected AbstractSimplex(int n)
n
- Dimension of the simplex.protected AbstractSimplex(int n, double sideLength)
n
- Dimension of the simplex.sideLength
- Length of the sides of the hypercube.protected AbstractSimplex(double[] steps)
steps
- Steps along the canonical axes representing box edges. They
may be negative but not zero.NullArgumentException
- if steps
is null
.MathIllegalArgumentException
- if one of the steps is zero.protected AbstractSimplex(double[][] referenceSimplex)
referenceSimplex
- Reference simplex.MathIllegalArgumentException
- if the reference simplex does not
contain at least one point.MathIllegalArgumentException
- if there is a dimension mismatch
in the reference simplex.IllegalArgumentException
- if one of its vertices is duplicated.public int getDimension()
public int getSize()
build
method, this method will
will be equivalent to getDimension() + 1
.public abstract void iterate(MultivariateFunction evaluationFunction, Comparator<PointValuePair> comparator)
evaluationFunction
- Evaluation function.comparator
- Comparator to use to sort simplex vertices from best
to worst.MathIllegalStateException
- if the algorithm fails to converge.public void build(double[] startPoint)
startPoint
- First point of the simplex.MathIllegalArgumentException
- if the start point does not match
simplex dimension.public void evaluate(MultivariateFunction evaluationFunction, Comparator<PointValuePair> comparator)
evaluationFunction
- Evaluation function.comparator
- Comparator to use to sort simplex vertices from best to worst.MathIllegalStateException
- if the maximal number of evaluations is exceeded.protected void replaceWorstPoint(PointValuePair pointValuePair, Comparator<PointValuePair> comparator)
pointValuePair
- Point to insert.comparator
- Comparator to use for sorting the simplex vertices
from best to worst.public PointValuePair[] getPoints()
public PointValuePair getPoint(int index)
index
.index
- Location.index
.protected void setPoint(int index, PointValuePair point)
index
.
Note that no deep-copy of point
is performed.index
- Location.point
- New value.protected void setPoints(PointValuePair[] points)
points
is performed.points
- New Points.Copyright © 2016-2021 CS GROUP. All rights reserved.