## 5.252. min_decreasing_slope

Origin

Motivated by time series.

Constraint

$\mathrm{𝚖𝚒𝚗}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}\left(\mathrm{𝙼𝙸𝙽},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\right)$

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

Given a sequence of variables $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}={V}_{1},{V}_{2},\cdots ,{V}_{n}$, sets $\mathrm{𝙼𝙸𝙽}$ to 0 if $\nexists i\in \left[1,n-1\right]|{V}_{i}>{V}_{i+1}$, otherwise sets $\mathrm{𝙼𝙸𝙽}$ to ${min}_{i\in \left[1,n-1\right]|{V}_{i}>{V}_{i+1}}\left({V}_{i}-{V}_{i+1}\right)$.

Example
 $\left(2,〈1,1,5,8,6,2,4,1,5〉\right)$ $\left(0,〈1,1,1,3,4,7,7,7,9〉\right)$ $\left(9,〈1,1,9,0,4,7,7,7,9〉\right)$

The first $\mathrm{𝚖𝚒𝚗}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}$ constraint holds since the sequence $115862415$ contains two decreasing subsequences $862$ and $41$ and the minimum slope is equal to $min\left(8-6,6-2,4-1\right)=2$ as shown on Figure 5.252.1.

##### Figure 5.252.1. Illustration of the first example of the Example slot: a sequence of nine variables ${V}_{1}$, ${V}_{2}$, ${V}_{3}$, ${V}_{4}$, ${V}_{5}$, ${V}_{6}$, ${V}_{7}$, ${V}_{8}$, ${V}_{9}$ respectively fixed to values 1, 1, 5, 8, 6, 2, 4, 1, 5 and the corresponding minimum slope on the strictly decreasing subsequences $862$ and $41$ ($\mathrm{𝙼𝙸𝙽}=2$) Typical
 $\mathrm{𝙼𝙸𝙽}>1$ $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}|>2$ $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}.\mathrm{𝚟𝚊𝚛}\right)>2$
Symmetry

One and the same constant can be added to the $\mathrm{𝚟𝚊𝚛}$ attribute of all items of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$.

Arg. properties

Functional dependency: $\mathrm{𝙼𝙸𝙽}$ determined by $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$.

Usage

Getting the minimum slope over the decreasing sequences of time series.

Counting
 Length ($n$) 2 3 4 5 6 7 8 Solutions 9 64 625 7776 117649 2097152 43046721

Number of solutions for $\mathrm{𝚖𝚒𝚗}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}$: domains $0..n$  Length ($n$)2345678
Total9646257776117649209715243046721
 Parameter value

062070252924343212870
1222256351256537105193622280084
211414518642872851537210601773
3-8981062147292550765106480
4--5670488531336722475484
5---3825266781981369232
6----261241330730161
7-----18136341618
8------129019

Solution count for $\mathrm{𝚖𝚒𝚗}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}$: domains $0..n$  Keywords
Cond. implications

$\mathrm{𝚖𝚒𝚗}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}\left(\mathrm{𝙼𝙸𝙽},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\right)$

with  $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}.\mathrm{𝚟𝚊𝚛}\right)=\mathrm{𝙼𝙸𝙽}+1$

implies $\mathrm{𝚖𝚊𝚡}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}$$\left(\mathrm{𝙼𝙰𝚇},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\right)$

when  $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}.\mathrm{𝚟𝚊𝚛}\right)=\mathrm{𝙼𝙰𝚇}+1$.

Automaton

Figure 5.252.2 depicts the automaton associated with the $\mathrm{𝚖𝚒𝚗}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}$ constraint. To each pair of consecutive variables $\left({\mathrm{𝚅𝙰𝚁}}_{i},{\mathrm{𝚅𝙰𝚁}}_{i+1}\right)$ of the collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ corresponds a signature variable ${S}_{i}$. The following signature constraint links ${\mathrm{𝚅𝙰𝚁}}_{i}$, ${\mathrm{𝚅𝙰𝚁}}_{i+1}$ and ${S}_{i}$: $\left({\mathrm{𝚅𝙰𝚁}}_{i}\le {\mathrm{𝚅𝙰𝚁}}_{i+1}⇔{S}_{i}=0\right)\wedge \left({\mathrm{𝚅𝙰𝚁}}_{i}>{\mathrm{𝚅𝙰𝚁}}_{i+1}⇔{S}_{i}=1\right)$.

##### Figure 5.252.2. Automaton for the $\mathrm{𝚖𝚒𝚗}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}$ constraint and its glue matrix (note that the reverse of $\mathrm{𝚖𝚒𝚗}_\mathrm{𝚍𝚎𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}$ is $\mathrm{𝚖𝚒𝚗}_\mathrm{𝚒𝚗𝚌𝚛𝚎𝚊𝚜𝚒𝚗𝚐}_\mathrm{𝚜𝚕𝚘𝚙𝚎}$) 