The approximability of MAX CSP with fixed-value constraints

In the maximum constraint satisfaction problem (MAX CSP), one is given a finite collection of (possibly weighted) constraints on overlapping sets of variables, and the goal is to assign values from a given finite domain to the variables so as to maximize the number (or the total weight, for the weighted case) of satisfied constraints. This problem is NP-hard in general, and, therefore, it is natural to study how restricting the allowed types of constraints affects the approximability of the problem. In this article, we show that any MAX CSP problem with a finite set of allowed constraint types, which includes all fixed-value constraints (i.e., constraints of the form x = a), is either solvable exactly in polynomial time or else is APX-complete, even if the number of occurrences of variables in instances is bounded. Moreover, we present a simple description of all polynomial-time solvable cases of our problem. This description relies on the well-known algebraic combinatorial property of supermodularity.


Introduction and Related Work 1.Background
Many combinatorial optimization problems are NP-hard, and the use of approximation algorithms is one of the most prolific techniques to deal with NP-hardness.However, hard optimization problems exhibit different behaviour with respect to approximability, and complexity theory for approximation is now a well-developed area [2].
Constraint satisfaction problems (CSPs) have always played a central role in this direction of research, since the CSP framework contains many natural computational problems, for example, from propositional logic and graph theory (see, e.g., [13,25]).In a CSP, informally speaking, one is given a finite collection of constraints on overlapping sets of variables, and the goal is to decide whether there is an assignment of values from a given domain to the variables satisfying all constraints (decision problem) or to find an assignment satisfying maximum number of constraints (optimization problem).These are the main versions of the CSP, and there are many other versions obtained from them by modifying the objective (see, e.g., [13,32,33]).In this paper, we will focus Definition 1.1 (constraint) A constraint over a set of variables V = {x 1 , x 2 , . . ., x n } is an expression of the form f (x) where D is called the constraint predicate; and The constraint f (x) is said to be satisfied on a tuple a = (a i 1 , . . ., a im ) ∈ D m if f (a) = 1.
Note that throughout the paper the values 0 and 1 taken by any predicate will be considered as integers, not as Boolean values, and addition will always denote the addition of integers.Definition 1.2 (Max CSP) For a finite F ⊆ R D , an instance of Max CSP(F) is a pair (V, C) where • V = {x 1 , . . ., x n } is a set of variables taking their values from the set D; • C is a collection of constraints f 1 (x 1 ), . . ., f q (x q ) over V , where f i ∈ F for all 1 ≤ i ≤ q.
The goal is to find an assignment ϕ : V → D that maximizes the number of satisfied constraints, that is, to maximize the function f : D n → Z + , defined by f (x 1 , . . ., x n ) = q i=1 f i (x i ).If the constraints have (positive integral) weights ̺ i , 1 ≤ i ≤ q, then the goal is to maximize the total weight of satisfied constraints, that is, to maximize the function f : D n → Z + , defined by f (x 1 , . . ., Complexity classifications for various versions of constraint satisfaction problems have attracted much attention in the recent years (see surveys [32,33]) because, as the authors of [13] nicely put it, these classifications "present as reasonably accurate bird's eye view of computational complexity and the equivalence classes it has created".Classifications with respect to a set of allowed constraint types (such as F in Max CSP(F) above) have been of particular interest, e.g., [5,7,8,9,13,17,24].
Boolean constraint satisfaction problems (that is, when D = {0, 1}) are by far better studied [13] than the non-Boolean version.The main reason is, in our opinion, that Boolean constraints can be conveniently described by propositional formulas which provide a flexible and easily manageable tool, and which have been extensively used in complexity theory from its very birth.Moreover, Boolean CSPs suffice to represent a number of well-known problems and to obtain results clarifying the structure of complexity for large classes of interesting problems [13].In particular, Boolean CSPs were used to provide evidence for one of the most interesting phenomena in complexity theory, namely that interesting problems belong to a small number of complexity classes [13], which cannot be taken for granted due to Ladner's theorem.After the pioneering work of Schaefer [37] presenting a tractable versus NP-complete dichotomy for Boolean decision CSPs, many classification results have been obtained (see, e.g., [13]), most of which are dichotomies.In particular, a dichotomy in complexity and approximability for Boolean Max CSP has been obtained by Creignou [12], and it was slightly refined in [29] (see also [13]).The complexity of Boolean Max CSP with arbitrary (i.e., not necessarily positive) weights was classified in [26].
Many papers on various versions of Boolean CSPs mention studying non-Boolean CSPs as a possible direction of future research, and additional motivation for it, with an extensive discussion, was given by Feder and Vardi [17].Dichotomy results on non-Boolean CSPs give a better understanding of what makes a computational problem tractable or hard, and they give a more clear picture of the structure of complexity of problems, since many facts observed in Boolean CSPs appear to be special cases of more general phenomena.Notably, many appropriate tools for studying non-Boolean CSPs have not been discovered until recently.For example, universal algebra tools have proved to be very fruitful when working with decision, counting, and quantified CSPs [5,6,7,8,9] while ideas from lattice theory, combinatorial optimization and operations research have been recently suggested for optimization problems [11,34].
The main research problem that we will look at in this paper is the following.
Problem 1 Classify the problems Max CSP(F) with respect to approximability.
We say that a predicate is non-trivial if it is not identically 0. We will always assume that F is finite and contains only non-trivial predicates.Whenever we do not specify which version (weighted or unweighted) we consider, we mean unweighted Max CSP.Note that the definition allows one to repeat constraints in instances (we follow [13] in this), so our unweighted problem actually allows polynomially bounded weights.However, our tractability results will hold for the weighted version, while in our hardness results, for every F, we will use only instances where every constraint occurs at most k F times (where k F is a constant depending on F).
For the Boolean case, Problem 1 was solved in [12,13,29].It appears that Boolean Max CSP(F) problems exhibit a dichotomy in that such a problem is either solvable exactly in polynomial time or else APX-complete, i.e., does not admit a PTAS (polynomial-time approximation scheme) unless P=NP.These papers also describe the boundary between the two cases.This dichotomy result was extended to the case |D| = 3 in [27], which is to the best of our knowledge the only paper tackling Problem 1 in the non-Boolean case.

Results
For a subset D ′ ⊆ D, let u D ′ denote the predicate such that u D ′ (x) = 1 if and only if x ∈ D ′ .Let U D = {u D ′ | ∅ = D ′ ⊆ D}, that is, U D is the set of all non-trivial unary predicates on D. Furthermore, let C D = {u {d} | d ∈ D}.Note that predicates from C D give rise to constraints of the form x = d, i.e., fixed-value constraints.
The decision problems CSP(F) are similar to Max CSP(F), but the the task is to decide whether all constraints in a given instance can be simultaneously satisfied.Problems of the form CSP(F ∪ U D ) are known as conservative (or list) CSPs, and their complexity has been completely classified by Bulatov in [7], while a complexity classification for the problems of the form CSP(F ∪ C D ) would imply a classification for all problems CSP(F) [9].
In this paper we solve the above Problem 1 for all sets of the form F ∪ C D where D is any finite set.(Note that this does not necessarily imply a full solution to Problem 1, as it would for decision problems.)Our result is parallel to Bulatov's classification of conservative CSPs [7], but our techniques are quite different from the universal-algebraic techniques used in [7].The universal-algebraic techniques from [7,9] cannot be applied in the optimization setting because the basic properties of decision CSPs that make these techniques useful are not satisfied by Max CSP.
It was suggested in Section 6 of [11] that Max CSP(F ∪ C D ) is solvable exactly in polynomial time if and only if all predicates in F are supermodular with respect to some linear ordering on D (see definitions in Section 4).We prove that this is indeed the case, and that in all other cases the problem Max CSP(F ∪ C D ) is APX-complete.Moreover, we show that every APXcomplete problem of the above form is APX-complete even when we further restrict it to instances where the number of occurrences of variables is bounded by some (possibly large) constant.Note that approximability properties for constraint problems with the bounded occurrence property (as well as for related problems on graphs with bounded degree) have been intensively studied in the literature (see, e.g., [1,4,21,28]).
Our classification result uses the combinatorial property of supermodularity which is a wellknown source of tractable optimization problems [10,18,38], and the technique of strict implementations [13,29] which allows one to show that an infinite family of problems can express, in a regular way, one of a few basic hard problems.We remark that the idea to use supermodularity in the analysis of the complexity of Max CSP(F) is very new, and has not been even suggested in the literature prior to [11].It was shown in [11,27] that supermodularity is the only source of tractability for problems of the form Max CSP(F) when D is small (i.e., |D| ≤ 3).This, together with the results obtained in the present paper, suggests that supermodularity is indeed the appropriate tool for tackling Problem 1.Some of our technical results (those in Appendix A) are of independent interest in combinatorics.In [31], Klinz et al. study how one can permute rows and columns of a 0-1 matrix so as to avoid a collection of given forbidden submatrices; some results of this nature have later been used in constructing phylogenetic trees [35].Klinz et al. obtain many results in this direction, but they leave open the case when matrices are square and rows and columns must be permuted by the same permutation (see Section 6 of [31]).Our results clarify the situation in this special case for one type of forbidden matrices considered in Theorem 4.5 of [31].
The structure of the paper is as follows: Section 2 contains definitions of approximation complexity classes and reductions.In Section 3, we describe our reduction techniques, and in Section 4 we give the basics of supermodularity and discuss the relevance of supermodularity in the study of Max CSP.Section 5 contains the proof of the main theorem of the paper.Finally, In Section 6, we discuss an application of our results to the optimization version of the List H-colouring problem for digraphs.Some of the technical proofs omitted from the main body of the paper can be found in Appendices.

Basics of approximability
A combinatorial optimization problem is defined over a set of instances (admissible input data); each instance I has a finite set sol(I) of feasible solutions associated with it.The objective function attributes a positive integer cost to every solution in sol(I).The goal in an optimization problem is, given an instance I, to find a feasible solution of optimum cost.The optimal cost is the largest one for maximization problems and the smallest one for minimization problems.A combinatorial optimization problem is said to be an NP optimization (NPO) problem if its instances and solutions can be recognized in polynomial time, the solutions are polynomial-bounded in the input size, and the objective function can be computed in polynomial time (see, e.g., [2]).

Definition 2.1 (performance ratio)
where Opt(I) is the optimal cost for a solution to I. The following result is contained in Proposition 2.3 [11] and its proof.
Lemma 2.3 Every (weighted or not) problem Max CSP(F) belongs to APX.Moreover, if a is the maximum arity of any predicate in F then there is a polynomial time algorithm which, for every instance I of Max CSP(F), produces a solution satisfying at least q |D| a constraints, where q is the number of constraints in I.
Completeness in APX is defined using an appropriate reduction, called AP -reduction.Our definition of this reduction follows [13,29].
It is a well-known fact (see, e.g., Section 8.2.1 in [2]) that AP -reductions compose.We shall now give an example of an APX-complete problem which will be used extensively in this paper.

Example 2.5 Given a graph
This problem is known to be APX-complete (it is Problem GT33 in [2]).Let neq k denote the binary disequality predicate on Consider the problem Max CSP({neq k }) restricted to instances where every pair of variables appears in the scope of at most one constraint.This problem is exactly the Maximum k-colourable Subgraph problem.To see this, think of vertices of a given graph as of variables that take values from D, and introduce the constraint neq k (x, y) for every pair of variables x, y such that (x, y) is an edge in the graph.It follows that the problem Max CSP({neq k }) is APX-complete.
Note that the weighted Max CSP({neq k }) problem coincides with the well-known problem Max k-Cut (it is Problem ND17 in [2]).The Max 2-Cut problem is usually referred to as simply Max Cut.
In some of our hardness proofs, it will be convenient for us to use another type of approximationpreserving reduction, called an L-reduction [2].It is well known (see, e.g., Lemma 8.2 in [2]) that, within APX, the existence of an L-reduction from Π 1 to Π 2 implies the existence of an AP -reduction from Π 1 to Π 2 .

Reduction techniques
The basic reduction technique in our APX-completeness proofs is based on strict implementations, see [13,29] where this notion was introduced for the Boolean case.We will give this definition in a slightly different form from that of [13,29], but it can easily be checked to be equivalent to the original one (in the case |D| = 2).is satisfied for all y 1 , . . ., y m , and some fixed α ∈ Z + , then this equality is said to be a strict α-implementation of g from g 1 , . . ., g s .
We use α − 1 rather than α in the above equality to ensure that this notion coincides with the original notion of a strict α-implementation for Boolean constraints [13,29].The intuition behind the notion of strict implementation is that it allows one to modify instances while keeping control over costs of solutions.For example, assume that we have a constraint g(u, v) in an instance I of Max CSP, and there is a strict 2-implementation g(y 1 , y 2 ) + 1 = max z (g 1 (y 1 , z) + g 2 (z, y 2 )).
Then the constraint g(u, v) can be replaced by two constraints g 1 (u, z), g 2 (z, v) such that z does not appear in I, and we know that every solution of cost c to I can be modified (by choosing an appropriate value for z) to a solution of cost c + 1 to the new instance.We say that a collection of predicates F strictly implements a predicate g if, for some α ∈ Z + , there exists a strict α-implementation of g using predicates only from F. In this case we write for some α.It is not difficult to show that if f can be obtained from F by a series of strict implementations then it can also be obtained by a single strict implementation (for the Boolean case, this is shown in Lemma 5.8 [13]).In this paper, we will use about 60 specific strict implementations for the case when |D| = 4.Each of them can be straightforwardly verified by hand, or by a simple computer program 1 .
The following lemma is a simple (but important) example of how strict implementations work.Proof: It is easy to see that, for any In our proofs, we will use problems with the bounded occurrence property, so we now introduce notation for such problems.Definition 3.3 (bounded occurrence problems) Max CSP(F) − k will denote the problem Max CSP(F) restricted to instances with the number of occurrences of variables is bounded by k.We will write that Max CSP(F) − B is APX-complete to denote that Max CSP(F) − k is APX-complete for some k.
Note that, by definition, repetitions of constraints in instances of Max CSP are allowed.If a variable occurs t times in a constraint which appears s times in an instance, then this would contribute t • s to the number of occurrences of that variable in the instance.Proof: This lemma for the Boolean case, but without the assumption on bounded occurrences, is Lemma 5.18 in [13].Our proof is almost identical to the proof of Lemma 5.18 in [13], and it uses the same AP -reduction.Essentially, we only need to verify that the mapping F in this reduction preserves the bounded occurrence property.
Let k be a number such that Max CSP(F ∪ {f }) − k is APX-complete and let α ∈ Z + be such that F s =⇒ α f .Take an arbitrary instance I of Max CSP(F ∪ {f }) − k.Note that every predicate in F can be (trivially) strictly α-implemented from F in such a way that each auxiliary variable appears only once in the strict implementation (simply use any satisfiable collection of α−1 constraints with no repetitions of variables); this is a small technicality which ensures uniformity in the following transformation of instances.Replace every constraint in I by a set of constraints appearing in the right-hand side of its strict α-implementation from F, keeping the same primary variables and using fresh copies of auxiliary variables every time.Denote the obtained instance by I ′ .The function F in this AP -reduction will be such that F (I) = I ′ for all I. Let t be the maximum number of occurrences of a variable (primary or auxiliary) in the right-hand side of the strict implementation of f from F. It is clear that I ′ is an instance of Max CSP(F), and that the number of occurrences of any variable in I ′ is bounded by k ′ = tk.
Let V ′ be the set of variables in I ′ .Let ϕ ′ : V ′ → D be an r-approximate solution to I ′ .The mapping G uses two possible solutions to I and takes the better of the two.The first solution is ϕ ′ | V , while the second is a solution satisfying β = q |D| a constraints which exists by Lemma 2.3 (here a is the maximum arity of constraints in F ∪ {f }).
We have constructed an AP -reduction from Max CSP(F ∪ {f }) − k to Max CSP(F) − k ′ , thus proving the lemma. 2 Lemma 3.4 will be used as follows in our APX-completeness proofs: if F ′ is a fixed finite collection of predicates each of which can be strictly implemented by F then we can assume that F ′ ⊆ F. For example, if F contains a binary predicate f then we can assume, at any time when it is convenient, that F also contains f ′ (x, y) = f (y, x), since this equality is a strict 1-implementation of f ′ .Finally, we will use a technique based on domain restriction.For a subset Proof: Let k be a bound on the number of occurences such that Max CSP(F| We may without loss of generality assume that all n variables x i actually appear in constraint scopes in I.Note that We will show that this pair of mappings is an L-reduction for suitable α and β. Note that, for any solution to I ′ , changing all values outside of D ′ to any values in D ′ can only increase the cost of the solution.This follows from the fact that, by changing any value outside of D ′ to a value in D ′ , we can lose at most k satisfied constraints, but we satisfy k constraints of the form u D ′ (x).It follows that Opt(I ′ ) = Opt(I) + kn.
Let a be the maximum arity of constraints in F| D ′ .Let c = 1 |D| a .Then we have c • q ≤ Opt(I) by Lemma 2.3.Set α = ak c + 1.Note that we have n ≤ aq because the total length of constraint scopes in I is at least n and at most aq.Since n ≤ aq ≤ aOpt(I) c , we have so the first property of an L-reduction is satisfied.
We will now show that the second property is satisfied with β = 1.Let ϕ ′ and ϕ be solutions to I ′ and I, respectively, such as described above.
Let V 1 be the set of variables which ϕ ′ sends to D \ D ′ , and V 2 the variables sent to D ′ ; set r = |V 2 |.Divide all constraints in I ′ into three pairwise disjoint groups: C 1 consists of all constraints f i (x i ) that contain at least one variable from V 1 , C 2 of all constraints f i (x i ) that use variables only from V 2 , and C 3 contains the kn constraints of the form u D ′ (x i ).Let q 1 = |C 1 | and q 2 = |C 2 |.Furthermore, let s 1 and s 2 be the numbers of constraints in C 1 and C 2 , respectively, that are satisfied by ϕ.By the bounded occurrence property, we have To make use of results in [11,27], we need to introduce some more notation.
Definition 3.6 (endomorphism, core) An endomorphism of F is a unary operation µ on D such that, for all f ∈ F and all (a 1 , . . ., a m ) ∈ D m , we have We will say that F is a core if every endomorphism of F is injective (i.e., a permutation).If µ is an endomorphism of F with a minimal image im(µ) = D ′ then a core of F, denoted core(F), is the set The intuition here is that if F is not a core then it has a non-injective endomorphism µ, which implies that, for every assignment ϕ, there is another assignment µϕ that satisfies all constraints satisfied by ϕ and uses only a restricted set of values, so the problem is equivalent to a problem over this smaller set.As in the case of graphs, all cores of F are isomorphic, so one can speak about the core of F. The following rather simple corollary from Lemma 3.5 will be useful in our proofs.

Supermodularity and Monge properties 4.1 Basics of supermodularity
In this section we discuss the well-known combinatorial algebraic property of supermodularity [38] which will play a crucial role in classifying the approximability of Max CSP problems.
A partial order on a set D is called a lattice order if, for every x, y ∈ D, there exists a greatest lower bound x ⊓ y and a least upper bound x ⊔ y.The corresponding algebra Note that predicates are functions, so it makes sense to consider supermodular predicates.We say that F ⊆ R D is supermodular on L if every f ∈ F has this property.
A finite lattice L = (D, ⊓, ⊔) is distributive if and only if it can be represented by subsets of a set A, where the operations ⊓ and ⊔ are interpreted as set-theoretic intersection and union, respectively.Totally ordered lattices, or chains, will be of special interest in this paper.Note that, for chains, the operations ⊓ and ⊔ are simply min and max.Hence, the supermodularity property for an n-ary function f on a chain is expressed as follows: 1) The disequality predicate neq D is not supermodular on any chain on D. Take two elements 2) Fix a chain on D and let a, b be arbitrary elements of D2 .Consider the binary predicate f a , f b and f b a defined by the rules where the order on D 2 is component-wise.It is easy to check that every predicate defined above in this part of the example is supermodular on the chain.Note that such predicates were considered in [11] where they were called generalized 2-monotone.We will see later in this subsection (Lemma 4.4) that such predicates are generic supermodular binary predicates on a chain.
We will now make some simple, but useful, observations.Observation 4.3 1. Any chain is a distributive lattice.

