Comparison functions

Comparison functions compare two arguments and produce a condition, used to define a constraint of the model, based on the result of the comparison.

The following functions are available:

See also

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


eq

Returns 1 if its two operands are equal, and 0 otherwise.

Parameters

Parameter

Description

Requirement

Argument 1

numeric (dimension 0 or 1)

Mandatory

Argument 2

numeric, with the same dimension as Argument 1

Mandatory


geq

Returns 1 if the first operand is greater than or equal to the second one, and 0 otherwise.

Parameters

Parameter

Description

Requirement

Argument 1

numeric (dimension 0 or 1)

Mandatory

Argument 2

numeric, with the same dimension as Argument 1

Mandatory


leq

Returns 1 if the first operand is lower than or equal to the second one, and 0 otherwise.

Parameters

Parameter

Description

Requirement

Argument 1

numeric (dimension 0 or 1)

Mandatory

Argument 2

numeric, with the same dimension as Argument 1

Mandatory


neq

Returns 1 if its two operands are different, and 0 otherwise.

Parameters

Parameter

Description

Requirement

Argument 1

numeric (dimension 0 or 1)

Mandatory

Argument 2

numeric, with the same dimension as Argument 1

Mandatory


mod

Returns the remainder r of the Euclidean division of the first operand a by the second operand b, i.e. the value r such that a = q * b + r, with q and r integers and r < b.

Parameters

Parameter

Description

Requirement

Argument 1

numeric (dimension 0 or 1)

Mandatory

Argument 2

numeric, with the same dimension as Argument 1

Mandatory


gt

Returns 1 if the first operand is strictly greater than the second one, and 0 otherwise. When applied to intervals, it returns 1 if the start of the first interval is greater than or equal to the end of the second one.

Parameters

Parameter

Description

Requirement

Argument 1

numeric/interval (dimension 0 or 1)

Mandatory

Argument 2

same type and dimension as Argument 1

Mandatory


lt

Returns 1 if the first operand is strictly lower than the second one, and 0 otherwise. When applied to intervals, it returns 1 if the end of the first interval is lower than or equal to the start of the second one.

Parameters

Parameter

Description

Requirement

Argument 1

numeric/interval (dimension 0 or 1)

Mandatory

Argument 2

same type and dimension as Argument 1

Mandatory