Class IntIterableSetUtils


  • public class IntIterableSetUtils
    extends Object

    Project: choco.

    Since:
    25/01/2016.
    Author:
    Charles Prud'homme
    • Constructor Detail

      • IntIterableSetUtils

        public IntIterableSetUtils()
    • Method Detail

      • copyIn

        public static void copyIn​(IntVar var,
                                  IntIterableRangeSet set)
        Copy the domain of var in set. First, it clears set, then it fills it with the value in var.
        Parameters:
        var - an integer variable
        set - set to transfer values to
      • complement

        public static IntIterableRangeSet complement​(IntIterableRangeSet set,
                                                     int lbu,
                                                     int ubu)
        Parameters:
        set - on which the complement is based
        lbu - lower bound (inclusive) of the universe
        ubu - upper bound (inclusive) of the universe
        Returns:
        the complement of this set wrt to universe set [lbu, ubu]. Values smaller than lbu and greater than ubu are ignored.
      • plus

        public static void plus​(IntIterableRangeSet setr,
                                IntIterableRangeSet set1,
                                int l,
                                int u)
        Set setr to {a + b | a in set1, b in [l..u]}
        Parameters:
        setr - set of ints
        set1 - a set of ints
        l - an int
        u - an int
      • minus

        public static void minus​(IntIterableRangeSet setr,
                                 IntIterableRangeSet set1,
                                 int l,
                                 int u)
        Set setr to {a - b | a in set1, b in [l..u]}
        Parameters:
        setr - set of ints
        set1 - a set of ints
        l - an int
        u - an int
      • intersection

        public static void intersection​(IntIterableRangeSet setr,
                                        IntIterableRangeSet set1,
                                        int from,
                                        int to)
        Set setr to set1 ∩ [from,to]
        Parameters:
        setr - set of ints
        set1 - a set of ints
        from - lower bound of an interval
        to - upper bound of an interval
      • intersectionOf

        public static boolean intersectionOf​(IntIterableRangeSet set1,
                                             IntIterableRangeSet set2)
        Set set1 to set1set2
        Parameters:
        set1 - a set of ints
        set2 - a set of ints
        Returns:
        true if set1 has changed
      • unionOf

        public static boolean unionOf​(IntIterableRangeSet set1,
                                      IntIterableRangeSet set2)
        Set set1 to set1set2
        Parameters:
        set1 - a set of ints
        set2 - a set of ints
        Returns:
        true if set1 has changed
      • union

        public static void union​(IntIterableRangeSet set,
                                 IntVar var)
        Put all value of var into set. TODO: more efficient operation
        Parameters:
        set - a set of ints
        var - a integer variable
      • includedIn

        public static boolean includedIn​(IntVar var,
                                         IntIterableRangeSet set)
        Parameters:
        var - a variable
        set - a set
        Returns:
        true if var is included into set, false otherwise.
      • includedIn

        public static boolean includedIn​(IntIterableRangeSet set1,
                                         IntIterableRangeSet set2)
        Parameters:
        set1 - a set
        set2 - a set
        Returns:
        true if set1 is included into set2, false otherwise.
      • notIncludedIn

        public static boolean notIncludedIn​(IntVar var,
                                            IntIterableRangeSet set)
        Parameters:
        var - a variable
        set - a set
        Returns:
        true if var is not included into set, false otherwise.
      • intersect

        public static boolean intersect​(IntVar var,
                                        IntIterableRangeSet set)
        Parameters:
        var - a variable
        set - a set
        Returns:
        true if intersection of var and set is not empty, false otherwise.
      • intersect

        public static boolean intersect​(IntIterableRangeSet set1,
                                        IntIterableRangeSet set2)
        Parameters:
        set1 - a set
        set2 - a set
        Returns:
        true if intersection of set1 and set2 is not empty, false otherwise.