A predicate is supermodular on a chain if and only if it is supermodular on its dual chain (obtained by reversing the order).
Given a chain in D, any binary function f on D can be represented as a |D| × |D| matrix M such that M (x, y) = f (x, y); here the chain indicates the order of indices of M , and M (x, y) is the entry in row x and column y of M .Note that this matrix is essentially the table of values of the predicate.For example, some binary predicates on D = {0, 1, 2, 3} that are supermodular on the chain 0 < 1 < 2 < 3 are listed in Fig. 1 (these predicates will be used later in the proof of Theorem 5.4).Note that all predicates in Fig. 1 have the form described in Example 4.2(2).For example, h 2 is f  A square matrix M is called anti-Monge (or a-Monge, for short) 2 if M (i, s) + M (r, j) ≤ M (i, j) + M (r, s) for all i < r and j < s.It is well known (and easy to check) that matrices corresponding to binary supermodular functions on a chain are precisely the a-Monge matrices (see, e.g., Observation 6.1 in [10]).Hence, one can view the tables in Fig. 1 as a-Monge matrices.We will be particularly interested in binary supermodular predicates on chains, and the next result describes the structure of 0-1 a-Monge square matrices.
In order to make the correspondence between matrices and binary functions more transparent, we will use the set J = {0, . . ., n − 1} to number rows and columns of an n × n matrix.Let L pq n denote the square 0-1 matrix of size n such that L pq n (i, j) = 1 if and only if i ≤ p and j ≤ q.Similarly, R st n denotes the square 0-1 matrix of size n such that R st n (i, j) = 1 if and only if i ≥ s and j ≥ t.Let U and W be two subsets of J.We denote by M [U, W ] the |U | × |W | submatrix of M that is obtained by deleting all rows not contained in U and all columns not in W . Expression M [U, W ] = a will mean that all elements in the submatrix are equal to a.

