Cumulative Scheduling and Pseudo-Boolean Constraints Deduction at - - PowerPoint PPT Presentation

cumulative scheduling and pseudo boolean constraints
SMART_READER_LITE
LIVE PREVIEW

Cumulative Scheduling and Pseudo-Boolean Constraints Deduction at - - PowerPoint PPT Presentation

Cumulative Scheduling and Pseudo-Boolean Constraints Deduction at Scale Albert Oliveras (+ Ignasi Ab o, Roberto As n, Robert Nieuwenhuis, Enric Rodr guez, Javier Larrosa, ...) Barcelogic Research Group, Tech. Univ. Catalonia,


slide-1
SLIDE 1

Barcelogic - Tech. Univ. Catalonia (UPC)

Cumulative Scheduling and Pseudo-Boolean Constraints Deduction at Scale

Albert Oliveras (+ Ignasi Ab´ ıo, Roberto As´ ın, Robert Nieuwenhuis, Enric Rodr´ ıguez, Javier Larrosa, ...)

Barcelogic Research Group, Tech. Univ. Catalonia, Barcelona

– p. 1

slide-2
SLIDE 2

Barcelogic - Tech. Univ. Catalonia (UPC)

Motivation

Assume a company needs to complete the following 15 jobs:

# Job Transport Unload Process Pack 1 1 truck 10 unloaders 5 technicians 3 packers 2 1 truck 5 unloaders 3 technicians, 1 supervisor 2 packers 3 1 car 2 unloaders 1 technicians , 1 supervisor 1 packer ... 15 1 truck 5 unloaders 3 technicians 2 packers

Tasks cannot be interrupted (non-preemptive) Task precedences: transport → unload ❀ process ❀ pack Each task has a certain duration Resource availability: 2 trucks, 4 cars, 30 unloaders, 13 techn., 3 superv., 8 packers GOAL: complete all jobs as early as possible

– p. 2

slide-3
SLIDE 3

Barcelogic - Tech. Univ. Catalonia (UPC)

Overview of the talk

Cumulative scheduling SAT encodings for PB constraints SAT encodings vs SMT Existing encodings Standard BDD-based encoding New results for BDD-based encodings CNFs for monotonic functions Probably BDDs for some PB constraints are non-poly Avoiding non-polynomial BDDs Conclusions and Future Work

– p. 3

slide-4
SLIDE 4

Barcelogic - Tech. Univ. Catalonia (UPC)

Problem statement

INPUT DATA: For each resource r ∈ R, an integer avail(r) For each task t ∈ T : d(t): duration of the task est(t): earliest starting time lct(t): latest completion time List of consumptions {(r, units(t, r)), . . . , } List of precedences t1 ❀ t2, and immediate ones t1 → t2 GOAL: find a valid schedule that minimizes makespan (i.e. minimizes the maximum completion time)

– p. 4

slide-5
SLIDE 5

Barcelogic - Tech. Univ. Catalonia (UPC)

Solving method

Best approach: encoding to SAT + PB-constraints ([StuckeyCP09]). Consider propositional variables: st,i ≡ start_time(t) ≤ i and add clauses: st,0 → st,1 st,1 → st,2 . . . [integer consistency]

¬st,est(t)−1

st,lct(t)−d(t) [satisfy est and lct] st2,0 → st1,0 st2,1 → st1,1 . . . [t1 precedes t2]

– p. 5

slide-6
SLIDE 6

Barcelogic - Tech. Univ. Catalonia (UPC)

Solving method

Best approach: encoding to SAT + PB-constraints ([StuckeyCP09]). Consider propositional variables: st,i ≡ start_time(t) ≤ i and add clauses: st,0 → st,1 st,1 → st,2 . . . [integer consistency]

¬st,est(t)−1

st,lct(t)−d(t) [satisfy est and lct] st2,0 → st1,0 st2,1 → st1,1 . . . [t1 precedes t2] Consider propositional variables: at,i ≡ task t is active at time i and define them with: at,i

