Maximizing the Number of Satisfied L-clauses

by   Mohamed El Halaby, et al.
Cairo University

The k-SAT problem for Ł-clausal forms has been found to be NP-complete if k≥ 3. Similar to Boolean CNF formulas, Ł-clausal forms are important from a theoretical and practical points of view for their expressive power, easy-hard-easy pattern as well as having a phase transition phenomena. In this paper, we investigate further Ł-clausal forms in terms of instance generation and maximizing the number of satisfied Ł-clauses. Firstly, we prove that minimizing the cost of Ł-clausal forms is NP-complete and present an algorithm for the problem. Secondly, we devise an instance generation model to produce Ł-clausal forms with different values of k and degree of absence of negated terms (l_1 ⊕...⊕ l_m) (we call p) in each clause. Finally, we conduct empirical investigation to identify the relationship between the cost and other parameters of the instance generator. One of our findings shows that the cost decreases exponentially as p increases, for any clauses to variables ratio. This enables us to generate satisfiable and unsatisfiable instances with the same clauses to variables ratio.



There are no comments yet.


page 1

page 2

page 3

page 4


Phase Transitions of the Typical Algorithmic Complexity of the Random Satisfiability Problem Studied with Linear Programming

The Boolean Satisfiability problem asks if a Boolean formula is satisfia...

On the P vs NP question: a proof of inequality

The analysis discussed in this paper is based on a well-known NP-complet...

Planar 3-SAT with a Clause/Variable Cycle

In a Planar 3-SAT problem, we are given a 3-SAT formula together with it...

LaserTank is NP-complete

We show that the classical game LaserTank is NP-complete, even when the ...

Phase Transitions in Knowledge Compilation: an Experimental Study

Phase transitions in many complex combinational problems have been widel...

On Theoretical Complexity and Boolean Satisfiability

Theoretical complexity is a vital subfield of computer science that enab...

Problem Solving at the Edge of Chaos: Entropy, Puzzles and the Sudoku Freezing Transition

Sudoku is a widely popular NP-Complete combinatorial puzzle whose prospe...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Given a propositional formula in conjunctive normal form (CNF), the satisfiability problem (SAT) [2] is finding an assignment to the variables of the formula that satisfies every clause. SAT is a core problem in theoretical computer science because of its central position in complexity theory [7]. Moreover, numerous NP-hard practical problems have been successfully solved using SAT [11].

When there is no satisfying assignment it might still be useful to find a truth assignment that satisfies as many clauses as possible, this is the Boolean maximum satisfiability problem (MaxSAT), which is a famous generalization of SAT. There has been great advancements in developing efficient MaxSAT solvers in recent years [12, 9] and because of that, many practical NP-hard optimization problems have been efficiently solved using MaxSAT [6, 1].

The counterpart of SAT in fuzzy logic (and Łukasiewicz logic specifically) exists, although, less attention has been paid to developing efficient solvers for the problem. One of the recent attempts [5] consists of enhancing the start-of-the-art Covariance Matrix Adaptation Evolution Strategy (CMA-ES) algorithm. This was done by having multiple CMA-ES populations running in parallel and then recombining their distributions if this leads to improvements. Another recent finding [4] showed that a hillclimber approach outperformed CMA-ES on some problem classes. A different idea was recently proposed which involves encoding the formula as an Satisfiability Modulo Theories (SMT) program then employing flattening methods and CNF conversion algorithms to derive an equivalent Boolean CNF SAT instance [14].

In this paper, we shall focus on defining the MaxSAT problem for a particular class of Łukasiewicz formulas, called Ł-clausal forms. This type of formulas resembles CNF in the classical Boolean logic. In addition, -SAT, , for Ł-clausal forms has been shown to be NP-complete [3]. First, we prove that MaxSAT for Ł-clausal forms is NP-complete. Second, we build a formula generator to produce benchmarks with selected properties. The aim is to provide insights into the relationship between the number of falsified clauses and the different input parameters of our model. Finally, we solve the MaxSAT instance by augmenting fresh variables to each clause then encode and solve the new formula as an SMT program using Z3111