Lemma 4.4 A non-zero 0-1 matrix M of size n × n without all-ones rows and columns is an a-Monge matrix if and only if one of the following holds
for some 0 ≤ p, q ≤ n − 2 and 1 ≤ s, t ≤ n − 1, with p < s, or q < t, or both.
Proof: It is easy to see that matrices L pq n , R st n and L pq n + R st n are a-Monge matrices.Assume now that matrix M is an a-Monge matrix.We consider two cases: M (0, 0) = 0 and M (0, 0) = In what follows we use the following 0-1 property of 0-1 a-Monge matrices: Let M (0, 0) = 0.It follows from the 0-1 property that then row 0 and column 0 in the matrix contain only zeros because, otherwise, the matrix would have an all-ones row or column.
Let M (u, v) = 1 for some u, v > 0. Since the row 0 and column 0 contain only zeros, the 0-1 property yields M (x, y) = 1 for all x ≥ u, y ≥ v (and, in particular, M (n − 1, n − 1) = 1).Let s be the smallest row containing one (s > 0), and t be the smallest column containing one in row s.We claim that there is no column j, j < t, with M (z, j) = 1 for some z.Indeed, in this case the submatrix M [{s, z}, {j, t}] would not be an a-Monge matrix.This completes the proof that, in the case when M (0, 0) = 0, we have M = R st n , for some 1 ≤ s, t ≤ n − 1.If M (0, 0) = 1 and M (n − 1, n − 1) = 0, then by symmetry, we have M = L pq n , for some 0 ≤ p, q ≤ n − 2. Let us now consider the case with M (0, 0) = M (n − 1, n − 1) = 1.Recall that, by assumption, every row and every column of M contains at least one 0. Let p + 1 be the smallest row with 0 in column 0, and q+1 be the smallest column with 0 in row 0. Then we have M [{0, . . ., p}, {0, . . ., q}] = 1.Indeed, if there is M (i, j) = 0 for some 0 < i ≤ p and 0 < j ≤ q then we choose this element to be as close to the left-top corner as possible, and the submatrix M [{i − 1, i}, {j − 1, j}] is not a-Monge.Furthermore, let s − 1 be the largest row with 0 in the last column, and t − 1 be the largest column with 0 in the last row.As above, we have M [{s, . . ., n − 1}, {t, . . ., n − 1}] = 1.Note that we have p < s, or q < t, or both, since, otherwise, M would contain an all-ones row or column.

