DM841 DISCRETE OPTIMIZATION Part 2 – Heuristics
Satisfiability
Marco Chiarandini
Department of Mathematics & Computer Science University of Southern Denmark
Satisfiability Marco Chiarandini Department of Mathematics & - - PowerPoint PPT Presentation
DM841 D ISCRETE O PTIMIZATION Part 2 Heuristics Satisfiability Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark SAT Outline 1. SAT Mathematical Programming Constraint Programming
Department of Mathematics & Computer Science University of Southern Denmark
SAT
2
SAT
3
SAT
3
SAT
◮ From 100 variables, 200 constraints (early 90s)
◮ Applications:
◮ SAT used to solve many other problems!
4
SAT
◮ Formula in propositional logic: well-formed string that may contain
◮ propositional variables x1, x2, . . . , xn; ◮ truth values ⊤ (‘true’), ⊥ (‘false’); ◮ operators ¬ (‘not’), ∧ (‘and’), ∨ (‘or’); ◮ parentheses (for operator nesting).
◮ Model (or satisfying assignment) of a formula F: Assignment of truth
◮ Formula F is satisfiable iff there exists at least one model of F,
5
SAT
◮ Given: Formula F in propositional logic ◮ Task: Find an assignment of truth values to variables in F that renders
◮ Given: Formula F := (x1 ∨ x2) ∧ (¬x1 ∨ ¬x2) ◮ Task: Find an assignment of truth values to variables x1, x2 that renders
6
SAT
◮ A formula is in conjunctive normal form (CNF) iff it is of the form m
ki
◮ A formula is in k-CNF iff it is in CNF and all clauses contain exactly k
◮ In many cases, the restriction of SAT to CNF formulae
◮ For every propositional formula, there is an equivalent formula in 3-CNF.
7
SAT
◮ F is in CNF. ◮ Is F satisfiable?
8
SAT
◮ replace α ⇔ with (α =
◮ replace α =
◮ ¬ must appear only in literals, hence move ¬ inwards ◮ distributive law for ∨ over ∧:
9
SAT
◮ Definite clauses: exactly one literal in the clause is positive. Eg:
◮ Horn clauses: at most one literal is positive.
10
SAT
11
SAT
12
SAT
◮ How to model an optimization problem
◮ choose some decision variables
◮ express the problem constraints in terms of these variables
◮ express the objective function
◮ The result is an optimization model
◮ It is a declarative formulation
◮ There may be many ways to model an optimization problem 13
SAT
14
SAT
15
SAT
BoolVarArray x = BoolVarArray(∗this, nvariables, 0, 1); for (int c=0; c < nclauses; c++) { // Create positive BoolVarArgs BoolVarArgs positives(clauses[c].pos.size()); for (int i=clauses[c].pos.size(); i−−;) positives[i] = x[clauses[c].pos[i]]; BoolVarArgs negatives(clauses[c].neg.size()); for (int i=clauses[c].neg.size(); i−−;) negatives[i] = x[clauses[c].neg[i]]; // Post propagators clause(∗this, BOT_OR, positives, negatives, 1); } branch(∗this, x, INT_VAR_NONE(), INT_VAL_MIN());
16
SAT
17
SAT
18
SAT
19
SAT
◮ Component analysis to find
◮ Intelligent backtracking ◮ Random restarts ◮ Clever indexing (data structures) ◮ Variable value ordering
20
SAT
◮ Degree ◮ Based on the occurrences in the (reduced) formula
◮ Maximal Occurrence in clauses of Minimal Size (MOMS, Jeroslow-Wang)
◮ Variable State Independent Decaying Sum (VSIDS)
◮ original idea (zChaff): for each conflict, increase the score of involved
◮ improvement (MiniSAT): for each conflict, increase the score of involved
22
SAT
◮ Based on the occurrences in the (reduced) formula
◮ examples: Jeroslow-Wang, Maximal Occurrence in clauses of Minimal
23
SAT
24