Z3 is an SMT solver from Microsoft Research that appeared in 2007. It is used to check the satisfiability of logical formulas over one or more theories. Supported theories include bit-vectors, arrays, propositional logic, among others.

[8]. Our experimental investigation showed that the number of falsified clauses increases exponentially as the frequency of occurrence of negated terms in the formula increases.

The paper is structured as follows. Firstly, we present some preliminaries and definitions regarding Ł-clausal forms and Lukasiewicz logic in general. Secondly, we define MaxSAT for Ł-clausal forms, prove that it is NP-complete and then introduce an algorithm to solve it. Thirdly, the generation and construction of Ł-clausal forms is presented. Finally, we report on empirical investigation regarding the cost of formulas generated with different parameter values.

2 Preliminaries

The basic connectives of Łukasiewicz logic are defined in Table 1. We will be dealing with five operations, namely negation (), the strong and weak disjunction ( and respectively) and the strong and weak conjunction ( and respectively).

Name Definition
Strong disjunction
Strong conjunction
Weak disjunction
Weak conjunction
Table 1: Logical operations in Łukasiewicz logic

It is important to note that one can generalize Boolean CNF by replacing the Boolean negation with the Łukasiewicz negation and the Boolean disjunction with the strong disjunction. The resulting form is

and is referred to as simple Ł-clausal form.

It has been shown [3] that the satisfiability problem for any simple Ł-clausal form is solvable in linear time, contrary to its counterpart in Boolean logic which is NP-complete in the general case. In addition, the expressiveness of simple Ł-clausal forms is limited. That is, not every Łukasiewicz formula has an equivalent simple Ł-clausal form. To remedy this matter, Botfill et al. proposed another form called Ł-clausal forms (Definition 1), for which the 3-SAT problem is NP-complete222The proof involves reducing Boolean 3-SAT to the SAT problem for Ł-clausal forms..

Definition 1.

Let be a set of variables. A literal is either a variable or . A term is a literal or an expression of the form , where are literals. An Ł-clause is disjunction of terms. An Ł-clausal form is a weak conjunction of Ł-clauses.

The authors also showed that 2-SAT is solvable in linear time for Ł-clausal forms. The difference between simple Ł-clausal forms and Ł-clausal forms is that in the latter, negations are allowed to be present above the literal level.

3 Maximizing the number of satisfied Ł-clauses

In Boolean MaxSAT, the problem can be stated in different ways. One definition is to find the cost (minimum number of falsified clauses). Another definition is to find an assignment that satisfies the maximum number of clauses (i.e., minimize the cost). In the Łukasiewicz version, we are going to go with the first problem definition.

Definition 2.

Given a set of propositional clauses or Ł-clauses , is the maximum number of satisfiable clauses in by any assignment.

Now we prove that maximizing the number of satisfied Ł-clauses is NP-complete.

Theorem 1.

Given a set of Ł-clauses and an integer , deciding whether there exists an assignment that satisfies at least Ł-clauses is NP-complete.


It is easy to see that the problem is in NP. Indeed, given an assignment to the variables, we can check whether or not it satisfies at least clauses in polynomial time. For the completeness part, we reduce from Boolean Max-2-SAT (i.e., MaxSAT instances with at most two literals per clause, which is NP-complete [10]).

Let be a Boolean Max-2-SAT instance of clauses over variables . We will create a set of Ł-clauses such that if and only if . The construction of is as follows:

  1. For each variable appearing in , add copies of the Ł-clause to .

  2. For each clause , add one copy of the Ł-clause to .

Thus, , where such that are identical copies of , and .

Let and be the corresponding assignment. For every , the copies are satisfied, because evaluates every to either 0 or 1. Hence, clauses are satisfied in . In addition, since and are equivalent when restricted to 0 and 1, thus, if are the clauses that are satisfied in , then are satisfied in .

Let and be the corresponding assignment. Since there are copies of every and there is only one copy of every clause of the other type, then satisfies . Hence, every appearing in is evaluated to either 0 or 1. Let be the clauses that satisfies. Now, we have , and since are also satisfied in , then .

Therefore, if and only if and thus deciding whether there is an assignment that satisfies at least Ł-clausal forms is NP-complete. ∎

