5.387. sum_of_increments

DESCRIPTIONLINKS
Origin

[Brand09]

Constraint

πšœπšžπš–_𝚘𝚏_πš’πš—πšŒπš›πšŽπš–πšŽπš—πšπšœ(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚,π™»π™Έπ™Όπ™Έπšƒ)

Synonyms

πš’πš—πšŒπš›πšŽπš–πšŽπš—πšπšœ_πšœπšžπš–, πš’πš—πšŒπš›_πšœπšžπš–, πšœπšžπš–_πš’πš—πšŒπš›, πšœπšžπš–_πš’πš—πšŒπš›πšŽπš–πšŽπš—πšπšœ.

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

Given a collection of variables πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ which can only be assigned non negative values, and a variable π™»π™Έπ™Όπ™Έπšƒ, enforce the condition πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[1].πšŸπšŠπš›+βˆ‘ i=2 |πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚| max(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[i].πšŸπšŠπš›-πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[i-1].πšŸπšŠπš›,0)β‰€π™»π™Έπ™Όπ™Έπšƒ. πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[1].πšŸπšŠπš› stands from the fact that we assume an additional implicit 0 before the first variable (i.e.,Β πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[1].πšŸπšŠπš›=max(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[1].πšŸπšŠπš›-0,0)).

Example
(4,4,3,4,6,7)

The πšœπšžπš–_𝚘𝚏_πš’πš—πšŒπš›πšŽπš–πšŽπš—πšπšœ constraint holds since we have that 4+max(4-4,0)+max(3-4,0)+max(4-3,0)+max(6-4,0)≀7.

Typical
|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|>2
πš›πšŠπš—πšπšŽ(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)>1
πš–πšŠπš‘πšŸπšŠπš•(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)>0
π™»π™Έπ™Όπ™Έπšƒ>0
π™»π™Έπ™Όπ™Έπšƒβ‰€|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|*πš›πšŠπš—πšπšŽ(πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš›)/2
Symmetries
  • One and the same constant can be added to πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚.πšŸπšŠπš› and to π™»π™Έπ™Όπ™Έπšƒ.

  • Items of πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ can be reversed.

  • π™»π™Έπ™Όπ™Έπšƒ can be increased.

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

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

Usage

The πšœπšžπš–_𝚘𝚏_πš’πš—πšŒπš›πšŽπš–πšŽπš—πšπšœ was initially motivated by the problem of decomposing a matrix of non-negative integers into a positive linear combination of matrices consisting of only zeros and ones, where the ones occur consecutively in each row.

Algorithm

A O(|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|) bound-consistency filtering algorithm for the πšœπšžπš–_𝚘𝚏_πš’πš—πšŒπš›πšŽπš–πšŽπš—πšπšœ constraint is described inΒ [Brand09].

Reformulation

The following reformulations are provided inΒ [Brand09]. Assuming πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[0].πšŸπšŠπš› is defined as 0 (i.e.,Β a zero is added before the first variable of the πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚ collection) we have:

  • βˆ‘ i=1 |πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚| S i β‰€π™»π™Έπ™Όπ™Έπšƒ with D i =πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[i].πšŸπšŠπš›-πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[i-1].πšŸπšŠπš› and S i =max(D i ,0) (1≀i≀|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|).

  • βˆ‘ i=1 |πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚| S i β‰€π™»π™Έπ™Όπ™Έπšƒ with πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[i].πšŸπšŠπš›-πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚[i-1].πšŸπšŠπš›β‰€S i and S i ∈[0,π™»π™Έπ™Όπ™Έπšƒ Β―] (1≀i≀|πš…π™°πšπ™Έπ™°π™±π™»π™΄πš‚|).

Counting
Length (n)2345678
Solutions14145287551415121010428573741801944469

Number of solutions for πšœπšžπš–_𝚘𝚏_πš’πš—πšŒπš›πšŽπš–πšŽπš—πšπšœ: domains 0..n

ctrs/sum_of_increments-1-tikz

ctrs/sum_of_increments-2-tikz

Length (n)2345678
Total14145287551415121010428573741801944469
Parameter
value

01111111
1471116222937
292351101183309493
3-5415639690418913679
4-6037511673235813518835
5--485284893182748374143
6--56342632298177947240751
7--608556838836193742675244
8--6256616567033598801688427
9---7314746585785113369015
10---7650906398374415865915
11---772010287511156879220695
12---7755110425138602913354545
13----113827161999318051195
14----115857179569422965651
15----116942190896827670800
16----117437198822231755573
17----117612203961634989993
18----117649206993337574073
19-----208576339526569
20-----209281740912205
21-----209543641827847
22-----209636042386387
23-----209682242700112
24-----209703242865683
25------42953199
26------43002171
27------43027581
28------43039551
29------43044507
30------43046215
31------43046656
32------43046721

Solution count for πšœπšžπš–_𝚘𝚏_πš’πš—πšŒπš›πšŽπš–πšŽπš—πšπšœ: domains 0..n

ctrs/sum_of_increments-3-tikz

ctrs/sum_of_increments-4-tikz

Keywords

characteristic of a constraint: difference, sum.

constraint type: predefined constraint.

filtering: bound-consistency.