Class ReferenceVectorGuidedPopulation

java.lang.Object
org.moeaframework.core.Population
org.moeaframework.algorithm.ReferenceVectorGuidedPopulation
All Implemented Interfaces:
Iterable<Solution>, Stateful, Displayable, Formattable<Solution>

public class ReferenceVectorGuidedPopulation extends Population
A reference vector guided population, for use with RVEA, that truncates the population using the method outlined in [1].

References:

  1. R. Cheng, Y. Jin, M. Olhofer, and B. Sendhoff. "A Reference Vector Guided Evolutionary Algorithm for Many-objective Optimization." IEEE Transactions on Evolutionary Computation, Issue 99, 2016.
  • Constructor Details

    • ReferenceVectorGuidedPopulation

      public ReferenceVectorGuidedPopulation(int numberOfObjectives, NormalBoundaryDivisions divisions)
      Constructs a new populationf or RVEA using default settings.
      Parameters:
      numberOfObjectives - the number of objectives
      divisions - the number of divisions
    • ReferenceVectorGuidedPopulation

      public ReferenceVectorGuidedPopulation(int numberOfObjectives, NormalBoundaryDivisions divisions, double alpha)
      Constructs a new population for RVEA.
      Parameters:
      numberOfObjectives - the number of objectives
      divisions - the number of divisions
      alpha - controls the rate of change in the angle-penalized distance function
    • ReferenceVectorGuidedPopulation

      public ReferenceVectorGuidedPopulation(int numberOfObjectives, NormalBoundaryDivisions divisions, double alpha, Iterable<? extends Solution> iterable)
      Constructs a new population for RVEA.
      Parameters:
      numberOfObjectives - the number of objectives
      divisions - the number of divisions
      alpha - controls the rate of change in the angle-penalized distance function
      iterable - the solutions used to initialize this population
  • Method Details

    • getDivisions

      public NormalBoundaryDivisions getDivisions()
      Returns the number of divisions used to generate the reference vectors.
      Returns:
      the number of divisions
    • getAlpha

      public double getAlpha()
      Returns the alpha parameter, which controls the rate of change in the angle-penalized distance function.
      Returns:
      the alpha parameter value
    • setScalingFactor

      public void setScalingFactor(double scalingFactor)
      Scaling factor used in the angle-penalized distance function. This should be set to currentGeneration / maxGenerations. Smaller values favor convergence while larger values favor diversity.
      Parameters:
      scalingFactor - the scaling factor, between 0 and 1
    • adapt

      public void adapt()
      Normalize the reference vectors.
    • calculateIdealPoint

      protected void calculateIdealPoint()
      Compute the ideal point.
    • translateByIdealPoint

      protected void translateByIdealPoint()
      Offsets the solutions in this population by the ideal point. This method does not modify the objective values, instead it sets the NormalizedObjectives attribute.
    • cosine

      protected static double cosine(double[] line, double[] point)
      Returns the cosine between the objective vector and a reference vector. This method assumes the line is a normalized weight vector; the point does not need to be normalized.
      Parameters:
      line - the line originating from the origin
      point - the point
      Returns:
      the cosine
    • acosine

      protected static double acosine(double[] line, double[] point)
      Returns the angle between the objective vector and a reference vector. This method assumes the line is a normalized weight vector; the point does not need to be normalized.
      Parameters:
      line - the line originating from the origin
      point - the point
      Returns:
      the angle (acosine)
    • associateToReferencePoint

      protected List<List<Solution>> associateToReferencePoint(Population population)
      Associates each solution to the nearest reference vector, returning a list-of-lists. The outer list maps to each reference vector using their index. The inner list is an unordered collection of the solutions associated with the reference point.
      Parameters:
      population - the population of solutions
      Returns:
      the association of solutions to reference points
    • smallestAngleBetweenWeights

      protected double smallestAngleBetweenWeights(int index)
      Computes the smallest angle between the given reference vector and all remaining vectors.
      Parameters:
      index - the index of the reference vector
      Returns:
      the smallest angle between the given reference vector and all remaining vectors
    • select

      protected Solution select(List<Solution> solutions, int index)
      Select the solution with the smallest penalized distance.
      Parameters:
      solutions - the solutions
      index - the index of the reference vector
      Returns:
      the solution with the smallest penalized distance
    • truncate

      public void truncate(int size, Comparator<? super Solution> comparator)
      Description copied from class: Population
      Sorts this population using the specified comparator and removes the last (maximum) solutions until this population's size is within the specified size.
      Overrides:
      truncate in class Population
      Parameters:
      size - the target population size after truncation
      comparator - the comparator to be used for truncation
    • truncate

      public void truncate()
      Truncates the population so that only one solution is associated with each reference vector.
    • copy

      Description copied from class: Population
      Returns a copy of this population. This can be thought of as a "deep copy", which creates a copy of both the population itself and copies of the individual solutions in the population. Consequently, the returned copy is completely independent, such that any modifications to the contents or order will not impact the original.

      Since creating such a "deep copy" can be expensive, prefer using the constructor Population(Iterable) or Population.addAll(Iterable) whenever possible. These alternatives are useful when filtering or reordering the solutions, but the solutions themselves are left unchanged.

      Overrides:
      copy in class Population
      Returns:
      the copy of this population
    • 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 Population
      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 Population
      Parameters:
      stream - the stream
      Throws:
      IOException - if an I/O error occurred
      ClassNotFoundException - if the stream referenced a class that is not defined