Supermodularity and Max CSP
The property of supermodularity has been used to classify the approximability of problems Max CSP(F) for small sets D (though, originally the classification for the case |D| = 2 was obtained and stated in [12,13,29] without using this property).Remark 4.7 It was shown in Lemma 5.37 of [13] that, for D = {0, 1}, F ⊆ R {0,1} can strictly implement neq 2 whenever Max CSP(F) is APX-complete in the above theorem (i.e.whenever F is a core that is not supermodular on any chain).Moreover, it follows from (the proof of ) Theorem 3 [27] that if |D| = 3 and F is supermodular on some chain on D then F ∪ C D can strictly express neq 2 or neq 3 by using a sequence of the following operations: • adding to F a predicate that can be strictly implemented from F • taking the core of a subset of F (i.e., replacing F by a subset of F| D ′ for some D ′ ⊆ D).
It was shown in [1] that Max Cut remains APX-complete even when restricted to cubic graphs.Since Max Cut is the same problem as Max CSP({neq 2 }) (see Example 2.5), it follows that Max CSP({neq 2 }) − B is APX-complete.Moreover, since neq k | {0,1} = neq 2 , it follows from Lemma 3.5 that Max CSP({neq k , u {0,1} }) − B is APX-complete for any k.Therefore, we obtain the following corollary by combining Remark 4.7 with Lemmas 3.4 and 3.5.The tractability part of our classification is contained in the following result: Theorem 4.9 ([11]) If F is supermodular on some distributive lattice on D, then weighted Max CSP(F) is in PO.

