Package org.opt4j.core
Class Individual
- java.lang.Object
-
- org.opt4j.core.Individual
-
- Direct Known Subclasses:
Particle
public class Individual extends Object
The
Individualclass forms a single solution for the given optimization problem.An
Individualcontains theGenotype,Phenotype, andObjectives: Initially, theIndividualcontains only aGenotype. TheDecoderdecodes theGenotypeinto aPhenotypeand adds it to theIndividual. Finally, thePhenotypeis evaluated and the resultingObjectivesare added to theIndividual.- See Also:
Genotype,Phenotype,Objectives
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIndividual.StateThe possible states of anIndividual.
-
Field Summary
Fields Modifier and Type Field Description protected Genotypegenotypeprotected Set<IndividualStateListener>individualStateListenersprotected Objectivesobjectivesprotected Phenotypephenotypeprotected Individual.Statestate
-
Constructor Summary
Constructors Modifier Constructor Description protectedIndividual()Constructs anIndividual.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenotypegetGenotype()Returns the genotype.ObjectivesgetObjectives()Returns the objectives.PhenotypegetPhenotype()Returns the phenotype.Individual.StategetState()Returns theIndividual.Stateof theIndividual.booleanisDecoded()Indicates whether thisIndividualis already decoded.booleanisEvaluated()Indicates 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 Detail
-
genotype
protected Genotype genotype
-
phenotype
protected Phenotype phenotype
-
objectives
protected Objectives objectives
-
individualStateListeners
protected Set<IndividualStateListener> individualStateListeners
-
state
protected Individual.State state
-
-
Constructor Detail
-
Individual
@Inject protected Individual()
Constructs anIndividual.
-
-
Method Detail
-
getPhenotype
public Phenotype getPhenotype()
Returns the phenotype.- Returns:
- the phenotype
- See Also:
setPhenotype(org.opt4j.core.Phenotype)
-
getObjectives
public Objectives getObjectives()
Returns the objectives.- Returns:
- the objectives
- See Also:
setObjectives(org.opt4j.core.Objectives)
-
getGenotype
public Genotype getGenotype()
Returns the genotype.- Returns:
- the genotype
- See Also:
setGenotype(org.opt4j.core.Genotype)
-
setGenotype
public void setGenotype(Genotype genotype)
Sets the genotype.- Parameters:
genotype- the genotype to be set- See Also:
getGenotype()
-
setPhenotype
public void setPhenotype(Phenotype phenotype)
Sets the phenotype.- Parameters:
phenotype- the phenotype to be set- See Also:
getPhenotype()
-
setObjectives
public void setObjectives(Objectives objectives)
Sets the objectives.- Parameters:
objectives- the objectives to be set- See Also:
getObjectives()
-
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
public void setState(Individual.State state)
Sets the state of theIndividual.- Parameters:
state- the new status- See Also:
getState()
-
getState
public Individual.State getState()
Returns theIndividual.Stateof theIndividual.- Returns:
- the current state
- See Also:
setState(org.opt4j.core.Individual.State)
-
setIndividualStatusListeners
protected void setIndividualStatusListeners(Set<IndividualStateListener> individualStateListeners)
Sets the list ofIndividualStateListeners that are called if theIndividual.Stateof this individual changes.- Parameters:
individualStateListeners- the listener for a changing status.
-
-