 # Fuzzy Maximum Satisfiability

In this paper, we extend the Maximum Satisfiability (MaxSAT) problem to Łukasiewicz logic. The MaxSAT problem for a set of formulae Φ is the problem of finding an assignment to the variables in Φ that satisfies the maximum number of formulae. Three possible solutions (encodings) are proposed to the new problem: (1) Disjunctive Linear Relations (DLRs), (2) Mixed Integer Linear Programming (MILP) and (3) Weighted Constraint Satisfaction Problem (WCSP). Like its Boolean counterpart, the extended fuzzy MaxSAT will have numerous applications in optimization problems that involve vagueness.

## Authors

##### 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

Boolean Satisfiability (SAT) stands at the crossroads of logic, graph theory and computer science in general. For this reason, nowadays more problems are being solved faster by SAT solvers than other means. A lot of real-life problems are difficult to solve because they pose computational challenges. In many of these problems, it is not sufficient to find a solution but rather one that is optimal. These are called optimization problems and they arise frequently in the real world. One of the most effective ways to solve optimization problems is to first model them mathematically or logically, then solve them using a suitable algorithm.

Maximum Satisfiability (MaxSAT) is the optimization version of SAT. In recent years, there has been a growing interest in developing efficient algorithms[18, 19] and implementing them into competent solvers that could solve instances from real-life applications[6, 12, 21, 4, 5]. In fact, an annual competition called The MaxSAT Evaluations is held for the purpose of running recent solvers on categories of benchmarks (random, crafted and industrial instances) then declaring a winner for each categories. Indeed, the performance of MaxSAT solvers is getting better with time and hence it is becoming more feasible to solve practical problems using MaxSAT.

Fuzzy logic is an extension of Boolean logic by Lotfi Zadeh in 1965 based on the theory of fuzzy sets, which is a generalization of the classical set theory. Introducing the notion of degree in the verification of a condition enables a condition to be in a state other than true or false (thus, infinite truth degrees). Fuzzy logic provides a very valuable flexibility for reasoning, which makes it possible to take into account inaccuracies and vagueness.

### 1.1 Boolean Logic and SAT

A Boolean variable can take one of two possible values: or . A literal is a variable or its negation . A disjunction is a group of literals joined by . This is expressed as A Boolean formula in Conjunctive Normal Form (CNF) is a group of disjunctions joined by (i.e., a conjunction of disjunctions). From now on, we will refer to a disjunction in a CNF formula as a clause. If consists of clauses where each clause is composed of literals, then can be written as

 ϕ=m⋀i=1Ci

where

 Ci=ri⋁j=1li,j

A formula is said to be -CNF if each clause has exactly literals. Sometimes we consider a CNF formula as a set of clauses . A Boolean CNF formula will be referred to as just a formula for short. If is a formula over the variables , then a complete assignment of is a set , where each is either or . A partial assignment is an assignment that leaves out some variables unassigned. An assignment (complete or partial) satisfies a literal if is assigned in and satisfies a literal if is assigned in . A clause is satisfied by if at least one literal of is satisfied by . A formula is satisfied by if satisfies all the clauses of .

The decision version of the SAT problem, given a formula , is deciding whether there exists an assignment that satisfies . The search version is concerned with finding (searching) for a satisfying assignment for . For example, has the satisfying assignment . The formula has the solution , which indeed satisfies .

### 1.2 MaxSAT

Maximum Satisfiability is a generalization of SAT. The idea behind it is that sometimes not all restrictions of a problem can be satisfied, and we try to satisfy as much of them as possible.

Given a CNF formula , MaxSAT asks for an assignment that maximizes the number of satisfied clausespipatsrisawat2007clone. For example, has as a solution. The maximum number of satisfied clauses in is three. Table 1.1 shows all the possible assignments for and the number of clauses that each one satisfies.

There are two general techniques to solve MaxSAT: (1) branch and bound algorithms, and (2) SAT-based algorithms. Branch and bound algorithms

work by searching the binary tree of all partial assignments to the variables of the input formula. The procedure starts with the empty assignment at the root of the tree and traverses it in a depth-first manner to find an optimal complete solution (represented by leaf nodes). Branching occurs on an unassigned variable at some node and the children of this node correspond to assigning the variable 1 or 0. Later works added more effective techniques in order to boost the search. Namely, more efficient data-structures, new branching heuristics, new simplification rules and more accurate lower bounds

[20, 1, 22, 23, 15, 13]. In practice, branch and bound Max-SAT solvers are suitable for instances generated at random and some crafted ones.

