Time-Series Constraints: Improvements and Application in CP and MIP - - PowerPoint PPT Presentation

time series constraints improvements and application in
SMART_READER_LITE
LIVE PREVIEW

Time-Series Constraints: Improvements and Application in CP and MIP - - PowerPoint PPT Presentation

Time-Series Constraints: Improvements and Application in CP and MIP Contexts Ekaterina Arafailova , Nicolas Beldiceanu, Rmi Douence, Pierre Flener, M. Andrena Francisco R., Justin Pearson, and Helmut Simonis May 31, 2016 Background


slide-1
SLIDE 1

Time-Series Constraints: Improvements and Application in CP and MIP Contexts

Ekaterina Arafailova, Nicolas Beldiceanu, Rémi Douence, Pierre Flener, M. Andreína Francisco R., Justin Pearson, and Helmut Simonis May 31, 2016

slide-2
SLIDE 2

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Contents

Time-Series Constraints

start

Automata Simplified Automata Implied Constraints Linear Decomposition Benchmarks CP and MIP

2 / 32

slide-3
SLIDE 3

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Contents

Time-Series Constraints

start

Automata Simplified Automata Implied Constraints Linear Decomposition Benchmarks CP and MIP

3 / 32

slide-4
SLIDE 4

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Time-series constraint

A time-series constraint1 g_f _σ(X1, . . . , Xn, M) where every Xi is over Di ⊂ Z is specified by

◮ A pattern, a regular expression over the alphabet {<, =, >},

e.g. Peak = ‘<(<|=)*(>|=)*>’. Currently 22 patterns in the framework

◮ A feature, a function over a subseries, e.g. one.

Currently 5 features in the framework

◮ An aggregator, a function over a feature sequence, e.g. Sum.

Currently 3 aggregators in the framework

1Beldiceanu, N., Carlsson, M., Douence, R., Simonis, H.: Using finite

transducers for describing and synthesising structural time-series constraints. Constraints 21(1), 22-40 (January 2016): summary on p. 723 of LNCS 9255, Springer, 2015

4 / 32

slide-5
SLIDE 5

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

NbPeak

sum

  • ne

peak

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

4 3 5 3 5 5 6 3 1 1 2 2 2 2 2 1 > < > < = < > > = < = = = = > < < > > < < > > > > < < = = = = = = = = > > 1 1 1 3

2 6 7 10 11 12 13 14

time series: input sequence (I) signature sequence (II) e-occurrences s-occurrences (III) feature sequence (IV) output: aggregation

Example NbPeak(4, 3, 5, 3, 5, 5, 6, 3, 1, 1, 2, 2, 2, 2, 2, 1, 3) holds !

5 / 32

slide-6
SLIDE 6

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Contents

Time-Series Constraints

start

Automata Simplified Automata Implied Constraints Linear Decomposition Benchmarks CP and MIP

6 / 32

slide-7
SLIDE 7

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Automata for time-series constraints

Every time-series constraint can be encoded as an automaton with three accumulators: D(potential), C(current), R(aggregation)

g(R, C) ≥ s    R ← defaultg,f , C ← defaultg,f , D ← idf    ≤ r ≥ t ≥ < ≤, {D ← φf (D, δf )} >, C ← φf (D, δf ), D ← idf

  • >,

C ← φf (C, φf (D, δf )), D ← idf

  • =,

{D ← φf (D, δf )} <,    R ← g(R, C), C ← defaultg,f , D ← idf   

Automaton for the g_f_peak constraints.

Feature f idf minf maxf φf δi

f

  • ne

1 1 1 max Aggregator g defaultg,f Sum

7 / 32

slide-8
SLIDE 8

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Automaton instantiation

When f is one and g is Sum the automaton becomes

≥ s    C ← 0 D ← 0 R ← 0    ≤ r ≥ t R + C ≥ < > C ← max(D, 1) D ← 0

{D ← max(D, 1)} > C ← max(C, max(D, 1)) D ← 0

  • =

{D ← max(D, 1)} <    C ← 0 D ← 0 R ← R + C   

Obviously, this automaton can be simplified

8 / 32

slide-9
SLIDE 9

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Contents

Time-Series Constraints

start

Automata Simplified Automata Implied Constraints Linear Decomposition Benchmarks CP and MIP

9 / 32

slide-10
SLIDE 10

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Automata simplifications

