Package org.goplanit.gap
Class StopCriterion
- java.lang.Object
-
- org.goplanit.gap.StopCriterion
-
public class StopCriterion extends Object
StopCriterion class. In its base form we only provide an epsilon value. However by deriving from this class additional citeria can be added- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_EPSILON
Default Epsilon in case it is not set by userstatic int
DEFAULT_MAX_ITERATIONS
Default maximum number of iterations in case it is not set by user
-
Constructor Summary
Constructors Constructor Description StopCriterion()
Default constructorStopCriterion(StopCriterion other, boolean deepCopy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
collectSettingsAsKeyValueMap()
Settings of base stop criterion classStopCriterion
deepClone()
Deep clone this instancedouble
getEpsilon()
Return the epsilon of this stopping criterionint
getMaxIterations()
Return the maximum allowable number of iterationsboolean
hasConverged(double gap, int iterationIndex)
Check if converged based on the gap and the internal informationvoid
setEpsilon(double epsilon)
Set the epsilon of this stopping criterionvoid
setMaxIterations(int maxIterations)
Set the maximum allowable number of iterationsStopCriterion
shallowClone()
Shallow clone this instance
-
-
-
Field Detail
-
DEFAULT_EPSILON
public static final double DEFAULT_EPSILON
Default Epsilon in case it is not set by user- See Also:
- Constant Field Values
-
DEFAULT_MAX_ITERATIONS
public static final int DEFAULT_MAX_ITERATIONS
Default maximum number of iterations in case it is not set by user- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StopCriterion
public StopCriterion()
Default constructor
-
StopCriterion
public StopCriterion(StopCriterion other, boolean deepCopy)
- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
hasConverged
public boolean hasConverged(double gap, int iterationIndex)
Check if converged based on the gap and the internal information- Parameters:
gap
- gap for the current iterationiterationIndex
- index of current iteration- Returns:
- true if gap is smaller than criterion, false otherwise
-
getMaxIterations
public int getMaxIterations()
Return the maximum allowable number of iterations- Returns:
- the maximum allowable number of iterations
-
setMaxIterations
public void setMaxIterations(int maxIterations)
Set the maximum allowable number of iterations- Parameters:
maxIterations
- the maximum allowable number of iterations
-
getEpsilon
public double getEpsilon()
Return the epsilon of this stopping criterion- Returns:
- the epsilon of this stopping criterion
-
setEpsilon
public void setEpsilon(double epsilon)
Set the epsilon of this stopping criterion- Parameters:
epsilon
- the epsilon of this stopping criterion
-
shallowClone
public StopCriterion shallowClone()
Shallow clone this instance- Returns:
- created copy
-
deepClone
public StopCriterion deepClone()
Deep clone this instance- Returns:
- created copy
-
-