EvaluatorType
- Type of Evaluator to usepublic abstract class AbstractAnytimeLineMinimizer<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>> extends AbstractAnytimeFunctionMinimizer<java.lang.Double,java.lang.Double,EvaluatorType> implements LineMinimizer<EvaluatorType>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ITERATIONS
Default number of iterations to run the algorithm, 100
|
static double |
DEFAULT_TOLERANCE
Default tolerance of the algorithm 1.0E-5
|
initialGuess, result, tolerance
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
AbstractAnytimeLineMinimizer(LineBracketInterpolator<? super EvaluatorType> interpolator)
Creates a new instance of AbstractAnytimeLineMinimizer
|
AbstractAnytimeLineMinimizer(LineBracketInterpolator<? super EvaluatorType> interpolator,
LineBracket bracket,
java.lang.Double initialGuess,
double tolerance,
int maxIterations)
Creates a new instance of AbstractAnytimeLineMinimizer
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
bracketingStep()
Continues the bracketing phase of the algorithm, which attempts to
place a bracket around a known minimum.
|
protected void |
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has
finished.
|
LineBracket |
getBracket()
Gets the LineBracket used to bound the search
|
java.lang.Double |
getInitialGuessFunctionValue()
Getter for initialGuessFunctionValue
|
java.lang.Double |
getInitialGuessSlope()
Getter for initialGuessSlope
|
LineBracketInterpolator<? super EvaluatorType> |
getInterpolator()
Gets the interpolator used to fit data points and derive an
interpolated (hypothesized) minimum to try next.
|
protected boolean |
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the
data that is stored in the data field.
|
boolean |
isValidBracket()
Returns true if the algorithm has found a valid bracket on a minimum,
false if the algorithm needs to continue the bracketing phase
|
WeightedInputOutputPair<Vector,java.lang.Double> |
minimizeAlongDirection(DirectionalVectorToScalarFunction function,
java.lang.Double functionValue,
Vector gradient)
Minimizes a Vector function along the direction given by the
DirectionalVectorToScalarFunction.
|
abstract boolean |
sectioningStep()
Continues the sectioning phase of the algorihtm.
|
void |
setBracket(LineBracket bracket)
Setter for bracket
|
void |
setData(EvaluatorType data)
Gets the data to use for learning.
|
void |
setInitialGuess(java.lang.Double initialGuess)
Setter for initialGuess
|
void |
setInitialGuessFunctionValue(java.lang.Double initialGuessFunctionValue)
Setter for initialGuessFunctionValue
|
void |
setInitialGuessSlope(java.lang.Double initialGuessSlope)
Setter for initialGuessSlope
|
void |
setInterpolator(LineBracketInterpolator<? super EvaluatorType> interpolator)
Setter for interpolator
|
void |
setValidBracket(boolean validBracket)
Setter for validBracket
|
protected boolean |
step()
Called to take a single step of the learning algorithm.
|
getInitialGuess, getResult, getTolerance, setResult, setTolerance
clone, getData, getKeepGoing, learn, setKeepGoing, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInitialGuess, getTolerance, learn, setTolerance
clone
getMaxIterations, getResult, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid, stop
public static final int DEFAULT_MAX_ITERATIONS
public static final double DEFAULT_TOLERANCE
public AbstractAnytimeLineMinimizer(LineBracketInterpolator<? super EvaluatorType> interpolator)
interpolator
- Type of algorithm to fit data points and find an interpolated minimum
to the known points.public AbstractAnytimeLineMinimizer(LineBracketInterpolator<? super EvaluatorType> interpolator, LineBracket bracket, java.lang.Double initialGuess, double tolerance, int maxIterations)
interpolator
- Type of algorithm to fit data points and find an interpolated minimum
to the known points.bracket
- LineBracket bounding a local minimum.initialGuess
- Initial guess to the location of the local minimum.tolerance
- Tolerance of the minimization algorithm.maxIterations
- Maximum number of iterations to run the algorithm before stopping.protected boolean initializeAlgorithm()
AbstractAnytimeBatchLearner
initializeAlgorithm
in class AbstractAnytimeBatchLearner<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>,InputOutputPair<java.lang.Double,java.lang.Double>>
protected boolean step()
AbstractAnytimeBatchLearner
step
in class AbstractAnytimeBatchLearner<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>,InputOutputPair<java.lang.Double,java.lang.Double>>
protected void cleanupAlgorithm()
AbstractAnytimeBatchLearner
cleanupAlgorithm
in class AbstractAnytimeBatchLearner<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>,InputOutputPair<java.lang.Double,java.lang.Double>>
public WeightedInputOutputPair<Vector,java.lang.Double> minimizeAlongDirection(DirectionalVectorToScalarFunction function, java.lang.Double functionValue, Vector gradient)
LineMinimizer
function
is
taken to be the initialGuess.minimizeAlongDirection
in interface LineMinimizer<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>>
function
- Defines the direction to search along, and the initial guess. The
direction is scaled by the line-search solutionfunctionValue
- Value of function at initialGuess, may be nullgradient
- Derivative of the output with respect to the input of function
at the initial guess. Gradient may be null if it's not being computer.
So, gradient is not required for all line-search methods, but
will throw an exception if it's expected but not available.public abstract boolean bracketingStep()
LineMinimizer
bracketingStep
in interface LineMinimizer<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>>
public abstract boolean sectioningStep()
LineMinimizer
sectioningStep
in interface LineMinimizer<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>>
public boolean isValidBracket()
LineMinimizer
isValidBracket
in interface LineMinimizer<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>>
public void setValidBracket(boolean validBracket)
validBracket
- Flag indicating if the algorithm has already found a valid bracket on
a local minimum.public LineBracketInterpolator<? super EvaluatorType> getInterpolator()
LineMinimizer
getInterpolator
in interface LineMinimizer<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>>
public void setInterpolator(LineBracketInterpolator<? super EvaluatorType> interpolator)
interpolator
- Type of algorithm to fit data points and find an interpolated minimum
to the known points.public LineBracket getBracket()
LineMinimizer
getBracket
in interface LineMinimizer<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>>
public void setBracket(LineBracket bracket)
bracket
- LineBracket bounding a local minimum.public void setData(EvaluatorType data)
AbstractAnytimeBatchLearner
setData
in class AbstractAnytimeBatchLearner<EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>,InputOutputPair<java.lang.Double,java.lang.Double>>
data
- The data to use for learning.public void setInitialGuess(java.lang.Double initialGuess)
AbstractAnytimeFunctionMinimizer
setInitialGuess
in interface FunctionMinimizer<java.lang.Double,java.lang.Double,EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>>
setInitialGuess
in class AbstractAnytimeFunctionMinimizer<java.lang.Double,java.lang.Double,EvaluatorType extends Evaluator<java.lang.Double,java.lang.Double>>
initialGuess
- Initial guess of the minimization routinepublic java.lang.Double getInitialGuessFunctionValue()
public void setInitialGuessFunctionValue(java.lang.Double initialGuessFunctionValue)
initialGuessFunctionValue
- Function value at the initialGuess, may be null.public java.lang.Double getInitialGuessSlope()
public void setInitialGuessSlope(java.lang.Double initialGuessSlope)
initialGuessSlope
- Function slope at the initialGuess, may be null.