5.5. all_equal

DESCRIPTIONLINKSGRAPH
Origin

Derived from 𝚜𝚘𝚏𝚝_πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš–πš’πš—_πšŒπšπš›

Constraint

πšŠπš•πš•_πšŽπššπšžπšŠπš•(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚)

Synonym

πš›πšŽπš•.

Argument
πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(πšŸπšŠπš›-πšπšŸπšŠπš›)
Restrictions
πš›πšŽπššπšžπš’πš›πšŽπš(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚,πšŸπšŠπš›)
|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|>0
Purpose

Enforce all variables of the collection πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ to take the same value.

Example
(5,5,5,5)

The πšŠπš•πš•_πšŽπššπšžπšŠπš• constraint holds since all its variables are fixed to value 5.

All solutions

FigureΒ 5.5.1 gives all solutions to the following non ground instance of the πšŠπš•πš•_πšŽπššπšžπšŠπš• constraint: V 1 ∈[0,6], V 2 ∈[0,2], V 3 ∈[0,2], V 4 ∈[1,4], πšŠπš•πš•_πšŽπššπšžπšŠπš•(〈V 1 ,V 2 ,V 3 ,V 4 βŒͺ).

Figure 5.5.1. All solutions corresponding to the non ground example of the πšŠπš•πš•_πšŽπššπšžπšŠπš• constraint of the All solutions slot
ctrs/all_equal-1-tikz
Typical
|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|>2
πš–πš’πš—πšŸπšŠπš•(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)β‰ 0
Symmetries
  • Items of πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ are permutable.

  • All occurrences of a value of πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš› can be renamed to any unused value.

Arg. properties

Contractible wrt. πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.

Counting
Length (n)2345678
Solutions3456789

Number of solutions for πšŠπš•πš•_πšŽπššπšžπšŠπš•: domains 0..n

ctrs/all_equal-2-tikz

ctrs/all_equal-3-tikz

Systems

atMostNValue in Choco, rel in Gecode, all_equal in MiniZinc.

See also

generalisation: πš—πšŸπšŠπš•πšžπšŽΒ (a variable counting the number of distinct values is introduced).

implies: πšŒπš˜πš—πšœπšŽπšŒπšžπšπš’πšŸπšŽ_πšŸπšŠπš•πšžπšŽπšœ, πšπšŽπšŒπš›πšŽπšŠπšœπš’πš—πš, πš’πš—πšŒπš›πšŽπšŠπšœπš’πš—πš, πš–πšžπš•πšπš’_πšπš•πš˜πš‹πšŠπš•_πšŒπš˜πš—πšπš’πšπšžπš’πšπš’.

negation: πš—πš˜πš_πšŠπš•πš•_πšŽπššπšžπšŠπš•.

soft variant: 𝚜𝚘𝚏𝚝_πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš–πšŠπš‘_πšŸπšŠπš›,

𝚜𝚘𝚏𝚝_πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš–πš’πš—_πšŒπšπš›Β (decomposition-based violation measure), 𝚜𝚘𝚏𝚝_πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš–πš’πš—_πšŸπšŠπš›Β (variable-based violation measure).

specialisation: 𝚎𝚚 (equality between just two variables).

Keywords

constraint type: value constraint.

Cond. implications

πšŠπš•πš•_πšŽπššπšžπšŠπš•(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚)

Β Β Β  withΒ  |πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|>1

Β Β implies πšœπš˜πš–πšŽ_πšŽπššπšžπšŠπš•(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚).

Arc input(s)

πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚

Arc generator
π‘ƒπ΄π‘‡π»β†¦πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(πšŸπšŠπš›πš’πšŠπš‹πš•πšŽπšœ1,πšŸπšŠπš›πš’πšŠπš‹πš•πšŽπšœ2)

Arc arity
Arc constraint(s)
πšŸπšŠπš›πš’πšŠπš‹πš•πšŽπšœ1.πšŸπšŠπš›=πšŸπšŠπš›πš’πšŠπš‹πš•πšŽπšœ2.πšŸπšŠπš›
Graph property(ies)
𝐍𝐀𝐑𝐂=|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|-1

Graph model

We use the arc generator 𝑃𝐴𝑇𝐻 in order to link consecutive variables of the collection πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ by a binary equality constraint.

PartsΒ (A) andΒ (B) of FigureΒ 5.5.2 respectively show the initial and final graph of the Example slot. Since we use the 𝐍𝐀𝐑𝐂 graph property, the arcs of the final graph are stressed in bold.

Figure 5.5.2. Initial and final graph of the πšŠπš•πš•_πšŽπššπšžπšŠπš• constraint
ctrs/all_equalActrs/all_equalB
(a) (b)