One way to solve MaxSAT for Ł-clausal forms is as follows. Given a set of Ł-clauses, replace each by , , where each is a new variable that does not appear in . A cardinality constraint is added to minimize the sum of . Augmenting each with a new variable ensures that is satisfied. Adding the cardinality constraint ensures that the minimum number of ’s are true and thus the maximum number of Ł-clauses are satisfied.

4 Construction of Ł-clausal forms

We have carried out a similar experiment to the one done by Bofill et al. in [3] on 3-valued Ł-clausal forms. The instances used were generated in the following manner: given the number of variables and the number of clauses , each clause is generated from three variables and picked uniformly at random. Then, one of the following eleven Ł-clauses is drawn uniformly at random , , , , , , , , , and . As can be seen in Figure 1, phase transition occurs from clauses to variables ratio 1.71 to 2.0.

Figure 1: Probability of satisfiability of 3-valued Ł-clausal forms with 1500 variables and a number of clauses ranging from 100 to 6000.

Our model generates Ł-clausal forms with parameters , where is the number of Ł-clauses, is the number of variables, is the number of variables appearing in each Ł-clause and is the degree of absence of negated terms. The decision of whether or not to put a negated term in a clause is made as follows: Given , we generate a random integer , and if , then we add a negated term. The length of the negated term is a random integer between , where is the current length of the Ł-clause, i.e., we have literals left to add.

So, as increases, the number of negated terms in each clause decreases. For example, when approaches 1, the sum of the lengths of negated terms in each Ł-clause approaches , and when approaches , the sum approaches 0. In the next section, we will discuss the relationship between and the cost.

5 Results

In this section, we introduce and discuss our findings. We are interested in the relationship between the cost and clauses to variables ratio, and . The results below are obtained from 3-valued, uniformly generated formulas at random. The machine has 16GB of RAM and an Intel® Xeon® E5-1650 (12MB Cache, 3.20GHz) processor. No time limits were set for any of the experiments.

Figure 2: Relationship between the number of falsified Ł-clauses (cost) and the degree of absence of negated terms ().

First we discuss the relationship between the cost and . All formulas used have 50 variables, and to investigate the relationship over instances with different clauses to variables ratio, we generated three sets of formulas having 100, 150 and 200 Ł-clauses. As Figure 2 shows, a threshold phenomena between and the cost exists. When increases, the cost decreases exponentially regardless of the clauses to variables ratio.

Figure 3: Relationship between the cost and the clauses to variables ratio.

A near linear relationship can be seen in Figure 3 between cost and the clauses to variables ratio, regardless of the degree of absence of negated terms (). The formulas used have 4 literals in each Ł-clause (), 50 variables, and degrees of absence of negated terms () of 1, 2, 5, 10, 15 and 20. As can be seen, the phase transition happens at earlier clauses to variables ratio as decreases. Moreover, the results show a near linear trend overall across the different values.

Figure 4: Relationship between and the cost, with (top), (middle) and (bottom).

Finally, we explore the relationship between the number of literals in each clause () and the cost, illustrated in Figure 4. Our experiment was carried out on formulas with 50 variables, , and 200, 150, 100 and 50 Ł-clauses. A different value of is chosen and fixed for each subplot of Figure 4. The value of in all subplots ranges from 3 to 20. Regardless of the clauses to variables ratio or , the results show a decline in cost as increases. Moreover, it can be seen that the drop in cost becomes more apparent as increases from 2 to 10. This can be justified by the observation in Figure 2. The increase in gives more possibilities to satisfy each Ł-clause. However, as Figure 2 suggests, the cost increases exponentially as becomes lower, which takes precedence over the number of possibilities for satisfying Ł-clauses offered by higher values.

6 Conclusion and Future Work

In this paper, we have proved that maximizing the number of satisfied Ł-clauses is NP-complete by reduction from Max-2-SAT. Also, we have designed a formula generator for Ł-clausal forms with four essential parameters which is able to generate formulas having the same clauses to variables ratio but with different costs. Such a model is important for producing benchmarks that can be used to test solvers of Ł-clausal forms and study their properties. One important parameter is the degree of absence of negated terms, . As we have shown, with the increases in , the number of falsified Ł-clauses decreases exponentially.