start_time(t)≤i

start_time(t) + d(t)≥i + 1

– p. 5

slide-7
SLIDE 7

Barcelogic - Tech. Univ. Catalonia (UPC)

Solving method

Best approach: encoding to SAT + PB-constraints ([StuckeyCP09]). Consider propositional variables: st,i ≡ start_time(t) ≤ i and add clauses: st,0 → st,1 st,1 → st,2 . . . [integer consistency]

¬st,est(t)−1

st,lct(t)−d(t) [satisfy est and lct] st2,0 → st1,0 st2,1 → st1,1 . . . [t1 precedes t2] Consider propositional variables: at,i ≡ task t is active at time i and define them with: at,i

start_time(t)≤i

start_time(t) + d(t)≥i + 1 Add PB-constraints of the form:

t s.t. t uses r

units(t, r) ∗ at,i ≤ avail(r), for each r and time i

– p. 5

slide-8
SLIDE 8

Barcelogic - Tech. Univ. Catalonia (UPC)

Solving method

Best approach: encoding to SAT + PB-constraints ([StuckeyCP09]). Consider propositional variables: st,i ≡ start_time(t) ≤ i and add clauses: st,0 → st,1 st,1 → st,2 . . . [integer consistency]

¬st,est(t)−1

st,lct(t)−d(t) [satisfy est and lct] st2,0 → st1,0 st2,1 → st1,1 . . . [t1 precedes t2] Consider propositional variables: at,i ≡ task t is active at time i and define them with: at,i

start_time(t)≤i

start_time(t) + d(t)≥i + 1 Add PB-constraints of the form: 2x1 + 7x2 + 5x3 + 10x4 ≤ 12

– p. 5

slide-9
SLIDE 9

Barcelogic - Tech. Univ. Catalonia (UPC)

Overview of the talk

Cumulative scheduling

SATencodings for PB constraints

SAT encodings vs SMT Existing encodings Standard BDD-based encoding New results for BDD-based encodings CNFs for monotonic functions Probably BDDs for some PB constraints are non-poly Avoiding non-polynomial BDDs Conclusions and Future Work

– p. 5

slide-10
SLIDE 10

Barcelogic - Tech. Univ. Catalonia (UPC)

SAT Encoding for PB-Constraints

SAT + PB-constraints problems solvable with an SMT system But ... recent experience with SAT + cardinality constraints (PB with all coeffs. 1):

Speed-up factor if encoding Slow-down factor if encoding Suite TO 4 2 1.5 TOT. 1.5 2 4 TO TOT. MSU4 168 54 14 7 243 7 24 215 12 258 DES 321 53 20 16 410 11 4 15 MSU4: unsat-based max-SAT solving DES: discrete event system diagnosis problems

How to decide whether SAT or SMT is the best choice? Why can SAT sometimes beat SMT?

– p. 6

slide-11
SLIDE 11

Barcelogic - Tech. Univ. Catalonia (UPC)

How could SAT beat SMT?

SMT solvers can generate unsat proofs, which come in two parts: A resolution refutation from: the clauses of the input CNF the generated explanations (clauses) For each explanation clause, an independent proof in (its) T. So, after all, SMT generates a SAT encoding, but lazily. SMT solver runtime ≥ size of smallest resolution proof.

– p. 7

slide-12
SLIDE 12

Barcelogic - Tech. Univ. Catalonia (UPC)

How could SAT beat SMT? (2)

In “artificial-like” problems: SMT’s lazy SAT encoding could end up being a full one And... this full encoding could be a rather naive one. Example: T = cardinality constraints. T-solver is just a counter. Unsat instance: x1 + . . . + xn ≤ k and x1 + . . . + xn > k Refutation requires all ( n

k+1) explanations like, e.g.,