Main result
We will need the following two technical lemmas.They will be used in our hardness proof to reduce the argument to the case when all non-unary predicates are binary and their matrices do not contain all-ones rows or columns.Lemma 5.1 If F is not supermodular on any chain on D then F ∪ U D can strictly implement a collection F ′ of binary predicates which is is not supermodular on any chain on D.
Proof: Let f ∈ F be not supermodular on some fixed chain.By Observation 4.3(2), f is n-ary with n ≥ 2. By Lemma 4.5, it is possible to substitute constants for some n − 2 variables of f to obtain a binary predicate f ′ which is not supermodular on this chain.Assume without loss of generality that these variables are the last n − 2 variables, and the corresponding constants are d 3 , . . ., d n , that is, f ′ (x, y) = f (x, y, d 3 , . . ., d n ).Then the following is a strict (n − 1)-implementation of f ′ : Repeating this for all chains on D, one can strictly implement a collection F ′ of binary predicates that is not supermodular on any chain.2 Lemma 5.2 [Lemma 3.3 [27]] Assume that h ∈ R D and there is a ∈ D such that h(x, a) = 1 for all x ∈ D. Let h ′ (x, y) = 0 if y = a and h ′ (x, y) = h(x, y) if y = a.Then the following holds: 1. for any chain on D, h and h ′ are supermodular (or not supermodular) on the chain simultaneously; 2. the problems Max CSP({h} ∪ U D ) and Max CSP({h ′ } ∪ U D ) are AP -reducible to each other.
The next result immediately follows from Corollary A.3 and Proposition A.6 (see Appendix A), by using the correspondence between 0-1 a-Monge matrices and binary supermodular predicates.
Proposition 5.3 If F is a set of binary predicates that is not supermodular on any chain on D then there exist Recall that all predicates from C D are supermodular on any chain on D. We will now prove our main result: Proof: The tractability part of the proof follows immediately from Theorem 4.9 (see also Observation 4.3(1)).By Lemmas 3.2 and 3.4, it is sufficient to prove the hardness part for sets of the form F ∪ U D .We will show that {neq 2 } can be obtained from F ∪ U D by using the following two operations: 1. replacing F ∪ U D by a subset of F ∪ U D ∪ {f } where f is a predicate that can be strictly implemented from F ∪ U D ; 2. replacing F ∪ U D by a subset of F| D ′ ∪ U D ′ for some D ′ .By Example 2.5 and Lemmas 3.4 and 3.5, this will establish the result.It follows from Lemmas 5.1 and 3.4 that it is sufficient to prove the hardness part of Theorem 5.4 assuming that F contains only binary predicates.Now, Proposition 5.3 and Lemma 3.5 imply that, in addition, we can assume that |F| ≤ 3 and |D| ≤ 4. Note that the case |D| ≤ 3 is already considered in Corollary 4.8 (see also Remark 4.7), so it remains to consider the case |D| = 4; we can without loss of generality assume in the rest of the proof that D = {0, 1, 2, 3}.Moreover, due to Lemma 3.5, we may consider only sets F satisfying the following condition: for any proper subset D ′ ⊂ D, F| D ′ is supermodular on some chain on D ′ .
( * ) We can assume that F is minimal with respect to inclusion, that is, every proper non-empty subset of F is supermodular on some chain on D. We will consider three cases depending on the number of predicates in F. Note that, by Lemma 5.2, we can without loss of generality assume that none of the predicates in F has a matrix containing an all-ones row or column (this property does not depend on the order of indices in the matrix).
We prove the result by using a computer-generated case analysis in each of the three cases.In each case, we first produce a list of all possible sets F with the above restrictions, then optimize the list by using various symmetries, and, finally, for each remaining set F, provide a strict implementation of a set F ′ that is known to have an APX-hard Max CSP(F ′ ) problem.To compactly describe such symmetries, we introduce some notation.Let π be a permutation on D and f a binary predicate on D. Then, we define π(f ) to be the predicate such that π(f )(a, b) = 1 if and only if f (π(a), π(b)) = 1 for all a, b ∈ D; in this case we say that the predicate π(f ) is isomorphic to f .We also define the predicate f t so that f t (a, b) = 1 if and only if f (b, a) = 1 for all a, b ∈ D (this corresponds to transposing the matrix of f ).We say that a predicate of the form π(f t ) is anti-isomorphic to f .Case 1. |F| = 1.First, we use exhaustive search to generate the list of all binary predicates f on D that (a) do not have all-ones rows or columns, (b) are not supermodular on any chain on D, and (c) F = {f } satisfies condition ( * ).Moreover, we may consider predicates only up to isomorphism and antiisomorphism.Thus, this list is then processed as follows: for every predicate f in the list, in order, remove all predicates below f in the list that are isomorphic or anti-isomorphic to f .Clearly, it is sufficient to prove the hardness result for all predicates that remain in the optimized list.Since there are only 2 16 = 65536 predicates to check, it is clear that generating and optimizing the list can easily be (and actually was) performed by a computer.The optimized list contains only 27 predicates which are given in Fig. 2.
We show, starting from h ′ 1 and proceeding in order, that {h ′ i } ∪ U D strictly implements some binary predicate g such that either, for some D ′ ⊂ D, the predicate g| D ′ is not supermodular on any chain on D ′ or g is equal to h ′ j for some j < i (up to isomorphism and anti-isomorphism).These implementations can be found in Appendix B. This, together with Remark 4.7, implies that neq 2 can be obtained from F ∪ U D .Case 2. |F| = 2. Let F = {f 1 , f 2 }.As in Case 1, we use exhaustive search to generate the list of all pairs of binary predicates on D such that (a) they do not have all-ones rows or columns, (b) each of the two predicates is supermodular on at least one chain, but there is no chain on which they are both supermodular, and (c) F satisfies condition ( * ).Without loss of generality, we can assume that f 1 is supermodular on the chain 0 < 1 < 2 < 3, that is, the matrix of f 1 with this order of indices is a-Monge.Since the matrix of f 1 does not have all-ones row or column, its structure is described in  Lemma 4.4.Similarly, the matrix of f 2 is a permuted a-Monge matrix, since π(f 2 ) is supermodular for some permutation π.
We can also assume that the a-Monge matrices for f 1 and f 2 (with respect to the orders on which the predicates are supermodular) have the third form (L pq 4 + R st 4 ) from Lemma 4.4.The reason is that if, say, the matrix of f 1 has the form L pq 4 for some 0 ≤ p, q ≤ 2 then f ′ 1 (x, y) . Hence, we can replace f 1 by f ′′ 1 in this pair, and show the hardness result for {f ′′ 1 , f 2 }.It is clear that if prove the result for all pairs (f 1 , f 2 ) with some fixed f 1 , then this also proves the result for all pairs with the first component f t 1 , or π(f 1 ), or π(f t 1 ) where π(x) = 3 − x.This implies that it is sufficient to consider only predicates from Fig. 1 as possible candidates for f 1 .Moreover, it can be straightforwardly checked by using a computer that if f 1 is one of the predicates h 1 , h 3 , h 4 , h 6 , h 7 , h 9 , h 10 from Fig. 1, then F = {f 1 , f 2 } fails to satisfy condition ( * ).Hence, all pairs (f 1 , f 2 ), where at least one of f 1 and π(f 2 ) (for some permutation π) coincides with one of 7 predicates above, will not be on the list of pairs that we need to consider.
Obviously, if we prove the result for some pair (f 1 , f 2 ) then this also proves the result for (f 1 , f t 2 ).Hence, provided f 2 = f t 2 , one of these two pairs can be excluded from the list.Now we show that predicates h 5 , h 11 , h 12 , and h 17 from Fig. 1 can also be excluded from consideration because they can strictly implement some other predicates from Fig. 1.Implementations: As above, all pairs (f 1 , f 2 ) such that, for some permutation π, π(f 2 ) or π(f t 2 ) is one of h 5 , h 11 , h 12 , h 17 , can also be excluded from the list.
Finally, we can exclude from the list all pairs isomorphic to some pair higher up in the list.That is, we exclude pair (f 1 , f 2 ) if there is a permutation π such that either π(f 1 ) = f 1 and the pair (f 1 , π(f 2 )) is above (f 1 , f 2 ) in the list or if there is a permutation π such that the pair (π(f 2 ), π(f 1 )) is above (f 1 , f 2 ) in the list (in the latter case, π(f 2 ) must be supermodular on 0 < 1 < 2 < 3).
The optimized list now contains 27 pairs of predicates.In Appendix C, we provide strict implementations for them that show that, for each pair (f 1 , f 2 ) in this list, {f 1 , f 2 }∪U D implements either a pair above it in the list or else a binary predicate g such that, for some D ′ ⊂ D, the predicate g| D ′ is not supermodular on any chain on D ′ .As in Case 1, it follows that neq 2 can be obtained from F ∪ U D .Case 3. |F| = 3.It can be checked by computer-assisted exhaustive search that there does not exist such a set F. 3Simply loop through all triples of (not necessarily distinct) binary predicates on {0, 1, 2} which are supermodular on the chain 0 < 1 < 2 and check that each possible extension to a triple of pairwise distinct predicates on D results in a set F satisfying one of the following conditions: 1. F is supermodular on some chain on D, 2. for some D ′ ⊂ D, F| D ′ is not supermodular on any chain on D ′ , 3. some proper subset of F is not supermodular on any chain on D.

