5.6. all_equal_peak

DESCRIPTIONLINKSAUTOMATON
Origin

Derived from πš™πšŽπšŠπš” and πšŠπš•πš•_πšŽπššπšžπšŠπš•.

Constraint

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

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

A variable V k (1<k<m) of the sequence of variables πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚=V 1 ,β‹―,V m is a peak if and only if there exists an i (1<i≀k) such that V i-1 <V i and V i =V i+1 =β‹―=V k and V k >V k+1 .

Enforce all the peaks of the sequence πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ to be assigned the same value, i.e.Β to be located at the same altitude.

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

The πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš” constraint holds since the two peaks, in bold, of the sequence 1 5 5 4 3 5 2 7 are located at the same altitude 5. FigureΒ 5.6.1 depicts the solution associated with the example.

Figure 5.6.1. Illustration of the Example slot: a sequence of eight variables V 1 , V 2 , V 3 , V 4 , V 5 , V 6 , V 7 , V 8 respectively fixed to values 1, 5, 5, 4, 3, 5, 2, 7 and its corresponding two peaks, in red, both located at altitude 5
ctrs/all_equal_peak-1-tikz

Note that the πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš” constraint does not enforce that the maximum value of the sequence πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ corresponds to the altitude of its peaks since, as shown by the example, the sequence can ends up with an increasing subsequence that go beyond the altitude of its peaks. It also does not enforce that the sequence πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ contains at least one peak.

All solutions

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

Figure 5.6.2. All solutions corresponding to the non ground example of the πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš” constraint of the All solutions slot where each peak is coloured in orange
ctrs/all_equal_peak-2-tikz
Typical
|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|β‰₯5
πš›πšŠπš—πšπšŽ(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)>1
πš™πšŽπšŠπš”(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)β‰₯2
Symmetries
  • Items of πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ can be reversed.

  • One and the same constant can be added to the πšŸπšŠπš› attribute of all items of πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.

Arg. properties
  • Prefix-contractible wrt. πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.

  • Suffix-contractible wrt. πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.

Counting
Length (n)23456789
Solutions964625733093947126779017908059266201992

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

ctrs/all_equal_peak-3-tikz

ctrs/all_equal_peak-4-tikz

See also

implied by: πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš”_πš–πšŠπš‘.

implies: πšπšŽπšŒπš›πšŽπšŠπšœπš’πš—πš_πš™πšŽπšŠπš”, πš’πš—πšŒπš›πšŽπšŠπšœπš’πš—πš_πš™πšŽπšŠπš”.

related: πšŠπš•πš•_πšŽπššπšžπšŠπš•_πšŸπšŠπš•πš•πšŽπš’, πš™πšŽπšŠπš”.

Keywords

characteristic of a constraint: automaton, automaton with counters, automaton with same input symbol.

combinatorial object: sequence.

constraint network structure: sliding cyclic(1) constraint network(2).

Cond. implications

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

Β Β Β  withΒ  πš™πšŽπšŠπš”(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)>1

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

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

Β Β Β  withΒ  πš™πšŽπšŠπš”(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)>0

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

Automaton

FigureΒ 5.6.3 depicts the automaton associated with the πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš” constraint. To each pair of consecutive variables (πš…π™°πš i ,πš…π™°πš i+1 ) of the collection πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ corresponds a signature variable S i . The following signature constraint links πš…π™°πš i , πš…π™°πš i+1 and S i : (πš…π™°πš i <πš…π™°πš i+1 ⇔S i =0) ∧ (πš…π™°πš i =πš…π™°πš i+1 ⇔S i =1) ∧ (πš…π™°πš i >πš…π™°πš i+1 ⇔S i =2).

Figure 5.6.3. Automaton for the πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš” constraint (note the conditional transition from state k to state j testing that the counter 𝐴𝑙𝑑𝑖𝑑𝑒𝑑𝑒 is equal to πš…π™°πš i for enforcing that all peaks are located at the same altitude)
ctrs/all_equal_peak-5-tikz
Figure 5.6.4. Hypergraph of the reformulation corresponding to the automaton of the πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš” constraint where A i stands for the value of the counter 𝐴𝑙𝑑𝑖𝑑𝑒𝑑𝑒 (since all states of the automaton are accepting there is no restriction on the last variable Q n-1 )
ctrs/all_equal_peak-6-tikz