We plan to extend our study to different types of formulas in Łukasiewicz logic, generated using different probability distributions (e.g., power law and exponential distributions). This is useful since formulas generated from applications tend to have non-uniform distributions when it comes to variable occurrences.

In classical Boolean logic, there have been various studies on predicting the satisfiability of instances at the phase transition [15, 16, 13]. All of them rely on generating polynomially-computable features to increase the accuracy of predicting the satisfiability. Thus, we will investigate how our model parameters can be used to learn the satisfiability of Ł-clausal forms generated near the phase transition area.


  • [1] Roberto Asín Achá and Robert Nieuwenhuis. Curriculum-based course timetabling with sat and maxsat. Annals of Operations Research, 218(1):71–91, 2014.
  • [2] Armin Biere, Marijn Heule, and Hans van Maaren. Handbook of satisfiability, volume 185. IOS press, 2009.
  • [3] Miquel Bofill, Felip Manya, Amanda Vidal, and Mateu Villaret. Finding hard instances of satisfiability in lukasiewicz logics. In Multiple-Valued Logic (ISMVL), 2015 IEEE International Symposium on, pages 30–35. IEEE, 2015.
  • [4] Tim Brys, Madalina M Drugan, Peter AN Bosman, Martine De Cock, and Ann Nowé. Local search and restart strategies for satisfiability solving in fuzzy logics. In Genetic and Evolutionary Fuzzy Systems (GEFS), 2013 IEEE International Workshop on, pages 52–59. IEEE, 2013.
  • [5] Tim Brys, Madalina M Drugan, Peter AN Bosman, Martine De Cock, and Ann Nowé. Solving satisfiability in fuzzy logics by mixing cma-es. In

    Proceedings of the 15th annual conference on Genetic and evolutionary computation

    , pages 1125–1132. ACM, 2013.
  • [6] Kerstin Bunte, Matti Järvisalo, Jeremias Berg, Petri Myllymäki, Jaakko Peltonen, and Samuel Kaski. Optimal neighborhood preserving visualization by maximum satisfiability. In AAAI, pages 1694–1700, 2014.
  • [7] Stephen A Cook. The complexity of theorem-proving procedures. In

    Proceedings of the third annual ACM symposium on Theory of computing

    , pages 151–158. ACM, 1971.
  • [8] Leonardo De Moura and Nikolaj Bjørner. Z3: An efficient smt solver. In International conference on Tools and Algorithms for the Construction and Analysis of Systems, pages 337–340. Springer, 2008.
  • [9] Mohamed El Halaby. Solving maxsat by successive calls to a sat solver. In Proceedings of SAI Intelligent Systems Conference, pages 428–452. Springer, 2016.
  • [10] Michael R Garey, David S. Johnson, and Larry Stockmeyer. Some simplified np-complete graph problems. Theoretical computer science, 1(3):237–267, 1976.
  • [11] Joao Marques-Silva. Practical applications of boolean satisfiability. In Discrete Event Systems, 2008. WODES 2008. 9th International Workshop on, pages 74–80. IEEE, 2008.
  • [12] Antonio Morgado, Federico Heras, Mark Liffiton, Jordi Planes, and Joao Marques-Silva. Iterative and core-guided maxsat solving: A survey and assessment. Constraints, 18(4):478–534, 2013.
  • [13] Eugene Nudelman, Kevin Leyton-Brown, Holger H Hoos, Alex Devkar, and Yoav Shoham. Understanding random sat: Beyond the clauses-to-variables ratio. In International Conference on Principles and Practice of Constraint Programming, pages 438–452. Springer, 2004.
  • [14] Joan Ramon Soler and Felip Manyà. A bit-vector approach to satisfiability testing in finitely-valued logics. In Multiple-Valued Logic (ISMVL), 2016 IEEE 46th International Symposium on, pages 270–275. IEEE, 2016.
  • [15] Haoze Wu.

    Improving sat-solving with machine learning.

    In Proceedings of the 2017 ACM SIGCSE Technical Symposium on Computer Science Education, pages 787–788. ACM, 2017.
  • [16] Lin Xu, Holger H Hoos, and Kevin Leyton-Brown. Predicting satisfiability at the phase transition. In AAAI, 2012.