sizeEval

Evaluates segmentedFunction using the size of an interval variable.

Syntax


floatExpr sizeEval(intervalVar interval, segmentedFunction function, float absentValue = 0)

Parameters

  • interval: interval variable.
  • function: function to evaluate.
  • absentValue: value to return if interval variable interval is absent.

Description

Evaluate function for the x value equal to the size of interval variable interval. If interval is absent then it does not have any defined size and absentValue is returned.

Example

A production task T has a variable size that is proportional to the quantity of product produced by the task. There is a cost function with a V-shape that penalizes too small amount of production and too large amount of production by the task.


T = intervalVar(size=10..120);
function = segmentedFunction((-10, 0), (20, 0, 1));
cost = sizeEval(T, function);