
MOEA Framework 2.12 API Specification 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object org.moeaframework.algorithm.PeriodicAction
public abstract class PeriodicAction
Decorates an algorithm to perform some action periodically throughout the execution of the algorithm. Note that due to the underlying implementation of the algorithm, the action may be invoked less frequently than requested or not at all.
Nested Class Summary  

static class 
PeriodicAction.FrequencyType
Defines the type of frequency. 
Field Summary  

protected Algorithm 
algorithm
The underlying algorithm being decorated. 
protected int 
frequency
The frequency that the doAction() method is invoked. 
protected PeriodicAction.FrequencyType 
frequencyType
The type of frequency. 
protected int 
iteration
The number of invocations of the Algorithm.step() method. 
protected int 
lastInvocation
The last invocation doAction() was invoked. 
Constructor Summary  

PeriodicAction(Algorithm algorithm,
int frequency,
PeriodicAction.FrequencyType frequencyType)
Decorates an algorithm to perform a period action. 
Method Summary  

abstract void 
doAction()
Invoked periodically by this class to perform some function. 
void 
evaluate(Solution solution)
Evaluates the specified solution for the problem being solved by this algorithm. 
int 
getNumberOfEvaluations()
Returns the number of times the evaluate method was invoked. 
Problem 
getProblem()
Returns the problem being solved by this algorithm. 
NondominatedPopulation 
getResult()
Returns the current bestknown result. 
Serializable 
getState()
Returns a Serializable object representing the internal state of
this algorithm. 
boolean 
isTerminated()
Returns true if this algorithm is terminated; false
otherwise. 
void 
setState(Object state)
Sets the internal state of of this algorithm. 
void 
step()
Performs one logical step of this algorithm. 
void 
terminate()
Terminates this algorithm. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

protected final Algorithm algorithm
protected final int frequency
doAction()
method is invoked.
protected final PeriodicAction.FrequencyType frequencyType
protected int iteration
Algorithm.step()
method. Only
used if the frequency type is STEPS
.
protected int lastInvocation
doAction()
was invoked. Only used if the
frequency type is STEPS
.
Constructor Detail 

public PeriodicAction(Algorithm algorithm, int frequency, PeriodicAction.FrequencyType frequencyType)
algorithm
 the algorithm being decoratedfrequency
 the frequency the doAction()
method is invokedfrequencyType
 the type of frequencyMethod Detail 

public Problem getProblem()
Algorithm
getProblem
in interface Algorithm
public NondominatedPopulation getResult()
Algorithm
getResult
in interface Algorithm
public void step()
Algorithm
This method should not be invoked when Algorithm.isTerminated()
returns
true
.
step
in interface Algorithm
public void evaluate(Solution solution)
Algorithm
evaluate
in interface Algorithm
solution
 the solution to be evaluatedProblem.evaluate(Solution)
public int getNumberOfEvaluations()
Algorithm
evaluate
method was invoked. This
is the primary measure of runtime for optimization algorithms.
getNumberOfEvaluations
in interface Algorithm
evaluate
method was invokedpublic boolean isTerminated()
Algorithm
true
if this algorithm is terminated; false
otherwise.
isTerminated
in interface Algorithm
true
if this algorithm is terminated; false
otherwiseAlgorithm.terminate()
public void terminate()
Algorithm
Algorithm.getResult()
and
Algorithm.getNumberOfEvaluations()
methods are still required to work
after termination.
terminate
in interface Algorithm
public abstract void doAction()
public Serializable getState() throws NotSerializableException
Algorithm
Serializable
object representing the internal state of
this algorithm.
getState
in interface Algorithm
Serializable
object representing the internal state of
this algorithm
NotSerializableException
 if this algorithm does not support
serializationpublic void setState(Object state) throws NotSerializableException
Algorithm
setState
in interface Algorithm
state
 the internal state of this algorithm
NotSerializableException
 if this algorithm does not support
serialization

MOEA Framework 2.12 API Specification 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 