x1 ∨ x2 ∨ . . . ∨ xk+1 Here a good SAT encoding with auxiliary vars works better. Splitting on aux vars can give expon. speedup: Extended Resol. But... some constraints admit no P-size domain-consistent SAT encoding, e.g., alldiff [BessiereEtal’09].

– p. 8

slide-13
SLIDE 13

Barcelogic - Tech. Univ. Catalonia (UPC)

PB-constraints SAT Encodings

Desirable properties of a SAT Encoding: Polynomial size w.r.t. the number of vars of the constraint Consistent: take 2x1 + 4x2 + 2x3 ≤ 5 and I = {x1, x2}. Unit propagation should detect a false clause. Arc-consistent: take 2x1 + 3x2 + 7x3 ≤ 5 and I = {x1}. Unit propagation should propagate x3 Existing encodings:

Encoding Size Consistent Arc-consistent Tree-like Exponential yes yes BDD Not known yes yes Adders O(∑ log ai) no no Sorting O((∑ log ai) log2 ∑ log ai) yes no WatchDog O(n2 log n log amax) yes yes

– p. 9

slide-14
SLIDE 14

Barcelogic - Tech. Univ. Catalonia (UPC)

Why yet another encoding?

Existing arc-consistent polyn. encoding depends on coeffs. Take constraints: 3x1 + 2x2 + 4x3 ≤ 5 30001x1 + 19999x2 + 39998x3 ≤ 50007 They both represent the same Boolean function:

¬(x1 ∧ x3) ∧ ¬(x2 ∧ x3)

2nd constr. would have an unnecessarily large encoding A BDD-based encoding would solve this problem Question: what is the BDD size?

– p. 10

slide-15
SLIDE 15

Barcelogic - Tech. Univ. Catalonia (UPC)

Overview of the talk

Cumulative scheduling SAT encodings for PB constraints SAT encodings vs SMT Existing encodings

Standard BDD-based encoding

New results for BDD-based encodings CNFs for monotonic functions Probably BDDs for some PB constraints are non-poly Avoiding non-polynomial BDDs Conclusions and Future Work

– p. 10

slide-16
SLIDE 16

Barcelogic - Tech. Univ. Catalonia (UPC)

BDD construction process

Take constraint 2x1 + 3x2 + 5x3 ≤ 6 a construct the diagram:

x1 x2 x2 x3 x3 x3 x3 1

1 1 1 1 1 1 1

Ordering x1 < x2 < x3 is previously chosen

– p. 11

slide-17
SLIDE 17

Barcelogic - Tech. Univ. Catalonia (UPC)

BDD construction process

Take constraint 2x1 + 3x2 + 5x3 ≤ 6 a construct the diagram:

x1 x2 x2 x3 x3 x3 x3 1

1 1 1 1 1 1 1

x1 x2 x2 x3 x3 x3 1

1 1 1 1 1 1

Nodes with identical children are removed

– p. 11

slide-18
SLIDE 18

Barcelogic - Tech. Univ. Catalonia (UPC)

BDD construction process

Take constraint 2x1 + 3x2 + 5x3 ≤ 6 a construct the diagram:

x1 x2 x2 x3 x3 x3 x3 1

1 1 1 1 1 1 1

x1 x2 x2 x3 x3 x3 1

1 1 1 1 1 1

x1 x2 x2 x3 1

1 1 1 1

Isomorphic subtrees are merged

– p. 11

slide-19
SLIDE 19

Barcelogic - Tech. Univ. Catalonia (UPC)

BDD construction process

Take constraint 2x1 + 3x2 + 5x3 ≤ 6 a construct the diagram:

x1 x2 x3 1

1 1 1

Canonical BDD for the constraint and ordering x1 < x2 < x3

– p. 11

slide-20
SLIDE 20

Barcelogic - Tech. Univ. Catalonia (UPC)

CNF conversion of BDDs

x1 x2 x3 1

1 1 1

Add auxiliary (output) variable for each node: o1, o2 and o3

– p. 12

slide-21
SLIDE 21

