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

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

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

This reaction strategy reinitializes 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 reinitializationRatio
           
 
Fields inherited from class net.sourceforge.cilib.pso.dynamic.responsestrategies.EnvironmentChangeResponseStrategy
hasMemory
 
Constructor Summary
ReinitializationReactionStrategy()
           
ReinitializationReactionStrategy(ReinitializationReactionStrategy<E> rhs)
           
 
Method Summary
 ReinitializationReactionStrategy<E> getClone()
          Clone the EnvironmentChangeResponseStrategy object.
protected  Random getRandomGenerator()
          Retrieve the random number generator being used.
 double getReinitializationRatio()
          Get the ratio of entities that should be reinitialized.
 void performReaction(E algorithm)
          Reinitialize the entities inside the topology.
protected  void reinitialize(List<? extends Entity> entities, int reinitializeCount)
          Reinitialize a specified number of the given entities.
protected  void setRandomGenerator(Random r)
          Set the random number generator to use.
 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

reinitializationRatio

protected double reinitializationRatio

randomGenerator

protected Random randomGenerator
Constructor Detail

ReinitializationReactionStrategy

public ReinitializationReactionStrategy()

ReinitializationReactionStrategy

public ReinitializationReactionStrategy(ReinitializationReactionStrategy<E> rhs)
Method Detail

getClone

public ReinitializationReactionStrategy<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)
Reinitialize the entities inside the topology. This is the method responsible for responding that should be overridden by sub-classes.

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

reinitialize

protected void reinitialize(List<? extends Entity> entities,
                            int reinitializeCount)
Reinitialize a specified number of the given entities.

Parameters:
entities - a List of entities that should be considered for reinitialization
reinitializeCount - anint specifying how many entities should be reinitialized

setReinitializationRatio

public void setReinitializationRatio(double rr)
Set the ratio of entities that should be reinitialized.

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

getReinitializationRatio

public double getReinitializationRatio()
Get the ratio of entities that should be reinitialized.

Returns:
the ratio of entities that should be reinitialized

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.