5.244. max_nvalue

DESCRIPTIONLINKSGRAPHAUTOMATON
Origin

Derived from πš—πšŸπšŠπš•πšžπšŽ.

Constraint

πš–πšŠπš‘_πš—πšŸπšŠπš•πšžπšŽ(π™Όπ™°πš‡,πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚)

Arguments
π™Όπ™°πš‡πšπšŸπšŠπš›
πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(πšŸπšŠπš›-πšπšŸπšŠπš›)
Restrictions
π™Όπ™°πš‡β‰₯1
π™Όπ™°πš‡β‰€|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|
πš›πšŽπššπšžπš’πš›πšŽπš(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚,πšŸπšŠπš›)
Purpose

π™Όπ™°πš‡ is the maximum number of times that the same value is taken by the variables of the collection πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.

Example
(3,9,1,7,1,1,6,7,7,4,9)
(1,9,1,7,3,2,6)
(6,5,5,5,5,5,5)

In the first example, values 1,4,6,7,9 are respectively used 3,1,1,3,2 times. So the maximum number of time π™Όπ™°πš‡ that a same value occurs is 3. Consequently the corresponding πš–πšŠπš‘_πš—πšŸπšŠπš•πšžπšŽ constraint holds.

Typical
π™Όπ™°πš‡>1
π™Όπ™°πš‡<|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|
|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|>1
πš›πšŠπš—πšπšŽ(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)>1
Symmetries
  • Items of πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ are permutable.

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

Arg. properties

Functional dependency: π™Όπ™°πš‡ determined by πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.

Usage

This constraint may be used in order to replace a set of πšŒπš˜πšžπš—πš or πšŠπš–πš˜πš—πš constraints were one would have to generate explicitly one constraint for each potential value. Also useful for constraining the number of occurrences of the mostly used value without knowing this value in advance and without giving explicitly an upper limit on the number of occurrences of each value as it is done in the πšπš•πš˜πš‹πšŠπš•_πšŒπšŠπš›πšπš’πš—πšŠπš•πš’πšπš’ constraint.

Reformulation

Assume that πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ is not empty. Let Ξ± and Ξ² respectively denote the smallest and largest possible values that can be assigned to the variables of the πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ collection. Let the variables O Ξ± ,O Ξ±+1 ,β‹―,O Ξ² respectively correspond to the number of occurrences of values Ξ±,Ξ±+1,β‹―,Ξ² within the variables of the πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ collection. The πš–πšŠπš‘_πš—πšŸπšŠπš•πšžπšŽ constraint can be expressed as the conjunction of the following two constraints:

Β Β Β πšπš•πš˜πš‹πšŠπš•_πšŒπšŠπš›πšπš’πš—πšŠπš•πš’πšπš’ (πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚,

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β βŒ©πšŸπšŠπš•-Ξ± πš—πš˜πšŒπšŒπšžπš›πš›πšŽπš—πšŒπšŽ-O Ξ± ,

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β πšŸπšŠπš•-Ξ±+1 πš—πš˜πšŒπšŒπšžπš›πš›πšŽπš—πšŒπšŽ-O Ξ±+1 ,

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β β‹―

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β πšŸπšŠπš•-Ξ² πš—πš˜πšŒπšŒπšžπš›πš›πšŽπš—πšŒπšŽ-O Ξ² βŒͺ),

Β Β Β πš–πšŠπš‘πš’πš–πšžπš–(π™Όπ™°πš‡,〈O Ξ± ,O Ξ±+1 ,β‹―,O Ξ² βŒͺ).

Counting
Length (n)2345678
Solutions9646257776117649209715243046721

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

ctrs/max_nvalue-1-tikz

ctrs/max_nvalue-2-tikz

Length (n)2345678
Total9646257776117649209715243046721
Parameter
value

1624120720504040320362880
2336420540078750130536024449040
3-48015002982064680015382080
4--51503780960402577960
5---62528232258048
6----739216128
7-----8576
8------9

Solution count for πš–πšŠπš‘_πš—πšŸπšŠπš•πšžπšŽ: domains 0..n

ctrs/max_nvalue-3-tikz

ctrs/max_nvalue-4-tikz

See also

common keyword: πšŠπš–πš˜πš—πšΒ (counting constraint), πšŒπš˜πšžπš—πš, πšπš•πš˜πš‹πšŠπš•_πšŒπšŠπš›πšπš’πš—πšŠπš•πš’πšπš’Β (value constraint,counting constraint), πš–πš’πš—_πš—πšŸπšŠπš•πšžπšŽ, πš—πšŸπšŠπš•πšžπšŽΒ (counting constraint).

Keywords

application area: assignment.

characteristic of a constraint: maximum, automaton, automaton with array of counters.

constraint arguments: pure functional dependency.

constraint type: value constraint, counting constraint.

final graph structure: equivalence.

modelling: maximum number of occurrences, functional dependency.

Arc input(s)

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

Arc generator
πΆπΏπΌπ‘„π‘ˆπΈβ†¦πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(πšŸπšŠπš›πš’πšŠπš‹πš•πšŽπšœ1,πšŸπšŠπš›πš’πšŠπš‹πš•πšŽπšœ2)

Arc arity
Arc constraint(s)
πšŸπšŠπš›πš’πšŠπš‹πš•πšŽπšœ1.πšŸπšŠπš›=πšŸπšŠπš›πš’πšŠπš‹πš•πšŽπšœ2.πšŸπšŠπš›
Graph property(ies)
πŒπ€π—_𝐍𝐒𝐂𝐂=π™Όπ™°πš‡

Graph model

Because of the arc constraint, each strongly connected component of the final graph corresponds to a distinct value that is assigned to a subset of variables of the πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ collection. Therefore the number of vertices of the largest strongly connected component is equal to the mostly used value.

PartsΒ (A) andΒ (B) of FigureΒ 5.244.1 respectively show the initial and final graph associated with the first example of the Example slot. Since we use the πŒπ€π—_𝐍𝐒𝐂𝐂 graph property, we show the largest strongly connected component of the final graph.

Figure 5.244.1. Initial and final graph of the πš–πšŠπš‘_πš—πšŸπšŠπš•πšžπšŽ constraint
ctrs/max_nvalueA
(a)
ctrs/max_nvalueB
(b)
Automaton

FigureΒ 5.244.2 depicts the automaton associated with the πš–πšŠπš‘_πš—πšŸπšŠπš•πšžπšŽ constraint. To each item of the collection πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ corresponds a signature variable S i that is equal to 0.

Figure 5.244.2. Automaton of the πš–πšŠπš‘_πš—πšŸπšŠπš•πšžπšŽ constraint
ctrs/max_nvalue-5-tikz