net.sourceforge.cilib.cooperative
Class CooperativeEntity

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

public class CooperativeEntity
extends AbstractEntity

Author:
Theuns Cloete
See Also:
Serialized Form

Field Summary
protected  Vector context
           
protected  Fitness fitness
           
 
Constructor Summary
CooperativeEntity()
           
CooperativeEntity(CooperativeEntity rhs)
           
 
Method Summary
 void append(Entity entity)
           
 void append(Type value)
           
 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.
 StructuredType getCandidateSolution()
          Get the value of the CandidateSolution maintained by this Entity.
 CooperativeEntity 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.
 Fitness getFitness()
          Get the fitness of the CandidateSolution maintained by this 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 reset()
           
 void setCandidateSolution(Type type)
           
 void setDimension(int dim)
           
 void setFitness(Fitness f)
           
 void update(Entity src, int srcPos, int dstPos, int length)
           
 
Methods inherited from class net.sourceforge.cilib.entity.AbstractEntity
getBestFitness, getFitnessCalculator, getId, getProperties, setCandidateSolution, setFitnessCalculator, setProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected Vector context

fitness

protected Fitness fitness
Constructor Detail

CooperativeEntity

public CooperativeEntity()

CooperativeEntity

public CooperativeEntity(CooperativeEntity rhs)
Method Detail

getClone

public CooperativeEntity getClone()
Description copied from interface: Entity
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)
Description copied from class: AbstractEntity
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()
Description copied from class: AbstractEntity

Overrides:
hashCode in class AbstractEntity

reset

public void reset()

compareTo

public int compareTo(Entity o)
Description copied from interface: Entity


append

public void append(Type value)

append

public void append(Entity entity)

update

public void update(Entity src,
                   int srcPos,
                   int dstPos,
                   int length)

getCandidateSolution

public StructuredType getCandidateSolution()
Description copied from class: AbstractEntity
Get the value of the CandidateSolution maintained by this Entity.

Specified by:
getCandidateSolution in interface CandidateSolution
Specified by:
getCandidateSolution in interface Entity
Overrides:
getCandidateSolution in class AbstractEntity
Returns:
The candidate solution as a Type.

setCandidateSolution

public void setCandidateSolution(Type type)

getDimension

public int getDimension()
Description copied from interface: Entity
Returns the dimension of the Entity.

Returns:
The dimension of the Entity.

setDimension

public void setDimension(int dim)

getFitness

public Fitness getFitness()
Description copied from class: AbstractEntity
Get the fitness of the CandidateSolution maintained by this Entity.

Specified by:
getFitness in interface CandidateSolution
Specified by:
getFitness in interface Entity
Overrides:
getFitness in class AbstractEntity
Returns:
The Fitness of the candidate solution.

setFitness

public void setFitness(Fitness f)

initialise

public void initialise(OptimisationProblem problem)
Description copied from interface: Entity
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.

reinitialise

public void reinitialise()
Description copied from interface: Entity
Re-initialise the given Entity within the defined domain.


calculateFitness

public void calculateFitness()
Description copied from interface: Entity
Calculate the fitness of the Entity incrementing the number of fitness evaluations for the algorithm.


calculateFitness

public void calculateFitness(boolean count)
Description copied from interface: Entity
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.


Copyright © 2009 CIRG. All Rights Reserved.