Goal

◮ Reduce the number of accumulators and aggregate as early

as possible

◮ Simplify the automata at the stage of their synthesis

Three simplification types

◮ Simplifications coming from the properties of patterns, ex.:

aggregate-once

◮ Simplifications coming from the properties of the

feature/aggregator pairs, ex.: immediate-aggregation

◮ Removing the never used accumulators.

10 / 32

slide-11
SLIDE 11

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

“Aggregate-once” simplification

What is the “Aggregate-once” simplification ? It allows to compute the feature value of a curent pattern

  • ccurrence only once and, possibly, earlier than the end of a pattern
  • ccurrence.

When is the simplification applicable ? There must exist a transition on which the value of the feature from the current pattern occurrence is known.

11 / 32

slide-12
SLIDE 12

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Example: counting number of peaks

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 4 3 2 1

S0 =‘<’ S1 =‘<’ S2 =‘=’ S3 =‘<’ S4 =‘<’ S5 =‘>’ S6 =‘>’ S7 =‘<’ S8 =‘=’ S9 =‘>’

  • 1. First peak is detected upon consuming s5
  • 2. Second peak is detected upon consuming s9

12 / 32

slide-13
SLIDE 13

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Two automata for nb_peak

≥ s    C ← 0 D ← 0 R ← 0    ≤ r ≥ t R + C ≥ < > C ← max(D, 1) D ← 0

{D ← max(D, 1)} > C ← max(C, max(D, 1)) D ← 0

  • =

{D ← max(D, 1)} <    C ← 0 D ← 0 R ← R + C    ≥ s {R ← 0} ≤ r ≥ t R ≥ < > {R ← R + 1} ≤ > = <

13 / 32

slide-14
SLIDE 14

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Percentage of simplified constraints

Simplification Percentage aggregate once 28.9 % immediate aggreg. 45.9 %

  • ther properties

11.6 % unchanged automata 13.6 %

14 / 32

slide-15
SLIDE 15

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Contents

Time-Series Constraints

start

Automata Simplified Automata Implied Constraints Linear Decomposition Benchmarks CP and MIP

15 / 32

slide-16
SLIDE 16

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Input

Input

◮ Time-series variables Xi with i in [0, n − 1] over their

domains [ai, bi]

◮ An automaton with accumulators for a time-series constraint

with

◮ a set of states Q; ◮ an input alphabet Σ; ◮ an m-tuple of integer accumulators with their initial values

I = I1, . . . , Im;

◮ a transition function δ : Q × Z m × Σ → Q × Z m.

16 / 32

slide-17
SLIDE 17

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Goal

Goal A way to generate a model for an automaton with linear or linearisable accumulator updates, for example containing min and max. Linear decomposition of automata without accumulators Côté, M.C., Gendron, B., Rousseau, L.M.: Modeling the regular constraint with integer programming. In: CPAIOR 2007. LNCS,

  • vol. 4510, pp. 29–43. Springer (2007)

17 / 32

slide-18
SLIDE 18

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Signature constraint

Introduced variables: Si over Σ with i ∈ [0, n − 2]. What do the values of Si mean ? Si = ‘>’ ⇔ Xi > Xi+1, ∀i ∈ [0, n − 2] Si = ‘=’ ⇔ Xi = Xi+1, ∀i ∈ [0, n − 2] Si = ‘<’ ⇔ Xi < Xi+1, ∀i ∈ [0, n − 2]

18 / 32

slide-19
SLIDE 19

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Transition function constraints

Introduced variables: Qi over Q with i ∈ [0, n − 1]; Ti over Q × Σ with i ∈ [0, n − 2] q δ1(q, σ)

σ

Each transition constraint has a form: Qi = q ∧ Si = σ ⇔ Qi+1 = δ1(q, σ) ∧ Ti = q, σ, ∀i ∈ [0, n − 2], ∀q ∈ Q, ∀σ ∈ Σ Initial state is fixed Q0 = q0

19 / 32

slide-20
SLIDE 20

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Accumulator updates

≥ s {R ← 0} ≤ r ≥ t R ≥ < > {R ← R + 1} ≤ > = <

Accumulator updates Ri over [a, b] with i in [0, n − 1]; Ti over Q × Σ with i in [0, n − 2].

