5.318. peak

DESCRIPTIONLINKSAUTOMATON
Origin

Derived from πš’πš—πšπš•πšŽπš‘πš’πš˜πš—.

Constraint

πš™πšŽπšŠπš”(𝙽,πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚)

Arguments
π™½πšπšŸπšŠπš›
πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(πšŸπšŠπš›-πšπšŸπšŠπš›)
Restrictions
𝙽β‰₯0
2*π™½β‰€πš–πšŠπš‘(|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|-1,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 (with 1<i≀k) such that V i-1 <V i and V i =V i+1 =β‹―=V k and V k >V k+1 . 𝙽 is the total number of peaks of the sequence of variables πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.

Example
(2,1,1,4,8,6,2,7,1)
(0,1,1,4,4,4,6,7,7)
(4,1,5,4,9,4,6,2,7,6)

The first πš™πšŽπšŠπš” constraint holds since the sequence 1 1 4 8 6 2 7 1 contains two peaks that respectively correspond to the variables that are assigned to values 8 and 7.

Figure 5.318.1. Illustration of the first example 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, 1, 4, 8, 6, 2, 7, 1 and its corresponding two peaks (𝙽=2)
ctrs/peak-1-tikz
All solutions

FigureΒ 5.318.2 gives all solutions to the following non ground instance of the πš™πšŽπšŠπš” constraint: π™½βˆˆ[1,2], V 1 ∈[1,2], V 2 =2, V 3 ∈[1,2], V 4 ∈[1,2], V 5 ∈[2,3], πš™πšŽπšŠπš”(𝙽,〈V 1 ,V 2 ,V 3 ,V 4 ,V 5 βŒͺ).

Figure 5.318.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/peak-2-tikz
Typical
|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|>2
πš›πšŠπš—πšπšŽ(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)>1
Symmetries
  • Items of πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ can be reversed.

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

Arg. properties
  • Functional dependency: 𝙽 determined by πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.

  • Contractible wrt. πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ when 𝙽=0.

Usage

Useful for constraining the number of peaks of a sequence of domain variables.

Remark

Since the arity of the arc constraint is not fixed, the πš™πšŽπšŠπš” constraint cannot be currently described with the graph-based representation. However, this would not hold anymore if we were introducing a slot that specifies how to merge adjacent vertices of the final graph.

Counting
Length (n)2345678
Solutions9646257776117649209715243046721

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

ctrs/peak-3-tikz

ctrs/peak-4-tikz

Length (n)2345678
Total9646257776117649209715243046721
Parameter
value

095029517921108869498439791
1-1433053137352894443011654622
2---67133033101092224895038
3-----723026057270

Solution count for πš™πšŽπšŠπš”: domains 0..n

ctrs/peak-5-tikz

ctrs/peak-6-tikz

See also

common keyword: πš‘πš’πšπš‘πšŽπšœπš_πš™πšŽπšŠπš”, πš’πš—πšπš•πšŽπš‘πš’πš˜πš—, πš–πš’πš—_πšπš’πšœπš_πš‹πšŽπšπš πšŽπšŽπš—_πš’πš—πšπš•πšŽπš‘πš’πš˜πš—, πš–πš’πš—_πš πš’πšπšπš‘_πš™πšŽπšŠπš”Β (sequence).

comparison swapped: πšŸπšŠπš•πš•πšŽπš’.

generalisation: πš‹πš’πš_πš™πšŽπšŠπš”Β (a tolerance parameter is added for counting only big peaks).

related: πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš”, πšŠπš•πš•_πšŽπššπšžπšŠπš•_πš™πšŽπšŠπš”_πš–πšŠπš‘, πšπšŽπšŒπš›πšŽπšŠπšœπš’πš—πš_πš™πšŽπšŠπš”, πš’πš—πšŒπš›πšŽπšŠπšœπš’πš—πš_πš™πšŽπšŠπš”, πš—πš˜_πšŸπšŠπš•πš•πšŽπš’.

specialisation: πš—πš˜_πš™πšŽπšŠπš”Β (the variable counting the number of peaks is set to 0 and removed).

Keywords

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

combinatorial object: sequence.

constraint arguments: reverse of a constraint, pure functional dependency.

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

filtering: glue matrix.

modelling: functional dependency.

Cond. implications

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

Β Β Β  withΒ  𝙽>0

Β Β implies πšŠπšπš•πšŽπšŠπšœπš_πš—πšŸπšŠπš•πšžπšŽ(π™½πš…π™°π™»,πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚)

Β Β Β  whenΒ  π™½πš…π™°π™»=2.

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

Β Β implies πš’πš—πšπš•πšŽπš‘πš’πš˜πš—(𝙽,πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚)

Β Β Β  whenΒ  𝙽=πš™πšŽπšŠπš”(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)+πšŸπšŠπš•πš•πšŽπš’(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›).

Automaton

FigureΒ 5.318.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.318.3. Automaton of the πš™πšŽπšŠπš” constraint
ctrs/peak-7-tikz
Figure 5.318.4. Hypergraph of the reformulation corresponding to the automaton of the πš™πšŽπšŠπš” constraint (since all states of the automaton are accepting there is no restriction on the last variable Q n-1 )
ctrs/peak-8-tikz
Figure 5.318.5. Glue matrix of the πš™πšŽπšŠπš” constraint
s {>|=} * u <{<|=} *

s {>|=} *

C β†’+C ←

Β Β Β Β Β C β†’+C ←

ctrs/peak-10-tikz

u <{<|=} *

Β Β Β Β Β C β†’+C ←

ctrs/peak-11-tikz

C β†’+1+C ←

ctrs/peak-12-tikz

ctrs/peak-9-tikz
Figure 5.318.6. Illustrating the use of the state pair (u,u) of the glue matrix for linking 𝙽 with the counters variables obtained after reading the prefix 1,1,4,8 and corresponding suffix 8,6,2,7,1 of the sequence 1,1,4,8,6,2,7,1; note that the suffix 8,6,2,7,1 (in pink) is proceed in reverse order; the left (resp.Β right) table shows the initialisation (for i=0) and the evolution (for i>0) of the state of the automaton and of its counter C upon reading the prefix 1,1,4,8 (resp.Β the suffix 1,7,2,6,8).
ctrs/peak-13-tikz