MOEA Framework 2.12
API Specification

org.moeaframework.algorithm
Class Checkpoints

java.lang.Object
  extended by org.moeaframework.algorithm.PeriodicAction
      extended by org.moeaframework.algorithm.Checkpoints
All Implemented Interfaces:
Algorithm

public class Checkpoints
extends PeriodicAction

Decorates an Algorithm to periodically save checkpoint files from which the algorithm can resume itself if unexpectedly terminated.

 File stateFile = new File("last.state");
 
 //if last.state exists, algorithm will be restored to last state
 Algorithm algorithm = new Checkpoints(new NSGAII(...), stateFile, 100);
 
 while (!algorithm.isTerminated()) {
   algorithm.step(); //periodically saves state to last.state
 }
 


Nested Class Summary
 
Nested classes/interfaces inherited from class org.moeaframework.algorithm.PeriodicAction
PeriodicAction.FrequencyType
 
Field Summary
 
Fields inherited from class org.moeaframework.algorithm.PeriodicAction
algorithm, frequency, frequencyType, iteration, lastInvocation
 
Constructor Summary
Checkpoints(Algorithm algorithm, File stateFile, int checkpointFrequency)
          Decorates an algorithm to periodically save checkpoints from which the algorithm can resume itself if unexpectedly terminated.
 
Method Summary
 void doAction()
          Invoked periodically by this class to perform some function.
 
Methods inherited from class org.moeaframework.algorithm.PeriodicAction
evaluate, getNumberOfEvaluations, getProblem, getResult, getState, isTerminated, setState, step, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Checkpoints

public Checkpoints(Algorithm algorithm,
                   File stateFile,
                   int checkpointFrequency)
Decorates an algorithm to periodically save checkpoints from which the algorithm can resume itself if unexpectedly terminated.

Parameters:
algorithm - the algorithm
stateFile - the file containing the checkpoint states
checkpointFrequency - the number of objective function evaluations between checkpoints
Method Detail

doAction

public void doAction()
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 class PeriodicAction

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!