Package org.goplanit.gap
Class GapFunction
- java.lang.Object
-
- org.goplanit.component.PlanitComponent<GapFunction>
-
- org.goplanit.gap.GapFunction
-
- All Implemented Interfaces:
Serializable
,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 String
LINK_BASED_RELATIVE_GAP
short code for link based relative duality gap function typestatic String
NORM_BASED_GAP
short code for a norm based gap function typeprotected StopCriterion
stopCriterion
The stopCriterion to use
-
Constructor Summary
Constructors Constructor Description GapFunction(GapFunction other, boolean deepCopy)
Copy constructorGapFunction(IdGroupingToken idToken, StopCriterion stopCriterion)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Map<String,String>
collectSettingsAsKeyValueMap()
Provide all the settings of this particular component by name and value, where each value is a string representation of the underlying entityabstract double
computeGap()
Compute the gap and return itabstract GapFunction
deepClone()
deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possibleabstract double
getGap()
Returns the last computed gapStopCriterion
getStopCriterion()
Return the StopCriterion objectboolean
hasConverged(int iterationIndex)
Verify if algorithm has convergedabstract void
reset()
Reset the gap functionabstract GapFunction
shallowClone()
Create a shallow copy of this entity-
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
clone, 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
appendExternalId, appendExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, hasExternalId, hasXmlId, setXmlId
-
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, boolean deepCopy)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
collectSettingsAsKeyValueMap
public Map<String,String> collectSettingsAsKeyValueMap()
Provide all the settings of this particular component by name and value, where each value is a string representation of the underlying entity- Specified by:
collectSettingsAsKeyValueMap
in classPlanitComponent<GapFunction>
- Returns:
- name-value map of all (user configurable) settings
-
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:
reset
in classPlanitComponent<GapFunction>
-
shallowClone
public abstract GapFunction shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in classPlanitComponent<GapFunction>
- Returns:
- shallow copy of entity
-
deepClone
public abstract GapFunction deepClone()
deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possible- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in classPlanitComponent<GapFunction>
- Returns:
- deep copy of entity
-
-