2
Remark 5.5 Note that, for any fixed D, it can be checked in polynomial time whether a given F is supermodular on some chain on D. That is, given F, we can check in polynomial time whether Max CSP(F ∪ C D ) is tractable or APX-complete.

Application to List H-coloring optimization
In this case, the digraph G is said to be H-colorable.The Graph H-colorability problem is, given a digraph G, to decide whether it is H-colorable.This problem attracts much attention in graph theory [25].
In this section, we consider the case when F consists of a single binary predicate h.This predicate specifies a digraph H such that V H = D and (u, v) is an arc in H if and only if h(u, v) = 1.Any instance I = (V, C) of CSP({h}) can be associated with a digraph G I whose nodes are the variables in V and whose arcs are the scopes of constraints in C. It is not difficult to see that the question whether all constraints in I are simultaneously satisfiable is equivalent to the question whether G I is H-colorable.Therefore, the problem CSP({h}) is precisely the Graph H-colorability problem for the digraph H.The problems CSP({h} ∪ U D ) and CSP({h} ∪ C D ) are equivalent to the List H-coloring and H-retraction problems, respectively.In the former problem, every vertex of an input digraph G gets a list of allowed target vertices in H, and the question is whether G has an H-coloring subject to the list constraints.The latter problem is the same except that each list contains either one or all vertices of H.These problems also attract much attention in graph theory [25].
The problem Max CSP({h} ∪ U D ) can then be viewed as the List H-coloring optimization problem: for every vertex v of an input digraph G, there is a list L v ⊆ V H along with a function ρ v : L v → Z + that indicates the 'score' which a mapping V G → V H gets if it sends v to a certain vertex (if a mapping sends v to a vertex outside of L v then this adds nothing to the 'cost' of this mapping).Then the goal is to maximize the combined 'cost' of such a mapping which is obtained by adding weights of preserved arcs and 'scores' from the lists.The 'score' functions ρ v arise as the result of the possible presence in C of several weighted constraints of the form u D ′ (v) for different D ′ ⊆ D and the same v.Thus, Theorem 5.4 in the case when F = {h} presents a complexity classification of list H-coloring optimization problems.Digraphs H corresponding to the tractable cases of this problem are the digraphs that have an a-Monge adjacency matrix under some total ordering on V H (note that this property of digraphs can be recognised in polynomial time, e.g., by using Proposition 5.3).Such matrices without all-one rows or columns are described in Lemma 4.4.It remains to note that, as is easy to see, replacing either some all-zero row or some all-zero columns with all-one ones does not affect the property of being a-Monge.
We remark that another problem related to optimizing list homomorphisms between graphs was recently considered in [19], in connection with some problems arising in defence logistics.the recognition of bad matrices is loosely based on the COM (Construct partial Orders and Merge them) algorithm, suggested in [15].This algorithm constitutes a general approach to deciding whether a given matrix, possibly with some unknown elements, can be permuted to avoid a special set of 2 × 2 submatrices.In our case, these are submatrices M [{i, j, k, l}] with ∆(i, j, k, l) < 0. We will use the idea of the COM algorithm, which goes as follows: given a matrix M , we try to construct an a-Monge permutation for it.We start with a pair of indices (i, j) which correspond to two non-equivalent rows or columns in the matrix.We assume further that the index i precedes index j in an a-Monge permutation π.The assumption i ≺ π j determines the order of some other indices.Under the assumption that i ≺ π j, the strict inequality ∆(i, j, k, l) > 0 indicates that k ≺ π l, while the strict inequality ∆(i, j, k, l) < 0 indicates that l ≺ π k. (Note that ∆(i, j, k, l) = −∆(i, j, l, k) = −∆(j, i, k, l) = ∆(j, i, l, k) -this property will often be used in our proofs).The obtained information can be conveniently represented as a directed graph P M with nodes J and directed arcs corresponding to the identified precedence constraints together with the initial constraint i ≺ π j.We then extend P M recursively to obtain additional information about the ordering of indices.Eventually, either P M contains an oriented cycle which signals that the matrix is not a permuted a-Monge matrix, or we can view P M as a partial order.This order defines a set of permutations (i.e., linear extensions of P M ) which are our candidates for an a-Monge permutation.We illustrate the COM approach with the following example.
Example A.1 Consider a submatrix M [{i, k, j}].Schematic representation of this sub-matrix and algebraic sums ∆ is shown in Fig. 3.We claim that, provided ∆(i, j) = ∆(i, k) = ∆(k, j) = 0, the submatrix is either a bad matrix or a sum matrix., k, k, j).Suppose that ∆(k, j, i, k) = 0 and ∆(i, k, k, j) = 0. Without loss of generality, suppose that i ≺ k in an a-Monge permutation and that ∆(i, k, k, j) > 0. The assumption that row i precedes row k, together with the inequality ∆(i, k, k, j) > 0 yields k ≺ j.The assumption that column i precedes column k together with the inequality ∆(k, j, i, k) > 0 yields a contradictory precedence j ≺ k.Therefore M [{i, j, k}] is a bad matrix.
If ∆(k, j, i, k) = 0 and ∆(i, k, k, j) = 0, then it can easily be shown that M [{i, j, k}] is a sum matrix. 2 We recommend the reader to use diagrams like the one in Fig. 3 in the following proof, since they make arguments more transparent.
Theorem A.2 If an n × n matrix M is not a permuted a-Monge matrix, then there exists a set of indices B with |B| ≤ 4, such that M [B] is a bad matrix.
Proof: We can without loss of generality assume that M has no pair s, t of indices such that both rows s, t are equivalent and columns s, t are equivalent.Indeed, if s, t is such a pair then it is easy to see that M is permuted a-Monge if and only if M [J \ {s}] is permuted a-Monge, so we can delete row s and column s and continue.
First note that if there exists a pair i, j such that i = j and ∆(i, j) < 0, then M [{i, j}] is a bad matrix, so we assume further on that ∆(i, j) ≥ 0 for all distinct i, j.
Assume that ∆(i, j) = 0 for all i, j.Suppose that there exists a triple i, j, k such that ∆(k, j, i, k) = 0 and/or ∆(i, k, k, j) = 0.Then, as shown in the example above, M [{i, j, k}] is a bad matrix in this case.Suppose instead that ∆(k, j, i, k) = 0 and ∆(i, k, k, j) = 0 for all i, k, j.For any s, t, k, l with s, t < k, l, we have ∆(s, t, k, l) = ∆(s, t, t, l) − ∆(s, t, t, k), and therefore ∆(s, t, k, l) = 0.For any s, t, k, l with s, t > k, l, we have ∆(s, t, k, l) = ∆(s, t, k, s) − ∆(s, t, l, s), and therefore ∆(s, t, k, l) = 0.It can be shown in a similar way that ∆(s, t, k, l) = 0 for all s, t, k, l, and therefore M is a sum matrix, which is impossible because M is not permuted a-Monge.
Suppose now that ∆(0, n − 1) = max k,l ∆(k, l) and there exists a permutation π, with π(0) = 0 and π(n − 1) = n − 1, that sorts both sequences.Fix such a permutation and permute M according to it.We can without loss of generality assume that M had this new form from the very beginning, that is, both the sequence (M (0, i)−M (n−1, i)) and the sequence (M (i, 0)−M (i, n−1)), i = 0, n−1, are already in non-increasing order.
Since M is not permuted a-Monge, we still have indices p, q, s, t such that p < q, s < t, and ∆(p, q, s, t) < 0. It follows from the inequality ∆(p, q, s, t) < 0 and from the equation ( 1) that there exists an index i with p ≤ i ≤ q − 1, and an index k with s ≤ k ≤ t − 1, such that ∆(i, i + 1, k, k + 1) < 0. We consider the case i < k: the case i = k is already eliminated and the case i > k is symmetric.
Assume that there exist indices i and ] is a bad matrix in this case.Indeed, the assumption i ≺ i + 1 yields i + 1 ≺ k and k + 1 ≺ k, and constraint k + 1 ≺ k for the columns k and k + 1 yields k ≺ i + 1.This proves the claim.
We consider two cases: Case 1 There exists a triple i < j < l with ∆(i, j, j, l) < 0 such that i = 0 or l = n − 1, or both.
We claim that, given the above inequalities, at least one of M [{0, i, j, l}] and M [{i, j, l, n − 1}] is a bad matrix.
By using a similar argument for the matrix M [{i, j, l, n − 1}]), we see that that if ∆(i, j) = 0 then this matrix is bad.So we will also assume that ∆(i, j) > 0.
We now consider the submatrix M [{0, i, j, l}] and will try to permute it into an a-Monge matrix.The assumption 0 ≺ i yields j ≺ l, i ≺ l, j ≺ i.Since ∆(i, j) > 0, and so ∆(0, j, i, j) = ∆(0, i, i, j)+ ∆(i, j, i, j) > 0, we also have j ≺ 0. This shows that a permutation other than j, 0, i, l cannot be an a-Monge permutation for M [{0, i, j, l}].By analyzing the matrix M [{i, j, l, n − 1}] in a similar way, we see that the only potential a-Monge permutation for it is the permutation i, l, n − 1, j .
This completes the proof of the theorem. 2 Note that the bound |B| ≤ 4 in the above theorem is tight.Indeed, it can be straightforwardly checked that the following matrix is not permuted a-Monge, while any matrix obtained from it by deleting a row and a column (with the same index) is permuted a-Monge.
We can now derive the main result of this section from Theorem A.2. Assume now that M is a permuted a-Monge matrix.The corresponding a-Monge permutation does not permute M 1 , . . ., M m into a-Monge matrices.Hence, there exist indices i, j, k, l and a pair of matrices, say, M 1 and M 2 such that M 1 (i, k) + M 1 (j, l) − M 1 (i, l) − M 1 (j, k) > 0 and M 2 (i, k) + M 2 (j, l) − M 2 (i, l) − M 2 (j, k) < 0. This implies that the matrices M 1 [{i, j, k, l}] and M 2 [{i, j, k, l}] cannot be simultaneously permuted into a-Monge matrices -this follows from the fact that the assumption i ≺ j implies k ≺ l for M 1 and l ≺ k for M 2 . 2

