optimising quantified expressions in constraint models
play

Optimising Quantified Expressions in Constraint Models Ian P. Gent, - PowerPoint PPT Presentation

Optimising Quantified Expressions Optimising Quantified Expressions in Constraint Models Ian P. Gent, Ian Miguel and Andrea Rendl University of St Andrews, UK AIT Austrian Institute of Technology, Austria September 2010 Workshop on Modelling


  1. Optimising Quantified Expressions Optimising Quantified Expressions in Constraint Models Ian P. Gent, Ian Miguel and Andrea Rendl University of St Andrews, UK AIT Austrian Institute of Technology, Austria September 2010 Workshop on Modelling and Reformulation

  2. Optimising Quantified Expressions Context of this Work Quantified expressions in solver-independent constraint modelling languages

  3. Optimising Quantified Expressions Context of this Work Quantified expressions in solver-independent constraint modelling languages Example: forall i,j:int(1..n) . (i � = j) ⇒ (q[i]-i � = q[j]-j)

  4. Optimising Quantified Expressions Context of this Work Quantified expressions in solver-independent constraint modelling languages Example: forall i,j:int(1..n) . (i � = j) ⇒ (q[i]-i � = q[j]-j) powerful means to compactly represent a set of expressions

  5. Optimising Quantified Expressions Context of this Work Quantified expressions in solver-independent constraint modelling languages Example: forall i,j:int(1..n) . (i � = j) ⇒ (q[i]-i � = q[j]-j) powerful means to compactly represent a set of expressions same structure in all constraint modelling languages

  6. Optimising Quantified Expressions Context of this Work Quantified expressions in solver-independent constraint modelling languages Example: forall i,j:int(1..n) . (i � = j) ⇒ (q[i]-i � = q[j]-j) powerful means to compactly represent a set of expressions same structure in all constraint modelling languages restriction : no decision variables in i 1 , . . . , i m and int(lb..ub)

  7. Optimising Quantified Expressions Goal and Contributions Our Observation : quantified expressions can contain redundancies , often when formulated by novices

  8. Optimising Quantified Expressions Goal and Contributions Our Observation : quantified expressions can contain redundancies , often when formulated by novices Our Goal : automatically improve poorly formulated quantified expressions

  9. Optimising Quantified Expressions Goal and Contributions Our Observation : quantified expressions can contain redundancies , often when formulated by novices Our Goal : automatically improve poorly formulated quantified expressions Our Contributions : we consider 2 kinds of redundancies

  10. Optimising Quantified Expressions Goal and Contributions Our Observation : quantified expressions can contain redundancies , often when formulated by novices Our Goal : automatically improve poorly formulated quantified expressions Our Contributions : we consider 2 kinds of redundancies we propose means to detect and address those redundancies

  11. Optimising Quantified Expressions Loop-invariant Expressions 1 Loop-invariant Expressions 2 Weak Guards 3 Summary

  12. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Idea : analyse equivalent representations of quantified expressions

  13. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Idea : analyse equivalent representations of quantified expressions Example: ( x = 0 ) ⇒ ∀ i ∈ D . ( x [ i ] = i )

  14. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Idea : analyse equivalent representations of quantified expressions Example: ( x = 0 ) ⇒ ∀ i ∈ D . ( x [ i ] = i ) ≡ ∀ i ∈ D . ( x = 0 ) ⇒ ( x [ i ] = i )

  15. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Idea : analyse equivalent representations of quantified expressions Example: ( x = 0 ) ⇒ ∀ i ∈ D . ( x [ i ] = i ) ≡ ∀ i ∈ D . ( x = 0 ) ⇒ ( x [ i ] = i ) we call ‘ ( x = 0 ) ’ loop-invariant

  16. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Idea : analyse equivalent representations of quantified expressions Example: ( x = 0 ) ⇒ ∀ i ∈ D . ( x [ i ] = i ) ≡ ∀ i ∈ D . ( x = 0 ) ⇒ ( x [ i ] = i ) we call ‘ ( x = 0 ) ’ loop-invariant Question: which representation is better?

  17. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Many different cases.... 1 A ∧∀ I E I ≡ ∀ I A ∧ E I

  18. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Many different cases.... 1 A ∧∀ I E I ≡ ∀ I A ∧ E I 2 A ∨∃ I E I ≡ ∃ I A ∨ E I 3 m A + � ≡ � I A + E I where m = | I | I E I 4 A ∨ ( ∀ I E I )) ≡ ∀ I A ∨ E I 5 etc

  19. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Many different cases.... 1 A ∧∀ I E I ≡ ∀ I A ∧ E I 2 A ∨∃ I E I ≡ ∃ I A ∨ E I 3 m A + � ≡ � I A + E I where m = | I | I E I 4 A ∨ ( ∀ I E I )) ≡ ∀ I A ∨ E I 5 etc Intuitively, we expect the outside-representation to be better...

  20. Optimising Quantified Expressions Loop-invariant Expressions Loop-invariant Expressions Many different cases.... 1 A ∧∀ I E I ≡ ∀ I A ∧ E I 2 A ∨∃ I E I ≡ ∃ I A ∨ E I 3 m A + � ≡ � I A + E I where m = | I | I E I 4 A ∨ ( ∀ I E I )) ≡ ∀ I A ∨ E I 5 etc Intuitively, we expect the outside-representation to be better... is this true for all cases?

  21. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations We compare representations at solver level (flat representation)

  22. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations We compare representations at solver level (flat representation) We assume the solver provides: (reifyable) n -ary conjunction ( ∀ ) (reifyable) n -ary disjunction ( ∃ ) n -ary sum ( � )

  23. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations We compare representations at solver level (flat representation) We assume the solver provides: (reifyable) n -ary conjunction ( ∀ ) (reifyable) n -ary disjunction ( ∃ ) n -ary sum ( � ) Let’s look at one case (see paper for other cases): A ⇒ ( ∀ I E I ) ≡ ∀ I A ⇒ E I

  24. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations Inside-Representation Outside-Representation Original ( ∀ I A ⇒ E I ) A ⇒ ( ∀ I E I )

  25. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations Inside-Representation Outside-Representation Original ( ∀ I A ⇒ E I ) A ⇒ ( ∀ I E I ) Unrolled ( A ⇒ E 1 ) ∧ A ⇒ ( E 1 ∧ · · · ∧ E k ) . . . ( A ⇒ E k )

  26. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations Inside-Representation Outside-Representation Original ( ∀ I A ⇒ E I ) A ⇒ ( ∀ I E I ) Unrolled ( A ⇒ E 1 ) ∧ A ⇒ ( E 1 ∧ · · · ∧ E k ) . . . ( A ⇒ E k ) Flat a ⇒ e 1 aux ⇔ ( e 1 ∧ · · · ∧ e k ) (unnested) . . . a ⇒ aux a ⇒ e k

  27. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations Inside-Representation Outside-Representation Original ( ∀ I A ⇒ E I ) A ⇒ ( ∀ I E I ) Unrolled ( A ⇒ E 1 ) ∧ A ⇒ ( E 1 ∧ · · · ∧ E k ) . . . ( A ⇒ E k ) Flat a ⇒ e 1 aux ⇔ ( e 1 ∧ · · · ∧ e k ) (unnested) . . . a ⇒ aux a ⇒ e k 0 auxiliary variables 1 auxiliary variable k constraints 2 constraints

  28. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations Inside-Representation : more constraints (increasing with k ), no additional variables

  29. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations Inside-Representation : more constraints (increasing with k ), no additional variables Outside-Representation : only two constraints but 1 additional variable

  30. Optimising Quantified Expressions Loop-invariant Expressions Comparing Representations Inside-Representation : more constraints (increasing with k ), no additional variables Outside-Representation : only two constraints but 1 additional variable Let’s compare the representations in an example!

  31. Optimising Quantified Expressions Loop-invariant Expressions Example: Peaceful Army of Queens Place two equally-sized armies of queens on a chess board such that they do not attack another, maximising the army size

  32. Optimising Quantified Expressions Loop-invariant Expressions Peaceful Army of Queens: Outside Representation Non-attacking Constraints in model based on Smith et al (2004): forall fields(i,j) on the chess board.

  33. Optimising Quantified Expressions Loop-invariant Expressions Peaceful Army of Queens: Outside Representation Non-attacking Constraints in model based on Smith et al (2004): forall fields(i,j) on the chess board. white queen at field(i,j) ⇒

  34. Optimising Quantified Expressions Loop-invariant Expressions Peaceful Army of Queens: Outside Representation Non-attacking Constraints in model based on Smith et al (2004): forall fields(i,j) on the chess board. white queen at field(i,j) ⇒ forall k . no black queen at field(i,k) (same column)

  35. Optimising Quantified Expressions Loop-invariant Expressions Peaceful Army of Queens: Outside Representation Non-attacking Constraints in model based on Smith et al (2004): forall fields(i,j) on the chess board. white queen at field(i,j) ⇒ forall k . no black queen at field(i,k) (same column) ∧ no black queen at field(k,j) (same row)

Recommend


More recommend