heightAtStart
OPL expression (scheduling) used with a cumulative function
Purpose
OPL expression (scheduling) used with a cumulative function
context | type |
---|---|
Model files (.mod) |
dexpr int |
Syntax
dexpr int h = heightAtStart(a,f[,dval]); Where: int dval; cumulFunction f; dvar interval a;
Description
The expression heightAtStart(a, f) returns the contribution of interval a to cumulFunction expression f at the interval's starting point. An integer value dval can be specified which will be the value returned if the interval is absent. Otherwise, if no value is specified, the expression will be equal to 0 when the interval is absent.
Consider interval variables a and b and cumulative function expression f defined by: f = step(0,100) + pulse(a, 3) + pulse(a, 2) — stepAtEnd(a, 1) + stepAtStart(b, 2) — stepAtEnd(b, 3). Assuming both intervals are present and of positive length, the expression heightAtStart(a, f) = 5, and heightAtStart(b, f) = 2.
Example
using CP; dvar interval i in 0..5 size 5; dvar interval ib in 0..5 size 5; cumulFunction c = pulse(i, 10, 10); dexpr int h= heightAtStart(i,c); dexpr int hb= heightAtStart(ib,c); subject to { } assert h==10; assert hb==0;