A.2 Reducing the number of matrices
We will now prove the bound |F ′ | ≤ 3 in Proposition 5.3, again via a-Monge matrices.In the proof, we will use special partial orders which we call multipartite partial orders.We say that a partial order on a set D is multipartite if and only if there is a partition of D = D 1 ∪ . . .∪ D t , t ≥ 2, such that d d ′ if and only if d = d ′ or else d ∈ D i and d ′ ∈ D j for some 1 ≤ i < j ≤ t.If P is a multipartite order, then we will call the classes D 1 , . . ., D t the corresponding partition classes of P .
It is clear that if π is an a-Monge permutation, for a matrix M then the reverse permutation π − is also an a-Monge permutation for M .It is also clear that if M is a-Monge and the matrix obtained from M by simultaneously swapping rows s and t and columns s and t is again a-Monge then rows s and t are equivalent, i.e., M (s, i) = M (t, i) + α st , and columns s and t are equivalent as well.Note that swapping of equivalent rows and columns does not affect the property of being a-Monge.A matrix M is called Monge if −M is a-Monge.It is shown in Observation 3.6 of [36] that if M is Monge, i ≺ j ≺ k in M , and rows (columns) i, k are equivalent in M then row j is equivalent to these rows (columns).Clearly, the statement is also true for a-Monge matrices.Theorem 3.9 of [36] states that if a Monge matrix has no equivalent rows or columns then the only way to permute it to a Monge matrix is by using either the identity permutation id or its reverse id − .This leads to the following characterization of a-Monge permutations in terms of multipartite orders.For every anti-Monge square matrix M , there exists two mutually reverse multipartite orders such that a permutation (i.e.ordering) of the indices of M is an a-Monge permutation if and only if this ordering is an extension of one of the two multipartite orders.Two indices i, j belong to the same partition class of such a multipartite order if and only if both rows i, j and columns i, j are equivalent in M .
We will now prove two auxiliary lemmas about multipartite orders.
Lemma A.4 For any two multipartite orders P ′ and P ′′ on D, there are a, b ∈ D such that a and b are comparable (not necessarily in the same direction) both in P ′ and in P ′′ .
Proof: Take a maximal chain in P ′ .If it is not entirely contained in a class of P ′′ then there are two elements in this chain belonging to two different classes of P ′′ , that is, these elements are comparable both in P ′′ and in P ′ .If all elements in the maximal chain are contained in the same class of P ′′ , then pick any element d in a different class of P ′′ .This element is comparable, in P ′′ , with all elements from the chain, and, clearly, it is comparable with at least one of these elements in P ′ . 2 Let us say that a collection P = {P 1 , . . ., P l } of multipartite orders is conflicting if their union (considered as a digraph G P ) contains a directed cycle.Proof: Let a 1 , . . ., a t , a 1 be a shortest directed cycle in G, and assume, for contradiction, that t > 2. Without loss of generality, let (a 1 , a 2 ) ∈ P 1 .In this case, (a 2 , a 3 ) ∈ P 1 , since, otherwise, we would have (a 1 , a 3 ) ∈ P 1 and get a shorter cycle.Without loss of generality, assume that (a 2 , a 3 ) ∈ P 2 .Since the order P 1 is multipartite, we conclude that a 1 and a 3 are comparable in P 1 .Furthermore, since we cannot have (a 1 , a 3 ) ∈ P 1 , we have (a 3 , a 1 ) ∈ P 1 .Since (a 1 , a 2 ) ∈ P 1 , the transitivity of P 1 implies that (a 3 , a 2 ) ∈ P 1 , which, together with (a 2 , a 3 ) ∈ P 2 , gives us the required arcs. 2 Proposition A.6 Let U = {M 1 , . . ., M m } be a set of matrices of size n × n such that no permutation is an a-Monge permutation for all matrices in U .Then, there is a subset U ′ ⊆ U such that |U ′ | ≤ 3 and no permutation is an a-Monge permutation for all matrices in U ′ .
Proof: We may assume that every matrix in U is a permuted a-Monge matrix, since, otherwise, the result follows immediately.Start with matrix M 1 ∈ U and choose any of the two multipartite orders that describe the set of corresponding a-Monge permutations for M 1 .Call this order P 1 .By Lemma A.4, there is a pair (a, b) ∈ P 1 such that a = b and a and b are comparable in P 2 , where P 2 is the multipartite order for M 2 .We may assume that (a, b) ∈ P 2 , since, otherwise, the other multipartite order for P 2 would be chosen.
If there is a pair of distinct elements (c, d) such that (c, d) ∈ P 1 and (d, c) ∈ P 2 , then there exists no a-Monge permutation for M 1 and M 2 and the proposition is proved.So we may assume that {P 1 , P 2 } is not conflicting.Since P 1 shares a pair of comparable elements with any multipartite order, we can in the same way choose a multipartite order P i for each matrix M i .If, for some i, the pair {P 1 , P i } is conflicting, then the proposition is proved.So assume that all such pairs of orders are non-conflicting.Note that if we chose the other multipartite order for M 1 , this would have led to choosing the other multipartite orders for all M 1 , . . ., M m .
Since there is no common a-Monge permutation for all of M 1 , . . ., M m , we know that the collection {P 1 , . . ., P m } of orders that we have constructed is conflicting.By Lemma A.5, there are orders P i and P j such that, for some distinct e, f , we have (e, f ) ∈ P i and (f, e) ∈ P j .Since both P i and P j share with P 1 some pairs of elements comparable in the same direction, we conclude that there is no common a-Monge permutation for M 1 , M i , M j .This completes the proof. 2 Note that the bound |U ′ | ≤ 3 in the above proposition is tight.Indeed, each of the following three matrices is permuted a-Monge, every two of them have a common a-Monge permutation, but there is no common a-Monge permutation for all three of them.
It is assumed throughout that D = {0, 1, 2, 3}.Implementations should be read as follows: • the symbol s =⇒ α means "strictly α-implements"; • U always denotes U D ; • Y = {x, y} is the set of primary variables and Z = {z, w} is the set of auxiliary variables (see Definition 3.1).
Each implementation produces some predicate g such that either g or π(g), or π(g c ) (for some permutation π) is a predicate for which a strict implementation has already been found, or else a predicate g such that, for some D ′ ⊂ D, g| D ′ is not supermodular on any chain on D ′ .We will describe the latter situation by writing, for simplicity, that "g| D ′ is bad".If |D ′ | = 2 then one can directly verify that the corresponding matrix is not a-Monge (there is no need to permute rows and columns).For the case |D ′ | = 3, one can use Lemma 4.4 to quickly check that the matrix of g| D ′ is not a permuted a-Monge matrix.=: g π(g t ) = h ′ 9 where π(0, 1, 2, 3) = (0, 2, 1, 3)  The rules for reading implementations are the same as in Appendix B. Each implementation implements some predicate g such that, for some D ′ ⊂ D, g| D ′ is bad, or else a pair for which a strict implementation has already been found.