Barcelogic - Tech. Univ. Catalonia (UPC)

CNF conversion of BDDs

x1 x2 x3 1

1 1 1

Add auxiliary (output) variable for each node: o1, o2 and o3 Specify behaviour of each node. For example: x1 ∧ o2 → o1 x1 ∧ o3 → o1

  • 2 ∧ o3 → o1

x1 ∧ o2 → o1 x1 ∧ o3 → o1

  • 2 ∧ o3 → o1

– p. 12

slide-22
SLIDE 22

Barcelogic - Tech. Univ. Catalonia (UPC)

CNF conversion of BDDs

x1 x2 x3 1

1 1 1

Add auxiliary (output) variable for each node: o1, o2 and o3 Specify behaviour of each node. For example: x1 ∧ o2 → o1 x1 ∧ o3 → o1

  • 2 ∧ o3 → o1

x1 ∧ o2 → o1 x1 ∧ o3 → o1

  • 2 ∧ o3 → o1

Add unit clause o1

– p. 12

slide-23
SLIDE 23

Barcelogic - Tech. Univ. Catalonia (UPC)

Overview of the talk

Cumulative scheduling SAT encodings for PB constraints SAT encodings vs SMT Existing encodings Standard BDD-based encoding

New results for BDD encodings

CNFs for monotonic functions Probably BDDs for some PB constraints are non-poly Avoiding non-polynomial BDDs Conclusions and Future Work

– p. 12

slide-24
SLIDE 24

Barcelogic - Tech. Univ. Catalonia (UPC)

CNF for BDDs of Monotonic Functions

PB-constraints are monotonic in the following sense: if M[x = 1] is a model, so is M[x = 0]. Consequence: only negated vars can be propagated We can exploit monotonicity and use only 2 clauses per node:

x t f

  • 1

f → o t ∧ x → o plus a unit clause with the root variable Encoding is arc-consistent for any monotonic function

– p. 13

slide-25
SLIDE 25

Barcelogic - Tech. Univ. Catalonia (UPC)

Exponential BDD for a given ordering

2n

  • a1

= · · ·

1

=

1 a2

= · · ·

1

=

2

· · · · · ·

a2n−1

=

1

· · ·

a2n

=

1

· · · =

22n−1 a2n+1

=

1

· · ·

1 a2n+2

=

1

· · ·

1

· · · · · ·

a4n−1

=

1 1

· · ·

a4n

=

1 1

· · ·

K

=

dm . . . d0

  • n in binary

1 1

· · ·

1 1

FIRST FACT: any selection of n coeffs. from the first 2n can be completed using the second half to add exactly K

– p. 14

slide-26
SLIDE 26

Barcelogic - Tech. Univ. Catalonia (UPC)

Exponential BDD for a given ordering

2n

  • a1

= · · ·

1

=

1 a2

= · · ·

1

=

2

· · · · · ·

a2n−1

=

1

· · ·

a2n

=

1

· · · =

22n−1 a2n+1

=

1

· · ·

1 a2n+2

=

1

· · ·

1

· · · · · ·

a4n−1

=

1 1

· · ·

a4n

=

1 1

· · ·

K

=

dm . . . d0

  • n in binary

1 1

· · ·

1 1

SECOND FACT: any two different selections of n coefficients form the first 2n have different sums

– p. 14

slide-27
SLIDE 27

Barcelogic - Tech. Univ. Catalonia (UPC)

Exponential BDD for a given ordering

2n

  • a1

= · · ·

1

=

1 a2

= · · ·

1

=

2

· · · · · ·

a2n−1

=

1

· · ·

a2n

=

1

· · · =

22n−1 a2n+1

=

1

· · ·

1 a2n+2

=

1

· · ·

1

· · · · · ·

a4n−1

=

1 1

· · ·

a4n

=

1 1

· · ·

K

=

dm . . . d0

  • n in binary

1 1

· · ·

1 1