◮ R0 = 0 ◮ Ti = r, > ⇒ Ri+1 = Ri + 1, ∀i ∈ [0, n − 2] ◮ Ti = q, σ ⇒ Ri+1 = Ri, ∀i ∈ [0, n − 2], ∀q, σ ∈

(Q × Σ) \ r, >

◮ M = Rn−1

20 / 32

slide-21
SLIDE 21

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

New variables for the linear model

New variables

◮ Qi is replaced by 0-1 variables Qq i for all q in Q.

Qq

i = 1 ⇔ Qi = q ◮ New constraint: q∈Q

Qq

i = 1, ∀i ∈ [0, . . . , n − 1] ◮ The same procedure for Ti and Si wrt their domains ◮ Xi and Ri remain integer variables! ◮ Every constraint of the logical model is made linear by

applying some standard techniques

◮ The linear model has O(n) variables and O(n) constraints

21 / 32

slide-22
SLIDE 22

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Contents

Time-Series Constraints

start

Automata Simplified Automata Implied Constraints Linear Decomposition Benchmarks CP and MIP

22 / 32

slide-23
SLIDE 23

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Implied constraints

Implied constraints2 improves propagation for constraints encoded via automata with at least one accumulator

◮ The implied constraints are generated offline ◮ The implied constraints are of the form:

α1y1 + · · · + αkyk + β ≥ 0 where the yi are the accumulators of A(C, D, R) and the weights αi and β are to be found

◮ Theoretically supported by Farkas’ Lemma

2Francisco Rodríguez, M.A., Flener, P., Pearson, J.: Implied constraints for

automaton constraints. In: GCAI 2015. EasyChair Epic Series in Computing,

  • vol. 36, pp. 113–126. EasyChair (2015)

23 / 32

slide-24
SLIDE 24

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

≥ s {R ← 0} ≤ r ≥ t R ≥ < > {R ← R + 1} ≤ > = <

Options Ri+2 ≤ Ri +1

24 / 32

slide-25
SLIDE 25

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Improvements

The first version of ImpGen

◮ Only linear accumulator updates ◮ Manual selection

Improvements of the new version

◮ Can handle max and min in accumulators updates ◮ Automatic selection by ranking

25 / 32

slide-26
SLIDE 26

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Improvements of ImpGen: example

s {R ← −∞} R ≥ < {R ← max(R, Xi+1 − Xi)}

Options Ri ≥ Xi+1 − Xi

26 / 32

slide-27
SLIDE 27

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Contents

Time-Series Constraints

start

Automata Simplified Automata Implied Constraints Linear Decomposition Benchmarks CP and MIP

27 / 32

slide-28
SLIDE 28

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Benchmark CP

Goal compare original and simplified automata

◮ For every time-series constraint maximise the result ◮ Time series of length 15 over [1, 3] ◮ Timeout of 100 seconds

(a) Runtime

0.01 0.1 1 10 100 0.01 0.1 1 10 100

(b) Backtracks

1 10 100 1000 10000 100000 1x106 1x107 1 10 100 1000 10000 100000 1x106 1x107

28 / 32

slide-29
SLIDE 29

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Staff scheduling application

◮ Satisfy the demand; ◮ Take into account business rules ◮ Respect union’s rules ◮ Minimise the costs

29 / 32

slide-30
SLIDE 30

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Results for staff scheduling application

◮ P characterises complexity of the problem ◮ Consider P ∈ {10, 15, 20, 25, 30, 35, 40} ◮ 100 instances for every value of P

  • ptimality gap

cp mip p avg max avg max

  • pt

20 3.42 9.67 2.28 18.77 27/100 30 3.20 8.02 2.04 6.34 26/100 40 3.51 17.32 1.97 10.47 18/100

◮ In average MIP is always better ◮ The maximal gap sometimes is smaller for CP ◮ MIP can solve to optimality just few instances

30 / 32

slide-31
SLIDE 31

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Conclusion

Contributions of the paper

◮ A linear decomposition for time-series constraints with O(n)

variables and O(n) constraints

◮ Simplified automata for time-series constraints ◮ New version of the generator of linear implied constraints

which handles accumulator updates with min, max

◮ Benchmarks in the contexts of CP and MIP

31 / 32

slide-32
SLIDE 32

Background Automata simplification Linear Decomposition Implied constraints Benchmark Conclusion

Thank you for your attention! Questions?

32 / 32