|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.openai.ai.ga.cell.AbstractCell
The AbstractCell class is an encapsulation of data that will
be used to try to solve a problem (Environment). This class
provides a skeletal implementation to minimize the effort needed to implement
a simple Cell interface.
The following functions must be implemented in the derived class:
double evaluateFitness(Environment)
Cell combine(Population)
double getFitness()
int getMaturity()
void mature()
void condemn()
void mutate()
| Field Summary | |
protected double |
cellFitness
The last evaluated fitness for the cell is stored here and is used for the getFitness calls. |
protected int |
cellMaturity
The maturity of the cell is stored here and is used for the
getMaturity. |
| Constructor Summary | |
AbstractCell()
|
|
| Method Summary | |
abstract Population |
combine(Population parents)
Tells the cell to create new offspring, which will be placed in the population. |
void |
condemn()
Tells the cell that it has been condemned to die. |
abstract double |
evaluateFitness(Environment env)
Return the fitness of the Cell. |
double |
getFitness()
Return the fitness of the Cell. |
int |
getMaturity()
Returns the maturity of the Cell. |
void |
mature()
Tells the cell to mature. |
void |
mutate()
Tells the cell that it has been chosen to mutate. |
java.lang.String |
toString()
Returns a string showing the fitness and maturity of this cell. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected double cellFitness
getFitness calls.protected int cellMaturity
getMaturity.| Constructor Detail |
public AbstractCell()
| Method Detail |
public double getFitness()
Cell. This call does not
neccessarily require that a new evaluation is performed, only that
the last fitness generated is desired. This is the preferred method
for any function curious about the cell's fitness as it should not
require any complex calculations. The fitness must be quantifiable
as an integer.
This skeletal implementation returns the value of the
cellFitness member.
getFitness in interface Celldouble representing the fitness of this
Cellpublic abstract double evaluateFitness(Environment env)
Cell. This call asks that a new
evaluation is performed. This method is called during every iteration
of a Population. The implementation must determine whether
a new evaluation is required or whether the last returned value will
suffice. The fitness must be quantifiable as an integer. This function
should only be called if there is reason to ask for a new value, but
should be generally avoided since it may require extra overhead.
There is no implementation in this skeletal implementation and must be provided by the derived class.
evaluateFitness in interface Cellenv - the Environment to evaluate againstdouble representing the fitness of this
Cellpublic int getMaturity()
Cell.
This skeletal implementation returns the value of the
cellMaturity member.
getMaturity in interface CellCellpublic void condemn()
This skeletal implementation is a stub {}.
condemn in interface Cellpublic void mutate()
{}.mutate in interface Cellpublic void mature()
This skeletal implementation increments the cellMaturity member by 1.
mature in interface Cellpublic abstract Population combine(Population parents)
Cell created
by some combination of the parents and should also be initialized with
data. The instance of Cell called is the first Cell in the
Population.combine in interface Cellparents - the chosen Population of parents for
the new cellPopulation to be added into the populationpublic java.lang.String toString()
toString in class java.lang.ObjectString containing the fitness and maturity
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||