Package org.opt4j.core
Class Individual
java.lang.Object
org.opt4j.core.Individual
- Direct Known Subclasses:
Particle
The Individual
class forms a single solution for the given
optimization problem.
An Individual
contains the Genotype
, Phenotype
, 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
.
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected Genotype
protected Set<IndividualStateListener>
protected Objectives
protected Phenotype
protected Individual.State
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the genotype.Returns the objectives.Returns the phenotype.getState()
Returns theIndividual.State
of theIndividual
.boolean
Indicates whether thisIndividual
is already decoded.boolean
Indicates whether thisIndividual
is already evaluated.void
setGenotype
(Genotype genotype) Sets the genotype.protected void
setIndividualStatusListeners
(Set<IndividualStateListener> individualStateListeners) Sets the list ofIndividualStateListener
s that are called if theIndividual.State
of this individual changes.void
setObjectives
(Objectives objectives) Sets the objectives.void
setPhenotype
(Phenotype phenotype) Sets the phenotype.void
setState
(Individual.State state) Sets the state of theIndividual
.
-
Field Details
-
genotype
-
phenotype
-
objectives
-
individualStateListeners
-
state
-
-
Constructor Details
-
Individual
@Inject protected Individual()Constructs anIndividual
.
-
-
Method Details
-
getPhenotype
Returns the phenotype.- Returns:
- the phenotype
- See Also:
-
getObjectives
Returns the objectives.- Returns:
- the objectives
- See Also:
-
getGenotype
Returns the genotype.- Returns:
- the genotype
- See Also:
-
setGenotype
Sets the genotype.- Parameters:
genotype
- the genotype to be set- See Also:
-
setPhenotype
Sets the phenotype.- Parameters:
phenotype
- the phenotype to be set- See Also:
-
setObjectives
Sets the objectives.- Parameters:
objectives
- the objectives to be set- See Also:
-
isDecoded
public boolean isDecoded()Indicates whether thisIndividual
is already decoded.- Returns:
true
if this individual is decoded
-
isEvaluated
public boolean isEvaluated()Indicates whether thisIndividual
is already evaluated.- Returns:
true
if this inividual is evaluated
-
setState
Sets the state of theIndividual
.- Parameters:
state
- the new status- See Also:
-
getState
Returns theIndividual.State
of theIndividual
.- Returns:
- the current state
- See Also:
-
setIndividualStatusListeners
Sets the list ofIndividualStateListener
s that are called if theIndividual.State
of this individual changes.- Parameters:
individualStateListeners
- the listener for a changing status.
-