org.eclipse.viatra.dse.objectives

## Class ObjectiveComparatorHelper

- java.lang.Object
- - org.eclipse.viatra.dse.objectives.ObjectiveComparatorHelper

-     public class ObjectiveComparatorHelper
      extends java.lang.Object

  This class is responsible to compare and sort fitness values. `TrajectoryFitness` instances can be added to an instance of this class, that it can sort them.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectiveComparatorHelper(IObjective[][] leveledObjectives)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTrajectoryFitness(TrajectoryFitness trajectoryFitness)` Adds a `TrajectoryFitness` to an inner list to compare later.
    `void` | `clearTrajectoryFitnesses()` Clears the inner `TrajectoryFitness` list.
    `int` | `compare(Fitness o1, Fitness o2)` Compares two fitnesses based on hierarchical dominance.
    `static void` | `crowdingDistanceAssignment(java.util.List<TrajectoryFitness> front, IObjective[][] leveledObjectives)` Executes the crowding distance assignment for the specified front.
    `java.util.List<? extends java.util.List<TrajectoryFitness>>` | `getFronts()` Returns the previously added `TrajectoryFitness` instances in fronts.
    `java.util.List<TrajectoryFitness>` | `getParetoFront()` Returns the pareto front of the previously added `TrajectoryFitness`.
    `TrajectoryFitness` | `getRandomBest()` Returns a random `TrajectoryFitness` from the pareto front.
    `java.util.List<TrajectoryFitness>` | `getTrajectoryFitnesses()` Returns the inner `TrajectoryFitness` list.
    `void` | `setComputeCrowdingDistance(boolean computeCrowdingDistance)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ObjectiveComparatorHelper

          public ObjectiveComparatorHelper(IObjective[][] leveledObjectives)

  - ### Method Detail

    - #### setComputeCrowdingDistance

          public void setComputeCrowdingDistance(boolean computeCrowdingDistance)

    - #### compare

          public int compare(Fitness o1,
                             Fitness o2)

      Compares two fitnesses based on hierarchical dominance. Returns -1 if the second parameter `o2` is a better solution (`o2` dominates `o1`), 1 if the first parameter `o1` is better (`o1` dominates `o2`) and returns 0 if they are non-dominating each other.

    - #### addTrajectoryFitness

          public void addTrajectoryFitness(TrajectoryFitness trajectoryFitness)

      Adds a `TrajectoryFitness` to an inner list to compare later.
      Parameters:
        `trajectoryFitness` -

    - #### clearTrajectoryFitnesses

          public void clearTrajectoryFitnesses()

      Clears the inner `TrajectoryFitness` list.

    - #### getTrajectoryFitnesses

          public java.util.List<TrajectoryFitness> getTrajectoryFitnesses()

      Returns the inner `TrajectoryFitness` list.

    - #### getRandomBest

          public TrajectoryFitness getRandomBest()

      Returns a random `TrajectoryFitness` from the pareto front.

    - #### getParetoFront

          public java.util.List<TrajectoryFitness> getParetoFront()

      Returns the pareto front of the previously added `TrajectoryFitness`.

    - #### getFronts

          public java.util.List<? extends java.util.List<TrajectoryFitness>> getFronts()

      Returns the previously added `TrajectoryFitness` instances in fronts.

    - #### crowdingDistanceAssignment

          public static void crowdingDistanceAssignment(java.util.List<TrajectoryFitness> front,
                                                        IObjective[][] leveledObjectives)

      Executes the crowding distance assignment for the specified front.
      Parameters:
        `front` -