Class Nooverlap

  • Direct Known Subclasses:
    Diffn

    public class Nooverlap
    extends Constraint
    Nooverlap constraint assures that any two rectangles from a vector of rectangles does not overlap in at least one direction. It is a simple implementation which does not use sophisticated techniques for efficient backtracking.
    Version:
    4.8
    • Field Detail

      • idNumber

        static java.util.concurrent.atomic.AtomicInteger idNumber
      • strict

        boolean strict
        defines how to treat rectangles with width zero strict = true means they still need to be between other rectangles strict = false these rectangles can be anywhere
      • rectangle

        Rectangle[] rectangle
        It specifies the list of rectangles which are of interest for this diff constraint.
      • overlapping

        TimeStamp<java.util.BitSet>[] overlapping
        Defines first position of the variable that is not ground to 1
      • stamp

        int stamp
        current stamp
      • doAreaCheck

        boolean doAreaCheck
    • Constructor Detail

      • Nooverlap

        public Nooverlap​(IntVar[][] rectangle)
        It specifies a diff constraint.
        Parameters:
        rectangle - list of rectangles which can not overlap in at least one dimension.
      • Nooverlap

        public Nooverlap​(IntVar[][] rectangle,
                         boolean strict)
        It specifies a diff constraint.
        Parameters:
        rectangle - list of rectangles which can not overlap in at least one dimension.
        strict - true- zero size rectangles need to be between other rectangles; false- these rectangles can be anywhere
      • Nooverlap

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

        public Nooverlap​(IntVar[] origin1,
                         IntVar[] origin2,
                         IntVar[] length1,
                         IntVar[] length2,
                         boolean strict)
        It constructs a diff constraint.
        Parameters:
        origin1 - list of variables denoting origin of the rectangle in the first dimension.
        origin2 - list of variables denoting origin of the rectangle in the second dimension.
        length1 - list of variables denoting length of the rectangle in the first dimension.
        length2 - list of variables denoting length of the rectangle in the second dimension.
        strict - true- zero size rectangles need to be between other rectangles; false- these rectangles can be anywhere
      • Nooverlap

        public Nooverlap​(java.util.List<? extends java.util.List<? extends IntVar>> rectangle)
        It specifies a diffn constraint.
        Parameters:
        rectangle - list of rectangles which can not overlap in at least one dimension.
      • Nooverlap

        public Nooverlap​(java.util.List<? extends java.util.List<? extends IntVar>> rectangle,
                         boolean strict)
        It specifies a diffn constraint.
        Parameters:
        rectangle - list of rectangles which can not overlap in at least one dimension.
        strict - true- zero size rectangles need to be between other rectangles; false- these rectangles can be anywhere
      • Nooverlap

        public Nooverlap​(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 constructs a diff constraint.
        Parameters:
        o1 - list of variables denoting origin of the rectangle in the first dimension.
        o2 - list of variables denoting origin of the rectangle in the second dimension.
        l1 - list of variables denoting length of the rectangle in the first dimension.
        l2 - list of variables denoting length of the rectangle in the second dimension.
      • Nooverlap

        public Nooverlap​(java.util.List<? extends IntVar> o1,
                         java.util.List<? extends IntVar> o2,
                         java.util.List<? extends IntVar> l1,
                         java.util.List<? extends IntVar> l2,
                         boolean strict)
        It constructs a diff constraint.
        Parameters:
        o1 - list of variables denoting origin of the rectangle in the first dimension.
        o2 - list of variables denoting origin of the rectangle in the second dimension.
        l1 - list of variables denoting length of the rectangle in the first dimension.
        l2 - list of variables denoting length of the rectangle in the second dimension.
        strict - true- zero size rectangles need to be between other rectangles; false- these rectangles can be anywhere
    • 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.
      • pruning

        void pruning()
      • prune

        void prune​(Rectangle r,
                   java.util.BitSet rects)
      • energyCheck

        void energyCheck​(Rectangle r,
                         java.util.BitSet rects)
      • 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.
      • satisfied

        public boolean satisfied()
      • notSatisfied

        public boolean notSatisfied()
      • 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