Skip to main content
FRAMES NO FRAMES

Cumul functions in CP Optimizer
PREVIOUS NEXT
Semantics
Cumul function expressions
Constraints on cumul function expressions
Expressions on cumul function expressions
Semantics

In scheduling problems involving cumulative resources (also known as renewable resources), the cumulated usage of the resource by the activities is usually represented by a function of time. An activity usually increases the cumulated resource usage function at its start time and decreases it when it releases the resource at its end time (pulse function). For resources that can be produced and consumed by activities (for instance the content of an inventory or a tank), the resource level can also be described as a function of time, production activities will increase the resource level whereas consuming activities will decrease it. In these type of problems, the cumulated contribution of activities on the resource can be represented by a function of time and constraints can be posted on this function, such as a maximal or a safety level.

CP Optimizer introduces the notion of cumul function expression which is a function that represents the sum of individual contributions of intervals. A selection of elementary cumul function expressions is available to describe the individual contribution of an interval variable (or a fixed interval of time); these cover the main use-cases mentioned above: pulse for usage of a cumulative resource, step for resource production/consumption (see Cumul function expressions). When the elementary cumul function expressions that define a cumul function expression are fixed (and, thus, so are their related intervals), the expression is fixed. CP Optimizer provides several constraints over cumul function expressions. These constraints allow restriction of the possible values of the function over the complete horizon or over some fixed or variable interval (see Constraints on cumul function expressions). For applications where the actual quantity of resource that is used, produced or consumed by intervals is an unknown of the problem, expressions are available for constraining these quantities (see Expressions on cumul function expressions).

The constraints involving interval variables and cumul function expressions cannot be used in logical constraints of CP Optimizer (see operator!, operator||). The reason is that any logical constraint involving interval variables must be represented via the presence Boolean value on the interval handled by the presenceOf constraint. The constraints having this limitation are , and alwaysIn.

Cumul function expressions

Let F_plus.png denote the set of all functions from double_struck_Z.png to double_struck_Z_plus.png. A cumul function expression f is an expression whose value is a function of F_plus.png and thus, whose domain dom(f) is a subset of F_plus.png. Let u, visin.pngdouble_struck_Z.png and cumul_h.png and a be an interval variable, we consider the following elementary cumul function expressions illustrated in Figure 5: pulse(u, v, h), step(u, h), pulse(a, h), pulse(a,hmin_hmax.png), stepAtStart(a, h), stepAtStart(a, hmin_hmax.png), stepAtEnd(a, h), stepAtEnd(a, hmin_hmax.png).

shapes.png

More formally, let u, visin.pngdouble_struck_Z.png and hisin.pngdouble_struck_Z_plus.png, we define the following particular functions of F_plus.png:

cumul_func1.png

The semantics of the elementary function expressions are listed in Table 4 together with the formal definitions of their domain. The function set zero_underscore_a.png is equal to the singleton singleton.png if perp.pngisin.png dom(a); in other words, if interval variable a is possibly absent and equal to the empty set otherwise.

cumul_func2.png
  • An elementary pulse function is represented by IloPulse
  • An elementary step function is represented by IloStep
  • An elementary step at start function is represented by IloStepAtStart
  • An elementary step at end function is represented by IloStepAtEnd
Constraints on cumul function expressions

The following constraints can be expressed on a cumul function expression f. Let u, visin.pngdouble_struck_Z.png and hmin_hmax.pngisin.pngdouble_struck_Z_plus.png and a be an interval variable:

  • alwaysIn(f, u, v,hmin_hmax.png) means that the values of function f must remain in the range [hmin_hmax.png] everywhere on the interval [u, v).
  • alwaysIn(f, a,hmin_hmax.png) means that if interval a is present, the values of function f must remain in the range [hmin_hmax.png] between the start and the end of interval variable a.
  • fhmax.png means that the function f cannot take values greater than hmax.png. It is semantically equivalent to alwaysIn(f,-∞, +∞, 0,hmax.png).
  • fhmin.png means that the function f cannot take values lower than hmin.png. It is semantically equivalent to alwaysIn(f,-∞, +∞,hmin.png, +∞).

More formally:

alwaysin.png

Expressions on cumul function expressions

The following elementary cumul function expressions are based on an interval variable a: pulse(a, h), pulse(a,hmin_hmax.png), stepAtStart(a, h), stepAtStart(a,hmin_hmax.png), stepAtEnd(a, h), stepAtEnd(a,hmin_hmax.png).

Some of these expressions define a range [hmin_hmax.png] of possible values for the actual height of the function when the interval variable a is present. The actual height is an unknown of the problem. CP Optimizer provides some integer expressions to control this height. These expressions are based on the notion of contribution of a given interval variable a to a (possibly composite) cumul function expression f. This contribution is defined as the sum of all the elementary cumul function expressions based on a in f. This contribution is a discrete function that can change value only at the start and at the end of interval a and is equal to 0 before the start of a.

For instance, let a and b be two interval variables and a cumul function expression f defined by: f = pulse(a, 3) + pulse(a, 2) - stepAtEnd(a, 1) + stepAtStart(b, 2) - stepAtEnd(b, 3). The contribution of a to f is the function pulse(a, 3) + pulse(a, 2) - stepAtEnd(a, 1) and the contribution of b to f is the function stepAtStart(b, 2) - stepAtEnd(b, 3).

If interval a is present, the expression heightAtStart(a, f) returns the value of the contribution of a to f evaluated at the start of a that is, it measures the contribution of interval a to cumul function expression f at its start point. Similarly, the expression heightAtEnd(a, f) returns the value of the contribution of a to f evaluated at the end of a that is, it measures the contribution of interval a to cumul function expression f at its end point. An additional integer value absVal can be specified at the construction of the expression in which case that will be the value returned by the expression when the interval is absent otherwise, if no value is specified, the expression will be equal to 0 when the interval is absent.

In the example above, assuming both interval a and b to be present we would get: heightAtStart(a, f) = 5, heightAtEnd(a, f) = -1, heightAtStart(b, f) = 2, heightAtEnd(b, f) = -1. Of course, in general when using ranges for the height of elementary cumul function expressions, the heightAtStart/End expressions will not be fixed until all the heights have been fixed by the search.

cumul_func3.png
  • An elementary pulse function is represented by IloPulse
  • An elementary step function is represented by IloStep
  • An elementary step at start function is represented by IloStepAtStart
  • An elementary step at end function is represented by IloStepAtEnd
  • A heightAtStart expression is represented by IloHeightAtStart
  • A heightAtEnd expression is represented by IloHeightAtEnd
PREVIOUS NEXT