[ library(gfd) | Reference Manual | Alphabetic Index ]

<ConsistencyModule:> scalar_product(++Coeffs,+Collection,+Rel,?Sum,?Bool)

Reflect into Bool the truth of the scalar product of the elements of Coeffs and Collection satisfying the relation sum(Coeffs*Collection) Rel Sum.
Collection of N integers.
Collection of N integers or (domain) variables.
One of the atom: #>, #>=, #<, #=<, #=, #\=
(Domain) variable or integer (array notation accepted)
(Domain) variable or the integer 0 or 1 (array notation accepted)


This is the reified form of scalar_product/4, which constrains the scalar product of the elements in Coeffs and Collection to satisfy the relation sum(Coeffs*Collection) Rel P.

Rel can be one of #>, #>=, #<, #=<, #=, #\= (or equivalently, >, >=, <, =<, =, \=).

Any input variables which are not already domain variable will be turn into domain variables with default bounds.

ConsistencyModule is the optional module specification to give the consistency level for the propagation for this constraint: gfd_bc for bounds consistency

This constraint is implemented using Gecode's linear() constraint (reified version).