Class Disjoint

  • All Implemented Interfaces:
    SatisfiedPresent, Stateful, UsesQueueVariable

    public class Disjoint
    extends Diff
    Disjoint constraint assures that any two rectangles from a vector of rectangles does not overlap in at least one direction.

    Zero-width rectangles does not overlap with any other rectangle.

    Version:
    4.8
    • Field Detail

      • idNumber

        static java.util.concurrent.atomic.AtomicInteger idNumber
    • Constructor Detail

      • Disjoint

        public Disjoint​(Rectangle[] rectangles,
                        boolean doProfile)
        Parameters:
        rectangles - a list of rectangles.
        doProfile - should profile be computed and used.
      • Disjoint

        public Disjoint​(java.util.List<IntVar> o1,
                        java.util.List<IntVar> o2,
                        java.util.List<IntVar> l1,
                        java.util.List<IntVar> l2,
                        boolean profile)
        It creates a diff2 constraint.
        Parameters:
        o1 - list of variables denoting the origin in the first dimension.
        o2 - list of variables denoting the origin in the second dimension.
        l1 - list of variables denoting the length in the first dimension.
        l2 - list of variables denoting the length in the second dimension.
        profile - specifies if the profile should be computed.
      • Disjoint

        public Disjoint​(java.util.List<? extends java.util.List<? extends IntVar>> rectangles)
        It creates a diff2 constraint.
        Parameters:
        rectangles - list of rectangles with origins and lengths in both dimensions.
      • Disjoint

        public Disjoint​(java.util.List<? extends java.util.List<? extends IntVar>> rectangles,
                        boolean profile)
        It creates a diff2 constraint.
        Parameters:
        rectangles - list of rectangles with origins and lengths in both dimensions.
        profile - specifies if the profile is computed and used.
      • Disjoint

        public Disjoint​(java.util.List<? extends IntVar> o1,
                        java.util.List<? extends IntVar> o2,
                        java.util.List<? extends IntVar> l1,
                        java.util.List<? extends IntVar> l2)
        It creates a diff2 constraint.
        Parameters:
        o1 - list of variables denoting the origin in the first dimension.
        o2 - list of variables denoting the origin in the second dimension.
        l1 - list of variables denoting the length in the first dimension.
        l2 - list of variables denoting the length in the second dimension.
      • Disjoint

        public Disjoint​(IntVar[] origin1,
                        IntVar[] origin2,
                        IntVar[] length1,
                        IntVar[] length2)
        It creates a diff2 constraint.
        Parameters:
        origin1 - list of variables denoting the origin in the first dimension.
        origin2 - list of variables denoting the origin in the second dimension.
        length1 - list of variables denoting the length in the first dimension.
        length2 - list of variables denoting the length in the second dimension.
      • Disjoint

        public Disjoint​(IntVar[] o1,
                        IntVar[] o2,
                        IntVar[] l1,
                        IntVar[] l2,
                        boolean profile)
        It creates a diff2 constraint.
        Parameters:
        o1 - list of variables denoting the origin in the first dimension.
        o2 - list of variables denoting the origin in the second dimension.
        l1 - list of variables denoting the length in the first dimension.
        l2 - list of variables denoting the length in the second dimension.
        profile - specifies if the profile should be computed.
      • Disjoint

        public Disjoint​(IntVar[][] rectangles)
        It creates a diff2 constraint.
        Parameters:
        rectangles - list of rectangles with origins and lengths in both dimensions.
      • Disjoint

        public Disjoint​(IntVar[][] rectangles,
                        boolean profile)
        It creates a diff2 constraint.
        Parameters:
        rectangles - list of rectangles with origins and lengths in both dimensions.
        profile - specifies if the profile is computed and used.
    • Method Detail

      • impose

        public void impose​(Store store)
        Description copied from class: Constraint
        It imposes the constraint in a given store.
        Overrides:
        impose in class Constraint
        Parameters:
        store - the constraint store to which the constraint is imposed to.
      • findRectangles

        private boolean findRectangles​(Rectangle r,
                                       int index,
                                       java.util.List<IntRectangle> UsedRect,
                                       java.util.List<Rectangle> ProfileCandidates,
                                       java.util.List<Rectangle> OverlappingRects,
                                       java.util.Set<IntVar> fdvQueue)
      • 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
        Overrides:
        satisfied in class Diff
        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 Diff