# M-best solutions for a class of fuzzy constraint satisfaction problems

The article considers one of the possible generalizations of constraint satisfaction problems where relations are replaced by multivalued membership functions. In this case operations of disjunction and conjunction are replaced by maximum and minimum, and consistency of a solution becomes multivalued rather than binary. The article studies the problem of finding d most admissible solutions for a given d. A tractable subclass of these problems is defined by the concepts of invariants and polymorphisms similar to the classic constraint satisfaction approach. These concepts are adapted in two ways. Firstly, the correspondence of "invariant-polymorphism" is generalized to (min,max) semirings. Secondly, we consider non-uniform polymorphisms, where each variable has its own operator, in contrast to the case of one operator common for all variables. The article describes an algorithm that finds d most admissible solutions in polynomial time, provided that the problem is invariant with respect to some non-uniform majority operator. It is essential that this operator needs not to be known for the algorithm to work. Moreover, even a guarantee for the existence of such an operator is not necessary. The algorithm either finds the solution or discards the problem. The latter is possible only if the problem has no majority polymorphism.

## Authors

• 1 publication
• 9 publications
• 2 publications
07/16/2020

### A dichotomy theorem for nonuniform CSPs simplified

In a non-uniform Constraint Satisfaction problem CSP(G), where G is a se...
03/02/2020

### Piecewise Linear Valued Constraint Satisfaction Problems with Fixed Number of Variables

Many combinatorial optimisation problems can be modelled as valued const...
02/06/2016

### Fuzzy Maximum Satisfiability

In this paper, we extend the Maximum Satisfiability (MaxSAT) problem to ...
01/26/2012

### Constraint Propagation as Information Maximization

This paper draws on diverse areas of computer science to develop a unifi...
04/26/2011

### Hybrid Tractable Classes of Binary Quantified Constraint Satisfaction Problems

In this paper, we investigate the hybrid tractability of binary Quantifi...
12/02/2020

### Tractable Combinations of Theories via Sampling

For a first-order theory T, the Constraint Satisfaction Problem of T is ...
07/20/2020

### Biased measures for random Constraint Satisfaction Problems: larger interaction range and asymptotic expansion

We investigate the clustering transition undergone by an exemplary rando...
##### 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.

The constraint satisfaction problem (CSP) [Rossi:HCP2006] is one of the paradigms of machine intelligence. The problem is to find values for variables satisfying a given set of constraints or to determine inconsistency of the constraints. The set of all possible constraint satisfaction problems forms an NP-complete class. However, three tractable subclasses are known. Each of these subclasses is defined in terms of polymorphisms [Bulatov:SIAM2005, Cohen:HCP2006], i.e. operators under which the problem is invariant. The article considers sets of constraints invariant under majority operators.

A stronger version is the counting CSP, where the goal is to count the number of solutions of a CSP rather than merely to decide if a solution exists. The complexity of counting CSPs has been analyzed in papers [Bulatov:ACM2013, Bulatov:IC2007]. Evidently, this problem is stronger than the consistency problem, because any algorithm that solves the counting problem can be used to determine consistency. Unfortunately, the counting problem turns out to be much harder. The three known tractable subclasses of constraint satisfaction problems become NP-complete for the counting problem. Under some additional conditions only problems invariant under Maltsev operators are tractable [Bulatov:ACM2013, Bulatov:IC2007]. This essential difference between consistency and counting problems makes it worthwhile to state and analyze intermediate problems. We are interested in a problem that is weaker than the counting problem but still stronger than the consistency problem. The problem is to determine whether a given set of constraints has more than solutions where is a given number. To the best of our knowledge this problem has not been stated yet, let alone analyzed.

One of our results is an algorithm which proves whether a given set of constraints has more than solutions, provided that the constraints are invariant under a majority operator. The task is solved in polynomial time, avoiding an NP-complete counting problem. In case of a positive answer and , the algorithm returns possible solutions for the given set of constraints. This particular result is closest to traditional constraint satisfaction theory. The article as a whole covers a more general set of questions.

We consider one of the possible modifications of constraint satisfaction problems with multilevel constraints. Instead of simply categorizing solutions into consistent and inconsistent ones, they rather define a level of consistency. This modification can be interpreted as fuzzy constraint satisfaction problem [Dubois:CFS1993, Ruttkay:ICFS1994], where the problem is to find the solution with highest level of consistency or, for the sake of brevity, the maximum admissible solution. The search of the maximum admissible solution can be reduced to discrete optimization tasks for special functions and proves to be tractable if the problem has a majority polymorphism [schlesingerMoscow]. The main novelty of the present article is to show that best solutions (and not only the most admissible one) can be found in polynomial time under the same assumptions. The equivalent task in the context of standard constraint satisfaction problems is to determine whether the number of solutions is greater than . The exact formulation of the result is given in Section 2 after the main definitions. Section 3 explains relations to known results.

