5.192. indexed_sum
DESCRIPTION | LINKS | GRAPH |
- Origin
N.Β Beldiceanu
- Constraint
- Arguments
- Restrictions
- Purpose
Given several items of the collection (each of them having a specific fixed as well as a that may be negative or positive), and a table (each entry of corresponding to a variable), assign each item to an entry of so that the sum of the weights of the items assigned to that entry is equal to the corresponding variable.
- Example
-
The constraint holds since the summation variables associated with each entry of are equal to the sum of the weights of the items assigned to the corresponding entry:
(since ),
(since does not occur as a value of the attribute of an item of ),
(since ).
- Typical
- Symmetries
Items of are permutable.
Items of are permutable.
- Reformulation
The constraint can be expressed in term of a set of reified constraints and of arithmetic constraints (i.e.,Β constraints).
For each item and for each table entry of we create a 0-1 variable that will be set to 1 if and only if is fixed to (i.e.,Β ).
For each entry of the table , we impose the sum to be equal to .
- See also
-
specialisation: Β (negative contribution not allowed, effective use variable for each bin replaced by an overall fixed capacity), Β (negative contribution not allowed, effective use variable for each bin replaced by a fixed capacity for each bin).
- Keywords
For all items of :
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
- Sets
-
- Constraint(s) on sets
- Graph model
We enforce the constraint on the weight of the items that are assigned to the same entry. Within the context of the Example slot, partΒ (A) of FigureΒ 5.192.1 shows the initial graphs associated with entries 1, 2 and 3 (i.e.,Β one initial graph for each item of the collection). PartΒ (B) of FigureΒ 5.192.1 shows the corresponding final graphs associated with entries 1 and 3. Each source vertex of the final graph can be interpreted as an item assigned to a specific entry of .
Figure 5.192.1. Initial and final graph of the constraint
(a) (b)