Class ArgMax

  • All Implemented Interfaces:
    SatisfiedPresent

    public class ArgMax
    extends Constraint
    implements SatisfiedPresent
    ArgMax constraint provides the index of the maximum variable from all variables on the list.
    Version:
    4.7
    • Field Detail

      • idNumber

        static final java.util.concurrent.atomic.AtomicInteger idNumber
      • firstConsistencyCheck

        boolean firstConsistencyCheck
      • list

        public final IntVar[] list
        It specifies a list of variables among which a maximum value is being searched for.
      • maxIndex

        public final IntVar maxIndex
        It specifies variable max which stores the maximum value present in the list.
      • indexOffset

        public int indexOffset
        It specifies indexOffset within an element constraint list[index-indexOffset] = value.
      • tiebreak

        public boolean tiebreak
        tirbreak == true --> select element with the lowest index if exist several
    • Constructor Detail

      • ArgMax

        public ArgMax​(IntVar[] list,
                      IntVar maxIndex,
                      int indexOffset,
                      boolean tiebreak)
        It constructs max constraint.
        Parameters:
        maxIndex - variable denoting the index of the maximum value
        list - the array of variables for which the index of the maximum value is imposed.
        indexOffset - the offset for the index that is computed from 1 by default (if needed from 0, use -1 for this parameter)
        tiebreak - defines if tie breaking should be used (returning the least index if several maximum elements
      • ArgMax

        public ArgMax​(IntVar[] list,
                      IntVar maxIndex)
      • ArgMax

        public ArgMax​(java.util.List<? extends IntVar> variables,
                      IntVar maxIndex,
                      int indexOffset,
                      boolean tiebreak)
        It constructs max constraint.
        Parameters:
        maxIndex - variable denoting index of the maximum value
        variables - the array of variables for which the maximum value is imposed.
        indexOffset - the offset for the index that is computed from 1 by default (if needed from 0, use -1 for this parameter)
        tiebreak - defines if tie breaking sgould be used (returning the least index if several maximum elements
      • ArgMax

        public ArgMax​(java.util.List<? extends IntVar> variables,
                      IntVar maxIndex)
    • Method Detail

      • consistency

        public void consistency​(Store store)
        Description copied from class: Constraint
        It is a (most probably incomplete) consistency function which removes the values from variables domains. Only values which do not have any support in a solution space are removed.
        Specified by:
        consistency in class Constraint
        Parameters:
        store - constraint store within which the constraint consistency is being checked.
      • satisfied

        public boolean satisfied()
        Description copied from interface: SatisfiedPresent
        It checks if the constraint is satisfied. It can return false even if constraint is satisfied but not all variables in its scope are grounded. It needs to return true if all variables in its scope are grounded and constraint is satisfied.

        Implementations of this interface for constraints that are not PrimitiveConstraint may require constraint imposition and consistency check as a requirement to work correctly.

        Specified by:
        satisfied in interface SatisfiedPresent
        Returns:
        true if constraint is possible to verify that it is satisfied.
      • toString

        public java.lang.String toString()
        Description copied from class: Constraint
        It produces a string representation of a constraint state.
        Overrides:
        toString in class Constraint