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

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

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

This reaction strategy wraps both a ReinitializationReactionStrategy and a ReevaluationReactionStrategy. It firstly performs the specified number of reinitializations on randomly chosen entities in the Topology. Then it performs the specified number of reevaluations on randomly chosen entities from those that remain.

Author:
Theuns Cloete
See Also:
Serialized Form

Field Summary
protected  Random randomGenerator
           
protected  ReevaluationReactionStrategy<E> reevaluation
           
protected  ReinitializationReactionStrategy<E> reinitialization
           
 
Fields inherited from class net.sourceforge.cilib.pso.dynamic.responsestrategies.EnvironmentChangeResponseStrategy
hasMemory
 
Constructor Summary
DualReactionStrategy()
           
DualReactionStrategy(DualReactionStrategy<E> rhs)
           
 
Method Summary
 DualReactionStrategy<E> getClone()
          Clone the EnvironmentChangeResponseStrategy object.
 Random getRandomGenerator()
          Retrieve the random number generator being used.
 double getReevaluationRatio()
          Get the ratio of entities that should be reevaluated.
 double getReinitializationRatio()
          Get the ratio of entities that should be reinitialized.
 void performReaction(E algorithm)
          Respond by firstly reinitializing a specified number of entities and then reevaluating another specified number of entities.
 void setRandomGenerator(Random r)
          Set the random number generator to use.
 void setReevaluationRatio(double rer)
          Set the ratio of entities that should be reevaluated.
 void setReinitializationRatio(double rr)
          Set the ratio of entities that should be reinitialized.
 
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

reevaluation

protected ReevaluationReactionStrategy<E extends PopulationBasedAlgorithm> reevaluation

reinitialization

protected ReinitializationReactionStrategy<E extends PopulationBasedAlgorithm> reinitialization

randomGenerator

protected Random randomGenerator
Constructor Detail

DualReactionStrategy

public DualReactionStrategy()

DualReactionStrategy

public DualReactionStrategy(DualReactionStrategy<E> rhs)
Method Detail

getClone

public DualReactionStrategy<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)
Respond by firstly reinitializing a specified number of entities and then reevaluating another specified number of entities. This is the method responsible for responding that should be overridden by sub-classes.

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

setReinitializationRatio

public void setReinitializationRatio(double rr)
Set the ratio of entities that should be reinitialized. This is defered to the wrapped ReinitializationReactionStrategy.

Parameters:
rr - a double value in the range (0.0, 1.0)

getReinitializationRatio

public double getReinitializationRatio()
Get the ratio of entities that should be reinitialized. This is defered to the wrapped ReinitializationReactionStrategy.

Returns:
the ratio of entities that should be reinitialized

setReevaluationRatio

public void setReevaluationRatio(double rer)
Set the ratio of entities that should be reevaluated. This is defered to the wrapped ReevaluationReactionStrategy.

Parameters:
rer - a double value in the range (0.0, 1.0)

getReevaluationRatio

public double getReevaluationRatio()
Get the ratio of entities that should be reevaluated. This is defered to the wrapped ReevaluationReactionStrategy.

Returns:
the ratio of entities that should be reevaluated

setRandomGenerator

public void setRandomGenerator(Random r)
Set the random number generator to use. Also make sure that the wrapped reaction strategies (reevaluation and reinitialization) use the same generator, so that the random numbers that are retrieved are in the same sequence.

Parameters:
r - a Random object

getRandomGenerator

public 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.