## D-Wave vs CPLEX Comparison. Part 3: WMAX2SAT
How good is CPLEX for the last series of test problems used in this McGe
Let's map the traditional definitions of 2SAT, MAX2SAT, and WMAX2SAT problems into mathematical programing. We have binary variables x
sum
where the l A 2SAT problem is decision problem where the constraints are 2-clauses. Given a 2SAT problem, the associated MAX2SAT problem is an optimization problem where the objective function is to maximize the number of clauses that can be satisfied. The weighted MAX2SAT (WMAX2SAT) problem is a generalization where each clause has a weight, and the sum of the weights of the satisfied clauses has to be maximized. Equivalently one can minimize the sum of the weights of the unsatisfied clauses.
We will denote the clause with literals u
w
The WMAX2SAT problem is to find values for the variables x
minimize sum
The rationale is the following. A clause w Replacing literals by their definition and expanding literal products yields QUBOs of the form
sum For instance, let's look at a very simple problem with one clause: 2: x + y >= 1 this is equivalent to minimize 2(1-x)(1-y) yielding this QUBO minimize 2xy -2x -2y + 2
McGeoch&Wang took 120 random instances from 2012 CPLEX was run with a time limit of 1800 seconds. Results published in the paper are given in the table below. It reads as follows. At n = 100, CPLEX was able to find 30 optimal solutions (of 40 instances) and to certify optimality in 10 cases. In all tests the CPLEX solution was never observed to be more than 7.5 units from optimal.
Results in McGeoch&Wang paper
As for - Use the latest CPLEX 12.5.1 release instead of the two years old 12.3 used in the paper
- Use parallelism. CPLEX was limited to using one thread in the paper.
- Use some CPLEX parameter tuning
- Use alternative ways of modeling the test problems
We first reused what gave the best results for the QUBO series, namely running CPLEX 12.5.1 on a 32 core machine with aggressive use of Gomory fractional cuts and zero half cuts on a model where product of variables were automatically linearized. Results are given below. We report the timings for finding the best solution and prove it is optimal. As before, the mean is the shifted geometric mean.
QUBO solving times with 32 threads in seconds We see that CPLEX takes about 17 seconds on average to do it, with a worst case of 89 seconds. We also see that CPLEX running time does not depend much on the number of variables. Our results are dramatically better than those reported in the paper. First of all, we are able to find and certify all optimal solutions in less than 90 seconds, whereas CPLEX could only certify about 1/4 of the solutions within 1800 seconds. Let's evaluate the speedup. The 10th fastest time for n=100 is 10.5 seconds. It means that in at most 10.5 seconds we can find best solution and certify optimality of 10 problem instances. In the paper this required up to 1800 seconds. We therefore have a speedup of 170x (1800/10.5) . Similarly for n=120, the 13th fastest time is 11.4, hence we have a speedup of about 160x (1800/11.4). Last, the 11th fastest time for n=140 is 11.8, which yields a speedup of about 150x (1800/11.8). Depending on the set of problems the speedup is between 150 and 170. What took 1800 seconds in McGeoch&Wang experiments now takes about 11 seconds. How does it look compared to other methods studied in the paper? Results were reported graphically as follows. With our new results the green boxes (for CPLEX) would now be similar to the blue boxes (the ones for the complete solver ak) for n=140. CPLEX would be therefore be in the same league as the specialized complete solver ak. It would also be not that far from heuristic methods, which is quite good given CPLEX certifies optimality of the solutions it finds.
Let's end with a discussion of how to best model WMAX2SAT problems as a MIP. We would model clause violation with a new binary variable z
minimize sum
Let's relate z
w
z
z
z
z
z
Depending on the sign of w
Wait a minute, isn't that what McGeoch&Wang did? Indeed, they also used the products (1 - u 2: x + y >= 1 which is equivalent to this QUBO minimize 2xy -2x -2y + 2 We would then linearize this with an extra variable z = xy, yielding minimize 2z -2x -2y +2 subject to z -x -y >= -1 z >= 0 Our direct approach would yield this model, where z is the variable associated to the violation of the clause minimize 2z subject to x + y + z >= 1 z >= 0 In general our model only contains the newly introduced variables in the objective function whereas the linearization of McGeoch&Wang models also have terms involving the original variables. Both models have the same number of constraints, two per clauses. It would have been nice to be able to compare the performance of both approaches. Unfortunately we were only provided the QUBOs, not the WMAX2SAT problems. It would be tempting to reconstruct the latter ones by undoing the transformation into QUBOs. Unfortunately this is not a 1 to 1 transformation. For instance, this MAX2SAT problem 1: x + y >= 1 -1: x + (1-z) >= 1 -1: y + z >= 1 yields this QUBO minimize xy + xz - yz - x This other WMAX2SAT problem yields the same QUBO. -1: x + (1-y) >= 1 1: x + z >= 1 -1: y + z >= 1 It may not be an issue for such simple problem, but undoing the transformation for larger problems looks like a combinatorial problem in itself. Solving it is way beyond the experiment we wanted to perform. |