net.sourceforge.cilib.pso.dynamic.detectionstrategies
Class RandomSentriesDetectionStrategy<E extends PopulationBasedAlgorithm>
java.lang.Object
net.sourceforge.cilib.pso.dynamic.detectionstrategies.EnvironmentChangeDetectionStrategy<E>
net.sourceforge.cilib.pso.dynamic.detectionstrategies.RandomSentriesDetectionStrategy<E>
- Type Parameters:
E
- some population based algorithm
- All Implemented Interfaces:
- Serializable, Cloneable
- Direct Known Subclasses:
- RandomSentryPointsDetectionStrategy
public class RandomSentriesDetectionStrategy<E extends PopulationBasedAlgorithm>
- extends EnvironmentChangeDetectionStrategy<E>
This class defines a detection strategy that uses a user-specified
number of sentry entities
and an value to
detect whether a change has occured in the environment.
- Author:
- Theuns Cloete
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
numberOfSentries
protected ControlParameter numberOfSentries
randomGenerator
protected Random randomGenerator
RandomSentriesDetectionStrategy
public RandomSentriesDetectionStrategy()
RandomSentriesDetectionStrategy
public RandomSentriesDetectionStrategy(RandomSentriesDetectionStrategy<E> rhs)
getClone
public RandomSentriesDetectionStrategy<E> getClone()
- Description copied from class:
EnvironmentChangeDetectionStrategy
- Clone the EnvironmentChangeDetectionStrategy object.
- Specified by:
getClone
in interface Cloneable
- Specified by:
getClone
in class EnvironmentChangeDetectionStrategy<E extends PopulationBasedAlgorithm>
- Returns:
- A cloned EnvironmentChangeDetectionStrategy
- See Also:
Object.clone()
detect
public boolean detect(E algorithm)
- After every
EnvironmentChangeDetectionStrategy.interval
iterations, pick
a number of
random entities from the given
algorithm's
topology and compare their previous fitness values with
their current fitness values. An environment change is detected when the difference
between the previous and current fitness values are >= the specified
EnvironmentChangeDetectionStrategy.epsilon
value.
- Specified by:
detect
in class EnvironmentChangeDetectionStrategy<E extends PopulationBasedAlgorithm>
- Parameters:
algorithm
- used to get hold of topology of entities and number of iterations
- Returns:
- true if a change has been detected, false otherwise
setNumberOfSentries
public void setNumberOfSentries(ControlParameter parameter)
getNumberOfSentries
public ControlParameter getNumberOfSentries()
setRandomNumberGenerator
public void setRandomNumberGenerator(Random rng)
getRandomNumberGenerator
public Random getRandomNumberGenerator()
Copyright © 2009 CIRG. All Rights Reserved.