## 2 Problem definition and main result.

The article uses the denotation similar to the commonly used denotation .

###### Definition 1.

For a finite set , an ordered set , a function and an integer , the expression means that is a subset of such that and holds for any pair , . For the expression means that .

The subset specified by this definition is not necessarily unique, in the same way as the element defined by the expression is not necessarily unique. The set is equivalently defined by the inequalities

 maxi∈I∗f(i)⩽maxi∈I′f(i), (1)

which must be fulfilled for any subset with elements.

Let and be two finite sets called the set of objects and the set of labels. A function will be called a labeling. Let denote the value of a labeling for an object and let denote its restriction to a subset . Let denote the set of all possible labellings for any . Whenever we want to stress that the domain of a labeling is a union of a pair of disjoint subsets , the labeling will be denoted by , and not by . Let denote the set of all possible subsets . A set will be called a structure of the set , the number being the order of a structure.

Let be a totally ordered set, be a structure and let be a function given for each structure element . We assume that each of these functions is defined by a table .

###### Definition 2.

The input data of a minimax labeling problem or, simply a problem, is a quintuple

 Φ=⟨T,K,W,S⊂2T,(φS:KS→W∣S∈S)⟩. (2)

The order of the problem is defined as the order of the structure .

The article considers arbitrary but fixed sets and . Therefore, we refer to problems also in form of a triple and not by a quintuple (2).

The input data of a problem define its objective function with values , , where is the restriction of to .

###### Definition 3.

For a given positive integer the solution of a problem is a subset .

The set of problems (2) forms an NP-complete class, because any constraint satisfaction problem can be expressed in this format. We formulate a tractable subclass of such problems based on the concepts of polymorphisms and invariants, which are the main tools for tractability analysis of constraint satisfaction problems [Bulatov:SIAM2005, Cohen:HCP2006]. We generalize these concepts in order to analyze problems (2), which are more general than constraint satisfaction problems.

Let be a ternary operator defined for each . A collection of such operators is understood as an operator , defined for each . Applying it to a triple gives the labeling defined by , .

###### Definition 4.

A function is invariant under the operator and an operator is a polymorphism of the function if the inequality holds for each triple .

This definition was first introduced in [Bulatov:LNCS2003] and is more general than the polymorphism-invariant correspondence commonly used in constraint satisfaction theory. Definition 4 assumes that each object gets assigned its own operator , instead of assigning a single operator to all variables. If it is necessary to emphasize that the components of an operator depend on , and, may differ from each other, we call the operator non-uniform.

###### Definition 5.

An operator is a polymorphism of the problem , and a problem is invariant under the operator if is a polymorphism of all functions , .

###### Definition 6.

An operator is a majority operator if the equalities

 pi(y,x,x)=pi(x,y,x)=pi(x,x,y)=x

hold for all and for all .

The result of this paper is an algorithm that solves problems (2) if they have a majority polymorphism. Its time complexity depends on parameters , , , the number of required labellings and the total size of the tables, which represent the functions , . The main idea is to transform a problem of arbitrary order into an equivalent problem of order 2, and then to solve the second order problem by sequentially excluding variables. The order reduction procedure is described in Section 4, the approach for solving second order problems is described in Section 5.

The set of problems (2) solvable by the algorithm for includes a well known subclass of constraint satisfaction problems and its fuzzy modifications. Example 1 illustrates the likely less known fact that certain clustering problems can be expressed in the form (2). Example 2 shows, how solving (2) for can improve a certain workaround for solving problems with additional global constraints.

###### Example 1.

Clustering. Consider a finite set and a function defining a dissimilarity for each pair . A partition of the set into two subsets is a pair such that , and its quality is defined by the value

 F(T1,T2)=max{maxs,t∈T1r(s,t),maxs,t∈T2r(s,t)}.

One possible definition of a clustering problem is to find the best partition

 (T∗1,T∗2)=argmin(T1,T2)max{maxs,t∈T1r(s,t),maxs,t∈T2r(s,t)}. (3)

