stepAtEnd

OPL expression (scheduling) of a cumulative function

Purpose

OPL expression (scheduling) of a cumulative function

context type
Model files (.mod)
cumulFunction

Syntax

cumulFunction f = stepAtEnd(a, h);
cumulFunction f = stepAtEnd(a, hmin, hmax);


Where:

int h;
int hmin;
int hmax;
cumulFunction f;
dvar interval a;

Description

stepAtEnd is an elementary cumulative function expression representing the contribution starting at the end of an interval. StepAtEnd covers the production or consumption of a cumulative resource.

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