## 5.150. highest_peak

Origin

Derived from $\mathrm{𝚙𝚎𝚊𝚔}$.

Constraint

$\mathrm{𝚑𝚒𝚐𝚑𝚎𝚜𝚝}_\mathrm{𝚙𝚎𝚊𝚔}\left(\mathrm{𝙷𝙴𝙸𝙶𝙷𝚃},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\right)$

Arguments
 $\mathrm{𝙷𝙴𝙸𝙶𝙷𝚃}$ $\mathrm{𝚍𝚟𝚊𝚛}$ $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛}-\mathrm{𝚍𝚟𝚊𝚛}\right)$
Restrictions
 $\mathrm{𝙷𝙴𝙸𝙶𝙷𝚃}\ge 0$ $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}.\mathrm{𝚟𝚊𝚛}\ge 0$ $\mathrm{𝚛𝚎𝚚𝚞𝚒𝚛𝚎𝚍}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂},\mathrm{𝚟𝚊𝚛}\right)$
Purpose

A variable ${V}_{k}$ $\left(1 of the sequence of variables $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}={V}_{1},...,{V}_{m}$ is a peak if and only if there exists an $i$ $\left(1 such that ${V}_{i-1}<{V}_{i}$ and ${V}_{i}={V}_{i+1}=...={V}_{k}$ and ${V}_{k}>{V}_{k+1}$. $\mathrm{𝙷𝙴𝙸𝙶𝙷𝚃}$ is the maximum value of the peak variables. If no such variable exists $\mathrm{𝙷𝙴𝙸𝙶𝙷𝚃}$ is equal to 0.

Example
$\left(\begin{array}{c}8,〈\begin{array}{c}\mathrm{𝚟𝚊𝚛}-1,\hfill \\ \mathrm{𝚟𝚊𝚛}-1,\hfill \\ \mathrm{𝚟𝚊𝚛}-4,\hfill \\ \mathrm{𝚟𝚊𝚛}-8,\hfill \\ \mathrm{𝚟𝚊𝚛}-6,\hfill \\ \mathrm{𝚟𝚊𝚛}-2,\hfill \\ \mathrm{𝚟𝚊𝚛}-7,\hfill \\ \mathrm{𝚟𝚊𝚛}-1\hfill \end{array}〉\hfill \end{array}\right)$

The $\mathrm{𝚑𝚒𝚐𝚑𝚎𝚜𝚝}_\mathrm{𝚙𝚎𝚊𝚔}$ constraint holds since 8 is the maximum peak of the sequence $11486271$.

Typical
 $\mathrm{𝙷𝙴𝙸𝙶𝙷𝚃}>0$ $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}|>2$ $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}.\mathrm{𝚟𝚊𝚛}\right)>1$
Symmetry

Items of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ can be reversed.

Figure 5.150.2 depicts the automaton associated with the $\mathrm{𝚑𝚒𝚐𝚑𝚎𝚜𝚝}_\mathrm{𝚙𝚎𝚊𝚔}$ constraint. To each pair of consecutive variables $\left({\mathrm{𝚅𝙰𝚁}}_{i},{\mathrm{𝚅𝙰𝚁}}_{i+1}\right)$ of the collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ corresponds a signature variable ${𝚂}_{i}$. The following signature constraint links ${\mathrm{𝚅𝙰𝚁}}_{i}$, ${\mathrm{𝚅𝙰𝚁}}_{i+1}$ and ${𝚂}_{i}$:
${\mathrm{𝚅𝙰𝚁}}_{i}>{\mathrm{𝚅𝙰𝚁}}_{i+1}⇔{𝚂}_{i}=0\wedge {\mathrm{𝚅𝙰𝚁}}_{i}={\mathrm{𝚅𝙰𝚁}}_{i+1}⇔{𝚂}_{i}=1\wedge {\mathrm{𝚅𝙰𝚁}}_{i}<{\mathrm{𝚅𝙰𝚁}}_{i+1}⇔{𝚂}_{i}=2$.