endEval
Evaluates segmentedFunction at the end of an interval variable.
Syntax
floatExpr endEval(intervalVar interval, segmentedFunction function, float absentValue = 0)
Parameters
-
interval: interval variable. -
function: function to evaluate. -
absentValue: value to return if interval variableintervalis absent.
Description
Evaluate function at the end of interval variable interval. However if interval
is absent then it does not have any defined end and absentValue is returned.
Example
A cost associated with task t depends on its completion time. It is preferred
to finish t within interval [10,14], the cost is zero within this interval.
If it is finished sooner or later then the minimal cost is 5 and increases
linearly, here is graph of the cost function:

For example, if the task ends at time 5 then the cost is 10.
Finally, there is also a possibility not to execute task t at all; in this case the
associated cost is 100.
The cost can be computed using endEval as:
function = segmentedFunction((-1, 5), (10, 0, 0), (15, 5, 3));
t = intervalVar(length=4);
cost = endEval(t, function, 100);