High-level Constraints

These following constraints are more complex ones. They could be written using the previous primitives and demon (see Demon).

Constraint functions which return CSint variable can return NULL to indicate fail.

IZBOOL cs_IfEq(CSint *vint1, CSint *vint2, int val1, int val2)

If vint1 is instantiated to the value val1 , then vint2 will be instantiated to val2 .

If vint2 is instantiated to the value val2 , then vint1 will be instantiated to val1 .

IZBOOL cs_IfNeq(CSint *vint1, CSint *vint2, int val1, int val2)

The couple of CSint variables ( vint1 , vint2 ) cannot have the values ( val1 , val2 ).

CSint *cs_Occur(CSint *vint, int val, CSint **array, int size)

The value val must appear vint times in the array .

This function is deprecated and will be deleted in future version. Please use cs_OccurConstraints().

CSint *cs_OccurDomain(int val, CSint **array, int size)

Returns CSint variable which counts the value val in the array.

IZBOOL cs_OccurConstraints(CSint *vint, int val, CSint **array, int size)

The value val must appear vint times in the array.

CSint *cs_Index(CSint **array, int size, int val)

Returns CSint variable index which is constrainted array [ index ] = val.

i \(\in\) domain( index ) \(\Leftrightarrow\) val \(\in\) domain( array [ i ])

CSint *cs_Element(CSint *index, int *values, int size)

Returns CSint variable element which is constrainted element = values [ index ].

CSint *cs_VarElement(CSint *index, CSint **array, int size)

Returns CSint variable element which is constrainted element = array [ index ].

CSint *cs_VarElementRange(CSint *index, CSint **array, int size)

Constraints CSint variables like cs_VarElement(). But constraint propagation for variables in array will occur only when upper or lower bound is changed.

CSint *cs_Min(CSint **array, int size)

Returns a CSint variable equal to the minimum of the CSint variables referenced by array .

CSint *cs_VMin(int nbVars, CSint *vint, ...)

cs_VMin() accepts a variable number of arguments (number specified by the first argument nbVars ).

CSint *cs_Max(CSint **array, int size)

Returns a CSint variable equal to the maximum of the CSint variables referenced by array .

CSint *cs_VMax(int nbVars, CSint *vint, ...)

cs_VMax() accepts a variable number of arguments (number specified by the first argument nbVars ).

IZBOOL cs_Cumulative(CSint** startVars, CSint** durationVars, CSint** resourceVars, int size, CSint* limitVar)

This constraint is mainly used in scheduling problems. Task i in size tasks starts at startVars [i], duration is durationVars [i] and uses resource resourceVars [i].

Amount of resource used by Tasks running simultaneously is constrainted not to exceed limitVar.

IZBOOL cs_Disjunctive(CSint** startVars, CSint** durationVars, int size)

This constraint is mainly used in scheduling problems. Task i in size tasks starts at startVars [i] and duration is durationVars [i].

All tasks are constrainted not to run simultaneously.