Class AdaptiveTimeContinuationExtension
java.lang.Object
org.moeaframework.algorithm.extension.PeriodicExtension
org.moeaframework.algorithm.continuation.AdaptiveTimeContinuationExtension
- All Implemented Interfaces:
Extension,Configurable,Stateful
- Direct Known Subclasses:
EpsilonProgressContinuationExtension
Decorator for
EvolutionaryAlgorithms to add time continuation (restarts). Restarts occur if either
- the number of fitness function evaluations since the last restart exceeds
maxWindowSize; or - the population-to-archive ratio exceeds
populationRatioby more than25%.
populationRatio, the the new population is filled with solutions selected from
algorithm.getArchive() and mutated using the specified Selection and Variation operators.
References:
- Goldberg, D. E. "Sizing Populations for Serial and Parallel Genetic Algorithms." In 3rd International Conference on Genetic Algorithms, pp. 70-79, 1989.
- Srivastava, R. P. "Time Continuation in Genetic Algorithms." Technical report, Illinois Genetic Algorithm Laboratory, 2002.
- Kollat, J. B., and Reed, P. M. "Comparison of Multi-Objective Evolutionary Algorithms for Long-Term Monitoring Design." Advances in Water Resources, 29(6):792-807, 2006.
-
Field Summary
Fields inherited from class org.moeaframework.algorithm.extension.PeriodicExtension
frequency, iteration, lastInvocation -
Constructor Summary
ConstructorsConstructorDescriptionCreates the adaptive time continuation extension with default settings.AdaptiveTimeContinuationExtension(int windowSize, int maxWindowSize, double injectionRate, int minimumPopulationSize, int maximumPopulationSize, Selection restartSelection, Variation restartVariation) Creates the adaptive time continuation extension. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRestartListener(RestartListener listener) Adds a listener to be notified whenever a restart occurs.protected RestartTypePerforms a check to determine if a restart should occur.voidThe action that is called by this extension.doubleReturns the percentage of the population that, during a restart, are introduced into the new population.intReturns the maximum size of the population.intReturns the maximum number of iterations allowed since the last restart before forcing a restart.intReturns the minimum size of the population.intReturns the number of iterations between invocations ofcheck.voidloadState(ObjectInputStream stream) Loads the state of this object from the stream.voidonRegister(Algorithm algorithm) Called when this extension is registered with an algorithm.voidremoveRestartListener(RestartListener listener) Removes the specified listener so it no longer receives notifications whenever a restart occurs.protected voidrestart(Algorithm algorithm, RestartType type) Performs a restart.voidsaveState(ObjectOutputStream stream) Writes the state of this object to the stream.voidsetInjectionRate(double injectionRate) Sets the percentage of the population that, during a restart, are introduced into the new population.voidsetMaximumPopulationSize(int maximumPopulationSize) Sets the maximum size of the population.voidsetMaxWindowSize(int maxWindowSize) Sets the maximum number of iterations allowed since the last restart before forcing a restart.voidsetMinimumPopulationSize(int minimumPopulationSize) Sets the minimum size of the population.voidsetWindowSize(int windowSize) Sets the number of iterations between invocations ofcheck.Methods inherited from class org.moeaframework.algorithm.extension.PeriodicExtension
onStepMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.moeaframework.core.configuration.Configurable
applyConfiguration, getConfigurationMethods inherited from interface org.moeaframework.algorithm.extension.Extension
onInitialize, onRun, onTerminate
-
Constructor Details
-
AdaptiveTimeContinuationExtension
public AdaptiveTimeContinuationExtension()Creates the adaptive time continuation extension with default settings. -
AdaptiveTimeContinuationExtension
public AdaptiveTimeContinuationExtension(int windowSize, int maxWindowSize, double injectionRate, int minimumPopulationSize, int maximumPopulationSize, Selection restartSelection, Variation restartVariation) Creates the adaptive time continuation extension.- Parameters:
windowSize- the number of iterations between invocations ofcheckmaxWindowSize- the maximum number of iterations allowed since the last restart before forcing a restartinjectionRate- the injection rate percentageminimumPopulationSize- the minimum size of the populationmaximumPopulationSize- the maximum size of the populationrestartSelection- the selection operator for selecting solutions from the archive during a restartrestartVariation- the variation operator for mutating solutions selected from the archive during a restart
-
-
Method Details
-
getWindowSize
public int getWindowSize()Returns the number of iterations between invocations ofcheck.- Returns:
- the window size, in iterations
-
setWindowSize
public void setWindowSize(int windowSize) Sets the number of iterations between invocations ofcheck.- Parameters:
windowSize- the window size, in iterations
-
getMaxWindowSize
public int getMaxWindowSize()Returns the maximum number of iterations allowed since the last restart before forcing a restart.- Returns:
- the maximum window size, in iterations
-
setMaxWindowSize
public void setMaxWindowSize(int maxWindowSize) Sets the maximum number of iterations allowed since the last restart before forcing a restart.- Parameters:
maxWindowSize- the maximum window size, in iterations
-
getInjectionRate
public double getInjectionRate()Returns the percentage of the population that, during a restart, are introduced into the new population.- Returns:
- the injection rate
-
setInjectionRate
public void setInjectionRate(double injectionRate) Sets the percentage of the population that, during a restart, are introduced into the new population. The population will be resized to holdarchive.size() / injectionRatesolutions.- Parameters:
injectionRate- the injection rate
-
getMinimumPopulationSize
public int getMinimumPopulationSize()Returns the minimum size of the population.- Returns:
- the minimum size of the population
-
setMinimumPopulationSize
public void setMinimumPopulationSize(int minimumPopulationSize) Sets the minimum size of the population.- Parameters:
minimumPopulationSize- the minimum size of the population
-
getMaximumPopulationSize
public int getMaximumPopulationSize()Returns the maximum size of the population.- Returns:
- the maximum size of the population
-
setMaximumPopulationSize
public void setMaximumPopulationSize(int maximumPopulationSize) Sets the maximum size of the population.- Parameters:
maximumPopulationSize- the maximum size of the population
-
addRestartListener
Adds a listener to be notified whenever a restart occurs.- Parameters:
listener- the listener to be notified whenever a restart occurs
-
removeRestartListener
Removes the specified listener so it no longer receives notifications whenever a restart occurs.- Parameters:
listener- the listener to be removed
-
onRegister
Description copied from interface:ExtensionCalled when this extension is registered with an algorithm. This can be used to perform any type checking or initialization.- Specified by:
onRegisterin interfaceExtension- Overrides:
onRegisterin classPeriodicExtension- Parameters:
algorithm- the algorithm associated with this extension
-
check
Performs a check to determine if a restart should occur. ReturnsRestartType.NONEif no restart should occur; orRestartType.HARDif the population-to-archive ratio exceedspopulationRatioby more than25%or the number of fitness evaluations since the last restart exceedsmaxWindowSize.- Parameters:
algorithm- the evolutionary algorithm- Returns:
RestartType.NONEif no restart should occur; orRestartType.HARDif the population-to-archive ratio exceedspopulationRatioby more than25%or if the number of fitness evaluations since the last restart exceedsmaxWindowSize
-
restart
Performs a restart. If the type isRestartType.HARD, the population is emptied, resized and filled with solutions selected and mutated from the archive. If the type isRestartType.SOFT, the population is not emptied; new solutions are only added to fill any empty slots.- Parameters:
algorithm- the evolutionary algorithmtype- the type of restart
-
doAction
Description copied from class:PeriodicExtensionThe action that is called by this extension.- Specified by:
doActionin classPeriodicExtension- Parameters:
algorithm- the algorithm associated with this extension
-
saveState
Description copied from interface:StatefulWrites the state of this object to the stream. The order that objects are written to the stream is important. We recommend first callingsuper.saveState(stream)followed by writing each field.- Specified by:
saveStatein interfaceStateful- Overrides:
saveStatein classPeriodicExtension- Parameters:
stream- the stream- Throws:
IOException- if an I/O error occurred
-
loadState
Description copied from interface:StatefulLoads the state of this object from the stream. The order for reading objects from the stream must match the order they are written to the stream inStateful.saveState(ObjectOutputStream).- Specified by:
loadStatein interfaceStateful- Overrides:
loadStatein classPeriodicExtension- Parameters:
stream- the stream- Throws:
IOException- if an I/O error occurredClassNotFoundException- if the stream referenced a class that is not defined
-