SAT-based MaxSAT algorithms[10, 17, 16, 14, 2] are based on iteratively calling a SAT solver. These techniques work by maintaining and refining a lower bound and/or an upper bound to the optimal solution with the help of a SAT-solver. It has been found that these techniques are particularly suitable for benchmarks coming from industrial applications and some crafted ones. One way to do this, given a Max-SAT instance, is to check if there is an assignment that falsifies no clauses. If such an assignment can not be found, the algorithm checks if there is an assignment that falsifies only one clause. This is repeated and each time the algorithm increments the number of clauses that are allowed to be falsified until the SAT solver returns 1 (or true), meaning that the minimum number of falsified clauses has been determined. Comprehensive surveys on SAT-based MaxSAT solving can be found in[18, 3].

### 1.3 Fuzzy Logic

Let be a nonempty set, a fuzzy set in is characterized by its membership function

 μA:X→[0,1]

and is interpreted as the degree of membership of element in fuzzy set for each . So, is determined by

 A={(x,μA(x))∣x∈X}

A fromula is built from a set of variables , constants from and an -ary connective for . An assignment (also called an interpretation)is a mapping , where:

• For each constant , .

• .

• , where is a binary connective.

The following table defines basic operations of Łukasiewicz logic. We will be dealing with five operations, namely negation (), the strong and weak disjunction ( and respectively) and the strong and weak conjunction ( and respectively).

Given a formula in Łukasiewicz logic and an assignment , we say that satisfies iff .

###### Example 1.1.

Let . Consider the following two assignments:

1. with .

 [ϕ]I1=¬(max{0+0−1,0}⊙¬1)=¬(0⊙0)=¬0=1
2. with .

 [ϕ]I2=¬(max{.6+0.7−1,0}⊙(¬0.2))
 =¬(max{.3+0.8−1,0})=¬0.1=0.9

So, satisfies , but does not.

The same principle of satisfiability exists in fuzzy logics (and many-valued logics), denoted SAT. Like its classical counterpart, it is useful for solving a variety of problems. We say that a formula in Łukasiewicz logic is satisfiable iff there exists an assignment such that .

###### Example 1.2.

In the previous example, is satisfiable since there exists an assignment () that satisfies it.

An assignment is said to be a model of a set of formulas iff for every formula , given a lower bound and upper bound for that formula (usually , and in classical logic even both ).

Solving satisfiability in fuzzy logics is still growing in theory as well as in application. In addition, to the best of our knowledge, MaxSAT has not been defined over fuzzy logic.

#### 1.3.1 Discretization

In practice, it is common to assume a finite number of truth degrees, taken from a set

 Tk={0,1k,2k,…,1}

with .

• Let denote infinite-valued Łukasiewicz logic and denote the -valued version in which only interpretations are considered that take truth degrees from .

• For every set of formulas in , there exists a finite number of truth degrees , such that is satisfiable in iff it is satisfiable in .

## 2 Fuzzy MaxSAT

###### Definition 2.1.

Given a set of formulae in Łukasiewicz logic, the MaxSAT problem asks for an assignment that maximizes the number of satisfied formulae in .

From now on we will call the MaxSAT problem defined over propositional logic “Boolean MaxSAT” and the one defined over Łukasiewicz logic “fuzzy MaxSAT”.

###### Definition 2.2.

The fuzzy Partial MaxSAT problem (fuzzy PMaxSAT) for the Łukasiewicz set of formulae is the problem of finding an assignment that satisfies all the formulae in and maximizes the number of satisfied formulae in .

###### Example 2.1.

Consider solving fuzzy MaxSAT on in example 1. Assignment is a solution since , which is the largest truth degree possible.

###### Theorem 2.1.

Boolean MaxSAT is reducible to fuzzy PMaxSAT in polynomial time.

###### Proof.

Let be a instance Boolean MaxSAT instance. We will construct a fuzzy MaxSAT instance such that maximizes the number of satisfied clauses in iff maximizes the number of clauses in , where is an assignment.

We construct and as follows:

1. For every variable appearing in , add the formula to . This formula evaluates to 1 iff or .

2. For every clause in , add the formula to .

Thus

 H={¬(x⊕x)⊕x∣x appears in ϕ}

and

 S={(l1⊕⋯⊕li)∣(l1∨⋯∨li)∈ϕ}

If the number of variables appearing in is and , then such that and .

