Class Cumulative

  • All Implemented Interfaces:
    SatisfiedPresent

    public class Cumulative
    extends Constraint
    implements SatisfiedPresent
    Cumulative implements the cumulative/4 constraint using edge-finding algorithm and profile information on the resource use.
    Version:
    4.8
    • Field Detail

      • idNumber

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

        private Profile maxProfile
        It contains information about maximal profile contributed by tasks.
      • minProfile

        private Profile minProfile
        It contains information about minimal profile contributed by regions for certain occupied by tasks.
      • Ts

        private Task[] Ts
      • doEdgeFinding

        protected boolean doEdgeFinding
        It specifies if the edge finding algorithm should be used.
      • doProfile

        protected boolean doProfile
        It specifies if the profiles should be computed to propagate onto limit variable.
      • setLimit

        protected boolean setLimit
        It specifies if the data from profiles should be used to propagate onto limit variable.
      • limit

        public IntVar limit
        It specifies the limit of the profile of cumulative use of resources.
      • starts

        public IntVar[] starts
        It specifies/stores start variables for each corresponding task.
      • durations

        public IntVar[] durations
        It specifies/stores duration variables for each corresponding task.
      • resources

        public IntVar[] resources
        It specifies/stores resource variable for each corresponding task.
      • domainMaxComparator

        private java.util.Comparator<IntDomain> domainMaxComparator
      • domainMinComparator

        private java.util.Comparator<IntDomain> domainMinComparator
      • taskAscEctComparator

        private java.util.Comparator<Task> taskAscEctComparator
      • taskDescLstComparator

        private java.util.Comparator<Task> taskDescLstComparator
    • Constructor Detail

      • Cumulative

        public Cumulative​(IntVar[] starts,
                          IntVar[] durations,
                          IntVar[] resources,
                          IntVar limit,
                          boolean doEdgeFinding,
                          boolean doProfile)
        It creates a cumulative constraint.
        Parameters:
        starts - variables denoting starts of the tasks.
        durations - variables denoting durations of the tasks.
        resources - variables denoting resource usage of the tasks.
        limit - the overall limit of resources which has to be used.
        doEdgeFinding - true if edge finding algorithm should be used.
        doProfile - specifies if the profiles should be computed in order to reduce limit variable.
      • Cumulative

        public Cumulative​(IntVar[] starts,
                          IntVar[] durations,
                          IntVar[] resources,
                          IntVar limit,
                          boolean doEdgeFinding,
                          boolean doProfile,
                          boolean setLimit)
        It creates a cumulative constraint.
        Parameters:
        starts - variables denoting starts of the tasks.
        durations - variables denoting durations of the tasks.
        resources - variables denoting resource usage of the tasks.
        limit - the overall limit of resources which has to be used.
        doEdgeFinding - true if edge finding algorithm should be used.
        doProfile - specifies if the profiles should be computed in order to reduce limit variable.
        setLimit - specifies if limit variable will be prunded.
      • Cumulative

        public Cumulative​(java.util.List<? extends IntVar> starts,
                          java.util.List<? extends IntVar> durations,
                          java.util.List<? extends IntVar> resources,
                          IntVar limit)
        It creates a cumulative constraint.
        Parameters:
        starts - variables denoting starts of the tasks.
        durations - variables denoting durations of the tasks.
        resources - variables denoting resource usage of the tasks.
        limit - the overall limit of resources which has to be used.
      • Cumulative

        public Cumulative​(java.util.List<? extends IntVar> starts,
                          java.util.List<? extends IntVar> durations,
                          java.util.List<? extends IntVar> resources,
                          IntVar limit,
                          boolean edgeFinding)
        It creates a cumulative constraint.
        Parameters:
        starts - variables denoting starts of the tasks.
        durations - variables denoting durations of the tasks.
        resources - variables denoting resource usage of the tasks.
        limit - the overall limit of resources which has to be used.
        edgeFinding - true if edge finding algorithm should be used.
      • Cumulative

        public Cumulative​(java.util.List<? extends IntVar> starts,
                          java.util.List<? extends IntVar> durations,
                          java.util.List<? extends IntVar> resources,
                          IntVar limit,
                          boolean edgeFinding,
                          boolean profile)
        It creates a cumulative constraint.
        Parameters:
        starts - variables denoting starts of the tasks.
        durations - variables denoting durations of the tasks.
        resources - variables denoting resource usage of the tasks.
        limit - the overall limit of resources which has to be used.
        edgeFinding - true if edge finding algorithm should be used.
        profile - specifies if the profiles should be computed in order to reduce limit variable.
      • Cumulative

        public Cumulative​(IntVar[] starts,
                          IntVar[] durations,
                          IntVar[] resources,
                          IntVar limit)
        It creates a cumulative constraint.
        Parameters:
        starts - variables denoting starts of the tasks.
        durations - variables denoting durations of the tasks.
        resources - variables denoting resource usage of the tasks.
        limit - the overall limit of resources which has to be used.
      • Cumulative

        public Cumulative​(IntVar[] starts,
                          IntVar[] durations,
                          IntVar[] resources,
                          IntVar limit,
                          boolean edgeFinding)
        It creates a cumulative constraint.
        Parameters:
        starts - variables denoting starts of the tasks.
        durations - variables denoting durations of the tasks.
        resources - variables denoting resource usage of the tasks.
        limit - the overall limit of resources which has to be used.
        edgeFinding - true if edge finding algorithm should be used.
    • Method Detail

      • after

        boolean after​(Task l,
                      java.util.List<Task> S)
      • before

        private boolean before​(Task l,
                               java.util.List<Task> S)
      • between

        boolean between​(Task l,
                        java.util.List<Task> S)
      • 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.
      • edgeFindingDown

        private void edgeFindingDown​(Store store)
      • edgeFindingUp

        private void edgeFindingUp​(Store store)
      • est

        private int est​(java.util.List<Task> S)
      • fitTasksAfter

        private boolean fitTasksAfter​(java.util.List<Task> s,
                                      int est0)
      • fitTasksBefore

        private boolean fitTasksBefore​(java.util.List<Task> s,
                                       int lct0)
      • getTasks

        Task[] getTasks()
      • intervalOverlap

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

        private int lct​(java.util.List<Task> S)
      • maxArea

        private int maxArea​(java.util.List<Task> Ts)
      • minOverlap

        private long minOverlap​(Task t,
                                int est,
                                int lct)
      • notFirst

        private void notFirst​(Store store,
                              Task s,
                              java.util.List<Task> S)
      • notLast

        private void notLast​(Store store,
                             Task s,
                             java.util.List<Task> S)
      • profileCheckInterval

        private void profileCheckInterval​(Store store,
                                          IntVar Start,
                                          IntVar Duration,
                                          Interval i,
                                          IntVar Resources,
                                          int mustUseMin,
                                          int mustUseMax)
      • profileCheckTasks

        private void profileCheckTasks​(Store store)
      • removeFromS_Est

        private void removeFromS_Est​(java.util.List<Task> s)
      • removeFromS_Lct

        private void removeFromS_Lct​(java.util.List<Task> s)
      • 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
      • updateTasksRes

        private void updateTasksRes​(Store store)