org.opt4j.core
Class Individual

java.lang.Object
  extended by org.opt4j.core.Individual

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.

See Also:
Genotype, Objectives

Nested Class Summary
static class Individual.State
          The possible states of an Individual.
 
Field Summary
protected  Genotype genotype
           
protected  java.util.Set<IndividualStateListener> individualStateListeners
           
protected  Objectives objectives
           
protected  java.lang.Object phenotype
           
protected  Individual.State state
           
 
Constructor Summary
protected Individual()
          Constructs an Individual.
 
Method Summary
 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 IndividualStateListeners 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

genotype

protected Genotype genotype

phenotype

protected java.lang.Object phenotype

objectives

protected Objectives objectives

individualStateListeners

protected java.util.Set<IndividualStateListener> individualStateListeners

state

protected Individual.State state
Constructor Detail

Individual

@Inject
protected Individual()
Constructs an Individual.

Method Detail

getPhenotype

public java.lang.Object getPhenotype()
Returns the phenotype.

Returns:
the phenotype
See Also:
setPhenotype(java.lang.Object)

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(java.lang.Object 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 this Individual is already decoded.

Returns:
true if this individual is decoded

isEvaluated

public boolean isEvaluated()
Indicates whether this Individual is already evaluated.

Returns:
true if this inividual is evaluated

setState

public void setState(Individual.State state)
Sets the state of the Individual.

Parameters:
state - the new status
See Also:
getState()

getState

public Individual.State getState()
Returns the Individual.State of the Individual.

Returns:
the current state
See Also:
setState(org.opt4j.core.Individual.State)

setIndividualStatusListeners

protected void setIndividualStatusListeners(java.util.Set<IndividualStateListener> individualStateListeners)
Sets the list of IndividualStateListeners that are called if the Individual.State of this individual changes.

Parameters:
individualStateListeners - the listener for a changing status.