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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Genotypeprotected Set<IndividualStateListener>protected Objectivesprotected Phenotypeprotected Individual.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the genotype.Returns the objectives.Returns the phenotype.getState()Returns theIndividual.Stateof theIndividual.booleanIndicates whether thisIndividualis already decoded.booleanIndicates whether thisIndividualis already evaluated.voidsetGenotype(Genotype genotype) Sets the genotype.protected voidsetIndividualStatusListeners(Set<IndividualStateListener> individualStateListeners) Sets the list ofIndividualStateListeners that are called if theIndividual.Stateof this individual changes.voidsetObjectives(Objectives objectives) Sets the objectives.voidsetPhenotype(Phenotype phenotype) Sets the phenotype.voidsetState(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 thisIndividualis already decoded.- Returns:
trueif this individual is decoded
-
isEvaluated
public boolean isEvaluated()Indicates whether thisIndividualis already evaluated.- Returns:
trueif this inividual is evaluated
-
setState
Sets the state of theIndividual.- Parameters:
state- the new status- See Also:
-
getState
Returns theIndividual.Stateof theIndividual.- Returns:
- the current state
- See Also:
-
setIndividualStatusListeners
Sets the list ofIndividualStateListeners that are called if theIndividual.Stateof this individual changes.- Parameters:
individualStateListeners- the listener for a changing status.
-