Assume that there are satisfied clauses in . Then every variable evaluates to either 0 or 1. Thus, every is satisfied and hence all is satisfied. If a clause is satisfied, then is also satisfied. Hence, there are exactly satisfied formulae in .

Now assume that is a solution that satisfies clauses in . Then surely every variable appearing in has a value either 0 or 1. This is because certainly satisfies all formulae in , which ensure just that. Since the semantics of the strong disjunction when restricted to 0 and 1 is identical to the semantics of Boolean disjunction, then if is satisfied then so is . Therefore, satisfies exactly clauses in . ∎

## 3 Encodings

Before presenting the encodings, 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

 m⋀i=1(ri⨁j=1lij)

and is referred to as simple Ł-clausal form in.

It has been shown that the satisfiability problem for any simple Ł-clausal form is solvable in linear time, contrary to the SAT problem 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, another form has been proposed called Ł-clausal form, for which the SAT problem is NP-complete111The proof involves reducing Boolean 3SAT to the SAT problem for Ł-clausal forms..

###### Definition 3.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. A Ł-clause is disjunction of terms. A Ł-clausal form is a conjunction of Ł-clauses.

### 3.1 A Proposed Fuzzy MaxSAT Algorithm for Simple Ł-clausal forms

The proposed algorithm takes advantage of the fact that the SAT problem for simple Ł-clausal forms is solvable in linear time. Moreover, it is based on the basic SAT-based technique of Boolean MaxSAT solving.

Let be a MaxSAT instance. The following formula is satisfiable iff there are

 ϕk={C1∨b1,…,Cm∨bm}∪CNF(m∑i=1bi≤k)

where each is a new variable and is the encoding of the constraint to CNF. This constraint is satisfied if has at most falsified clauses. There are three ways to start searching for the value of which corresponds to the optimal solution, denoted :

1. Start at and increase while is unsatisfiable.

2. Start at and decrease while is satisfiable.

3. Do binary search for : alternate between satisfiable and unsatisfiable until the algorithm converges to .

An interesting question is, can we use the same technique for simple Ł-clausal forms? Remember that for such forms, the satisfiability problem is solvable in linear time, and thus the time complexity of the resulting algorithm will be a huge improvement over that of Boolean MaxSAT.

### 3.2 Into DLRs

A disjunctive linear relation (DLR) is an expression

 P1∘1Q1∨⋯∨Pm∘mQm

where each and is a polynomial of degree one with rational coefficients over the real-valued variables and each , ().

The satisfiability problem for a set of DLRs (denoted SAT) is determining whether there exists an assignment such that every DLR in is satisfied. In 1998, Jonsson and Bäckström showed that SAT is NP-complete.

Let be a set of formulae. We replace each by where is a new variable, for . Each of these formulae ensure that if is satisfied then is falsified.

Each occurrence of can be replaced by with the following inequalities: . The purpose of rewriting and is that they are nonlinear functions and they do not fit the formulation of DLRs. Each occurrence of can be replaced and rewritten similarly.

The final step is to add a bound on the variables to capture the semantics of maximizing the number of satisfied formulae. Thus, we first add the bound and check the satisfiability of the DLR instance. If it is not satisfiable, then we keep increasing the bound until the instance is satisfiable.

### 3.3 Into MILP

A Mixed Integer Linear Program (MILP) involves minimizing subject to

 n∑j=1aijxj≤bi,(i=1,2,…,m)
 xj≥0,(j=1,2,…,n)

where some of are integers and some are real and

Let be a set of formulas .

• Introduce

(one per formula).

• Replace each formula by the relaxed formula .

• Take the resulting formula of the previous step and replace every occurrence of and due to and just as shown in the DLR encoding.

Let be the result of performing the previous three steps on . The MILP instance would be:

 Minimize m∑i=1yi subject to f(ϕ1)≥1,…,f(ϕm)≥1

### 3.4 Into WCSP

A weighted CSP (WCSP) instance is a triple , where , and are variables, domains and constraints respectively. Each is a pair , where is the constraint scope and is a cost (weight) function that maps each tuple to its associated weight.

An optimal solution to a WCSP instance is a complete assignment to the variables in in which the sum of the costs of the constraints is minimal. The WCSP Problem for a WCSP instance consists in finding an optimal solution for that instance.

Given a set of formulae , we encode the problem as follows:

1. Create a variable for each formula with domain the set of possible assignments to the variables appearing in . When takes a value in this represents the fact that the variables of have been assigned accordingly.

2. For each variable add a constraint that assigns cost 0 to each domain value satisfying and assigns cost to the values falsifying .

