net.sourceforge.cilib.boa.bee
Class AbstractBee

java.lang.Object
  extended by net.sourceforge.cilib.entity.AbstractEntity
      extended by net.sourceforge.cilib.boa.bee.AbstractBee
All Implemented Interfaces:
Serializable, Comparable<Entity>, HoneyBee, CandidateSolution, Entity, Cloneable
Direct Known Subclasses:
OnlookerBee, WorkerBee

public abstract class AbstractBee
extends AbstractEntity
implements HoneyBee

The entity class for the ABC algorithm that represents the bees.

Author:
Andrich
See Also:
Serialized Form

Field Summary
protected  int dimension
           
protected  BeePositionUpdateStrategy positionUpdateStrategy
           
protected  SelectionStrategy targetSelectionStrategy
           
 
Constructor Summary
AbstractBee()
          Default constructor.
AbstractBee(AbstractBee 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)
          
abstract  AbstractBee 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.
 Vector getPosition()
          Gets the bee's position (contents).
 BeePositionUpdateStrategy getPositionUpdateStrategy()
          Getter method for the position update strategy.
 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 setPosition(Vector position)
          Sets the bee's position (contents).
abstract  void updatePosition()
          Updates the position of the bee based on the neighboring nectar content.
 
Methods inherited from class net.sourceforge.cilib.entity.AbstractEntity
equals, getBestFitness, getCandidateSolution, getFitness, getFitnessCalculator, getId, getProperties, hashCode, setCandidateSolution, setFitnessCalculator, setProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.cilib.boa.bee.HoneyBee
getFitness
 
Methods inherited from interface net.sourceforge.cilib.entity.Entity
getBestFitness, getCandidateSolution, getFitnessCalculator, getId, getProperties, setCandidateSolution, setProperties
 

Field Detail

positionUpdateStrategy

protected BeePositionUpdateStrategy positionUpdateStrategy

targetSelectionStrategy

protected SelectionStrategy targetSelectionStrategy

dimension

protected int dimension
Constructor Detail

AbstractBee

public AbstractBee()
Default constructor. Defines reasonable defaults for common members.


AbstractBee

public AbstractBee(AbstractBee copy)
Copy constructor. Create a copy of the provided instance.

Parameters:
copy - the reference of the bee that is deep copied.
Method Detail

getClone

public abstract AbstractBee 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 HoneyBee
Specified by:
getClone in interface Entity
Specified by:
getClone in interface Cloneable
Returns:
the cloned object
See Also:
Object.clone()

getPositionUpdateStrategy

public BeePositionUpdateStrategy getPositionUpdateStrategy()
Getter method for the position update strategy.

Specified by:
getPositionUpdateStrategy in interface HoneyBee
Returns:
the position update strategy.

updatePosition

public abstract void updatePosition()
Updates the position of the bee based on the neighboring nectar content.

Specified by:
updatePosition in interface HoneyBee

calculateFitness

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

Specified by:
calculateFitness in interface Entity

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.

Specified by:
calculateFitness in interface Entity
Parameters:
count - Add or do not add this fitness evaluation to the algorithm global count.

compareTo

public int compareTo(Entity o)

Specified by:
compareTo in interface Comparable<Entity>
Specified by:
compareTo in interface Entity

getDimension

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

Specified by:
getDimension in interface Entity
Returns:
The dimension of the Entity.

getPosition

public Vector getPosition()
Gets the bee's position (contents).

Specified by:
getPosition in interface HoneyBee
Returns:
the position.

setPosition

public void setPosition(Vector position)
Sets the bee's position (contents).

Specified by:
setPosition in interface HoneyBee
Parameters:
position - The value to set.

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.

Specified by:
initialise in interface Entity
Parameters:
problem - The OptimisationProblem to based the initialisation on.

reinitialise

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

Specified by:
reinitialise in interface Entity


Copyright © 2009 CIRG. All Rights Reserved.