This page is created by M.Motoki and O.Watanabe. For question and/or comment of this page, please contact mmotoki@is.titech.ac.jp.
One can easily think of the following algorithm to generate positive instances:
Our first approach is to use this simple algorithm. We modify it to get a better generation algorithm.
Intuitively, the more clauses a formula has, the less number of assignments satisfy the formula. In fact, for the above simple algorithm, we can show that the algorithm outputs a unique solution formula with high probability if m > 7n/3 ln n + O(n). Furthermore, we can also show that m > 7n/3 ln n is necessary for the algorithm to yield a unique solution formula with high probability.
On the other hand, an interesting m and n ratio is about 4.2 in the case of 3SAT because m = 4.2n is the cross over point and it has been believed that a formula with this or closer ratio is difficult. Thus, we modify the above algorithm so that it yields a unique solution formula with high probability with much smaller m and n ratio. We can prove that our new algorithm outputs unique solution formula with probability, say half, when m > 4.3n. (See our paper in References and Links for further explanation.)
We call our unique solution instance generator G2.c. The program are called as
G2 [n] [m] > [outfile]
where [n] is the number of variables,
[m] is the number of clauses,
and [outfile] is output filename.
Caution: We use rand() as random generator because it is ANSI function. Hence, we recommend that you use other random generator if your rand() is not good. For example, many UNIX systems have random() instead of rand(). We also recommend Mersenne Twister.
The probability that G2.c generates a unique solution instance depends on the number of clauses m. Theoretically, we can give an upper bound on m. That is, we showed that our algorithm outputs a unique solution instance with high probability if m > ?n/? + o(n). We also have some experimental results. What follows is summary of our experiment for the case n = 100. It shows that the probability of getting a unique solution instance is fairly high when n = 100 and m = 500.
| num. of clauses | prob. of unique solution instance (from upper bound) | prob. of unique solution instance (from experiment) |
|---|---|---|
| 350 | 0 | |
| 360 | 0.001 | |
| 370 | 0 | |
| 380 | 0.01 | |
| 390 | 0.043 | |
| 400 | 0.1 | |
| 410 | 0.191 | |
| 420 | 0.305 | |
| 430 | 0.497 | |
| 440 | 0.589 | |
| 450 | 0.724 | |
| 460 | 0.786 | |
| 470 | 0.845 | |
| 480 | 0.870 | |
| 490 | 0.882 | |
| 500 | 0.887 | |
| 510 | 0.895 | |
| 520 | 0.921 | |
| 530 | 0.918 | |
| 540 | 0.932 | |
| 550 | 0.953 | |
| 560 | 0.947 | |
| 570 | 0.949 | |
| 580 | 0.964 | |
| 590 | 0.966 | |
| 600 | 0.239 | 0.966 |
| 610 | 0.573 | 0.973 |
| 620 | 0.714 | 0.987 |
| 630 | 0.791 | 0.975 |
| 640 | 0.840 | 0.979 |
| 650 | 0.873 | 0.979 |
| 660 | 0.896 | 0.982 |
| 670 | 0.914 | 0.980 |
| 680 | 0.928 | 0.986 |
| 690 | 0.939 | 0.982 |
| 700 | 0.948 | 0.986 |
| num. of clauses | prob. of unique solution instance (from experiment) |
|---|---|
| 350 | 0 |
| 360 | 0 |
| 370 | 0 |
| 380 | 0.008 |
| 390 | 0.037 |
| 400 | 0.139 |
| 410 | 0.284 |
| 420 | 0.472 |
| 430 | 0.689 |
| 440 | 0.821 |
| 450 | 0.903 |
| 460 | 0.968 |
| 470 | 0.986 |
| 480 | 0.992 |
| 490 | 0.997 |
| 500 | 0.998 |
| 510 | 1.000 |
| 520 | 1.000 |
| 530 | 1.000 |
| 540 | 1.000 |
| 550 | 1.000 |
In what follows we give some set of instances generated by using our generator.
Suppose that we generate k unique solution formulas with n variables and m clauses. Then by adding one more clause to each formula, we obtain a negative instance. Thus, combining all of them, we get a formula such that no assignment satisfies more than km - k clauses. With this idea, we can generate nontrivial instances for the MAX-3SAT problem.
Here we give a program called maxG3.c that generates MAX-3SAT instance based on G3. The program are called as
maxG3 [n] [m] [k] > [outfile]
where [n] is the number of variables,
[k] is minimum number of unsatisfiable clauses
and [m] means the number of clauses per [k].
Thus total number of clauses is [k]×[m].
Here we give some sets of instances obtained following this idea.
| num. of variables | num. of clauses | optimal num. of satisfied clauses | file name |
|---|---|---|---|
| 100 | 500 | 499 | max-100-500-1-1.txt |
| 100 | 500 | 499 | max-100-500-1-2.txt |
| 100 | 500 | 499 | max-100-500-1-3.txt |
| 100 | 500 | 499 | max-100-500-1-4.txt |
| 100 | 500 | 499 | max-100-500-1-5.txt |
| 100 | 1000 | 998 | max-100-1000-2-1.txt |
| 100 | 1000 | 998 | max-100-1000-2-2.txt |
| 100 | 1000 | 998 | max-100-1000-2-3.txt |
| 100 | 1000 | 998 | max-100-1000-2-4.txt |
| 100 | 1000 | 998 | max-100-1000-2-5.txt |
| 100 | 1500 | 1497 | max-100-1500-3-1.txt |
| 100 | 1500 | 1497 | max-100-1500-3-2.txt |
| 100 | 1500 | 1497 | max-100-1500-3-3.txt |
| 100 | 1500 | 1497 | max-100-1500-3-4.txt |
| 100 | 1500 | 1497 | max-100-1500-3-5.txt |