decision procedures and verifjcation
play

Decision Procedures and Verifjcation NAIL094 Petr Kuera Charles - PowerPoint PPT Presentation

Decision Procedures and Verifjcation NAIL094 Petr Kuera Charles University 2019/20 (5th lecture) Petr Kuera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 1 / 47 Solvers based on stochastic (local)


  1. Decision Procedures and Verifjcation NAIL094 Petr Kučera Charles University 2019/20 (5th lecture) Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 1 / 47

  2. Solvers based on stochastic (local) search

  3. Walking Around the Cube WalkSat alternate between greedy and random choices 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) https://www.cs.rochester.edu/u/kautz/walksat Both available at Bart Selman, Kautz, Cohen, et al., 1993 Last version 1st April, 2019 Common idea: Selman, Leveque, and Mitchell, 1992 of clauses GSAT greedily fmip a variable which satisfjes the biggest number Stops after a restart limit is reached — incomplete Restart with another assignment after a number of fmips If it is not satisfying, pick a variable and fmip its value Pick a random assignment 3 / 47

  4. GSAT (Selman, Leveque, and Mitchell, 1992) return SAT 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) return UNKNOWN (possibly negative) in the number of unsatisfjed clauses 4 / 47 Output: SAT or UNKNOWN Function GSAT( ϕ , t , f ) Input: CNF ϕ , max number of tries t , max number of fmips f for i = 1 to t do α ← random full assignment for j = 1 to f do if α satisfjes all clauses of ϕ then x ← variable whose fmipping gives the greatest decrease α ( x ) ← ¬ α ( x ) // fmip the value of x

  5. GSAT Example Number of unsatisfjed clauses: 4 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) decrease unsatisfjed 5 / 47 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 0 1 0 1 0

  6. GSAT Example Number of unsatisfjed clauses: 4 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) decrease unsatisfjed 5 / 47 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 1 0 1 0 1 0 3 1

  7. GSAT Example Number of unsatisfjed clauses: 4 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) decrease unsatisfjed 5 / 47 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 1 1 0 1 0 3 3 1 1

  8. GSAT Example Number of unsatisfjed clauses: 4 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) decrease unsatisfjed 5 / 47 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 0 0 0 1 0 3 3 2 1 1 2

  9. GSAT Example Number of unsatisfjed clauses: 4 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) decrease unsatisfjed 5 / 47 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 0 1 1 1 0 3 3 2 2 1 1 2 2

  10. GSAT Example Number of unsatisfjed clauses: 4 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) decrease unsatisfjed 5 / 47 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 0 1 0 0 0 3 3 2 2 2 1 1 2 2 2

  11. GSAT Example Number of unsatisfjed clauses: 4 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) decrease unsatisfjed 5 / 47 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 0 1 0 1 1 3 3 2 2 2 4 1 1 2 2 2 0

  12. GSAT Example Number of unsatisfjed clauses: 4 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) decrease unsatisfjed 5 / 47 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 0 1 0 1 0 3 3 2 2 2 4 1 1 2 2 2 0 Flip variable x 3 Variables x 4 or x 5 could have been chosen as well

  13. GSAT Example Petr Kučera (Charles University) 2019/20 (5th lecture) Decision Procedures and Verifjcation 6 / 47 Flipped x 3 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 0 0 0 1 0 Next, fmip x 2 decrease 1 in the number of unsatisfjed clauses)

  14. GSAT Example Petr Kučera (Charles University) 2019/20 (5th lecture) Decision Procedures and Verifjcation 7 / 47 Flipped x 2 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 1 0 0 1 0 Next, fmip x 4 decrease 1 in the number of unsatisfjed clauses)

  15. GSAT Example All clauses are satisfjed 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) 8 / 47 Flipped x 4 ϕ = ( x 1 ∨ x 2 ∨ ¬ x 3 ) ∧ ( x 2 ∨ x 3 ∨ x 6 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ∨ ¬ x 4 ) ∧ ( ¬ x 3 ∨ x 4 ∨ x 6 ) ∧ ( ¬ x 1 ∨ x 4 ∨ ¬ x 5 ) ∧ ( x 2 ∨ ¬ x 3 ∨ ¬ x 6 ) ∧ ( x 1 ∨ ¬ x 3 ∨ ¬ x 5 ) ∧ ( ¬ x 2 ∨ x 4 ∨ x 6 ) ∧ ( x 2 ∨ x 4 ∨ ¬ x 5 ) x 1 2 3 4 5 6 α 0 1 0 1 1 0

  16. WalkSAT (Bart Selman, Kautz, Cohen, et al., 1993) Focused random walk with noise Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 9 / 47 Noise p gives the probability of a random fmip Random walk with probability p for instance 0 . 57 for random 3 -CNFs Greedy step with probablity 1 − p break-count of a variable x number of satisfjed clauses which become unsatisfjed after fmipping the value of x

  17. WalkSAT (Bart Selman, Kautz, Cohen, et al., 1993) // freebie move 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) return UNKNOWN // greedy move else // random walk move 10 / 47 Output: SAT or UNKNOWN Function WalkSAT( ϕ , t , f ) Input: CNF ϕ , max number of tries t , max number of fmips f for i = 1 to t do α ← random full assignment for j = 1 to f do if α satisfjes all clauses of ϕ then return SAT C ← an unsatisfjed clause of ϕ chosen at random if C contains a variable x with break-count 0 then v ← x else if rand( 0 , 1 ) < p then x ← a randomly chosen variable in C x ← variable in C with the smallest break-count α ( v ) ← ¬ α ( v ) // fmip the value of v

  18. Stochastic search Hard to add completeness to local search solvers efgectively CDCL solvers are getting closer to local search solvers with rapid restarts. Other approaches: Message passing algorithms — iteratively change value of a variable according to efgect of related clauses Warning propagation (Feige, Mossel, and Vilenchik, 2006) Survey propagation Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 11 / 47

  19. Hardness of Random 3-CNF Formulas Graph from the Handbook of Satisfjability (Biere et al., 2009) 2019/20 (5th lecture) Decision Procedures and Verifjcation Petr Kučera (Charles University) 12 / 47 4000 20--variable formulas 40--variable formulas 50--variable formulas 3500 3000 2500 # of DP calls 2000 1500 1000 500 0 2 3 4 5 6 7 8 Ratio of clauses-to-variables Peak at ratio α ≈ 4 . 26

Recommend


More recommend