Definition 2 . 4 (
AP -reduction, APX-completeness) An NPO problem Π 1 is said to be APreducible to an NPO problem Π 2 if two polynomial-time computable functions F and G and a constant α exist such that (a) for any instance I of Π 1 , F (I) is an instance of Π 2 ; (b) for any instance I of Π 1 , and any feasible solution s ′ of F (I), G(I, s ′ ) is a feasible solution of I; (c) for any instance I of Π 1 , and any r ≥ 1, if s ′ is an r-approximate solution of F (I) then G(I, s ′ ) is an (1 + (r − 1)α + o(1))-approximate solution of I where the o-notation is with respect to |I|.

Definition 2 . 6 (
L-reduction) An NPO problem Π 1 is said to be L-reducible to an NPO problem Π 2 if two polynomial-time computable functions F and G and positive constants α, β exist such that (a) given any instance I of Π 1 , algorithm F produces an instance I ′ = F (I) of Π 2 , such that the cost of an optimal solution for I ′ , Opt(I ′ ), is at most α • Opt(I); (b) given I, I ′ = F (I), and any solution s ′ to I ′ , algorithm G produces a solution s to I such that |cost(s) − OP T (I)| ≤ β • |cost(s ′ ) − OP T (I ′ )|.

Lemma 3 . 2 C
D strictly implements every predicate in U D .

Lemma 3 . 4
If F strictly implements a predicate f , and Max CSP(F ∪ {f })−B is APX-complete, then Max CSP(F) − B is APX-complete as well.

Lemma 4 . 5
An n-ary, n ≥ 2, function f is supermodular on a fixed chain if and only if the following holds: every binary function obtained from f by replacing any given n − 2 variables by any constants is supermodular on this chain.

Theorem 4 . 6 (
[11,13,27]) Let |D| ≤ 3 and let F ⊆ R D be a core.If F is supermodular on some chain on D then weighted Max CSP(F) belongs to PO.Otherwise, Max CSP(F) is APXcomplete.

Corollary 4 . 8
Let |D| ≤ 3 and F not supermodular on any chain on D. Then the problem Max CSP(F ∪ U D ) − B is APX-complete.

Figure 2 :
Figure 2: The optimized list of 27 predicates from the proof of Case 1.The predicates are represented by tables of values.

Corollary A. 3
Let M 1 , . . ., M m be n × n matrices.If there exists no permutation that simultaneously permutes all these matrices into a-Monge matrices, then there exists a subset of indices B with |B| ≤ 4, such that no permutation of the indices in B simultaneously permutes matrices M 1 [B], . . ., M m [B] into a-Monge matrices.Proof: Consider the matrix M = m i=1 M i .If M is not a permuted a-Monge matrix then, by Theorem A.2, there exists a subset of indices B with |B| ≤ 4, such that M [B] is a bad matrix.Consider matrices M 1 [B], . . ., M m [B].If there existed a permutation that permutes all these matrices into a-Monge matrices, then the sum of the permuted matrices, which is M [B], would be an a-Monge matrix as well.This contradiction proves that there exists no permutation that simultaneously permutes matrices M 1 [B], . . ., M m [B] into a-Monge matrices.

Lemma A. 5
If a collection P = {P 1 , . . ., P l } is conflicting then the digraph G P contains arcs (a, b) and (b, a) for some distinct a, b.