public class Individual
extends java.lang.Object
The Individual
class forms a single solution for the given
optimization problem.
An Individual
contains the Genotype
, phenotype Object
, and Objectives
: Initially, the Individual
contains only a
Genotype
. The Decoder
decodes the
Genotype
into a phenotype and adds it to the Individual
.
Finally, the phenotype is evaluated and the resulting Objectives
are
added to the Individual
.
Genotype
,
Objectives
Modifier and Type | Class and Description |
---|---|
static class |
Individual.State
The possible states of an
Individual . |
Modifier and Type | Field and Description |
---|---|
protected Genotype |
genotype |
protected java.util.Set<IndividualStateListener> |
individualStateListeners |
protected Objectives |
objectives |
protected java.lang.Object |
phenotype |
protected Individual.State |
state |
Modifier | Constructor and Description |
---|---|
protected |
Individual()
Constructs an
Individual . |
Modifier and Type | Method and Description |
---|---|
Genotype |
getGenotype()
Returns the genotype.
|
Objectives |
getObjectives()
Returns the objectives.
|
java.lang.Object |
getPhenotype()
Returns the phenotype.
|
Individual.State |
getState()
Returns the
Individual.State of the Individual . |
boolean |
isDecoded()
Indicates whether this
Individual is already decoded. |
boolean |
isEvaluated()
Indicates whether this
Individual is already evaluated. |
void |
setGenotype(Genotype genotype)
Sets the genotype.
|
protected void |
setIndividualStatusListeners(java.util.Set<IndividualStateListener> individualStateListeners)
Sets the list of
IndividualStateListener s that are called if the
Individual.State of this individual changes. |
void |
setObjectives(Objectives objectives)
Sets the objectives.
|
void |
setPhenotype(java.lang.Object phenotype)
Sets the phenotype.
|
void |
setState(Individual.State state)
Sets the state of the
Individual . |
protected Genotype genotype
protected java.lang.Object phenotype
protected Objectives objectives
protected java.util.Set<IndividualStateListener> individualStateListeners
protected Individual.State state
@Inject protected Individual()
Individual
.public java.lang.Object getPhenotype()
setPhenotype(java.lang.Object)
public Objectives getObjectives()
setObjectives(org.opt4j.core.Objectives)
public Genotype getGenotype()
setGenotype(org.opt4j.core.Genotype)
public void setGenotype(Genotype genotype)
genotype
- the genotype to be setgetGenotype()
public void setPhenotype(java.lang.Object phenotype)
phenotype
- the phenotype to be setgetPhenotype()
public void setObjectives(Objectives objectives)
objectives
- the objectives to be setgetObjectives()
public boolean isDecoded()
Individual
is already decoded.true
if this individual is decodedpublic boolean isEvaluated()
Individual
is already evaluated.true
if this inividual is evaluatedpublic void setState(Individual.State state)
Individual
.state
- the new statusgetState()
public Individual.State getState()
Individual.State
of the Individual
.setState(org.opt4j.core.Individual.State)
protected void setIndividualStatusListeners(java.util.Set<IndividualStateListener> individualStateListeners)
IndividualStateListener
s that are called if the
Individual.State
of this individual changes.individualStateListeners
- the listener for a changing status.