PROOF: consider assignm. I1 and I2 to the first 2n vars. s.t. They assign exactly n variables to true sum(I1) < sum(I2)

– p. 14

slide-28
SLIDE 28

Barcelogic - Tech. Univ. Catalonia (UPC)

Exponential BDD for a given ordering

2n

  • a1

= · · ·

1

=

1 a2

= · · ·

1

=

2

· · · · · ·

a2n−1

=

1

· · ·

a2n

=

1

· · · =

22n−1 a2n+1

=

1

· · ·

1 a2n+2

=

1

· · ·

1

· · · · · ·

a4n−1

=

1 1

· · ·

a4n

=

1 1

· · ·

K

=

dm . . . d0

  • n in binary

1 1

· · ·

1 1

There exists an assignment A to the last 2n vars such that sum(I1 ∪ A) = K and hence sum(I2 ∪ A) > K. Hence I1 and I2 lead to different BDD nodes ⇒ at least (2n

n ) nodes

– p. 14

slide-29
SLIDE 29

Barcelogic - Tech. Univ. Catalonia (UPC)

Interval of a PB-constraint

We need an ingredient to prove the main result about BDD sizes. Consider again 2x1 + 3x2 + 5x3 ≤ 6. First observation: Note that no combination of coefficients can add 6 Hence, constraint is equivalent to 2x1 + 3x2 + 5x3 ≤ 5 In this case, we cannot repeat this process Second observation: Note that there is a combination that adds 7 Hence, constraint is not equivalent to 2x1 + 3x2 + 5x3 ≤ 7 CONCLUSION: constraint is equivalent to 2x1 + 3x2 + 5x3 ≤ [5, 6]. COMPLEXITY: solve subset sum problems (NP-complete) However, given the BDD, this can be easily computed.

– p. 15

slide-30
SLIDE 30

Barcelogic - Tech. Univ. Catalonia (UPC)

Interval of a PB-constraint

Take BDD for 2x1 + 3x2 + 5x3 ≤ 6 and a modified version:

x1 x2 x3 1

1 1 1

[5, 6] [5, 7] [0, 4] [0, ∞) (−∞, −1]

x1 x2 x2 x3 x3 1

1 1 1 1 1

[5, 6] [5, 7] [3, 4] [5, 8] [0, 4] [0, ∞) (−∞, −1]

We will compute intervals bottom up on the modified version (same could be done on the original one)

– p. 16

slide-31
SLIDE 31

Barcelogic - Tech. Univ. Catalonia (UPC)

Interval of a PB-constraint

Take BDD for 2x1 + 3x2 + 5x3 ≤ 6 and a modified version:

x1 x2 x3 1

1 1 1

[5, 6] [5, 7] [0, 4] [0, ∞) (−∞, −1]

x1 x2 x2 x3 x3 1

1 1 1 1 1

[5, 6] [5, 7] [3, 4] [5, 8] [0, 4] [0, ∞) (−∞, −1]

True node is equivalent to 0 ≤ [0, ∞) False node is equivalent to 0 ≤ (−∞, −1]

– p. 16

slide-32
SLIDE 32

Barcelogic - Tech. Univ. Catalonia (UPC)

Interval of a PB-constraint

Take BDD for 2x1 + 3x2 + 5x3 ≤ 6 and a modified version:

x1 x2 x3 1

1 1 1

[5, 6] [5, 7] [0, 4] [0, ∞) (−∞, −1]

x1 x2 x2 x3 x3 1

1 1 1 1 1

[5, 6] [5, 7] [3, 4] [5, 8] [0, 4] [0, ∞) (−∞, −1]

Let’s compute the interval for the root node: False child represents 3x2 + 5x3 ≤ [5, 7]. True child represents 3x2 + 5x3 ≤ [3, 4]

– p. 16

slide-33
SLIDE 33

Barcelogic - Tech. Univ. Catalonia (UPC)

Interval of a PB-constraint

