Class Objectives

java.lang.Object
org.opt4j.core.Objectives
All Implemented Interfaces:
Iterable<Map.Entry<Objective,Value<?>>>

public class Objectives extends Object implements Iterable<Map.Entry<Objective,Value<?>>>
The Objectives contain the Objective-Value pairs of an Individual.
See Also:
  • Constructor Details

  • Method Details

    • iterator

      Specified by:
      iterator in interface Iterable<Map.Entry<Objective,Value<?>>>
    • 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!
      Returns:
      an array containing values which have to be minimized
      See Also:
    • size

      public int size()
      Returns the number of set Objectives.
      Returns:
      the number of set objectives
    • getKeys

      Returns all objectives.
      Returns:
      all objectives
    • getValues

      public Collection<Value<?>> getValues()
      Returns all values.
      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.
      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.
      Parameters:
      value - the given value
      Returns:
      the objective
    • add

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

      public void add(String name, Objective.Sign sign, Value<?> value)
      Adds the objective with the specified value.
      Parameters:
      name - the name of the objective
      sign - the optimization direction
      value - the value
    • add

      public void add(Objective objective, double value)
      Adds the objective with the specified double value.
      Parameters:
      objective - the objective
      value - the value
    • add

      public void add(String name, Objective.Sign sign, double value)
      Adds the objective with the specified value.
      Parameters:
      name - the name of the objective
      sign - the optimization direction
      value - the value
    • add

      public void add(Objective objective, int value)
      Adds the objective with the specified integer value.
      Parameters:
      objective - the objective
      value - the value
    • add

      public void add(String name, Objective.Sign sign, int value)
      Adds the objective with the specified value.
      Parameters:
      name - the name of the objective
      sign - the optimization direction
      value - the value
    • 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 is based on the array() values.
      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 is based on the array() values.
      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