|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmetal.core.Algorithm
public abstract class Algorithm
This class implements a generic template for the algorithms developed in
jMetal. Every algorithm must have a mapping between the parameters and
and their names, and another mapping between the operators and their names.
The class declares an abstract method called execute
, which
defines the behavior of the algorithm.
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
inputParameters_
Stores algorithm specific parameters. |
protected java.util.Map<java.lang.String,Operator> |
operators_
Stores the operators used by the algorithm, such as selection, crossover, etc. |
protected Problem |
problem_
Stores the problem to solve |
Constructor Summary | |
---|---|
Algorithm(Problem problem)
Constructor |
Method Summary | |
---|---|
void |
addOperator(java.lang.String name,
Operator operator)
Offers facilities for add new operators for the algorithm. |
abstract SolutionSet |
execute()
Launches the execution of an specific algorithm. |
java.lang.Object |
getInputParameter(java.lang.String name)
Gets an input parameter through its name. |
Operator |
getOperator(java.lang.String name)
Gets an operator through his name. |
java.lang.Object |
getOutputParameter(java.lang.String name)
Gets an output parameter through its name. |
Problem |
getProblem()
Returns the problem to solve |
void |
setInputParameter(java.lang.String name,
java.lang.Object object)
Sets an input parameter to an algorithm. |
void |
setOutputParameter(java.lang.String name,
java.lang.Object object)
Sets an output parameter that can be obtained by invoking getOutputParame . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Problem problem_
protected java.util.Map<java.lang.String,Operator> operators_
protected java.util.Map<java.lang.String,java.lang.Object> inputParameters_
Constructor Detail |
---|
public Algorithm(Problem problem)
problem
- The problem to be solvedMethod Detail |
---|
public abstract SolutionSet execute() throws JMException, java.lang.ClassNotFoundException
SolutionSet
that is a set of non dominated solutions
as a result of the algorithm execution
JMException
java.lang.ClassNotFoundException
public void addOperator(java.lang.String name, Operator operator)
getOperator
method.
name
- The operator nameoperator
- The operatorpublic Operator getOperator(java.lang.String name)
name
- The operator name
public void setInputParameter(java.lang.String name, java.lang.Object object)
getInputParameter
method.
name
- The parameter nameobject
- Object that represent a parameter for the
algorithm.public java.lang.Object getInputParameter(java.lang.String name)
name
- The parameter name
public void setOutputParameter(java.lang.String name, java.lang.Object object)
getOutputParame
. Typically this algorithm is invoked by an
algorithm at the end of the execute
to retrieve output
information
name
- The output parameter nameobject
- Object representing the output parameterpublic java.lang.Object getOutputParameter(java.lang.String name)
name
- The output parameter name
public Problem getProblem()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |