org.eclipse.viatra.dse.objectives

## Interface IObjective

- All Known Implementing Classes:
    AlwaysSatisfiedDummyHardObjective, BaseObjective, CompositeObjective, ConstraintsObjective, DepthHardObjective, NeverSatisfiedDummyHardObjective, NoRuleActivationsHardObjective, TrajectoryCostSoftObjective

      public interface IObjective

  Implementation of this interface represents a single objective of the DSE problem, which can assess a solution (trajectory) in a single number. It has a name and a comparator which orders two solution based on the calculated value.

  Objectives can be either hard or soft objectives. Hard objectives can be satisfied or unsatisfied. If all of the hard objectives are satisfied on a single solution, then it is considered to be a valid (or goal) solution.

  Certain objectives can have inner state for calculating the fitness value. In this case a new instance is necessary for every new thread, and the `createNew` method should not return the same instance more than once.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `IObjective` | `createNew()` Returns an instance of the `IObjective`.
    `java.util.Comparator<java.lang.Double>` | `getComparator()` Returns a `Comparator` which is used to compare fitness (doubles).
    `java.lang.Double` | `getFitness(ThreadContext context)` Calculates the value of the objective on a given solution (trajectory).
    `int` | `getLevel()` Gets the level of the objective.
    `java.lang.String` | `getName()` Returns the name of the objective.
    `void` | `init(ThreadContext context)` Initializes the objective.
    `boolean` | `isHardObjective()` Returns true if the objective is a hard objective.
    `boolean` | `satisifiesHardObjective(java.lang.Double fitness)` Determines if the given fitness value satisfies the hard objective.
    `void` | `setComparator(java.util.Comparator<java.lang.Double> comparator)` Sets the `Comparator` which is used to compare fitness (doubles).
    `void` | `setLevel(int level)` Set the level of the objective.

- - ### Method Detail

    - #### getName

          java.lang.String getName()

      Returns the name of the objective.
      Returns:
        The name of the objective.

    - #### setComparator

          void setComparator(java.util.Comparator<java.lang.Double> comparator)

      Sets the `Comparator` which is used to compare fitness (doubles). It determines whether the objective is to minimize or maximize (or minimize or maximize a delta from a given number).
      Parameters:
        `comparator` - The comparator.

    - #### getComparator

          java.util.Comparator<java.lang.Double> getComparator()

      Returns a `Comparator` which is used to compare fitness (doubles). It determines whether the objective is to minimize or maximize (or minimize or maximize a delta from a given number).
      Returns:
        The comparator.

    - #### getFitness

          java.lang.Double getFitness(ThreadContext context)

      Calculates the value of the objective on a given solution (trajectory).
      Parameters:
        `context` - The `ThreadContext`
      Returns:
        The objective value in double.

    - #### init

          void init(ThreadContext context)

      Initializes the objective. It is called exactly once for every thread starts.
      Parameters:
        `context` - The `ThreadContext`.

    - #### createNew

          IObjective createNew()

      Returns an instance of the `IObjective`. If it returns the same instance, all the methods has to be thread save as they are called concurrently.
      Returns:
        An instance of the objective.

    - #### isHardObjective

          boolean isHardObjective()

      Returns true if the objective is a hard objective. In such a case the method `satisifiesHardObjective(Double)` is called.
      Returns:
        True if the objective is a hard objective.
      See Also:
        `satisifiesHardObjective(Double)`, `IObjective`

    - #### satisifiesHardObjective

          boolean satisifiesHardObjective(java.lang.Double fitness)

      Determines if the given fitness value satisfies the hard objective.
      Parameters:
        `fitness` - The fitness value of a solution.
      Returns:
        True if it satisfies the hard objective or it is a soft constraint.
      See Also:
        `IObjective`

    - #### setLevel

          void setLevel(int level)

      Set the level of the objective.

    - #### getLevel

          int getLevel()

      Gets the level of the objective.