net.sourceforge.cilib.entity
Interface Entity

All Superinterfaces:
Cloneable, Comparable<Entity>, Serializable
All Known Subinterfaces:
HoneyBee, Particle, SocialEntity
All Known Implementing Classes:
AbstractBee, AbstractEntity, AbstractParticle, ChargedParticle, CoherenceParticle, CooperativeEntity, DeviationDecorator, DynamicParticle, Harmony, Individual, LFDecorator, MultiObjectiveParticle, OnlookerBee, ParticleDecorator, RNAParticle, StandardParticle, WorkerBee

public interface Entity
extends Comparable<Entity>, Cloneable, Serializable

This is the super interface which all corresponding entity implementation and extending interfaces, for use in population based algorithms, must implement/extend from.


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)
          
 Fitness getBestFitness()
          Return the best fitness associated with this Entity, provided a best fitness is defined on the Entity.
 StructuredType getCandidateSolution()
          Get the candidate solution of the entity.
 Entity 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()
          Returns the Entity fitness.
 FitnessCalculator getFitnessCalculator()
          Get the current FitnessCalculator for the current Entity.
 long getId()
          Get the identifier associated with the Entity instance.
 Blackboard<Enum<?>,Type> getProperties()
          Get the properties associate with the Entity.
 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 setCandidateSolution(StructuredType type)
          Set the candidate solution of the current Entity to the provided Type.
 void setProperties(Blackboard<Enum<?>,Type> properties)
          Set the properties for the current Entity.
 

Method Detail

getClone

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

Specified by:
getClone in interface Cloneable
Returns:
the cloned object
See Also:
Object.clone()

compareTo

int compareTo(Entity o)

Specified by:
compareTo in interface Comparable<Entity>

getCandidateSolution

StructuredType getCandidateSolution()
Get the candidate solution of the entity. The contents will depend on the subclass. Eg. genotypes for Individual position for Particle tour for Ant etc...

Returns:
The Type representing the contents of the Entity.

setCandidateSolution

void setCandidateSolution(StructuredType type)
Set the candidate solution of the current Entity to the provided Type.

Parameters:
type - the Type to be set as the contents of the Entity.

calculateFitness

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


calculateFitness

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.

getFitness

Fitness getFitness()
Returns the Entity fitness.

Returns:
The Fitness of the Entity.

getBestFitness

Fitness getBestFitness()
Return the best fitness associated with this Entity, provided a best fitness is defined on the Entity. If a best fitness is not defined, the current fitness is returned as it is the best current fitness. Entity objects that need to use this method need to override it in their implementation, for example with Particle objects.

Returns:
The associated best Fitness value.

initialise

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.

getDimension

int getDimension()
Returns the dimension of the Entity.

Returns:
The dimension of the Entity.

reinitialise

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


getProperties

Blackboard<Enum<?>,Type> getProperties()
Get the properties associate with the Entity.

Returns:
The Blackboard containing the properties.

setProperties

void setProperties(Blackboard<Enum<?>,Type> properties)
Set the properties for the current Entity.

Parameters:
properties - The properties to set.

getId

long getId()
Get the identifier associated with the Entity instance.

Returns:
The associated identifier.

getFitnessCalculator

FitnessCalculator getFitnessCalculator()
Get the current FitnessCalculator for the current Entity.

Returns:
The FitnessCalculator associated with this Entity.


Copyright © 2009 CIRG. All Rights Reserved.