5.392. sum_set

DESCRIPTIONLINKSGRAPH
Origin

H.Β Cambazard

Constraint

πšœπšžπš–_𝚜𝚎𝚝(πš‚πš…,πš…π™°π™»πš„π™΄πš‚,π™²πšƒπš,πš…π™°πš)

Arguments
πš‚πš…πšœπšŸπšŠπš›
πš…π™°π™»πš„π™΄πš‚πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(πšŸπšŠπš•-πš’πš—πš,𝚌𝚘𝚎𝚏-πš’πš—πš)
π™²πšƒπšπšŠπšπš˜πš–
πš…π™°πšπšπšŸπšŠπš›
Restrictions
πš›πšŽπššπšžπš’πš›πšŽπš(πš…π™°π™»πš„π™΄πš‚,[πšŸπšŠπš•,𝚌𝚘𝚎𝚏])
πšπš’πšœπšπš’πš—πšŒπš(πš…π™°π™»πš„π™΄πš‚,πšŸπšŠπš•)
πš…π™°π™»πš„π™΄πš‚.𝚌𝚘𝚎𝚏β‰₯0
π™²πšƒπšβˆˆ[=,β‰ ,<,β‰₯,>,≀]
Purpose

Let πš‚πš„π™Ό denote the sum of the 𝚌𝚘𝚎𝚏 attributes of the πš…π™°π™»πš„π™΄πš‚ collection for which the corresponding values πšŸπšŠπš• occur in the set πš‚πš…. Enforce the following constraint to hold: πš‚πš„π™Ό π™²πšƒπš πš…π™°πš.

Example
{2,3,6},πšŸπšŠπš•-2𝚌𝚘𝚎𝚏-7,πšŸπšŠπš•-9𝚌𝚘𝚎𝚏-1,πšŸπšŠπš•-5𝚌𝚘𝚎𝚏-7,πšŸπšŠπš•-6𝚌𝚘𝚎𝚏-2,=,9

The πšœπšžπš–_𝚜𝚎𝚝 constraint holds since the sum of the 𝚌𝚘𝚎𝚏 attributes 7+2 for which the corresponding πšŸπšŠπš• attribute belongs to the first argument πš‚πš…={2,3,6} is equal (i.e.,Β since π™²πšƒπš is set to =) to its last argument πš…π™°πš=9.

Typical
|πš…π™°π™»πš„π™΄πš‚|>1
πš…π™°π™»πš„π™΄πš‚.𝚌𝚘𝚎𝚏>0
π™²πšƒπšβˆˆ[=,<,β‰₯,>,≀]
Symmetry

Items of πš…π™°π™»πš„π™΄πš‚ are permutable.

Systems

weights in Gecode.

See also

common keyword: πšœπšžπš–, πšœπšžπš–_πšŒπšπš›Β (sum).

Keywords

characteristic of a constraint: sum.

constraint arguments: binary constraint, constraint involving set variables.

constraint type: arithmetic constraint.

Arc input(s)

πš…π™°π™»πš„π™΄πš‚

Arc generator
π‘†πΈπΏπΉβ†¦πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(πšŸπšŠπš•πšžπšŽπšœ)

Arc arity
Arc constraint(s)
πš’πš—_𝚜𝚎𝚝(πšŸπšŠπš•πšžπšŽπšœ.πšŸπšŠπš•,πš‚πš…)
Graph property(ies)
π’π”πŒ(πš…π™°π™»πš„π™΄πš‚,𝚌𝚘𝚎𝚏) π™²πšƒπš πš…π™°πš

Graph model

PartsΒ (A) andΒ (B) of FigureΒ 5.392.1 respectively show the initial and final graph associated with the Example slot.

Figure 5.392.1. Initial and final graph of the πšœπšžπš–_𝚜𝚎𝚝 constraint
ctrs/sum_setActrs/sum_setB
(a) (b)