
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.AbstractAlgorithm
public abstract class AbstractAlgorithm
Abstract class providing default implementations for several
Algorithm
methods. All method extending this class must use the
evaluate(org.moeaframework.core.Solution)
method to evaluate a solution. This is mandatory to ensure
the getNumberOfEvaluations()
method returns the correct result.
Subclasses should avoid overriding the step()
method and instead
override the initialize()
and iterate()
methods
individually.
Field Summary  

protected boolean 
initialized
true if the initialize() method has been invoked;
false otherwise. 
protected int 
numberOfEvaluations
The number of times the evaluate(org.moeaframework.core.Solution) method was invoked. 
protected Problem 
problem
The problem being solved. 
protected boolean 
terminated
true if the terminate() method has been invoked;
false otherwise. 
Constructor Summary  

AbstractAlgorithm(Problem problem)
Constructs an abstract algorithm for solving the specified problem. 
Method Summary  

void 
evaluate(Solution solution)
Evaluates the specified solution for the problem being solved by this algorithm. 
void 
evaluateAll(Iterable<Solution> solutions)
Evaluates the specified solutions. 
void 
evaluateAll(Solution[] solutions)
Evaluates the specified solutions. 
protected void 
finalize()

int 
getNumberOfEvaluations()
Returns the number of times the evaluate method was invoked. 
Problem 
getProblem()
Returns the problem being solved by this algorithm. 
Serializable 
getState()
Returns a Serializable object representing the internal state of
this algorithm. 
protected void 
initialize()
Performs any initialization that is required by this algorithm. 
boolean 
isInitialized()
Returns true if the initialize() method has been
invoked; false otherwise. 
boolean 
isTerminated()
Returns true if this algorithm is terminated; false
otherwise. 
protected abstract void 
iterate()
Performs one iteration of the algorithm. 
void 
setState(Object state)
Sets the internal state of of this algorithm. 
void 
step()
This method first checks if the algorithm is initialized. 
void 
terminate()
Implementations should always invoke super.terminate() to ensure
the hierarchy is terminated correctly. 
Methods inherited from class java.lang.Object 

clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Methods inherited from interface org.moeaframework.core.Algorithm 

getResult 
Field Detail 

protected final Problem problem
protected int numberOfEvaluations
evaluate(org.moeaframework.core.Solution)
method was invoked.
protected boolean initialized
true
if the initialize()
method has been invoked;
false
otherwise.
protected boolean terminated
true
if the terminate()
method has been invoked;
false
otherwise.
Constructor Detail 

public AbstractAlgorithm(Problem problem)
problem
 the problem being solvedMethod Detail 

public void evaluateAll(Iterable<Solution> solutions)
evaluate(Solution)
on each of the solutions. Subclasses should
prefer calling this method over evaluate
whenever possible,
as this ensures the solutions can be evaluated in parallel.
solutions
 the solutions to evaluatepublic void evaluateAll(Solution[] solutions)
evaluateAll(Arrays.asList(solutions))
.
solutions
 the solutions to evaluatepublic 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 Problem getProblem()
Algorithm
getProblem
in interface Algorithm
protected void initialize()
step()
, but may also be called manually prior to any invocations
of step
. Implementations should always invoke
super.initialize()
to ensure the hierarchy is initialized
correctly.
AlgorithmInitializationException
 if the algorithm has already
been initializedpublic boolean isInitialized()
true
if the initialize()
method has been
invoked; false
otherwise.
true
if the initialize()
method has been
invoked; false
otherwisepublic void step()
initialize()
method is invoked. If initialized, all calls to
step
invoke iterate()
. Implementations should override
the initialize
and iterate
methods in preference to
modifying this method.
step
in interface Algorithm
AlgorithmTerminationException
 if the algorithm has already
terminatedprotected abstract void iterate()
public 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()
super.terminate()
to ensure
the hierarchy is terminated correctly. This method is automatically
invoked during finalization, and need only be called directly if
nonJava resources are in use.
terminate
in interface Algorithm
AlgorithmTerminationException
 if the algorithm has already
terminatedprotected void finalize() throws Throwable
finalize
in class Object
Throwable
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 