Class Objectives

All Implemented Interfaces:
Iterable<Map.Entry<Objective,Value<?>>>

public class Objectives extends CriterionSet<Objective>
The Objectives contains the Objective-Values pairs of an Individual. Additionally, the feasibility of the Objectives can be set. The feasibility isFeasible() is true by default. Set this value to false to indicate that the corresponding Individual is infeasible (e.g., it violates constraints).
See Also:
  • Field Details

  • Constructor Details

    • Objectives

      @Deprecated public Objectives()
      Deprecated.
      Inject a Provider<Objectives> object instead and create Objectives objects with provider.get().
    • Objectives

      @Inject public Objectives(DominationStrategy strategy)
  • Method Details

    • getConstraints

      public Constraints getConstraints()
      Returns the constraints.
      Returns:
      the constraints
    • setConstraints

      public void setConstraints(Constraints constraints)
      Sets the constraints.
      Parameters:
      constraints - the constraints to set
    • getDominationStrategy

      public DominationStrategy getDominationStrategy()
      Returns the domination strategy of the Objective.
      Returns:
      the domination strategy of the Objective
    • isFeasible

      public boolean isFeasible()
      Returns the feasibility.
      Returns:
      the feasibility
    • setFeasible

      public void setFeasible(boolean feasible)
      Sets the feasibility.
      Parameters:
      feasible - the feasibility to set
    • iterator

      public Iterator<Map.Entry<Objective,Value<?>>> iterator()
      Specified by:
      iterator in interface Iterable<Map.Entry<Objective,Value<?>>>
      Overrides:
      iterator in class CriterionSet<Objective>
    • array

      public double[] array()
      Returns an array of all values which all have to be minimized. Do not call this method before all objectives were added!
      Specified by:
      array in class CriterionSet<Objective>
      Returns:
      an array containing values which have to be minimized
      See Also:
    • submit

      protected void submit()
      Calculates the array.
    • size

      public int size()
      Returns the number of set Objectives.
      Overrides:
      size in class CriterionSet<Objective>
      Returns:
      the number of set objectives
    • getKeys

      public Collection<Objective> getKeys()
      Returns all objectives.
      Overrides:
      getKeys in class CriterionSet<Objective>
      Returns:
      all objectives
    • getValues

      public Collection<Value<?>> getValues()
      Returns all values.
      Overrides:
      getValues in class CriterionSet<Objective>
      Returns:
      all values
    • get

      public Value<?> get(Objective objective)
      Returns the value that is assigned to the given objective. Returns null if the objective does not exist.
      Overrides:
      get in class CriterionSet<Objective>
      Parameters:
      objective - the given objective
      Returns:
      the value
    • get

      public Objective get(Value<?> value)
      Returns the objective that is assigned to the given value. Returns null if the value does not exist.
      Overrides:
      get in class CriterionSet<Objective>
      Parameters:
      value - the given value
      Returns:
      the objective
    • add

      public void add(Objective objective, Value<?> value)
      Adds the objective with the specified value.
      Overrides:
      add in class CriterionSet<Objective>
      Parameters:
      objective - the objective
      value - the value
    • add

      public void add(Objective objective, double value)
      Adds the objective with the specified double value.
      Overrides:
      add in class CriterionSet<Objective>
      Parameters:
      objective - the objective
      value - the value
    • add

      public void add(Objective objective, int value)
      Adds the objective with the specified integer value.
      Overrides:
      add in class CriterionSet<Objective>
      Parameters:
      objective - the objective
      value - the value
    • add

      @Deprecated public void add(Objectives objectives)
      Deprecated.
      Adds all objective with the specified value specified in Objectives.
      Parameters:
      objectives - the objectives
    • addAll

      public void addAll(Objectives objectives)
      Adds all objective with the specified value specified in Objectives.
      Parameters:
      objectives - the objectives
    • weaklyDominates

      public boolean weaklyDominates(Objectives opponent)
      Returns true if this objectives weakly dominates the specified objectives. This comparison depends on the chosen DominationStrategy.
      Parameters:
      opponent - other objectives
      Returns:
      true if this objectives weakly dominate the opponent
    • dominates

      public boolean dominates(Objectives opponent)
      Returns true if this objectives dominate the specified objectives. This comparison depends on the chosen DominationStrategy.
      Parameters:
      opponent - other objectives
      Returns:
      true if these objectives dominate the opponent
    • isEqual

      public boolean isEqual(Objectives opponent)
      Returns true if this objectives are equal to the specified objectives. This comparison is based on the array() values.
      Parameters:
      opponent - other objectives
      Returns:
      true if these objectives dominate the opponent
    • distance

      public double distance(Objectives other)
      Calculates the euclidean distance of two Objectives. This calculation is based on the array() values.
      Parameters:
      other - the second objectives
      Returns:
      the euclidean distance
    • toString

      public String toString()
      Overrides:
      toString in class Object