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 doubleDEFAULT_EPSILONDefault Epsilon in case it is not set by userstatic intDEFAULT_MAX_ITERATIONSDefault 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 classStopCriteriondeepClone()Deep clone this instancedoublegetEpsilon()Return the epsilon of this stopping criterionintgetMaxIterations()Return the maximum allowable number of iterationsbooleanhasConverged(double gap, int iterationIndex)Check if converged based on the gap and the internal informationvoidsetEpsilon(double epsilon)Set the epsilon of this stopping criterionvoidsetMaxIterations(int maxIterations)Set the maximum allowable number of iterationsStopCriterionshallowClone()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
-
-