stepAtStart
OPL expression (scheduling) of a cumulative function
Purpose
OPL expression (scheduling) of a cumulative function
| context | type |
|---|---|
| Model files (.mod) |
cumulFunction |
Syntax
cumulFunction f = stepAtStart(a, h); cumulFunction f = stepAtStart(a, hmin, hmax); Where: int h; int hmin; int hmax; cumulFunction f; dvar interval a;
Description
stepAtStart is an elementary cumulative function expression representing the contribution beginning at the start of an interval. StepAtStart covers the production or consumption of a cumulative resource.
The start of interval a is the start of production or consumption. The height of the function is represented by h, or bounded by hmin and hmax.
Note that a cumulfunction is constrained to be non-negative if it is involved in a <= or alwaysIn constraint. Also, <= and alwaysIn constraints on cumulfunction expressions cannot be used in meta-constraints.
Example
A set of producing and consuming activities on a tank with a given capacity and safety level.
int SafetyLevel = ...;
int Capacity = ...;
int StartLevel = ...;
int QProd[p in 1..NProd] ...;
int QCons[c in 1..NCons] ...;
dvar interval AProd[p in 1..NProd] ...;
dvar interval ACons[c in 1..NCons] ...;
cumulFunction level =
step(0, StartLevel)
+ sum (p in 1..NProd) stepAtEnd(AProd[p], QProd[p])
- sum (c in 1..NCons) stepAtStart(ACons[c], QCons[c]);
subject to {
alwaysIn(level, 0, maxint, SafetyLevel, Capacity);
};