Arithmetic Constraints

These constraints enable the user to create a new CSint variable defined by arithmetic relations between already existing CSint variables. These constraints never fails when the user posts it.

CSint *cs_Add(CSint *vint1, CSint *vint2)

Returns a CSint variable defined as the sum of vint1 and vint2 .

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

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

It returns a CSint variable defined as the sum of the CSint variables given in arguments.

cs_VAdd(n, V1, V2, ..., Vn) = V1 + V2 + … + Vn

CSint *cs_Sub(CSint *vint1, CSint *vint2)

Returns a CSint variable defined as the difference between vint1 and vint2 .

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

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

It returns a CSint variable defined as the difference between the first argument and the sum of all the others.

cs_VSub(n, V1, V2, V3, ..., Vn) = V1 - V2 - V3 - … - Vn

CSint *cs_Mul(CSint *vint1, CSint *vint2)

Returns a CSint variable defined as the product of vint1 and vint2 .

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

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

It returns a CSint variable defined as the product of the CSint variables given in arguments.

cs_VMul(n, V1, V2, ..., Vn) = V1 * V2 * … * Vn

CSint *cs_Div(CSint *vint1, CSint *vint2)

Returns a CSint variable defined as the quotient of vint1 and vint2 .

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

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

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

Returns a CSint variable constrained to be equal to the sum of the size CSint variables referenced by array.

CSint *cs_ScalProd(CSint **array, int *vector, int size)

Returns a CSint variable constrained to be equal to the scalar product of the vector of CSint variables array and the vector of integer vector (both of size elements).

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

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

cs_VScalProd(n, V1, V2, …, Vn, c1, c2, …, cn) returns the scalar product of the vector of CSint variables (V1, V2, …, Vn) and the vector of integer (c1, c1, …, cn).

CSint *cs_Abs(CSint *vint)

Returns a CSint variable constrained to be equal to the absolute value of the CSint variable vint .