Intervals functions

Intervals functions define interval-typed variables (typically used to model tasks or activities with a duration) and the constraints that can be defined among them.

The following functions are available:

See also

See Constraint Programming functions for a general explanation on how to read the signature tables below.


interval

Declares an interval variable, representing the integer time range of a task or event. If Argument 1 is 0, the interval is optional, default to 1. Argument 2 and Argument 3 are the start and the end of the interval and they could be either integer variables or integer constants. Argument 4 is the duration of the interval and it could be either an integer variable or an integer constant.

Parameters

Parameter

Description

Requirement

Argument 1

boolean

Optional

Argument 2

integer

Optional

Argument 3

integer

Optional

Argument 4

integer

Optional


noOverlap

Returns 1 if a given set of intervals do not overlap, and 0 otherwise

Parameters

Signature (dimension of Argument 1: 0)

Parameter

Description

Requirement

Argument 1

interval

Mandatory

Argument >= 2

Additional intervals. They all together form the array of intervals to be checked for overlaps.

Optional

Signature (dimension of Argument 1: 1)

Parameter

Description

Requirement

Argument 1

interval

Mandatory


cumulative

Returns 1 if the resource constraint, where the sum of the demands of the overlapping intervals must not exceed the capacity of the resource, is satisfied, and 0 otherwise. The first argument is an array of intervals, the second argument is the weight in capacity for each interval, and the third argument is the capacity of the resource.

Parameters

Parameter

Description

Requirement

Argument 1

interval (dimension 1)

Mandatory

Argument 2

array of integers of dimension 1

Mandatory

Argument 3

integer (dimension 0)

Mandatory


reservoir

Returns 1 if the reservoir constraint is satisfied, and 0 otherwise. The reservoir constraint guaranties a certain quantity not overcome a supposed maximum and does not become lower of a supposed minimum. It is configured with 4 arguments. The Argument 1 is an array of moments in which a change in the studied quantity occurs, the Argument 2 is an array of the changes in the quantity at each moment, the Argument 3 is the minimum value of the quantity and the Argument 4 is the maximum value of the quantity. The last argument is an array of boolean values that indicates if the change should be considered or not. If the last argument is not provided, all changes are considered.

Parameters

Parameter

Description

Requirement

Argument 1

numeric (dimension 1)

Mandatory

Argument 2

numeric array (dimension 1)

Mandatory

Argument 3

numeric (dimension 0)

Optional

Argument 4

numeric (dimension 0)

Optional

Argument 5

boolean

Optional