Class Diff

    • Field Detail

      • idNumber

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

        Store currentStore
      • minPosition

        private int minPosition
      • stamp

        int stamp
      • durMax

        private java.util.List<java.lang.Integer> durMax
      • variableQueue

        java.util.Set<IntVar> variableQueue
      • rectangles

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

        boolean doProfile
        It specifies if the constraint should compute and use the profile.
      • dimIthMinComparator

        protected java.util.function.Function<java.lang.Integer,​java.util.Comparator<IntRectangle>> dimIthMinComparator
    • Constructor Detail

      • Diff

        protected Diff()
      • Diff

        public Diff​(Rectangle[] rectangles,
                    boolean doProfile)
        It specifies a diff constraint.
        Parameters:
        rectangles - list of rectangles which can not overlap in at least one dimension.
        doProfile - should the constraint compute and use the profile functionality.
      • Diff

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

        public Diff​(IntVar[] o1,
                    IntVar[] o2,
                    IntVar[] l1,
                    IntVar[] l2,
                    boolean profile)
        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.
        profile - it specifies if the profile should be computed and used.
      • Diff

        public Diff​(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.
      • Diff

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

        public Diff​(java.util.List<? extends java.util.List<? extends IntVar>> rectangles,
                    boolean profile)
        It specifies a diff constraint.
        Parameters:
        profile - specifies is the profiles are used.
        rectangles - list of rectangles which can not overlap in at least one dimension.
      • Diff

        public Diff​(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.
      • Diff

        public Diff​(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 profile)
        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.
        profile - it specifies if the profile should be computed and used.
      • Diff

        public Diff​(IntVar[][] rectangles,
                    boolean profile)
        It specifies a diff constraint.
        Parameters:
        profile - specifies is the profiles are used.
        rectangles - list of rectangles which can not overlap in at least one dimension.
    • Method Detail

      • removeLevel

        public void removeLevel​(int level)
        Description copied from interface: Stateful
        This function is called in case of the backtrack, so a constraint can clear the queue of changed variables which is no longer valid. This function is called *before* all timestamps, variables, mutablevariables have reverted to their previous value.
        Specified by:
        removeLevel in interface Stateful
        Parameters:
        level - the level which is being removed.
      • 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.
      • containsChangedVariable

        boolean containsChangedVariable​(Rectangle r,
                                        java.util.Set<IntVar> fdvQueue)
      • findRectangles

        private boolean findRectangles​(Rectangle r,
                                       java.util.List<IntRectangle> UsedRect,
                                       java.util.List<Rectangle> ProfileCandidates,
                                       java.util.Set<IntVar> fdvQueue)
      • intervalOverlap

        boolean intervalOverlap​(int min1,
                                int max1,
                                int min2,
                                int max2)
      • computeNewMaxDuration

        private void computeNewMaxDuration​(IntVar start,
                                           int durMin,
                                           int excludeMin,
                                           int excludeMax)
      • narrowRectangles

        void narrowRectangles​(java.util.Set<IntVar> fdvQueue)
      • notFit

        private boolean notFit​(int i,
                               Rectangle r,
                               java.util.List<IntRectangle> ConsideredRect,
                               int barierPosition)
      • profileCheckInterval

        private void profileCheckInterval​(Store store,
                                          DiffnProfile Profile,
                                          int limit,
                                          IntVar Start,
                                          IntVar Duration,
                                          int iMin,
                                          int i_max,
                                          IntVar Resources)
      • profileCheckRectangle

        void profileCheckRectangle​(DiffnProfile Profile,
                                   Rectangle r,
                                   int i,
                                   int j)
      • profileNarrowing

        void profileNarrowing​(int i,
                              Rectangle r,
                              java.util.List<Rectangle> ProfileCandidates)
      • queueVariable

        public void queueVariable​(int level,
                                  Var V)
        Description copied from class: Constraint
        This is a function called to indicate which variable in a scope of constraint has changed. It also indicates a store level at which the change has occurred.
        Overrides:
        queueVariable in class Constraint
        Parameters:
        level - the level of the store at which the change has occurred.
        V - variable which has changed.
      • 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