Class MaxFunctionEvaluations
java.lang.Object
org.moeaframework.core.termination.MaxFunctionEvaluations
- All Implemented Interfaces:
Named,TerminationCondition
Terminates a run when the maximum number of function evaluations is exceeded.
-
Constructor Summary
ConstructorsConstructorDescriptionMaxFunctionEvaluations(int maxEvaluations) Constructs a new termination condition based on the maximum number of function evaluations. -
Method Summary
Modifier and TypeMethodDescriptionstatic intderive(TerminationCondition terminationCondition) Attempts to determine the maximum number of function evaluations that would execute given the termination condition.doublegetPercentComplete(Algorithm algorithm) Returns the percentage that this condition is complete, as a value between0.0and100.0.voidinitialize(Algorithm algorithm) Invoked when the algorithm is created to collect any initial conditions.booleanshouldTerminate(Algorithm algorithm) Invoked after every step to check if the algorithm should terminate.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.moeaframework.core.termination.TerminationCondition
getName
-
Constructor Details
-
MaxFunctionEvaluations
public MaxFunctionEvaluations(int maxEvaluations) Constructs a new termination condition based on the maximum number of function evaluations.- Parameters:
maxEvaluations- the maximum number of function evaluations
-
-
Method Details
-
initialize
Description copied from interface:TerminationConditionInvoked when the algorithm is created to collect any initial conditions. Note that the algorithm may not have been initialized at this point.- Specified by:
initializein interfaceTerminationCondition- Parameters:
algorithm- the algorithm
-
shouldTerminate
Description copied from interface:TerminationConditionInvoked after every step to check if the algorithm should terminate.- Specified by:
shouldTerminatein interfaceTerminationCondition- Parameters:
algorithm- the algorithm- Returns:
trueif the algorithm should terminate;falseotherwise
-
getPercentComplete
Description copied from interface:TerminationConditionReturns the percentage that this condition is complete, as a value between0.0and100.0. If the percentage can not be determined, returns 0d/0d.- Specified by:
getPercentCompletein interfaceTerminationCondition- Parameters:
algorithm- the algorithm- Returns:
- the percentage completion
-
derive
Attempts to determine the maximum number of function evaluations that would execute given the termination condition.- Parameters:
terminationCondition- the termination condition- Returns:
- the max number of function evaluations, or
-1if the value could not be derived
-