Class CriterionSet<T extends Criterion>

java.lang.Object
org.opt4j.core.CriterionSet<T>
All Implemented Interfaces:
Iterable<Map.Entry<T,Value<?>>>
Direct Known Subclasses:
Constraints, Objectives

public abstract class CriterionSet<T extends Criterion> extends Object implements Iterable<Map.Entry<T,Value<?>>>
Superclass for Criterion-Values pairs. Provides methods for the administration of these pairs.
  • Field Details

  • Constructor Details

    • CriterionSet

      public CriterionSet()
  • Method Details

    • iterator

      public Iterator<Map.Entry<T,Value<?>>> iterator()
      Specified by:
      iterator in interface Iterable<T extends Criterion>
    • array

      public abstract double[] array()
      Returns an array of all CriterionSet values.
      Returns:
      an array containing CriterionSet values
    • size

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

      public Collection<T> getKeys()
      Returns all Criterions.
      Returns:
      all Criterions
    • getValues

      public Collection<Value<?>> getValues()
      Returns all values.
      Returns:
      all values
    • get

      public Value<?> get(T criterion)
      Returns the value that is assigned to the given Criterion. Returns null if the Criterion does not exist.
      Parameters:
      criterion - the given criterion
      Returns:
      the value
    • get

      public T get(Value<?> value)
      Returns the Criterion that is assigned to the given value. Returns null if the value does not exist.
      Parameters:
      value - the given value
      Returns:
      the Criterion
    • add

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

      public void add(T criterion, double value)
      Adds the Criterion with the specified double value.
      Parameters:
      criterion - the criterion
      value - the value
    • add

      public void add(T criterion, int value)
      Adds the Criterion with the specified integer value.
      Parameters:
      criterion - the criterion
      value - the value
    • add

      public void add(CriterionSet<T> criterionSet)
      Adds all Criterions with the specified value specified in criterionSet.
      Parameters:
      criterionSet - the criterionSet
    • isEqual

      public boolean isEqual(CriterionSet<T> opponent)
      Returns true if this CriterionSet is equal to the specified CriterionSet. This comparison is based on the #array() values.
      Parameters:
      opponent - other CriterionSet
      Returns:
      true if the CriterionSets are equal
    • distance

      public double distance(CriterionSet<T> other)
      Calculates the euclidean distance of two CriterionSets. This calculation is based on the #array() values.
      Parameters:
      other - the second CriterionSet
      Returns:
      the euclidean distance