Package org.moeaframework.algorithm
Class Checkpoints
java.lang.Object
org.moeaframework.core.PeriodicAction
org.moeaframework.algorithm.Checkpoints
- All Implemented Interfaces:
Extensible
,Algorithm
,Stateful
Deprecated.
Decorates an
Algorithm
to periodically save checkpoint files from which the algorithm can resume itself if
unexpectedly terminated.
File stateFile = new File("last.state"); Algorithm algorithm = new Checkpoints(new NSGAII(...), stateFile, 100); while (!algorithm.isTerminated()) { algorithm.step(); }
-
Nested Class Summary
Nested classes/interfaces inherited from class org.moeaframework.core.PeriodicAction
PeriodicAction.FrequencyType
-
Field Summary
Fields inherited from class org.moeaframework.core.PeriodicAction
algorithm, frequency, frequencyType, iteration, lastInvocation
-
Constructor Summary
ConstructorDescriptionCheckpoints
(Algorithm algorithm, File stateFile, int checkpointFrequency) Deprecated.Decorates an algorithm to periodically save checkpoints from which the algorithm can resume itself if unexpectedly terminated. -
Method Summary
Methods inherited from class org.moeaframework.core.PeriodicAction
evaluate, getAlgorithm, getExtensions, getNumberOfEvaluations, getProblem, getResult, initialize, isInitialized, isTerminated, loadState, saveState, step
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.moeaframework.core.Algorithm
evaluateAll, evaluateAll, run, run
Methods inherited from interface org.moeaframework.algorithm.extension.Extensible
addExtension, removeExtension
-
Constructor Details
-
Checkpoints
Deprecated.Decorates an algorithm to periodically save checkpoints from which the algorithm can resume itself if unexpectedly terminated.- Parameters:
algorithm
- the algorithmstateFile
- the file containing the checkpoint statescheckpointFrequency
- the number of objective function evaluations between checkpoints
-
-
Method Details
-
doAction
public void doAction()Deprecated.Description copied from class:PeriodicAction
Invoked periodically by this class to perform some function. This function should not depend on the frequency that it is invoked, since it is not guaranteed that this method is invoked at any specific frequency and, in some cases, may not be invoked at all.- Specified by:
doAction
in classPeriodicAction
-
terminate
public void terminate()Deprecated.Description copied from interface:Algorithm
Called when the termination condition is reached and the run is complete. This method is automatically called when usingAlgorithm.run(TerminationCondition)
, but can also be invoked directly if executing the algorithm step-by-step withAlgorithm.step()
.Implementations should always call
super.terminate()
to ensure the algorithm is terminated correctly.- Specified by:
terminate
in interfaceAlgorithm
- Overrides:
terminate
in classPeriodicAction
-
CheckpointExtension
instead