public class SmallGradientConditon extends AbstractTerminationCondition
TerminationCondition
that allows no further iteration in an optimization if the
the gradient becomes small, i.e.,
Modifier and Type | Class and Description |
---|---|
static class |
SmallGradientConditon.SmallGradientConditonParameterSet
This class implements the parameter set for a
SmallStepCondition . |
AbstractTerminationCondition.AbstractTerminationConditionParameterSet
parameter
Constructor and Description |
---|
SmallGradientConditon(double epsilon)
This constructor creates an instance that stops the optimization if the sum of the absolute
values of gradient components is smaller than
epsilon . |
SmallGradientConditon(SmallGradientConditon.SmallGradientConditonParameterSet parameter)
This is the main constructor creating an instance from a given parameter set.
|
SmallGradientConditon(StringBuffer xml)
The standard constructor for the interface
Storable . |
Modifier and Type | Method and Description |
---|---|
boolean |
doNextIteration(int iteration,
double fLast,
double fCurrent,
double[] gradient,
double[] direction,
double alpha,
Time t)
This method allows to decide whether to do another iteration in an optimization or not.
|
protected String |
getXmlTag()
This method returns the xml tag that is used in the method
AbstractTerminationCondition.toXML() and
in the constructor AbstractTerminationCondition.AbstractTerminationCondition(StringBuffer) . |
boolean |
isSimple()
This method returns
false if the TerminationCondition uses either
the gradient or the direction for the decision, otherwise it returns true . |
protected void |
set()
This method sets internal member variables from
AbstractTerminationCondition.parameter . |
clone, getCurrentParameterSet, toXML
public SmallGradientConditon(double epsilon) throws Exception
epsilon
.epsilon
- the threshold for stopping, has to be non-negativeException
- if the parameter can not be set properlypublic SmallGradientConditon(SmallGradientConditon.SmallGradientConditonParameterSet parameter) throws CloneNotSupportedException
parameter
- the set of parametersCloneNotSupportedException
- if parameter
can not be cloned properly.public SmallGradientConditon(StringBuffer xml) throws NonParsableException
Storable
.
Constructs a SmallGradientConditon
out of an XML representation.xml
- the XML representation as StringBuffer
NonParsableException
- if the SmallGradientConditon
could not be reconstructed out of
the StringBuffer
xml
protected void set()
AbstractTerminationCondition
AbstractTerminationCondition.parameter
.
It is used in the constructors.set
in class AbstractTerminationCondition
protected String getXmlTag()
AbstractTerminationCondition
AbstractTerminationCondition.toXML()
and
in the constructor AbstractTerminationCondition.AbstractTerminationCondition(StringBuffer)
.getXmlTag
in class AbstractTerminationCondition
public boolean doNextIteration(int iteration, double fLast, double fCurrent, double[] gradient, double[] direction, double alpha, Time t)
TerminationCondition
true
it is recommended to do another iteration, otherwise
(the method returns false
and) it is recommended to stop the algorithm.iteration
- the number of performed iterationsfLast
- last value of the functionfCurrent
- current value of the functiongradient
- the gradient of the functiondirection
- the last direction of the optimizationalpha
- the last step sizet
- a time object measuring the time that has been elapsed in the optimizationtrue
if another iteration should be donepublic boolean isSimple()
TerminationCondition
false
if the TerminationCondition
uses either
the gradient or the direction for the decision, otherwise it returns true
.false
for gradient or direction based TerminationCondition
s