Take BDD for 2x1 + 3x2 + 5x3 ≤ 6 and a modified version:

x1 x2 x3 1

1 1 1

[5, 6] [5, 7] [0, 4] [0, ∞) (−∞, −1]

x1 x2 x2 x3 x3 1

1 1 1 1 1

[5, 6] [5, 7] [3, 4] [5, 8] [0, 4] [0, ∞) (−∞, −1]

Let’s compute the interval for the root node: False child represents 2x1 + 3x2 + 5x3 ≤ [5, 7] (since x1 = 0) True child represents 2x1 + 3x2 + 5x3 ≤ [5, 6] (since x1 = 1) Hence root node represents 2x1 + 3x2 + 5x3 ≤ [5, 7] ∩ [5, 6] = [5, 6]

– p. 16

slide-34
SLIDE 34

Barcelogic - Tech. Univ. Catalonia (UPC)

Size of BDDs for PB constraints

  • Theorem. Unless NP=co-NP,

there are PB constr. for which all BDDs are non-poly

  • Proof. Assume poly BDDs always exist.

Take UNSAT subset sum pbl: ∃ subset of {a1, . . . , an} with sum K? (NP-complete problem) Let’s show there is a poly UNSAT certificate verifiable in poly time: We know that pbl is UNSAT iff a1x1 + . . . + anxn ≤ K and a1x1 + . . . + anxn ≤ K−1 are equiv. Take poly BDD for a1 + . . . an ≤ K (will act as the certificate) Checking that constraints are equivalent (i.e. pbl UNSAT) amounts:

  • 1. Computing the interval I of the root (poly time)
  • 2. Checking that K − 1 ∈ I

– p. 17

slide-35
SLIDE 35

Barcelogic - Tech. Univ. Catalonia (UPC)

Avoiding Non-Polynomial BDDs

Consider the constraint 9x1 + 8x2 + 3x3 ≤ 10 We can rewrite it using powers of two:

(8y1 + 1y2) + 8x2 + (2z1 + z2) ≤ 10

and add clauses for y1 = y2 = x1 and z1 = z2 = x3 Good news: BDDs for power-of-two PB constraints are polynomial Bad news: Arc-consistency for the original constraint is lost But... Nice consistency property is preserved:

A cannot be extended to a model ⇒ r unit-propagated

(where r is the BDD root) This allows us to recover arc-consistency [WalshIJCAI’09]

– p. 18

slide-36
SLIDE 36

Barcelogic - Tech. Univ. Catalonia (UPC)

Recovering Arc-consistency

Very simple idea: Take constraint C : 2e1x1 + . . . + 2enxn ≤ K Build BDD-encoding for Ci : 2e1x1 + . . . + 2ei · 1 + . . . + 2enxn ≤ K with root var ri Add clauses ri → xi It is easy to see that this recovers arc-consistency: Take assigment A that can only be extended with xi Hence Ci is inconsitent with A and ri is unit propagated xi is propagated due to clause ri → xi Upper bound on the final encoding size: O(n · n2 log amax)

– p. 19

slide-37
SLIDE 37

Barcelogic - Tech. Univ. Catalonia (UPC)

Overview of the talk

Cumulative scheduling SAT encodings for PB constraints SAT encodings vs SMT Existing encodings Standard BDD-based encoding New results for BDD encodings CNFs for monotonic functions Probably BDDs for some PB constraints are non-poly Avoiding non-polynomial BDDs

Conclusions and Future Work

– p. 19

slide-38
SLIDE 38

Barcelogic - Tech. Univ. Catalonia (UPC)

Conclusions and Future Work

Conclusions: Shown polynomial and arc-consistent BDD-based encoding Proved that, unless NP=co-NP, PB constraints have non-polynomial BDDs Future work: Find PB constraint family that exhibits exponential behavior Try to achieve arc-consistency without replicating constraints Experimental evaluation on diverse benchmarks

– p. 20