This problem is reduced to a minimax problem (2) by

 K={1,2},S={{s,t}∣∣s,t∈T,t≠s}, φ{s,t}(k,k′)={r(s,t)if k=k′,minWotherwise,{s,t}∈S.

A solution of this labeling problem defines a solution of the clustering problem (3) via .

The minimax problem has a binary label domain and is of order two. Any such problem is invariant under some majority operator and can be solved by the provided algorithm. ∎

###### Example 2.

Constraint relaxation. Suppose that the task is to find the best labeling for given data (2) under some additional constraints. Formally put, the labeling must belong to some given set of labellings. This might be a condition which is easy to verify. For example, it might be required that a certain label appears in a labeling at most times. However, seeking the best labeling

 ¯x∗=argmin¯x∈K[maxS∈SφS(xS)] (4)

under such additional constraints may turn out to be much harder than seeking the best labeling

 ¯x∗=argmin¯x∈KT[maxS∈SφS(xS)]. (5)

without such constraints. Moreover, it might happen that the additional constraints are hard to formalize. The set may represent, for example, a user who rejects labellings based on informal personal preferences.

A workaround is to find the best labeling (5) and to check condition afterwards. Obviously, if the condition holds, then is a solution of (4). However, this requirement is rather too strong. It can be weakened by finding best labellings. The approach for solving (4) is to consider labellings one by one, from best to worst. The first labeling in the sequence which fulfills is a solution of the task . Of course, this labeling may appear late in the sequence and the problem (4) will remain unsolved. However, an incorrect solution is excluded in any case. ∎

## 3 Relations to known results.

The closest counterpart to problem (2) are constraint satisfaction problems. It is known that constraint satisfaction problems with a majority polymorphism form a tractable subclass [Jeavons:AI1998]. This result can be easily generalized to problems (2) for . Solving is tractable because it can be reduced to solving constraint satisfaction problems.

We solve the task for arbitrary . For constraint satisfaction problems this means to prove existence of at least solutions satisfying the constraints. As far as we know, this question has not yet been studied for constraint satisfaction problems.

The article presents an algorithm that solves a certain subclass of an -complete class of problems. This subclass is defined in terms of existence of a non-uniform majority polymorphism. For practical application of the algorithm, it is necessary to either know its behavior on problems instances without such a polymorphism or to have a method for proving existence of a non-uniform majority polymorphism for a given problem instance. There are known methods for proving whether a problem has a uniform majority polymorphism [Cohen:HCP2006], however, we are not aware of such a method for non-uniform majority polymorphisms. We conjecture this to be a nontrivial task. The advantage of the presented algorithm is that such a prior control of input data is not required. For any problem (2) from an -complete class given on its input, the algorithm stops in polynomial time either returning a set of best labellings or discarding the problem. The latter is possible only if the problem has no majority polymorphism. Therefore, the algorithm solves any problem (2) that is invariant under some non-uniform majority operator and avoids to answer the potentially hard question of existence of such an operator let alone to find it.

## 4 Transforming problems of arbitrary order to problems of second order.

Let be a set of objects, and .

###### Definition 7.

The projection of a function onto the subset is the function , obtained by minimizing over all variables not in , i.e.

 φS(xS)=minxR∈KRφ(xS,xR).

The following property immediately follows from this definition.

###### Lemma 1.

Let , and be the projections of a function onto and respectively and be the projection of onto . Then .

The next two lemmas express properties of functions invariant under some operator.

###### Lemma 2.

If a function is invariant under an operator , then its projection is invariant under the same operator.

###### Proof:

Let us denote . Let , , be three labellings of the form . Since is the projection of onto , there exist three labellings

 ¯x=(xS,xR),¯y=(yS,yR),¯z=(zS,zR)

of the form , such that

 φ(¯x)=φS(xS),φ(¯y)=φS(yS),φ(¯z)=φS(zS).

Let us denote

 ¯u=P(¯x,¯y,¯z),uS=P(xS,yS,zS),uR=P(xR,yR,zR).

Because is the projection of onto and is invariant under , it follows that

###### Lemma 3.

If two functions are invariant under an operator , then their element-wise maximum, i.e. the function with values , , is invariant under the same operator.

###### Proof:

Let , be three labellings and . The fact that and are invariant under means that and . It follows that

 maximax{φ(¯xi),ψ(¯xi)}⩾max{φ(¯y),ψ(¯y)},

and, equivalently,

 maxiω(¯xi)⩾ω(¯y)=ω(P(¯x1,¯x2,¯x3)).

If a function has a majority operator then it has an important additional property.

###### Lemma 4.

Let be a function which has a majority polymorphism and let , , be pairwise disjoint subsets of such that . Denote by , , the projections of onto the subsets , , respectively. Then the equality

 φ(¯x)=max{φQR(xQ,xR),φQS(xQ,xS),φRS(xR,xS)}

holds for any labeling .

###### Proof:

Let us pick an arbitrary labeling for the following considerations. Let , , denote the restrictions of the labeling onto the subsets , , respectively. By definition of projection the inequalities

 φ(¯x)⩾φQR(xQ,xR), φ(¯x)⩾φQS(xQ,xS), φ(¯x)⩾φRS(xR,xS),

are valid, and, consequently we have

 φ(¯x)⩾max{φQR(xQ,xR),φQS(xQ,xS),φRS(xR,xS)}.

Let us prove the converse inequality

 φ(¯x)⩽max{φQR(xQ,xR),φQS(xQ,xS),φRS(xR,xS)}.

Because , , are the projections of the function onto the subsets , , , there exist three labellings , and such that

 φ(xQ,xR,yS)=φQR(xQ,xR), φ(xQ,yR,xS)=φQS(xQ,xS), (6) φ(yQ,xR,xS)=φRS(xR,xS).

The function has some majority polymorphism , therefore, (4) implies the chain

 φ(¯x)=φ(xQ,xR,xS)==φ(P(xQ,xQ,yQ),P(xR,yR,xR),P(yS,xS,xS))⩽⩽max{φ(xQ,xR,yS),φ(xQ,yR,xS),φ(yQ,xR,xS)}==max{φQR(xQ,xR),φQS(xQ,xS),φRS(xR,xS)}.\qed

Lemma 4 shows that any function of arguments that has a majority polymorphism, can be expressed in terms of three projections , , onto subsets , provided that the union of their pairwise intersections coincides with . Each of these functions depends on less variables than and, according to Lemma 2, they are invariant under the same operator as . Therefore, each of the functions , , can in turn be expressed in terms of functions of less variables. Moreover, there will be no collisions when projecting some functions and onto . According to Lemma 1, both projections are equal to the projection of onto . Therefore, any function that has a majority polymorphism can be expressed in form of , , where are the projections of onto and have the same majority polymorphism as .

The stated properties allow us to transform any problem with a majority polymorphism into an equivalent problem of second order, even if the polymorphism itself is not known. Instead of denoting the second order problem by a triple , we will denote it by a tuple , where , , are functions such that for all , and for all . The value of the objective function for a labeling is

###### Theorem 1.

Any problem that has a majority polymorphism can be transformed to a second order problem such that

 maxS∈SφS(xS)=maxi,j∈Tψij(xi,xj),¯x∈KT,

where is the restriction of labeling onto and are its values for . The second order problem is invariant under the same majority operator as .

###### Proof:

Let us denote the projection of onto by . We assume for . The functions are invariant under the same operator as the function . Let us define functions of the problem as . According to Lemma 3 these functions are invariant under the same operator as . Therefore, both problems and are invariant under the same majority operator. And, the following chain

 maxS∈SφS(xS)=maxS∈Smaxi,j∈SφSij(xi,xj)==maxi,j∈TmaxS∈SφSij(xi,xj)=maxi,j∈Tψij(xi,xj)

holds for each labeling . ∎

The proof of the theorem implicitly contains an algorithm for transforming the problem into the problem . Assuming that the functions , , which define the problem , are given in form of a tables , this algorithm reads as follows.

###### Algorithm 1.

Reducing the problem’s order.
Input: problem .
Output: problem .
….0. For each ,
….….….;
….1. for each
….….….1.0. for each ,
….….
{….….….;
….….
{….1.1. for each and each
….….
{….….….
….….{….1.2. for each
….….
{….….….if ,
….….
….….
{….1.3. for each ,
….….
{….….….. ∎

If the input problem has a majority polymorphism then Algorithm 1 is guaranteed to transform the problem into an equivalent problem of order two. Testing conditions in p.1.2 is redundant in this case. None of them holds. However, testing these conditions extends the scope of the algorithm to cover any problem, and not only those which have a majority polymorphism. The absence of a ”discard” message guarantees that the algorithm has successfully converted the input problem into a second order problem. This is true regardless of presence or absence of a majority polymorphism. Notice however, that the resulting problem has no majority polymorphism if the input problem lacks one. As will be shown in section 5, this does not violate the applicability of algorithms given there for solving problems of second order. The ”discard” message means that the problem is not in the applicability range of the algorithm. This is possible only if the problem has no majority polymorphism.

The complexity of Algorithm 1 as well as of all other presented algorithms is measured by the number of and operations. The complexity of Algorithm 1 depends polynomially on the parameters of the problem: the numbers , , , the order and the size of the input data.

The complexity of p.0 is of order . The total complexity for all of p.1.0 and 1.3 is of order . The total complexity for all of p.1.1 and 1.2 is of order .

## 5 Second order problems.

### 5.1 A general approach for excluding variables.

Let us define two problems and , for a set and the set obtained from by removing an arbitrary element . Consider an algorithm that “reduces” the search of a solution to the search of in a greedy way. Algorithms of this type minimize a function of variables by minimizing an auxiliary function of variables first, and then find the optimal value of the remaining -th variable by keeping the other variables fixed to the previously found minimizer of the auxiliary function. The auxiliary function itself is minimized by the same greedy algorithm, so that the optimization over variables is eventually “reduced” to optimizations over a single variable.

We modify this idea in two ways. Firstly, a greedy algorithm is used to find best solutions, and not only the best solution. Secondly, we include an essential test that allows to detect situations in which the result of the algorithm differs from .

###### Algorithm 2.

Greedy algorithm.
Input: a problem .
0. If ,
0. then ;
else
1. pick , let ;
2. using Algorithm 2 find ,
….….….;
3. if there is at least one labeling
….….….fulfilling the inequality
….….….,
4. construct the auxiliary set
4. ;
5. find . ∎

The subset returned by the algorithm is not necessarily the solution of the problem. However, testing conditions in p.3 allows to detect situations in which is a solution. The next lemma proves that is the required labeling subset if the algorithm does not output ”discard”.

###### Lemma 5.

Let and be two problems such that and . Let

 WORK={(x,xt)∈KT∣∣x∈Sol(Φ∗),xt∈K}

denote all possible extensions of labellings and let

 Sol′=arg(d)min¯x∈WORKmaxi,j∈Tφij(xi,xj).

be a set of best labellings in . If the inequality

 maxi,j∈Sφij(xi,xj)⩾mink∈Kmaxi∈Sφti(k,xi) (7)

holds for each labeling , then is a solution of , i.e.

###### Proof:

Denote

 φS(x) =maxi,j∈Sφij(xi,xj), θ∗ φ(¯x) =maxi,j∈Tφij(xi,xj), θ′ =max{φ(¯x)∣¯x∈Sol′}

for and .

Let us first prove that . We enumerate labellings from by numbers and denote by the labeling with number , so that . Let us define the label for each labeling . This gives labellings , . Because of assumption (7) they fulfill the equalities

 φ(x(l),xt(l))=φS(x(l)),l∈{1,2,…,d}, (8)

 θ′=max¯x∈Sol′φ(¯x)⩽max1⩽l⩽dφ(x(l),xt(l))==maxx∈Sol(Φ∗)φS(x)=θ∗.

The inequality in this chain follows from the property (1) of the set . The next equality is valid due to (8).

Let us prove that the inequality holds for all . For labellings this inequality follows directly from the definition of . It is also true for labellings , because

 φ(¯x)=maxi,j∈Tφij(xi,xj)⩾maxi,j∈Sφij(xi,xj)==φS(xS)⩾θ∗⩾θ′,

where is the restriction of to . The second inequality of this chain follows from the fact that if . We obtain, that holds for all and holds for all . According to Definition 1, this means that . ∎

It follows from Lemma 5, that the Algorithm 2 is applicable for the whole NP-complete class of problems. Its output is either ”discard” or a correct solution. Unfortunately, this correct solution is obtained only for a very limited set of simple problems. We expand this set by replacing the problem in step 2 of the algorithm by an equivalent problem . Equivalence means here that both problems have the same objective function, i.e. that holds for any labeling . Section 5.2 shows how to construct this equivalent problem in such a way, that the extension of Algorithm 2 solves all problems with a majority polymorphism.

### 5.2 Equivalent transformation of a problem.

###### Definition 8.

A structure defined for a set is called a star with center ; a structure defined for a set is called a simplex.

The objective function of a problem defined on a star structure is

 φ(¯x)=maxi∈T∖{t}φti(xt,xi),¯x∈KT.
###### Definition 9.

A transformation of a star into a simplex is the transformation of a problem , defined on a star structure, into a problem , defined on a simplex structure, such that are the projections of the objective function of onto .

The starting point for the following construction is to represent the objective function of the problem , defined on a simplex, in form of a maximum of two functions

 φ(¯x)=maxi,j∈Tφij(xi,xj)==max(maxi∈Sφti(xt,xi),maxi,j∈Sφij(xi,xj)),¯x∈KT. (9)

The first of these functions is the objective function of a problem defined on a star. The second one is the objective function of a problem defined on a smaller simplex.

###### Lemma 6.

Let be a problem, , and let be the projections of the function onto . Denote by the point-wise maximum of the functions and for . Then the equality

 φ(¯x)=max{maxi,j∈Sωij(xi,xj),maxi∈Sφti(xt,xi)}. (10)

holds for any labeling .

The functions