Class RepeatedSingleObjective

java.lang.Object
org.moeaframework.algorithm.AbstractAlgorithm
org.moeaframework.algorithm.single.RepeatedSingleObjective
All Implemented Interfaces:
Algorithm, Extensible, Named, Stateful

public class RepeatedSingleObjective extends AbstractAlgorithm
Instantiates and runs several instances of a single objective algorithm. This is intended to be used with single-objective optimizers that use weighted aggregation of the objectives. This is based on the Repeated Single Objective (RSO) algorithm by E. J. Hughes [1], where they investigate running many single-objective optimizers (one many) compared to running a single many-objective optimizer (many once).

Be mindful of how running multiple instances affects the AbstractAlgorithm.step(). Each step performs one iteration of each instance. Thus, given 50 instances of an algorithm with a population size of 100, then 5000 evaluations will occur each step. In [1], they decrease the population size for the single objective optimizers.

References:

  1. E. J. Hughes. "Evolutionary many-objective optimization: many once or one many." 2005 IEEE Congress on Evolutionary Computation, pp. 222-227.
  • Constructor Details

    • RepeatedSingleObjective

      public RepeatedSingleObjective(Problem problem, int instances, String algorithmName, TypedProperties properties)
      Constructs a new instance of the RSO algorithm using the given single-objective algorithm. The properties are passed to each individual algorithm with the addition of a "weights" parameter, which is randomly-generated for each instance.
      Parameters:
      problem - the problem to solve
      algorithmName - the algorithm name
      properties - the algorithm properties
      instances - the number of instances
    • RepeatedSingleObjective

      public RepeatedSingleObjective(Problem problem, int instances, BiFunction<Problem,double[],Algorithm> creator)
      Constructs a new instance of the RSO algorithm using randomly-generated weights.
      Parameters:
      problem - the problem to solve
      instances - the number of single-objective algorithm instances to create using random weights
      creator - function that creates a single-objective algorithm for the given weight vector
    • RepeatedSingleObjective

      public RepeatedSingleObjective(Problem problem, WeightGenerator weightGenerator, BiFunction<Problem,double[],Algorithm> creator)
      Constructs a new instance of the RSO algorithm. The weight generator defines the number of instances.
      Parameters:
      problem - the problem to solve
      weightGenerator - generates the weight vectors used to configure each single-objective algorithm
      creator - function that creates a single-objective algorithm for the given weight vector
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Algorithm
      Returns the name of this algorithm. Whenever possible, this name should match the name recognized by AlgorithmFactory.
      Returns:
      the name of this algorithm
    • getNumberOfEvaluations

      public int getNumberOfEvaluations()
      Description copied from interface: Algorithm
      Returns the number of times the evaluate method was invoked. This is the primary measure of runtime for optimization algorithms.
      Specified by:
      getNumberOfEvaluations in interface Algorithm
      Overrides:
      getNumberOfEvaluations in class AbstractAlgorithm
      Returns:
      the number of times the evaluate method was invoked
    • getResult

      public NondominatedPopulation getResult()
      Description copied from interface: Algorithm
      Returns the current best-known result.
      Returns:
      the current best-known result
    • initialize

      public void initialize()
      Description copied from interface: Algorithm
      Performs any initialization that is required by this algorithm. This method should only be called once, though the specific implementation may choose to no-op or throw AlgorithmInitializationException if called multiple times.

      Implementations should always call super.initialize() to ensure the algorithm is initialized correctly.

      Specified by:
      initialize in interface Algorithm
      Overrides:
      initialize in class AbstractAlgorithm
    • iterate

      protected void iterate()
      Description copied from class: AbstractAlgorithm
      Performs one iteration of the algorithm. This method should be overridden by implementations to perform each logical iteration of the algorithm.
      Specified by:
      iterate in class AbstractAlgorithm
    • 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 AbstractAlgorithm
      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 AbstractAlgorithm
      Parameters:
      stream - the stream
      Throws:
      IOException - if an I/O error occurred
      ClassNotFoundException - if the stream referenced a class that is not defined