Table of Contents

Class IntStepFunction

Namespace
OptalCP
Assembly
OptalCP.dll

Piecewise-constant function mapping time to integers, used for costs and availability windows.

public class IntStepFunction : ModelElement
Inheritance
IntStepFunction
Inherited Members

Remarks

Integer step function.

Integer step function is a piecewise constant function defined on integer values in range Model.IntVarMin to Model.IntVarMax. The function can be created by Model.StepFunction.

Step functions can be used in the following ways:

Methods

Eval(IntExpr)

Evaluates the step function at a given point.

public IntExpr Eval(IntExpr arg)

Parameters

arg IntExpr

The point at which to evaluate the step function.

Returns

IntExpr

The resulting integer expression

Remarks

The result is the value of the step function at the point arg. If the value of arg is absent, then the result is also absent.

By constraining the returned value, it is possible to limit arg to be only within certain segments of the segmented function. In particular, functions Model.ForbidStart and Model.ForbidEnd work that way.

See also:

Eval(int)

Evaluates the step function at a given point.

public IntExpr Eval(int arg)

Parameters

arg int

The point at which to evaluate the step function.

Returns

IntExpr

The resulting integer expression

Remarks

The result is the value of the step function at the point arg. If the value of arg is absent, then the result is also absent.

By constraining the returned value, it is possible to limit arg to be only within certain segments of the segmented function. In particular, functions Model.ForbidStart and Model.ForbidEnd work that way.

See also:

Integral(IntervalVar)

Computes sum of values of the step function over the interval interval.

public IntExpr Integral(IntervalVar interval)

Parameters

interval IntervalVar

The interval variable.

Returns

IntExpr

The resulting integer expression

Remarks

The sum is computed over all integer time points from interval.start() to interval.end()-1 inclusive. In other words, the sum includes the function value at the start time but excludes the value at the end time (half-open interval). If the interval variable has zero length, then the result is 0. If the interval variable is absent, then the result is absent.

Requirement: The step function func must be non-negative.

See also: