Package org.goplanit.gap
Class GapFunction
- java.lang.Object
-
- org.goplanit.component.PlanitComponent<GapFunction>
-
- org.goplanit.gap.GapFunction
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IdAble>,EventListener,PlanitComponentListener,EventListener,ExternalIdAble,IdAble
- Direct Known Subclasses:
LinkBasedRelativeDualityGapFunction,NormBasedGapFunction
public abstract class GapFunction extends PlanitComponent<GapFunction> implements Serializable
Abstract base class for gap functions- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringLINK_BASED_RELATIVE_GAPshort code for link based relative duality gap function typestatic StringNORM_BASED_GAPshort code for a norm based gap function typeprotected StopCriterionstopCriterionThe stopCriterion to use
-
Constructor Summary
Constructors Constructor Description GapFunction(GapFunction other)Copy constructorGapFunction(IdGroupingToken idToken, StopCriterion stopCriterion)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract GapFunctionclone()Create a shallow copy of this entityabstract doublecomputeGap()Compute the gap and return itabstract doublegetGap()Returns the last computed gapStopCriteriongetStopCriterion()Return the StopCriterion objectbooleanhasConverged(int iterationIndex)Verify if algorithm has convergedabstract voidreset()Reset the gap function-
Methods inherited from class org.goplanit.component.PlanitComponent
equals, getComponentType, getExternalId, getId, getIdGroupingToken, getKnownSupportedEventTypes, getXmlId, hashCode, onPlanitComponentEvent, setExternalId, setXmlId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.event.EventListener
hasKnownSupportedEventTypes
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
hasExternalId, hasXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, idEquals, idHashCode
-
-
-
-
Field Detail
-
stopCriterion
protected final StopCriterion stopCriterion
The stopCriterion to use
-
LINK_BASED_RELATIVE_GAP
public static final String LINK_BASED_RELATIVE_GAP
short code for link based relative duality gap function type
-
NORM_BASED_GAP
public static final String NORM_BASED_GAP
short code for a norm based gap function type
-
-
Constructor Detail
-
GapFunction
public GapFunction(IdGroupingToken idToken, StopCriterion stopCriterion)
Constructor- Parameters:
idToken- to use for the generation of its idstopCriterion- the StopCriterion object to be used
-
GapFunction
public GapFunction(GapFunction other)
Copy constructor- Parameters:
other- to copy
-
-
Method Detail
-
hasConverged
public boolean hasConverged(int iterationIndex)
Verify if algorithm has converged- Parameters:
iterationIndex- the index of the current iteration- Returns:
- true if stopping criterion has been met, false otherwise
-
getStopCriterion
public StopCriterion getStopCriterion()
Return the StopCriterion object- Returns:
- StopCriterion object being used
-
computeGap
public abstract double computeGap()
Compute the gap and return it- Returns:
- the gap for the current iteration
-
getGap
public abstract double getGap()
Returns the last computed gap- Returns:
- latest gap
-
reset
public abstract void reset()
Reset the gap function- Specified by:
resetin classPlanitComponent<GapFunction>
-
clone
public abstract GapFunction clone()
Create a shallow copy of this entity- Specified by:
clonein interfaceIdAble- Specified by:
clonein classPlanitComponent<GapFunction>- Returns:
- shallow copy of entity
-
-