net.sourceforge.cilib.pso.dynamic.responsestrategies
Class ReevaluationReactionStrategy<E extends PopulationBasedAlgorithm>

java.lang.Object
  extended by net.sourceforge.cilib.pso.dynamic.responsestrategies.EnvironmentChangeResponseStrategy<E>
      extended by net.sourceforge.cilib.pso.dynamic.responsestrategies.ReevaluationReactionStrategy<E>
Type Parameters:
E - some population based algorithm
All Implemented Interfaces:
Serializable, Cloneable

public class ReevaluationReactionStrategy<E extends PopulationBasedAlgorithm>
extends EnvironmentChangeResponseStrategy<E>

This reaction strategy reevaluates the specified ratio of randomly chosen entities in the given Topology.

Author:
Theuns Cloete
See Also:
Serialized Form

Field Summary
protected  Random randomGenerator
           
protected  double reevaluationRatio
           
 
Fields inherited from class net.sourceforge.cilib.pso.dynamic.responsestrategies.EnvironmentChangeResponseStrategy
hasMemory
 
Constructor Summary
ReevaluationReactionStrategy()
           
ReevaluationReactionStrategy(ReevaluationReactionStrategy<E> rhs)
           
 
Method Summary
 ReevaluationReactionStrategy<E> getClone()
          Clone the EnvironmentChangeResponseStrategy object.
protected  Random getRandomGenerator()
          Retrieve the random number generator being used.
 double getReevaluationRatio()
          Get the ratio of entities that should be reevaluated.
 void performReaction(E algorithm)
          Just reevaluate the entities inside the topology.
protected  void reevaluate(List<? extends Entity> entities, int reevaluateCount)
          Reevaluate a specified percentage of the given entities.
protected  void setRandomGenerator(Random r)
          Set the random number generator to use.
 void setReevaluationRatio(double rer)
          Set the ratio of entities that should be reevaluated.
 
Methods inherited from class net.sourceforge.cilib.pso.dynamic.responsestrategies.EnvironmentChangeResponseStrategy
getHasMemory, respond, setHasMemory, updateNeighbourhoodBestEntities
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reevaluationRatio

protected double reevaluationRatio

randomGenerator

protected Random randomGenerator
Constructor Detail

ReevaluationReactionStrategy

public ReevaluationReactionStrategy()

ReevaluationReactionStrategy

public ReevaluationReactionStrategy(ReevaluationReactionStrategy<E> rhs)
Method Detail

getClone

public ReevaluationReactionStrategy<E> getClone()
Description copied from class: EnvironmentChangeResponseStrategy
Clone the EnvironmentChangeResponseStrategy object.

Specified by:
getClone in interface Cloneable
Specified by:
getClone in class EnvironmentChangeResponseStrategy<E extends PopulationBasedAlgorithm>
Returns:
A cloned EnvironmentChangeResponseStrategy
See Also:
Object.clone()

performReaction

public void performReaction(E algorithm)
Just reevaluate the entities inside the topology. An entity's implementation should handle updating anything else that is necessary, e.g. a StandardParticle's personal best position in the case of PSO. This is the method responsible for responding that should be overridden by sub-classes.

Specified by:
performReaction in class EnvironmentChangeResponseStrategy<E extends PopulationBasedAlgorithm>

reevaluate

protected void reevaluate(List<? extends Entity> entities,
                          int reevaluateCount)
Reevaluate a specified percentage of the given entities.

Parameters:
entities - a List of entities that should be considered for reevaluation
reevaluateCount - an int specifying how many entities should be reevaluated

setReevaluationRatio

public void setReevaluationRatio(double rer)
Set the ratio of entities that should be reevaluated.

Parameters:
rer - a double value in the range (0.0, 1.0)
Throws:
{@link - IllegalArgumentException} when the ratio is not within the above mentioned range

getReevaluationRatio

public double getReevaluationRatio()
Get the ratio of entities that should be reevaluated.

Returns:
the ratio of entities that should be reevaluated

setRandomGenerator

protected void setRandomGenerator(Random r)
Set the random number generator to use.

Parameters:
r - a Random object

getRandomGenerator

protected Random getRandomGenerator()
Retrieve the random number generator being used.

Returns:
the Random object being used to generate a random sequence of numbers


Copyright © 2009 CIRG. All Rights Reserved.