step

OPL expression (scheduling) of a cumulative function

Purpose

OPL expression (scheduling) of a cumulative function.

context type
Model files (.mod)
cumulFunction

Syntax

cumulFunction f = step(u, h);


Where:

int u;
int h;
cumulFunction f;

Description

Step is an elementary cumulative function expression representing the contribution starting at a point in time. Step covers the production or consumption of a cumulative resource.

The time u is the start of production or consumption and the height of the function is represented by h.

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);
};