net.sourceforge.cilib.ec
Class Individual

java.lang.Object
  extended by net.sourceforge.cilib.entity.AbstractEntity
      extended by net.sourceforge.cilib.ec.Individual
All Implemented Interfaces:
Serializable, Comparable<Entity>, CandidateSolution, Entity, Cloneable

public class Individual
extends AbstractEntity

Author:
otter Implements the Entity interface. Individual represents entities used within the EC paradigm.
See Also:
Serialized Form

Field Summary
protected  int dimension
           
 
Constructor Summary
Individual()
          Create an instance of Individual.
Individual(Individual copy)
          Copy constructor.
 
Method Summary
 void calculateFitness()
          Calculate the fitness of the Entity incrementing the number of fitness evaluations for the algorithm.
 void calculateFitness(boolean count)
          Calculate the fitness of the Entity.
 int compareTo(Entity o)
          
 boolean equals(Object object)
           It doesn;t make sense to compare the meta data of the entity.
 Type getBehaviouralParameters()
          Return the Entity associated behavioural parameters.
 Individual getClone()
          Make a clone of the Entity the exact semantics of the clone method will be defined by the classes that implements this interface.
 int getDimension()
          Returns the dimension of the Entity.
 int hashCode()
          
 void initialise(OptimisationProblem problem)
          Intialise the Entity to something meaningful and within the problem space.
 void reinitialise()
          Re-initialise the given Entity within the defined domain.
 void resetFitness()
          Resets the fitness to InferiorFitness.
 void setBehaviouralParameters(Type type)
          Set the behavioural parameters for the Entity.
 void setCandidateSolution(StructuredType type)
          Set the Type maintained by this Entitys CandidateSolution.
 void setDimension(int dim)
          Set the current dimension value for the current Individual.
 String toString()
          Create a textual representation of the current Individual.
 
Methods inherited from class net.sourceforge.cilib.entity.AbstractEntity
getBestFitness, getCandidateSolution, getFitness, getFitnessCalculator, getId, getProperties, setFitnessCalculator, setProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

dimension

protected int dimension
Constructor Detail

Individual

public Individual()
Create an instance of Individual.


Individual

public Individual(Individual copy)
Copy constructor. Creates a copy of the given Individual.

Parameters:
copy - The Individual to copy.
Method Detail

getClone

public Individual getClone()
Make a clone of the Entity the exact semantics of the clone method will be defined by the classes that implements this interface.

Returns:
the cloned object
See Also:
Object.clone()

equals

public boolean equals(Object object)
It doesn;t make sense to compare the meta data of the entity. In other words, the properties of the entity may vary, but the entity is still the same entity.

Overrides:
equals in class AbstractEntity
Parameters:
object - The object to compare equality.

hashCode

public int hashCode()

Overrides:
hashCode in class AbstractEntity

resetFitness

public void resetFitness()
Resets the fitness to InferiorFitness.


initialise

public void initialise(OptimisationProblem problem)
Intialise the Entity to something meaningful and within the problem space. The exact semantics of this method is defined by the classes that implements this interface. Take note. The Intialiser is obsolete the new Type System handles it now. Init can be left out now.

Parameters:
problem - The OptimisationProblem to based the initialisation on.

compareTo

public int compareTo(Entity o)


setCandidateSolution

public void setCandidateSolution(StructuredType type)
Set the Type maintained by this Entitys CandidateSolution.

Specified by:
setCandidateSolution in interface CandidateSolution
Specified by:
setCandidateSolution in interface Entity
Overrides:
setCandidateSolution in class AbstractEntity
Parameters:
type - The Type that will be the new value of the Entity CandidateSolution.

calculateFitness

public void calculateFitness()
Calculate the fitness of the Entity incrementing the number of fitness evaluations for the algorithm.


calculateFitness

public void calculateFitness(boolean count)
Calculate the fitness of the Entity. This method may or may not increment the number of fitness evaluations of the algorithm.

Parameters:
count - Add or do not add this fitness evaluation to the algorithm global count.

getDimension

public int getDimension()
Returns the dimension of the Entity.

Returns:
The dimension of the Entity.

setDimension

public void setDimension(int dim)
Set the current dimension value for the current Individual.

Parameters:
dim - The dimension value to set.

toString

public String toString()
Create a textual representation of the current Individual. The returned String will contain both the genotypes and penotypes for the current Individual.

Overrides:
toString in class Object
Returns:
The textual representation of this Individual.

getBehaviouralParameters

public Type getBehaviouralParameters()
Return the Entity associated behavioural parameters.

Returns:
a Type representing the behavioural parameters.

setBehaviouralParameters

public void setBehaviouralParameters(Type type)
Set the behavioural parameters for the Entity.

Parameters:
type - The behavioural parameters to set.

reinitialise

public void reinitialise()
Re-initialise the given Entity within the defined domain.



Copyright © 2009 CIRG. All Rights Reserved.