Solving the Max2Sat problem
Sonia Cafieri
LIX, École Polytechnique cafieri@lix.polytechnique.fr
Nov 18th 2008
- S. Cafieri (LIX)
max2sat problem 18/11/08 1 / 58
Solving the Max2Sat problem Sonia Cafieri LIX, cole Polytechnique - - PowerPoint PPT Presentation
Solving the Max2Sat problem Sonia Cafieri LIX, cole Polytechnique cafieri@lix.polytechnique.fr Nov 18 th 2008 S. Cafieri (LIX) max2sat problem 18/11/08 1 / 58 Outline Basic concepts and definitions 1 Some definition Problem statement
LIX, École Polytechnique cafieri@lix.polytechnique.fr
max2sat problem 18/11/08 1 / 58
1
2
3
max2sat problem 18/11/08 2 / 58
1
2
3
max2sat problem 18/11/08 3 / 58
max2sat problem 18/11/08 4 / 58
max2sat problem 18/11/08 5 / 58
max2sat problem 18/11/08 6 / 58
m
max2sat problem 18/11/08 7 / 58
max2sat problem 18/11/08 8 / 58
1
2
3
max2sat problem 18/11/08 9 / 58
max2sat problem 18/11/08 10 / 58
max2sat problem 18/11/08 11 / 58
max2sat problem 18/11/08 12 / 58
max2sat problem 18/11/08 12 / 58
max2sat problem 18/11/08 13 / 58
max2sat problem 18/11/08 14 / 58
max2sat problem 18/11/08 15 / 58
1
2
3
max2sat problem 18/11/08 16 / 58
max2sat problem 18/11/08 17 / 58
max2sat problem 18/11/08 17 / 58
max2sat problem 18/11/08 17 / 58
Yi
max2sat problem 18/11/08 18 / 58
Yi
max2sat problem 18/11/08 19 / 58
max2sat problem 18/11/08 20 / 58
1
2
3
max2sat problem 18/11/08 21 / 58
max2sat problem 18/11/08 22 / 58
max2sat problem 18/11/08 23 / 58
max2sat problem 18/11/08 24 / 58
max2sat problem 18/11/08 25 / 58
max2sat problem 18/11/08 26 / 58
1
2
3
max2sat problem 18/11/08 27 / 58
max2sat problem 18/11/08 28 / 58
max2sat problem 18/11/08 29 / 58
max2sat problem 18/11/08 30 / 58
max2sat problem 18/11/08 31 / 58
max2sat problem 18/11/08 32 / 58
max2sat problem 18/11/08 33 / 58
max2sat problem 18/11/08 34 / 58
max2sat problem 18/11/08 35 / 58
max2sat problem 18/11/08 36 / 58
max2sat problem 18/11/08 37 / 58
max2sat problem 18/11/08 38 / 58
max2sat problem 18/11/08 39 / 58
max2sat problem 18/11/08 40 / 58
max2sat problem 18/11/08 41 / 58
Yi
max2sat problem 18/11/08 42 / 58
max2sat problem 18/11/08 43 / 58
1
2
3
max2sat problem 18/11/08 44 / 58
max2sat problem 18/11/08 45 / 58
## parameters param m, integer; # number of clauses param n, integer; # number of variables (2n is the number of literals) set M := 1..m; set N := 1..n; # phi[i,j] = 1 if x_j appears in clause i # = -1 if bar{x}_j appears in clause i # = 0
param phi{M,N} integer, default 0; ## variables # x = 1 if literal x is true and 0 if false # y = 1 if clause is satisfied ## continuous relaxation var x{ i in N} >= 0, <=1; var y{ i in M} >= 0, <=1; ## objective maximize clauses: sum{i in M} y[i]; ## constraints subject to clause {i in M} : sum{j in N : phi[i,j] = 1} x[j] + sum{j in N : phi[i,j] = -1} (1-x[j]) >= y[i];
max2sat problem 18/11/08 46 / 58
param m := 4; # number of clauses param n := 3; # number of variables # phi[i,j] = 1 if x_j appears in clause i # = -1 if bar{x}_j appears in clause i # = 0
param phi := 1 1
1 2 1 2 1 1 2 2
3 2
3 3 1 4 1
4 3
;
max2sat problem 18/11/08 47 / 58
max2sat problem 18/11/08 48 / 58
max2sat problem 18/11/08 49 / 58
max2sat problem 18/11/08 50 / 58
max2sat problem 18/11/08 51 / 58
# param definitions ... repeat while (termination = 0) { # retrieve x’ from list # fix x’ (to 0 or 1) # solve LP relaxation
solve > /dev/null; if (solve_result = "infeasible") then { # no branching } else { # check if all xi are binary (integ = 1) if (integ = 1) then { if (clauses > fstar) then { let fstar := clauses; let {i in N} xstar[i] := x[i]; } # no branching } else { # branching # choice of the branching variable # update list } } # check for termination }
max2sat problem 18/11/08 52 / 58
max2sat problem 18/11/08 53 / 58
max2sat problem 18/11/08 54 / 58
max2sat problem 18/11/08 55 / 58
max2sat problem 18/11/08 56 / 58
max2sat problem 18/11/08 57 / 58
max2sat problem 18/11/08 58 / 58