|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.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 best-known 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 frequency| Method Detail |
|---|
public Problem getProblem()
Algorithm
getProblem in interface Algorithmpublic NondominatedPopulation getResult()
Algorithm
getResult in interface Algorithmpublic void step()
Algorithm
This method should not be invoked when Algorithm.isTerminated() returns
true.
step in interface Algorithmpublic void evaluate(Solution solution)
Algorithm
evaluate in interface Algorithmsolution - the solution to be evaluatedProblem.evaluate(Solution)public int getNumberOfEvaluations()
Algorithmevaluate method was invoked. This
is the primary measure of runtime for optimization algorithms.
getNumberOfEvaluations in interface Algorithmevaluate method was invokedpublic boolean isTerminated()
Algorithmtrue if this algorithm is terminated; false
otherwise.
isTerminated in interface Algorithmtrue if this algorithm is terminated; false
otherwiseAlgorithm.terminate()public void terminate()
AlgorithmAlgorithm.getResult() and
Algorithm.getNumberOfEvaluations() methods are still required to work
after termination.
terminate in interface Algorithmpublic abstract void doAction()
public Serializable getState()
throws NotSerializableException
AlgorithmSerializable object representing the internal state of
this algorithm.
getState in interface AlgorithmSerializable object representing the internal state of
this algorithm
NotSerializableException - if this algorithm does not support
serialization
public void setState(Object state)
throws NotSerializableException
Algorithm
setState in interface Algorithmstate - the internal state of this algorithm
NotSerializableException - if this algorithm does not support
serialization
|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||