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

public class AdaptiveTimeContinuationExtension extends PeriodicExtension implements Configurable
Decorator for EvolutionaryAlgorithms to add time continuation (restarts). Restarts occur if either
  1. the number of fitness function evaluations since the last restart exceeds maxWindowSize; or
  2. the population-to-archive ratio exceeds populationRatio by more than 25%.
If a restart occurs, the population is emptied, the population size is adapted to maintain the populationRatio, the the new population is filled with solutions selected from algorithm.getArchive() and mutated using the specified Selection and Variation operators.

References:

  1. Goldberg, D. E. "Sizing Populations for Serial and Parallel Genetic Algorithms." In 3rd International Conference on Genetic Algorithms, pp. 70-79, 1989.
  2. Srivastava, R. P. "Time Continuation in Genetic Algorithms." Technical report, Illinois Genetic Algorithm Laboratory, 2002.
  3. 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.
  • 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:
      algorithm - the algorithm being decorated
      windowSize - the number of iterations between invocations of check
      maxWindowSize - the maximum number of iterations allowed since the last restart before forcing a restart
      injectionRate - the injection rate percentage
      minimumPopulationSize - the minimum size of the population
      maximumPopulationSize - the maximum size of the population
      restartSelection - the selection operator for selecting solutions from the archive during a restart
      restartVariation - 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 of check.
      Returns:
      the window size, in iterations
    • setWindowSize

      public void setWindowSize(int windowSize)
      Sets the number of iterations between invocations of check.
      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 hold archive.size() / injectionRate solutions.
      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

      public void addRestartListener(RestartListener listener)
      Adds a listener to be notified whenever a restart occurs.
      Parameters:
      listener - the listener to be notified whenever a restart occurs
    • removeRestartListener

      public void removeRestartListener(RestartListener listener)
      Removes the specified listener so it no longer receives notifications whenever a restart occurs.
      Parameters:
      listener - the listener to be removed
    • onRegister

      public void onRegister(Algorithm algorithm)
      Description copied from interface: Extension
      Called when this extension is registered with an algorithm. This can be used to perform any type checking or initialization.
      Specified by:
      onRegister in interface Extension
      Overrides:
      onRegister in class PeriodicExtension
      Parameters:
      algorithm - the algorithm associated with this extension
    • check

      protected RestartType check(Algorithm algorithm)
      Performs a check to determine if a restart should occur. Returns RestartType.NONE if no restart should occur; or RestartType.HARD if the population-to-archive ratio exceeds populationRatio by more than 25% or the number of fitness evaluations since the last restart exceeds maxWindowSize.
      Parameters:
      algorithm - the evolutionary algorithm
      Returns:
      RestartType.NONE if no restart should occur; or RestartType.HARD if the population-to-archive ratio exceeds populationRatio by more than 25% or if the number of fitness evaluations since the last restart exceeds maxWindowSize
    • restart

      protected void restart(Algorithm algorithm, RestartType type)
      Performs a restart. If the type is RestartType.HARD, the population is emptied, resized and filled with solutions selected and mutated from the archive. If the type is RestartType.SOFT, the population is not emptied; new solutions are only added to fill any empty slots.
      Parameters:
      algorithm - the evolutionary algorithm
      type - the type of restart
    • doAction

      public void doAction(Algorithm algorithm)
      Description copied from class: PeriodicExtension
      The action that is called by this extension.
      Specified by:
      doAction in class PeriodicExtension
      Parameters:
      algorithm - the algorithm associated with this extension
    • saveState

      public void saveState(ObjectOutputStream stream) throws IOException
      Description copied from interface: Stateful
      Writes the state of this object to the stream. The order that objects are written to the stream is important. We recommend first calling super.saveState(stream) followed by writing each field.
      Specified by:
      saveState in interface Stateful
      Overrides:
      saveState in class PeriodicExtension
      Parameters:
      stream - the stream
      Throws:
      IOException - if an I/O error occurred
    • loadState

      public void loadState(ObjectInputStream stream) throws IOException, ClassNotFoundException
      Description copied from interface: Stateful
      Loads 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 in Stateful.saveState(ObjectOutputStream).
      Specified by:
      loadState in interface Stateful
      Overrides:
      loadState in class PeriodicExtension
      Parameters:
      stream - the stream
      Throws:
      IOException - if an I/O error occurred
      ClassNotFoundException - if the stream referenced a class that is not defined