3. For each two formulae and sharing variables, we add a constraint that assigns cost to assignments that assign different values to the shared variables, and cost 0 otherwise.

## 4 Future Work

Recently, it has been found that the satisfiability problem for simple Ł-clausal forms can be solved in linear time. We will investigate whether or not an algorithm for the new MaxSAT problem for simple Ł-clausal forms can take advantage of this fact in order for its time complexity to be polynomial.

An interesting alternative definition to fuzzy MaxSAT is: Given a formula in Łukasiewicz logic, find an assignment such that is maximum. In other words, the new definition asks for an assignment that maximizes ’s truth degree.

## References

•  Teresa Alsinet, Felip Manya, and Jordi Planes. A max-sat solver with lazy data structures.

, pages 334–342, 2004.
•  Xuanye An, Miyuki Koshimura, Hiroshi Fujita, and Ryuzo Hasegawa. Qmaxsat version 0.3 & 0.4. In Proceedings of the International Workshop on First-Order Theorem Proving, FTP, pages 7–15, 2011.
•  Carlos Ansótegui, Maria Luisa Bonet, and Jordi Levy. Sat-based maxsat algorithms. Artificial Intelligence, 196:77–105, 2013.
•  Josep Argelich, Daniel Le Berre, Inês Lynce, Joao Marques-Silva, and Pascal Rapicault. Solving linux upgradeability problems using boolean optimization. arXiv preprint arXiv:1007.1021, 2010.
•  Josep Argelich and Inês Lynce. Cnf instances from the software package installation problem. In RCRA Workshop, 2008.
•  Roberto Asín Achá and Robert Nieuwenhuis. Curriculum-based course timetabling with sat and maxsat. Annals of Operations Research, pages 1–21, 2012.
•  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.
•  Brian Borchers and Judith Furman. A two-phase exact algorithm for max-sat and weighted max-sat problems.

Journal of Combinatorial Optimization

, 2(4):299–306, 1998.
•  Michael David Fisher, Dov M Gabbay, and Lluis Vila. Handbook of temporal reasoning in artificial intelligence, volume 1. Elsevier, 2005.
•  Zhaohui Fu and Sharad Malik. On solving the partial max-sat problem. Theory and Applications of Satisfiability Testing-SAT 2006, pages 252–265, 2006.
•  Peter Jonsson and Christer Bäckström. A unifying approach to temporal constraint reasoning. Artificial Intelligence, 102(1):143–155, 1998.
•  Manu Jose and Rupak Majumdar. Cause clue clauses: error localization using maximum satisfiability. ACM SIGPLAN Notices, 46(6):437–446, 2011.
•  Javier Larrosa, Federico Heras, and Simon de Givry. A logical approach to efficient max-sat solving. Artificial Intelligence, 172(2):204–233, 2008.
•  Daniel Le Berre and Anne Parrain. The sat4j library, release 2.2 system description. Journal on Satisfiability, Boolean Modeling and Computation, 7:59–64, 2010.
•  Chu Min Li, Felip Manyà, and Jordi Planes. New inference rules for max-sat. Journal of Artificial Intelligence Research, 30(1):321–359, 2007.
•  Joao Marques-Silva and Vasco Manquinho. Towards more effective unsatisfiabilityimum satisfiability algorithms. In Theory and Applications of Satisfiability Testing–SAT 2008, pages 225–230. Springer, 2008.
•  Joao Marques-Silva and Jordi Planes. On using unsatisfiability for solving maximum satisfiability. arXiv preprint arXiv:0712.1097, 2007.
•  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.
•  Nina Narodytska and Fahiem Bacchus. Maximum satisfiability using core-guided maxsat resolution. In AAAI, pages 2717–2723, 2014.
•  Rolf Niedermeier and Peter Rossmanith. New upper bounds for MaxSat. Springer, 1999.
•  Sean Safarpour, Hratch Mangassarian, Andreas Veneris, Mark H Liffiton, Karem Sakallah, et al. Improved design debugging using maximum satisfiability. In Formal Methods in Computer Aided Design, 2007. FMCAD’07, pages 13–19. IEEE, 2007.
•  Haiou Shen and Hantao Zhang. Improving exact algorithms for max-2-sat. Annals of Mathematics and Artificial Intelligence, 44(4):419–436, 2005.
•  Zhao Xing and Weixiong Zhang. Maxsolver: An efficient exact algorithm for (weighted) maximum satisfiability. Artificial Intelligence, 164(1):47–80, 2005.