Package de.uka.ipd.sdq.tcfmoop.tcmanager
Class TerminationCriteriaManager
- java.lang.Object
-
- de.uka.ipd.sdq.tcfmoop.tcmanager.TerminationCriteriaManager
-
- All Implemented Interfaces:
IRequestManualTerminationListener
,ITerminationCriteriaManager
,org.opt4j.core.optimizer.OptimizerIterationListener
public class TerminationCriteriaManager extends Object implements ITerminationCriteriaManager
The main goal of the Termination Criteria Manager is to create termination criteria, call them so that they can evaluate the current optimization state and then evaluate their decisions, on which it must base its own decision whether to stop the optimization or not.
-
-
Constructor Summary
Constructors Constructor Description TerminationCriteriaManager(org.opt4j.core.optimizer.Control control, org.opt4j.core.optimizer.Population population, org.opt4j.core.optimizer.Archive archive)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateComposedCriterion()
Activates Composed Criterion Mode in which multiple termination criteria can be stringed together to form a more powerful termination criterionvoid
activateTCComparisionMode()
Activates Termination Criteria Comparison Mode in which termination criteria decisions do not influence the optimization but are shown on the output.void
addOptimizationTerminatedListener(IOptimizationTerminatedListener listener)
Removes a new listener for the OptimizationTerminated event.void
addOutputChangedListener(IOutputChangedListener listener)
Adds a new listener for the OutputChanged event.static void
addTerminationCriteriaManagerInitializedListener(ITerminationCriteriaManagerInitializedListener listener)
Adds a new listener for the static TerminationCriteriaManagerInitialized event.void
deactivateComposedCriterion()
If Composed Criterion is deactivated then a simple || condition is used to evaluate results from the different criteria.void
deactivateTCComparisionMode()
Deactivates Termination Criteria Comparison Mode in which termination criteria decisions are do not influence the optimization but are shown on the output.void
evaluateTerminationCriteria()
Evaluates the termination criteria and then stops the optimization if the specified conditions are met.void
handleManualTerminationRequest()
Logic witch should be executed when a ManualTerminationRequest event is fired.void
initialize(List<IConfiguration> tcConfigurations)
Initializes the termination criteria manager by supplying it with a list of termination criteria configurations.void
iterationComplete(org.opt4j.core.optimizer.Optimizer optimizer, int iteration)
void
removeOptimizationTerminatedListener(IOptimizationTerminatedListener listener)
Removes a new listener for the OptimizationTerminated event.void
removeOutputChangedListener(IOutputChangedListener listener)
Removes a new listener for the OutputChanged event.static void
removeTerminationCriteriaManagerInitializedListener(ITerminationCriteriaManagerInitializedListener listener)
Removes a listener from the static TerminationCriteriaManagerInitialized event.void
setComposedCriterionExpression(String composedCriterionExpression)
Sets the expression used to define the relationship between the termination criterion.
-
-
-
Method Detail
-
initialize
public void initialize(List<IConfiguration> tcConfigurations)
Initializes the termination criteria manager by supplying it with a list of termination criteria configurations.- Specified by:
initialize
in interfaceITerminationCriteriaManager
-
activateTCComparisionMode
public void activateTCComparisionMode()
Activates Termination Criteria Comparison Mode in which termination criteria decisions do not influence the optimization but are shown on the output.- Specified by:
activateTCComparisionMode
in interfaceITerminationCriteriaManager
-
deactivateTCComparisionMode
public void deactivateTCComparisionMode()
Deactivates Termination Criteria Comparison Mode in which termination criteria decisions are do not influence the optimization but are shown on the output.- Specified by:
deactivateTCComparisionMode
in interfaceITerminationCriteriaManager
-
activateComposedCriterion
public void activateComposedCriterion()
Activates Composed Criterion Mode in which multiple termination criteria can be stringed together to form a more powerful termination criterion- Specified by:
activateComposedCriterion
in interfaceITerminationCriteriaManager
-
deactivateComposedCriterion
public void deactivateComposedCriterion()
If Composed Criterion is deactivated then a simple || condition is used to evaluate results from the different criteria.- Specified by:
deactivateComposedCriterion
in interfaceITerminationCriteriaManager
-
setComposedCriterionExpression
public void setComposedCriterionExpression(String composedCriterionExpression)
Sets the expression used to define the relationship between the termination criterion. If not set a standard Expression is used (Crit1 || Crit2 || Crit3 || Crit4 || ...)- Specified by:
setComposedCriterionExpression
in interfaceITerminationCriteriaManager
-
evaluateTerminationCriteria
public void evaluateTerminationCriteria()
Evaluates the termination criteria and then stops the optimization if the specified conditions are met.- Specified by:
evaluateTerminationCriteria
in interfaceITerminationCriteriaManager
-
addOutputChangedListener
public void addOutputChangedListener(IOutputChangedListener listener)
Adds a new listener for the OutputChanged event. If the listener is also a IRequestManualTerminationProvider. the TCM will add itself as a listener to that event.- Specified by:
addOutputChangedListener
in interfaceITerminationCriteriaManager
- Parameters:
listener
- IOutputChangedListener listener
-
removeOutputChangedListener
public void removeOutputChangedListener(IOutputChangedListener listener)
Removes a new listener for the OutputChanged event. If the listener is also a IRequestManualTerminationProvider. the TCM will remove itself as a listener from that event.- Specified by:
removeOutputChangedListener
in interfaceITerminationCriteriaManager
- Parameters:
listener
- IOutputChangedListener listener
-
addTerminationCriteriaManagerInitializedListener
public static void addTerminationCriteriaManagerInitializedListener(ITerminationCriteriaManagerInitializedListener listener)
Adds a new listener for the static TerminationCriteriaManagerInitialized event.- Parameters:
listener
- ITerminationCriteriaManagerInitializedListener listener
-
removeTerminationCriteriaManagerInitializedListener
public static void removeTerminationCriteriaManagerInitializedListener(ITerminationCriteriaManagerInitializedListener listener)
Removes a listener from the static TerminationCriteriaManagerInitialized event.- Parameters:
listener
- ITerminationCriteriaManagerInitializedListener listener
-
iterationComplete
public void iterationComplete(org.opt4j.core.optimizer.Optimizer optimizer, int iteration)
- Specified by:
iterationComplete
in interfaceorg.opt4j.core.optimizer.OptimizerIterationListener
-
addOptimizationTerminatedListener
public void addOptimizationTerminatedListener(IOptimizationTerminatedListener listener)
Removes a new listener for the OptimizationTerminated event.- Specified by:
addOptimizationTerminatedListener
in interfaceITerminationCriteriaManager
- Parameters:
listener
- IOptimizationTerminatedListener listener
-
removeOptimizationTerminatedListener
public void removeOptimizationTerminatedListener(IOptimizationTerminatedListener listener)
Removes a new listener for the OptimizationTerminated event.- Specified by:
removeOptimizationTerminatedListener
in interfaceITerminationCriteriaManager
- Parameters:
listener
- IOptimizationTerminatedListener listener
-
handleManualTerminationRequest
public void handleManualTerminationRequest()
Logic witch should be executed when a ManualTerminationRequest event is fired.- Specified by:
handleManualTerminationRequest
in interfaceIRequestManualTerminationListener
-
-