A Hypergraph Based Approach for the 4-Constraint Satisfaction Problem Tractability
AA Hypergraph Based Approach for the 4-Constraint SatisfactionProblem Tractability Rachid Oucheikh ∗ Ismail Berrada Outman El Hichami Université Sidi Mohamed Ben Abdellah , Faculty of Science Dhar El Mahraz, Fez, Morocco Université Abdelmalek Essaâdi, Faculty of Science Tetouan, Morocco {oucheikh.rachid,berrada.ismail}@usmba.ac.ma, [email protected]
Abstract
Constraint Satisfaction Problem (CSP) is a framework for modeling and solving a variety of real-world problems. Once the problem is expressed as a finite set of constraints, the goal is to findthe variables’ values satisfying them. Even though the problem is in general NP-complete, there aresome approximation and practical techniques to tackle its intractability. One of the most widely usedtechniques is the Constraint Propagation. It consists in explicitly excluding values or combination ofvalues for some variables whenever they make a given subset of constraints unsatisfied. In this paper,we deal with a CSP subclass which we call 4-CSP and whose constraint network infers relations ofthe form: { x ∼ α, x − y ∼ β, ( x − y ) − ( z − t ) ∼ λ } , where x, y, z and t are real variables, α, β and λ are real constants and ∼∈ {≤ , ≥} . The paper provides the first graph-based proofs of the 4-CSPtractability and elaborates algorithms for 4-CSP resolution based on the positive linear dependencetheory, the hypergraph closure and the constraint propagation technique. Time and space complexitiesof the resolution algorithms are proved to be polynomial. Keywords:
Graph theory, positive linear dependence, constraint satisfaction problem (CSP), con-straint propagation, canonical form.
Constraint Satisfaction Problem (CSP) is a fundamental concept in constraints programing. It is funda-mentally used to model and solve research problems, such as optimization, calculus and programming.CSP has received a remarkable interest over the last years, which has effectively led to the developmentof a rich theory that relies on techniques from various areas, especially operation research and artifi-cial intelligence. Most real-world problems can be successfully solved using CSP; among which we cancite resource allocation, scheduling, building design, graph coloring problem, temporal reasoning, finan-cial profits maximization, paths optimization, data clustering, tomography, and more recently naturallanguage processing [7, 17, 43].Within the CSP framework, a problem is considered as a finite set of variables which values, satisfyingcertain problem-specific constraints, are assigned to. Actually, solving a CSP aims to achieve one or moreof the following goals:1. Finding all solutions, i.e. all combinations of values that satisfy all the constraints.2. Finding one solution.3. Detecting an inconsistency. ∗ The corresponding author, e-mail: [email protected], B.P. 1796 Fès-Atlas, 30003 MAROC a r X i v : . [ c s . D M ] M a y . Finding an optimal solution with regard to some metrics or objective functions.5. Finding all optimal solutions.6. Reducing all interval domains to smaller sizes.7. Reaching a solved form from which all the solutions can be easily generated.Determining whether a finite CSP (i.e. CSP with finite domain variables) has a solution is, in general,an NP-complete problem [35], which is also the case with finding one solution. An earlier attempt tosolve CSPs relies on the guess and check strategy; This latter consists in guessing the assignments of allvariables and checking whether they satisfy all constraints. This allows to solve the CSP in a polynomialtime. Actually, a CSP can be solved in a reasonable time either by studying the tractability of its specificsubclasses or by using the heuristics and combinatorial search methods. Furthermore, the important resultof Schaefer (Dichotomy Theorem) [42] states that every Boolean CSP is contained in one out of six casesand gives necessary and sufficient conditions to classify the problem in polynomial-time or NP-complete.This theorem was recently generalized to a larger class of CSP (i.e. propositional logic of graphs) [15].Recently, many researches have been conducted on development of effective techniques for CSPs solv-ing, especially for the finite domain case. Examples include Constraint Propagation (CP) [5], ForwardChecking (FC) [11], Maintaining Arc Consistency (MAC) [32, 33], and MAC-Backtracking techniques[46]. Another important topic of great application in artificial intelligence and which is considered asa special case of CSP, is the boolean SATisfiability problem (SAT) [24, 2]. The SAT problem is thefirst known NP-complete problem, it consists in checking the satisfiability of a given propositional logicformula. Despite the SAT complexity, many of SAT instances that occur in practical issues can be solvedin polynomial time. Checking the satisfiability of a formula in Conjunctive Normal Form (CNF) is aSAT subclass where each clause is limited to at most three literals (3-SAT [40]). It is one of Karp’s 21NP-complete problems. Besides that, 2-SAT and Disjunctive Normal Form (DNF) can be checked inlinear time.Tractability of CSPs can be reached by considering specific classes. These classes are obtained bylimiting the allowed domains or the relations which appear in constraints. For example, if the domain isbinary and all variables are binary, the satisfiability is polynomial-time solvable (equivalent to 2-SAT).This paper deals with a subclass of CSPs in which constraints are expressed as inequalities written inone of the following forms: { x ∼ α, x − y ∼ β, ( x − y ) − ( z − t ) ∼ λ }, such that x, y, z and t arereal variables, α, β and λ are real constants and ∼∈ {≤ , ≥} . We denote this CSP subclass by "4-CSP".There are several reasons for which studying CSPs is important, firstly because CSP are omnipresent in anumber (différent) of real-world problems and secondly for reason of their reduced complexity proven tobe polynomial. Many types of hard and useful real-world problems can be modeled as 4-CSPs. The FourPhase Handshake Protocol [14] given in [31], and depicted in Figure. 1 is one example, amongst others.This protocol uses two clocks x , x , two parameters minIO , maxIO , and the following constraints:( x < maxIO ), ( x > inIO ), ( x < maxIO ), ( x > inIO ), and (( x − x ) ≤ ( maxIO − minIO )).Dealing with the protocol comes down to deal with its equivalent 4-CSP.An other relevant example that shows the utility of 4-CSPs is the verification of temporal constraintsin real-time systems. Parametric Timed Automata (PTA)[3] are among the most popular formalisms formodeling real-time systems. Almost all the systems modeled by this type of automata can be representedby a 4-CSP. PTA facilitate the manipulation of real-time systems, especially for their control and verifi-cation. Unfortunately, most of PTA verification problems are undecidable [10, 4]. In this model, a clock2igure 1: 4-phase handshake protocol(timer) or a difference of two-clocks is compared to a linear combination of parameters. Hune et al. [27]define the subclass "lower bound/upper bound (L/U) automata", where each parameter occurs in thetiming constraints either as a lower bound or as an upper bound. In fact, L/U automata can be used tomodel the Fisher’s mutual exclusion algorithm, the root contention protocol, and other known examplesfrom the literature [27]. The algorithms based on the 4-CSP framework can serve for an accelerated L/Uautomata verification.In addition, the results presented in this paper show that the 4-CSP can be used to derive a numericalabstract domain [22, 23, 30]. Numerical abstract domains are widely used in static program analysis.Numerical abstraction [22, 25, 37, 21, 28], applied in static code analysis, provides a wider set of reachablestates that guarantees the safety of the result. The challenge consists of choosing the suitable numericalabstract domain and formal methods capable to analyze all program behaviors. The abstract domaindefined based on the 4-CSP extends the conjunction of octagonal invariants [37], called Unit Two VariablePer Inequality (UTVPI) constraints, with inequalities of the form: { ( x − y ) − ( z − t ) ≤ λ } . The precisionof the derived domain lies between the domains of octagons [37] and polyhedra [28].Using the general CSP framework to express the constraints in the aforementioned examples is verycomplex and almost NP-Complete. The 4-CSP framework is however precise enough to cover all theirconstraints and has the advantage to be linear in time and space. The 4-CSP constraint set can be seen asa subclass of the octahedron constraint set [21] which has the form: Σ( x i ) − Σ( x j ) ≥ k, k ∈ Q . However,the complexity of octahedra operations over n variables is 3 n in memory and 3 n in execution time [21].This is very costly compared to the complexity of our implementation proved to be cubic in the number ofvariables. One question that immediately comes to mind when solving the 4-CSP is why it is not enoughto use the classical solving techniques, namely Linear Programming (LP). Actually, the LP seems to benot suitable for the 4-CSP presented in this paper, but it is limited just to finding an optimal solutionwith regard to some objective function, whereas the computation methods based on 4-CSP frameworkhave many other goals: to guarantee the existence of a solution, to reduce all interval domains to smallersizes and to achieve a solved form where all the solutions can easily be generated.To sum up, the main contributions of this paper consist of:1. Setting a theoretical basis for the 4-CSP and giving a data structure for its domains.2. Providing, based on hypergraph theory coupled with positive linear dependence theory, the firstgraph-based method for the 4-CSP tractability.3. Developing a modified arc consistency algorithm that combines the MAC algorithm with the hy-pergraph closure in order to easily solve the 4-CSPs: either to check the emptiness of solution setor to list the solutions. All these operations have a polynomial time and space complexity.3he remaining of the paper is organized as follows: The second section highlights some basic definitionsand provides the mathematical background of the paper. In section 3, we establish a hypergraph-basedcharacterization of the feasibility problem. In section 4, we show the 4-CSP problem resolution methodsand algorithms. Section 5 discusses the implementation issues of our approaches. Finally, section 6concludes and draws some perspectives. Throughout this paper, we use the following notations: • N (resp. Z ) denotes the set of natural numbers (resp. integers) and R (resp. Q ) the set of real(resp. rational) numbers. • For a domain T ( R or Q ), and n ∈ N : – T ≥ denotes the set { x | x ≥ , x ∈ T } . + ∞ (resp. −∞ ) denotes positive (resp. negative)infinity such that: for all t ∈ T , −∞ < t < + ∞ , t + (+ ∞ ) = (+ ∞ ) + t = + ∞ and t + ( −∞ ) =( −∞ ) + t = −∞ . T denotes T ∪ { + ∞ , −∞} . – P ( T ) denotes the power set of T . For a set S ⊆ P ( T ), min ( S ) (resp. max ( S )) is the minimal(resp. maximal) element of S . When S has no lower bound (resp. upper bound), then min ( S ) = −∞ (resp. max ( S ) = + ∞ ). – For a set X = { x , x , ...., x n } of valued variables over T , a valuation ν over X is a functionthat associates to each variable of X , a value in T : ν : X −→ T x i ν i ν can be seen as a vector of T n . V ( X ) denotes the set of valuations over X . D x i is the set of possible values for the variable x i and it is called domain of x i . x is a specialvariable that is always equal to zero i.e. D x = { } and X = X ∪ { x } . – ( T n , + , × ) denotes the n-dimensional vector space over T . The vector e denotes the zerovector of T n . The set { e , e , · · · , e n } denotes the canonical basis (standard basis) of T n , thatis : For all e i = ( a j ) j ∈ [1 ,n ] ⇒ ( a j = 1 If j = ia j = 0 Otherwise The theory of positive linear dependence was initiated by J. Farkas[26] and T. Motzkin[38], and developedby Chandler Davis [18]. In this paper, we consider an adaptation of this theory. Therefore, the definitionsgiven in the rest of this section are slightly different from those of Chandler. After giving the adapteddefinitions, the fundamental theorem for the simple and positively dependent sets is introduced.Let f = ( V i ) i ∈ [1 ,r ] be a family of distinct non-empty vectors of T n . A strictly positive combination of f is a linear combination P ri =1 λ i V i , with λ i ∈ N > . Definition 1 f is said to be positively independent if none of the strictly positive combinations of f is equal to e . Otherwise, f is positively dependent (ie. there exist some scalars λ i ∈ N > suchthat P ri =1 λ i V i = e ). A positively dependent family f is said to be simple if every subfamily f ⊂ f ispositively independent. (cid:3) heorem 1 If f is simple, then the scalars ( λ i ) i ∈ [1 ,r ] ∈ N > that satisfy the equation P ri =1 λ i V i = e areunique (up to multiplication by a positive constant). The unique (minimal) solution is denoted by U ( f ) . (cid:3) In other words, if we have ( λ i ) i ∈ [1 ,r ] ∈ N > and ( α i ) i ∈ [1 ,r ] ∈ N > such that P ri =1 λ i V i = P ri =1 α i V i = e ,then α i λ i = α j λ j for all i, j ∈ [1 , r ]. This can be proved based on the proof of "theorem 4.3" given by Chandlerin [18]. Proof 1
The proof is based on the following claim: • For all ≤ p < r , the only scalars ( α i ) i ∈ [1 ,p ] ∈ Z that satisfy the equation P α i V i = e , are α i = 0 for i ∈ [1 , p ] This claim states that any sub-family of f is not positively independent in Z . Since f is positively depen-dent, then there exist ( λ i ) i ∈ [1 ,r ] ∈ N > such that λ × V + λ × V + · · · + λ p × V p + · · · + λ r × V r = e (1) Now, assuming that we can find ( α i ) i ∈ [1 ,p ] ∈ Z such that α i = 0 , for all i ∈ [1 , p ] and: α × V + α × V + · · · + α p × V p = e (2) And, let m j = min ( { λ i | α i | | i ∈ [1 , p ] , α i < } ) be the minimal value reached by λ j | α j | .We can therefore deduce that: λ i + m j × α i = λ i + λ j | α j | × α i = λ j ( λ i λ j + α i | α j | ) It is clear that this sum is grater that zero if α i > .If α i < , since m j = λ j | α j | ≤ λ i | α i | implies that | α i || α j | ≤ λ i λ j . Thus, | α i || α j | + α i | α j | ) ≤ ( λ i λ j + α i | α j | ) From this,we can conclude that λ i + m j × α i ≥ for all i ∈ [1 , p ] and λ j + m j × α j = 0 . Finally, by multiplyingequation (2) with the positive scalar m j and adding it to equation (1), we end up with the following newequation: ( λ + m j × α ) × V + · · · +( λ j + m j × α j ) × V j + · · · +( λ p + m j × α p ) × V p + λ p +1 × V p +1 + · · · + λ r × V r = e (3) λ j + m j × α j = 0 means that there is a sub-family of f which is positively dependent. This appears tocontradict the fact that f is simple.Now, if we have ( λ i ) i ∈ [1 ,r ] ∈ N > and ( α i ) i ∈ [1 ,r ] ∈ N > such that P ri =1 λ i V i = P ri =1 α i V i = e , thenit is easy to see that α r × P ri =1 λ i V i − λ r × P ri =1 α i V i = P ri =1 (( α r × λ i ) − ( λ r × α i )) V i = e and has atmost r − vectors. From the previous result we deduce that: λ r × α i = α r × λ i , for all i ≤ r . (cid:3) In this way, Theorem 1 states a fundamental result that allows the characterization of constraints tobe considered while checking the emptiness of a general CSP. Furthermore, it identifies the constraintsset that may have an impact on the computation of the tight bound of a given linear constraint. The caseof 4-CSP is further explained in the section 2.3. 5 .2 Constraint Satisfaction Problem
Definition 2 (Constraint Satisfaction Problem)
A Constraint Satisfaction Problem is a triplet N =( X, D, C ) , where: • X = { x , x , ..., x n } is a set of variables. • D = D x × D x × ... × D x n is the domain for X , where D x i ∈ T is the set of possible values for thevariable x i . • C = { c , c , ..., c r } is a set of constraints. A constraint c i ∈ C is a pair < u i , R i > , where u i ⊆ X is subset of k variables and R i is a k-aryrelation on these variables. A valuation ν satisfies < u i , R i > if the values assigned to the variables of u i satisfy the relation R i . A valuation is consistent if it verifies all the constraints in C ( i.e. V c i ), and iscomplete if it includes all variables. Each valuation that is consistent and complete is a CSP solution. Byabuse of notation, V c i denotes the CSP constraint set, and we write C = V c i .Most of research works dealing with CSPs consider binary constraints (i.e. k = 2). The constraintsconsidered in this work are defined in the next paragraphs to be atomic 4-Constraints. Motivated by many real-life problems like temporal system verification,we introduce the 4-CSP with theatomic 4-constraints defined below. Let X = { x , x , ...., x n } be a set of real-valued variables over T . Definition 3 An atomic 4-constraint over X is an inequality of the form: ( (cid:15) i x i − (cid:15) j x j ) − ( (cid:15) p x p − (cid:15) q x q ) ∼ m ijpq where m ijpq ∈ T , ∼∈ {≤ , ≥} , and for all k ∈ { i, j, p, q } , (cid:15) k ∈ { , } .An atomic 4-constraint is said to be in its canonical form iff for all k ∈ { i, j, p, q } , (cid:15) k = 0 and ” ∼ ” is equal to ” ≤ ” . (cid:3) For instance, ( x + x − x − x ≤ x + x ≤ x + x − x ≤
6) and ( x − x − x ≤
8) areatomic 4-constraints. It is easy to see that, by introducing a special variable x , which is always equal tozero, every atomic 4-constraint might be converted to its canonical form. For example, the 4-constraint(0 × x i − × x j ) − (1 × x p − × x q ) ∼ m ijpq can be written as: ( x − x j ) − ( x p − x q ) ∼ m ijpq .The set of atomic (resp. canonical) 4-constraints over X is denoted by Φ( X ) (resp. Φ( X )). In the restof the paper, we will not distinguish between Φ( X ) and 4-Φ( X ), and we will consider only canonical4-constraints. For a canonical 4-constraint c ijpq = ( x i − x j ) − ( x p − x q ) ≤ m ijpq , we define: • The normal vector of the hyperplane induced by c ijpq (variables involved in c ijpq ): F v : 4 − Φ( X ) −→ I n ( x i − x j ) − ( x p − x q ) ≤ m ijpq e i − e j − e p + e q • The upper bound ( the weight function ): F b : 4 − Φ( X ) −→ T ( x i − x j ) − ( x p − x q ) ≤ m ijpq m ijpq The complement : c ijpq = c jiqp = (( x j − x i ) − ( x q − x p ) ≤ m jiqp )Note that, F v ( c ) = − F v ( c ) for every constraint c ∈ X ). Definition 4 A S over X , is expressed as a conjunction of constraint set noted: C s = ^ (( x i − x j ) − ( x p − x q ) ≤ m ijpq ) A solution of the 4-CSP is then a solution of m canonical 4-constraints over X , where m is the numberof non-redundant conjunction terms. (cid:3) For a 4-CSP S over X , we denote by C s the set of all canonical 4-constraints of S , and D s the domainof solutions for 4 − CSP . For a valuation ν ∈ V ( X ), ν ∈ D s iff ν satisfies all constraints of C s . D s is anempty set iff for all ν ∈ V ( X ), ν D s . As an example, the 4-CSP defined by the following 4-constraints: C s = ( x + x − x − x ≤ ∧ ( x + x − x − x ≤ − ∧ ( x + x − x − x ≤ ^ ( x + x − x − x ≤ ∧ ( x + x − x − x ≤ ∧ ( x + x − x − x ≤ ∧ ( x + x − x − x ≤ x , x , x , x , x ) = (0 , , , , ∈ D s .In order to keep bounds of constraints involved in the 4-CSP S , we extend the mapping F b to C s , inthe usual way: F sb : 4 − Φ( X ) −→ T c ( F b ( c ) If c ∈ C s + ∞ OtherwiseIn this way, F sb keeps the upper bounds of constraints involved in S and sets to positive infinity theother constraints not in C s (the weight function related to S ). Finally, S is said to be a bounded 4-CSP if there exits a scalar w ∈ T such that: D s ⊆ { ν | ν ∈ V ( X ) such that − w < ν i < w } Graph-based algorithms has been widely used for checking the feasibility (or the emptiness) of a systemof inequalities with restricted form, such as the potential constraints conjunctions [25] ( V ( x i − x j ≤ m ij ))and Octagons [37] ( V ( ± x i ± x j ≤ m ij )). In the case of potential constraints, a data structure calledDifference Bound Matrices (DBM) is used to store the system constraints. A DBM can be seen as theadjacency matrix of a directed graph G = ( N, E, w ) (potential graph), where the set N corresponds tothe system variables, E ⊆ N and w ∈ E T is the weight function defined by: ( ( x i , x j ) / ∈ E if m ij = + ∞ , ( x i , x j ) ∈ E and w ( x i , x j ) = m ij if m ij = + ∞ . A well known result of Bellman [8] shows when DBMs are feasible. In fact, Bellman proves that a DBMis empty if and only if there exists, in its associated potential graph, a cycle with a strictly negative totalweight. The concept of cycles (either simple cycle or closed walk) used in graph theory is able to handleconstraints of the form ± x i ± x j ≤ m ij (plan constraints). However, it will not handle constraints of the7orm ( x i − x j ) − ( x p − x q ) ≤ m ijpq (hyperplane constraints).Broadly speaking, this work aims to develop scalable algorithms based on graph theory, for the feasi-bility checking and canonical form computation of CSPs. The question that immediately arises is can agraph theory based approach for general CSP feasibility characterization achieve similar results to that ofBellman? As will be discussed, the answer is fortunately positive for 4-CSP. This is because hypergraphtheory coupled with positive linear dependence theory gives us strong theoretical tools to answer theraised question. In this paper, we restrict ourselves to 4-CSP; however, the results can be extended toCSP with constraints similar to those represented by the Octahedra abstract domain[21]. Definition 5
A directed hypergraph [6] H is a pair ( N, E ) , where N is a non empty set of nodes and E is a set of hyperarcs. A hyperarc e is an ordered pair ( T, h ) , with T ⊆ N , T = ∅ , and h ∈ N \ T . T and h are called the tail and the head of e , and are denoted by tail ( e ) and head ( e ) , respectively. A weighteddirected hypergraph ( N, E, w ) , is a directed hypergraph ( N, E ) that has a positive number w ( e ) associatedwith each hyperarc e , called the weight of hyperarc e . (cid:3) Clearly, a 4-CSP S over X can be easily mapped to a weighted directed hypergraph ( N, E, w ). In fact,the set of nodes N will correspond to the set of variables X . Each constraint c ijpq ∈ C ( S ) defines thehyperarc e = ( T, h ) such that: T = { x j , x p } and h = { x i , x q } . In other words, the normal vector F v ( c ijpq )of c ijpq , can be mapped to a unique hyperarc: positive values of F v ( c ijpq ) are mapped to the head of e ,and negative values to the tail of e . Furthermore, we can associate a weight function to the hypergraphdefined by w ( e ) = F sb ( c ijpq ).Since the first papers of Berger [9], the hypergraph theory has been a useful tool in several fields includingcomputer science, mathematics, bio-informatics, engineering and chemistry [47]. Since a hypergraph isnothing but a family of sets and for the sake of clarity, in this paper, we will use the terminology of thehypergraph theory together with the notations of positive linear dependence theory. Thus, rather thanusing a hyperarc to map a 4-constraint, we use the corresponding normal vector F v () and weextend the notions of paths, cycles and minimal weights to hypergraphs in a consistent manner. Definition 6
Let C = { c , c , · · · , c r } be a set of distinct constraints of 4- Φ( X ) . We say that C generatesa hypercycle ( h-cycle for short) if the family f = ( F v ( c i )) i ∈ [1 ,r ] of normal vectors is positively dependent.We say that C generates a simple hypercycle if f = ( F v ( c i )) i ∈ [1 ,r ] is simple positively dependent. (cid:3) Intuitively, C generates a hypercycle if we can find some strictly positive natural numbers λ i such thatthe sum P λ i F v ( c i ) equals the empty vector. On the one hand, this definition is quite different fromthose found in the literature in the sense that, the h-cycle nodes are required to appear as hyperarc tailsthe same number of times they appear as hyperarc heads in the associated hypergraph. On the otherhand, hypercycles can be seen as a generalization of graph-based cycles where ( λ i ) are equal to 1. Infact, each edge ( x i , x j ) of a cycle in a graph defines the normal vector V ij = e i − e j . One can notice that P × V ij = P ( e i − e j ) equals the zero vector. Thus, the family ( V ij ) is positively dependent, which meansthat the set C = { c = ( x i − x j ≤ w ( x i , x j )) , c = ( x j − x l ≤ w ( x j , x l )) , · · · , c k = ( x k − x i ≤ w ( x k , x i )) } generates a h-cycle. Regarding the simple h-cycle, it is the hypercycle that can not be decomposed intomultiple hypercycles (like elementary cycle in graphs). Note that, the set { c, c } generates a simple h-cyclefor every constraint c ∈ X ).For instance, assuming that X = { x , x , x , x } : 8. The set C = { c = ( x + x − x − x ≤ , c = ( x + x − x − x ≤ − , c = ( x + x − x − x ≤ } generates a h-cycle as F v ( c ) = (1 , − , − , F v ( c ) = ( − , , , − F v ( c ) = (0 , , ,
1) and F v ( c ) + F v ( c ) + F v ( c ) = .2. The set C = { c = ( x + x − x − x ≤ , c = ( x + x − x − x ≤ − , c = ( x + x − x − x ≤ } generates a h-cycle as F v ( c ) = (1 , − , − , F v ( c ) = (1 , , − , F v ( c ) = ( − , , ,
0) and F v ( c ) + F v ( c ) + 2 × F v ( c ) = .In the remaining, the set of all hypercycles over 4-Φ( X ) will be denoted: HCycle ( X ) = { ( C, ( λ i ) i ∈ [1 ,r ] ) | C = { c , c , · · · , c r } , ( λ i ) i ∈ [1 ,r ] ∈ N > , and r X i =1 λ i F v ( c i ) = e } In a similar way, the notion of graph paths can be extended to hyperpaths as follows:
Definition 7
Let P = { c , c , · · · , c r } ⊆ Φ( X ) , and c ∈ Φ( X ) . Then, P generates a hyperpath ( h-path for short) of c , if P ∪ { c } generates a hypercycle. P generates a simple hyperpath of c , if P ∪ { c } generates a simple hypercycle. (cid:3) From the previous example, it is easy to see that { ( x + x − x − x ≤ , ( x + x − x − x ≤ − } generates a hyperpath of ( x + x − x − x ≤ c ∈ X ) will be denotedby: HP ath ( c ) = { ( P, ( λ i λ ) i ∈ [1 ,r ] ) | P = { c , c , · · · , c r } , ( λ, λ i ) ∈ N > and F v ( c ) + r X i =1 λ i λ F v ( c i ) = e } Remark 1
As mentioned before, each 4-constraint generates a unique hyperarc and thus the definitions6 and 7 hold for the hypergraph associated to the 4-CSP.
Let S be a 4-CSP over X and H s = ( N, E, w ) the weighted directed hypergraph associated to S . As is thecase with weighted graphs, S defines the minimum weight hypergaph H sm = ( N, E, w m ). Before defining H sm , let us extend the weight function F sb () (resp. w ) of S (resp. of H s ) to hypercycles and hyperpaths,in the usual way: Definition 8
Let c ∈ − φ ( X ) be a 4-constraint. Then: • For a h-path ( P, ( λ i )) ∈ HP ath ( c ) of c such that P = { p , p , · · · } , the weight of P in S (and it isthe same for H s ) is: w (( P, ( λ i ))) = F sb (( P, ( λ i ))) = P λ i F sb ( p i ) . • For a h-cycle ( C, ( α i )) ∈ HCycle ( X ) such that C = { c , c , · · · } , the weight of C in S (the samefor H s ) is: w (( C, ( α i ))) = F sb (( C, ( α i ))) = P α i F sb ( c i ) . When w (( C, ( α i )) ≥ , we say that ( C, ( α i )) is a positive h-cycle of H s . As an example, the set C = { ( x + x − x − x ≤ , ( x + x − x − x ≤ − , ( x + x − x − x ≤ } generates a positive h-cycle as the sum of these constraints is equal to 3 − Theorem 2
Assume that all hypercycles of H s are positives and let’s take c ∈ − Φ( X ) such that F v ( c ) = e . Then, for each h-path P of c , we can find a simple h-path Q of c with a weight less than P . (cid:3) Proof 2
Let ( P, ( λ i ) i ∈ [1 ,k ] ) ∈ HP ath ( c ) such that P = { p , p , · · · , p k } , and F v ( c ) + k X i =1 λ i F v ( p i ) = e (4) Recall that, by definition, normal vectors of P are all distinct. If k = 1 then P is simple. If P is simplethen Q = P . Now, assume that P is not simple. Then, we can find a subset P { q , q , · · · , q r } (at mostwith k elements) of P ∪ { c } having the size r , such that the corresponding normal vectors are positivelydependent and thus generates a h-cycle (remember that P ∪ { c } generates a h-cycle). We identify twocases: either all P include c ( c ∈ P ) or there exists P such that c P .1. Case 1: c P . Without loss of generality, assume that P { p , p , · · · , p r } such that, r X i =1 α i F v ( p i ) = e (5) As all hypercycles are positive, then: r X i =1 α i F sb ( p i ) ≥ Let j ≤ r such that m j = λ j α j = min ( { λ i α i | i ∈ [1 , r ] } ) . Note that λ i α i − m j ≥ , and λ j α j − m j = 0 . As, k X i =1 λ i F v ( p i ) = r X i =1 λ i F v ( p i )+ k X i = r +1 λ i F v ( p i ) = r X i =1 m j × α i F v ( p i )+ r X i =1 ( λ i − m j × α i ) F v ( p i )+ k X i = r +1 λ i F v ( p i )(7) F sb (( P, ( λ i ))) = k X i =1 λ i F v ( p i ) = m j × r X i =1 α i F v ( p i ) + r X i =1 α i × ( λ i α i − m j ) F v ( p i ) + k X i = r +1 λ i F v ( p i ) (8) From equations (8), (5) and (4), we deduce that e = F v ( c ) + k X i =1 λ i F v ( p i ) = F v ( c ) + r X i =1 α i × ( λ i α i − m j ) F v ( p i ) + k X i = r +1 λ i F v ( p i ) (9) In other words, we have constructed a new h-path Q such that Q ∪ { c } is a h-cycle with at most k elements as α j ( λ j α j − m j ) = 0 . Now, from equations (8) and (6), we deduce that Q has a weight lessthan P : r X i =1 α i × ( λ i α i − m j ) F sb ( p i )+ k X i = r +1 λ i F sb ( p i ) ≤ m j × r X i =1 α i F sb ( p i )+ r X i =1 α i × ( λ i α i − m j ) F sb ( p i )+ k X i = r +1 λ i F sb ( p i )(10) More specifically, we define Q = ( q , q , · · · , q k ) and ( β i ) by: • For i ≤ r , then(a) if λ i − m j × α i = 0 then q i = p i and β i = α i × ( λ i α i − m j ) (b) else drop q i from Q (we drop elements of P that are dependent in P ). For r + 1 ≤ i ≤ k , then q i = p i and β i = λ i .From equations (9) and (10), it is easy to see that Q is a h-path of c such that: F sb (( Q, β i )) ≤ F sb (( P, λ i )) .Note that Q has at least one element. In fact,(a) if r = k , then there exists at least one index i such that λ i − m j × α i = 0 otherwise F v ( c ) = e .(b) if r < k , at least Q has k − r ≥ elements.In this way, we have constructed a h-path having at least one element with less weight than P . If Q is not simple, we replace P with Q and repeat this reasoning until having a simple h-path of c .2. Case 2: c ∈ P . In this case, all h-cycles of P ∪ { c } contain c . Let us show that P is the sum of atleast two h-paths of c . Without loss of generality, we assume that P { c, p , p , · · · , p r } , with F v ( c ) + r X i =1 α i F v ( p i ) = e (11) Note that r < k as P ⊂ P ∪ { c } . In the same way, we set j ≤ r such that m j = λ j α j = min ( { λ i α i | i ∈ [1 , r ] } ) . First, let us show that m j < . In fact, if m j ≥ , then from equation (8), we deduce that: k X i =1 λ i F v ( p i ) = r X i =1 α i F v ( p i ) + ( m j − × r X i =1 α i F v ( p i ) + r X i =1 α i × ( λ i α i − m j ) F v ( p i ) + k X i = r +1 λ i F v ( p i ) (12) From equations (4), (11), and by adding F v ( c ) to both sides of equation (12), we deduce e = ( m j − × r X i =1 α i F v ( p i ) + r X i =1 α i × ( λ i α i − m j ) F v ( p i ) + k X i = r +1 λ i F v ( p i ) (13) In other words, we found a h-cycle of P ∪ { c } not containing c (contradiction). Thus, m < . Now,let us prove that P is the sum of two h-paths of c . Let us add F v ( c ) to both sides of equation (8) : F v ( c )+ k X i =1 λ i F v ( p i ) = (1 − m j ) F v ( c )+ m j F v ( c )+ m j × r X i =1 α i F v ( p i )+ r X i =1 α i × ( λ i α i − m j ) F v ( p i )+ k X i = r +1 λ i F v ( p i )(14) Again, by reducing equation (14) using equations (4) and (11), we have: e = (1 − m j ) F v ( c ) + r X i =1 α i × ( λ i α i − m j ) F v ( p i ) + k X i = r +1 λ i F v ( p i ) (15) This is nothing more than a new h-path Q of c having the weight F sb (( Q , ( β i )) = 11 − m j × ( r X i =1 α i × ( λ i α i − m j ) F sb ( p i ) + k X i = r +1 λ i F sb ( p i )) (16) In the same way, equation (11) defines a h-path Q of c such that: F sb (( Q , ( α i )) = r X i =1 α i F sb ( p i ) (17)11 y replacing equations (17) and (16) in equation (8) and taking the weight function, we have: F sb (( P, ( λ i ))) = m j × F sb (( Q , ( α i )) + (1 − m j ) × F sb (( Q , ( β i )) (18) Thus, the weight of P is written as an affine combination of the weights of Q and Q . Thus, oneof them has less weight than P . Again, we found a h-path of c with less weight than P .At the end, we showed that, in all cases, we can find a simple h-path having less weight than P . (cid:3) As proved in the previous theorem, simple h-paths play an outstanding role in weighted hypergraph.In the next theorem, we establish their uniqueness.
Theorem 3
Let’s assume that P = ( p , p , · · · , p k ) generates in H s a simple h-path of c ∈ − Φ( X ) such that F v ( c ) = e . Then, there exists a unique family, noted U ( P ) , of scalars ( λ i ) i ∈ [1 ,k ] such that ( P, ( λ i ) i ∈ [1 ,k ] ) ∈ HP ath ( c ) . (cid:3) Proof 3
Let ( P, ( λ i λ ) i ∈ [1 ,k ] ) ∈ HP ath ( c ) and ( P, ( α i α ) i ∈ [1 ,k ] ) ∈ HP ath ( c ) two simple h-paths of c . Thus λF v ( c ) + k X i =1 λ i F v ( p i ) = αF v ( c ) + k X i =1 α i F v ( p i ) = e o As the family f = { ( F v ( p i )) i ∈ [1 ,k ] ∪ { F v ( c ) } is simple positively dependent, according to theorem 1, thereexists a unique solution U ( f ) = (( β i ) i ∈ [0 ,k ] ) . Thus, there exists m ∈ N > such that λ i = m × β i , α i = m × β i , λ = m × β and α = m × β . Hence, λ i λ = α i α = β i β . At the end, the unique solution is U ( P ) = (( β i β ) i ∈ [1 ,k ] ) . (cid:3) Theorem 4
All hypercycles of H s are positive if and only if all simple hypercycles of H s are positive. (cid:3) Proof 4
The first implication is trivial since simple hypercycles are hypercycles. Now, let ( C, ( λ ) i ∈ [1 ,k ] ) bea hypercycle such that C = { c , c , · · · , c k } and let us prove that P ki =1 λ i F sb ( c i ) ≥ . Note that k > (a h-cycle has at least two elements), and P ki =1 λ i F v ( c i ) = e implies that P = { c , · · · , c k } generates a h-pathof c with weight P ki =2 λ i λ F sb ( c i ) . According to theorem 2, we can find a simple h-path ( Q, ( α i α ) i ∈ [1 ,r ] ) of c such that P ri =1 α i α F sb ( q i ) ≤ P ki =2 λ i λ F sb ( c i ) . As Q ∪{ c } is a simple h-cycle then P ri =1 α i α F sb ( q i )+ F sb ( c ) ≥ ,and thus λ × ( P ki =2 λ i λ F sb ( c i ) + F sb ( c )) ≥ . (cid:3) Generally, canonicity of the systems of linear inequalities is a key point when dealing with CSPs. How-ever, as stated in [21] (regarding roughly similar constraints i.e. octahedra constraints), computing thecanonicity is hard: "finding an efficient algorithm that can compute the canonical form of an octahedronfrom a non-canonical system of inequalities is an open problem at the time of writing this paper ". In thispart, we will introduce, for the first time, a graph-based characterization for the 4-CSP canonical form,which might lead to the development of new efficient algorithms for other CSP classes.
Definition 9
Let S be a 4-CSP, and H s = ( N, E, w ) be the weighted hypergraph associated to S . Theminimum weight hypergraph associated to S is the weighted hypergraph defined by H sm = ( N, E, w m ) ,where w m is the weight function defined on C s and derived from F sbm as follows: w m ( c ) = ( F sbm ( c ) if c ∈ C s + ∞ else hereas F sbm is defined on the set − Φ( X ) as follows: F sbm : 4 − Φ( X ) −→ T c min ( { F sb (( P, ( λ k ))) | ( P, ( λ k )) ∈ HP ath ( c ) } ) (cid:3) Since the upper bound of c in S might not be a tight upper bound, the minimum weight function F sbm searches for the tight upper bound of c , if it exists, by taking the smallest bound of all h-paths of c . Theorem 5
The following assertions are equivalent:1. All simple hypercycles of H s are positive2. All simple hypercycles of H sm are positive. (cid:3) This theorem states that the minimum weight function preserves the positivity of hypercycles in H s and H sm . Proof 5
Let C = { c , c , · · · , c r } be a simple h-cycle such that P rk =1 λ k F v ( c k ) = e
1. Let’s assume that every simple h-cycle of H s is positive and let’s prove that the associated h-cycleto C is positive in H sm .(a) First, let us prove that for every constraint c k of C , F sbm ( c k ) = −∞ .i. According to theorem 2, only simple h-paths of c k can have less weight than c k .ii. According to theorem 3, each simple h-path has a unique solution.iii. The number of combinations (subset) that we can construct from the set 4- Φ( X ) is finite(at most n )Thus, the set of simple h-paths of c k is finite. In other words, either F sbm ( c k ) = + ∞ or thereexists a simple h-path P k = ( p k , p k , · · · ) of c k such that F sbm ( c k ) = ∪ ( P k ) = F sb (( P k , ( λ ki ))) = P i =1 λ ki F sb ( p ki ) .(b) Now, for each c k of C , the minimal h-path of c k will be denoted by P k . As λ k × ( F v ( c k ) + P i =1 λ ki F v ( p ki )) = e , thus P rk =1 λ k F v ( c k ) + P rk =1 P i λ k λ ki F v ( p ki ) = e . On the one hand,we know that C = ( c i , c , · · · , c r ) is a simple h-cycle such that P rk =1 λ k F v ( c k ) = e , andwe deduce that P rk =1 λ k F v ( c k ) = e . On the other hand, S k P k forms a h-cycle and thus P rk =1 F sb (( P k , ( λ ki ))) ≥ (if simple h-cycles are positive then h-cycles are also positives, fromtheorem 4). Finally, P rk =1 F sb (( P k , ( λ ki ))) = P rk =1 P i λ k λ ki F sb ( p ki ) = P rk =1 λ k F sbm ( c k ) ≥ .Thus, C is positives in H sm .2. Let’s assume that every simple h-cycle of H sm is positive and let’s prove that the h-cycle associatedto C is positive in H s . It is easy to see that the path { c , · · · , c r } is a simple h-path of c , andthus F sbm ( c ) ≤ P rk =2 λ k λ F sb ( c k ) . As F sbm ( c ) ≤ F sb ( c ) , we conclude that ≤ F sbm ( c ) + F sbm ( c ) ≤ λ P rk =1 λ k F sb ( c k ) ( c and c form a simple h-cycle in H sm ). (cid:3) . Next, we will give the fundamental theorem of the feasibility testing of 4-CSP.
Theorem 6
Let assume that S is bounded. Then D s = ∅ if and only if all simple hypercycles of H sm arepositive, where D s is the solution domain of S . (cid:3) roof 6 (sketch).Without loss of generality, we suppose that S is saturated, which means the existence of all constraints,and if no c i exists, we should add it (in the way that its minimal bound is infinity). Then, H s will becomplete, and consequently F sb of any constraints is bounded. Assume that all simple hypercycles of H sm are positive, and let us find a solution to S . The idea of this proof is to use the minimal function tocompute minimal bounds and reduce S by adding new constraints until finding a final solution. In fact,starting with i = 1 , and let us find all constraints c k such that { c k , c i } forms a simple h-cycle with λ k F v ( c k ) + α k F v ( c i ) = e . Then, we construct a new 4-CSP S from S , by replacing c k with c k definedby: F v ( c k ) = F v ( c k ) and F s b ( c k ) = − α k λ k F smb ( c i ) . In other words, we try to find the valuation ν ∈ D s such that ν i = F smb ( c i ) . Now, S defines the hypergraph H s . Note that, the differences between H s and H s , are only over the weight of hyperarcs (constraints) c k . We can affirm then that all h-cycles of H s are positive. In fact, if we find a h-cycle which is negative, it must necessarily contain some modifiedconstraints c k : P ri =1 λ i F s b ( c i ) < . This is not possible because in that case we will find a new pathof c strictly less than F smb ( c i ) ( H sm is minimal). According to theorem 4, all h-cycles of H s arepositive implies that all simple h-cycles of H s are positive. According to theorem 5, all simple h-cyclesof H s m will be positive. Now, given S and H s m , we restart the next iteration i = 2 , . After at most n iterations, D s will be reduced to one valuation that satisfies S . (cid:3) At the end, the minimum weight hypergraph of S is saturated in the sense that all bounds are reachable. Theorem 7 If D s = ∅ , then:1. For all ( i, j, p, q ) , if F smb ( c jipq ) = + ∞ , then there exists ν ∈ D s such that ( ν i − ν j ) − ( ν p − ν q ) = F smb ( c jipq ) .2. For all ( i, j, p, q ) , if F smb ( c jipq ) = + ∞ , then for all M < + ∞ , there exists ν ∈ D s such that ( ν i − ν j ) − ( ν p − ν q ) ≥ M . (cid:3) Proof 7 (similar to the previous proof)
As stated in the introduction, solving a given CSP aims to achieve one or more goals. In the case of our4-CSP, we aim to: • Detect an inconsistency. • Guarantee the existence of at least one solution. • Reduce all interval domains to smaller sizes. • Achieve a solved (or canonical) form wherefrom all solutions can be generated easily.As will be detailed in this section, these goals can be achieved using the hypergraph-based character-ization introduced in the previous section.Computing the canonical form of a 4-CSP, using the minimal weight function, will provide a usefulmechanism to solve many problems modeled by 4-CSP. However, finding an efficient algorithm that cancompute the minimal weight function is, in the general case, an open problem at the time of writing thispaper. Note that, computing the minimal weight by finding all
HP ath , is a hard problem since there are14xponential number of
HP ath . Thus, as long as an upper approximation can be guaranteed, an exactrepresentation of a 4-CSP is not required. Keeping this fact in mind, we introduce some fundamentalresults that will allow us to compute either the canonical form (for some special cases), or an upperapproximations of the canonical form. The next theorem gives the necessary conditions to be verified bythe minimal weight function.
Theorem 8
Let x i , x j , x p , x q , x k , x l be six variables of X and let M ijpq denotes the minimal bound F sbm ( c ijpq ) of a constraint c ijpq = (( x i − x j ) − ( x p − x q ) ≤ m ijpq ) . Then,1. M ijpq = M qpji = M ipjq M ijkk = M ij M ijji = 2 M ij M ijpq ≤ M ijkl + M klpq M ijpq ≤ M iklq + M kjpl (cid:3) Proof 8
The proof of the first point is based on the fact that F v ( c ijpq ) = F v ( c ipjq ) = F v ( c qpji ) and thus HP ath ( c ijpq ) = HP ath ( c ipjq ) = HP ath ( c qpji ) . The same remark holds for points 2 and 3: F v ( c ijkk ) = F v ( c ij ) and F v ( c ijji ) = 2 F v ( c ij ) .Now, the idea of proving the 4 point comes from the fact that M ijpq is either −∞ (presence of negativehypercycles in S ) or reached by a h-path. Here we give only the proof for the first point; the last one canbe proved similarly. • Let assume that M ijkl = −∞ and M klpq = −∞ . Then, there exist two h-paths ( P , ( λ i )) ∈ HP ath ( c ijkl ) and ( P , ( λ i )) ∈ HP ath ( c klpq ) such that:1. P { c , c , · · · } , M ijkl = F sb (( P , ( λ i ))) = P λ i F v ( c i ) , and F v ( c ijkl ) + P λ i F v ( c i ) = e P { c , c , · · · } , M klpq = F sb (( P , ( λ i ))) = P λ i F v ( c i ) , and F v ( c klpq ) + P λ i F v ( c i ) = e .Since F v ( c ijkl ) + F v ( c klpq ) = F v ( c ijpq ) , and F v ( c ijpq ) + P λ i F sb ( c i ) + P λ i F sb ( c i ) = e , P ∪ P generates a h-path of c ijpq . Then, M ijpq is less than the h-path bound associated to P ∪ P whichhas as bound of P λ i F sb ( c i ) + P λ i F sb ( c i ) = M ijkl + M klpq and thus M ijpq ≤ M ijkl + M klpq . • Now, assume that M ijkl = −∞ . As every h-path of c ijkl , on the one side, can be extended to a h-pathof c ijpq , and on the other side, has a new h-path smaller than it ( M ijkl = −∞ ), then M ijpq = −∞ .A similar proof remains valid if M klpq = −∞ (cid:3) The next theorem, presented below, deals with 4-CSP subclasses solutions.
Theorem 9
The way we can get the canonical form is given for some subclasses of 4-CSP as follows:1.
Octagon forms : if all 4-constraints are of the form ( ± x i ± x j ≤ k ) , then the canonical form isgiven by the first four points of theorem 8.2. Upper bound forms : if all 4-constraints are of the form ( x i − x j ≤ x p + k ) , then the canonicalform is given by the five points of theorem 8.3. Lower bound forms : if all 4-constraints are of the form ( x p ≤ x i − x j + k ) , then the canonicalform is given by the five points of theorem 8. Proof 9
The different subclasses of 4-CSP are based on the nature of their constraints, which result inthe three following subclasses: . Octagon subclass:Foremost, the octagon inequalities are translated into the 4- CSP atomic constraints as follows: x i − x j − x + x ≤ M ij , x − x i − x j + x ≤ M ij , and so on. The initial constraints are then: c i , c ij , c ij , c ij . If we take into account the four first points of Theorem 8, all other constraintscan be derived from these initial ones. c ijpq can be obtained, for instance, from c ij and c pq .The challenge is to prove that if all the minimal bounds of the octagon verify the first four points ofTheorem 8, then the octagon is surely in its canonical form. Formally speaking: ∀ ( x i , x j ) ∈ R , ± x i ± x j ≤ k = ⇒ (cid:64) k ∈ R such that: ± x i ± x j ≤ k ≤ k .This assertion will be proved by contraposition. Suppose that the octagon is not canonic evenwhen the four points of Theorem 8 are verified, then there exists, for instance, a hyperpath P =( p , p , . . . , p n ) such that: F v ( P ) = F v ( c ij ) and F smb ( P ) < M ij . P ∪ c ij generates a h-cycle,which means: F v ( c ji ) + Σ ni =1 λ i F v ( p i ) = e .Suppose that this hyperpath length equals to one, i.e. P = ( p , p ) then: ∃ M i and M j such that: M i + M j < M ij . This is absurd since the fourth point of Theorem 8 is already fulfilled. Now,for any hyperpath length, i.e. P = ( p , p , . . . , p n ) then ∃ M c , M c , ..., M c n such that: P M c i < M ij .Each constraint c i is either in or derived from the initial form. Let’s replace all constraints by theirinitial ones, for example: c ijpq can be replaced by two constraints having the lowest bounds ( c ij and c pq for instance ). By doing this we can deduce by induction that: ∃ M c n and M c m such that: M c n + M c m < M ij and this contradicts the fourth point of Theorem 8.2. The upper bound subclass:This form contains three variables per inequality. Considering the proof of the octagon case andTheorem 8, the need for using the first four points of the Theorem 8 to get the canonical form canbe proved easily. Let us prove the necessity of the fifth point: M ijp ≤ M ikl + M kjpl :Let assume that M ikl = −∞ and M kjpl = −∞ . Then, there exists two h-paths ( P , ( λ i )) ∈ HP ath ( c ikl ) and ( P , ( λ i )) ∈ HP ath ( c kjpl ) such that:(a) P { c , c , · · · } , M ikl = F sb (( P , ( λ i ))) = P λ i F v ( c i ) , and F v ( c ikl ) + P λ i F v ( c i ) = e (b) P { c , c , · · · } , M kjpl = F sb (( P , ( λ i ))) = P λ i F v ( c i ) , and F v ( c kjpl ) + P λ i F v ( c i ) = e .As F v ( c ikl ) + F v ( c kjpl ) = F v ( c ijp ) , and F v ( c ijp ) + P λ i F sb ( c i ) + P λ i F sb ( c i ) = e , thus P ∪ P generates a h-path of c ijp . Finally, M ijp is less than the h-path bound associated to P ∪ P whichhas as bound of P λ i F sb ( c i ) + P λ i F sb ( c i ) = M ikl + M kjpl and thus M ijp ≤ M ikl + M kjpl , which isa special case for the fifth property: M ijpq ≤ M iklq + M kjpl .3. The lower bound subclass:This form contains also three variables per inequality. The result is proved in the same manner asupper bound forms taking into account just the order matter. (cid:3) After presenting all necessary ingredients and theoretical backgrounds related to the 4-constraint satis-faction problem, we discuss in this section the implementation of a 4-CSP detail, from an implementationpoint of view, how 4-CSP can be stored and how efficient algorithms can be developed for computingcanonical forms and testing the emptiness of a 4-CSP.16 .1 2D-DBM data-structure
Difference Bound Matrix (DBM) is a square matrix M where each coordinate m kl represents the upperbound of the difference x l − x k . For example, the following constraints x ≤ x − x ≤ x ≤ , x ≥
5, 8 ≥ x − x ≥ M = x x x x x x − − To implement and facilitate the manipulation of the 4-CSP domains, a suitable data structure isneeded. Therefore, DBM is extended in two dimensions to obtain the so-called "2D-DBM". A 2-Dimensions Difference Bound Matrix (2D-DBM) is a square matrix M where m kl is the upper bound M ijpq of the constraints C ijpq , for 1 ≤ k, l ≤ ( n + 1) : lines and columns become difference of variablesinstead of variables, as depicted in Figure 2. M = x − x x − x . . . x i − x j . . . x n − x n x − x M . . . M ij . . . M nn x − x M M . . . M ij ... M nn ... ... . . . ... . . . ... x p − x q M pq M pq . . . M ijpq ... M nnpq ... ... . . . ... . . . ... x n − x n M nn M nn . . . M ijnn . . . M nnnn Figure 2: 2D-BDM data structure.
The idea of computing the canonical form (or, sometimes, just an upper approximation) of a given 2D-DBM is based on Theorems 8 and 9. In fact, Theorem 8 gives the necessary conditions to be fulfilled byany canonical 4-CSP (e.g canonical 2D-DBM), whereas Theorem 9 establishes special cases where someof these conditions are sufficient. From the viewpoint of graph theory, both theories rely on the minimalweight hypergraph (the hypergraph closure) associated to a 2D-DBM.
The first algorithm developed in this paper, for computing the canonical (or, sometimes, just an upperapproximation) form of a given 2D-DBM and testing the emptiness of the solution set, is illustrated inthe Algorithm 1. From the viewpoint of graph theory, Algorithm 1 allows to minimize the hypergraphassociated to a given 4-CSP and to check the existence of a negative hypercycle.A solution is guaranteed if the diagonal of the final canonical 2D-DBM does not contain any negativecell (i.e. there is no negative hypercycle in the hypergraph). Thus, we obtain at least one solution: thevariable valuations contained in the first column. Note that each iteration of the algorithm presents theconstraint propagation technique, since the changing of one constraint upper bound impact the upperbounds of the others. In fact, each iteration strengthens the bounds of each system constraint, whichmeans that it excludes quickly many values from the variables domains. Consequently, the constraintpropagation process is accelerated. 17 nput : output:
Canonical 2D-DBM (or upper approximation of the canonical form in the worst case) do foreach cell M ijpq in 2D-DBM representing a 4-CSP constraint do M ijpq := min ( M ijpq , M ijkl + M klpq , M iklq + M kjpl ) end Update cells in order to ensure the following equalities: M ijpq := M qpji := M ipjq M ijkk := M ij M ijji := 2 M ij while ; Algorithm 1:
Skeleton of the hypergraph closure
For the sake of clarity, we presented in Algorithm 1 only the skeleton of the hypergraph closure, withoutgiving technical details about how operations will be implemented or when the algorithm will terminate.Technically, in the implementation, we use two two-dimensional tables, with ( n + 1) columns and ( n + 1) lines. The 2D-DBM is rewritten in a way that: column C ij (resp. line L ij ) of 2D-DBM which representsthe variable x i − x j becomes the column C i ∗ n + j (resp. line L i ∗ n + j ). The algorithm complexity analysis.
It is obvious that the canonical form is obtained in at most( n + 1) / n + 1) / O ( n ). This reflectsthe efficiency of our algorithm compared with the other approximation algorithms that infer complexconstraints, and the precision obtained besides using just binary constraints interested in by the majorityof works. Up to now, the domain of solutions is very reduced, it remains fair to extract the solution combinations.For this, we add to our algorithm the last version of the Arc Consistency algorithm AC2001 [12]. AC2001takes as an only input the Constraint Network resulted from the hypergraph closure algorithm, which isvery reduced. Therefore, it provides the set of variable values quickly.
In this paper, we have introduced a subclass of CSP named 4-CSP. As it has been shown, studying 4-CSP can be of great importance, considering their omnipresence in many real problems as well as theirreduced complexity proven to be polynomial. In comparison with the other variants of CSP, the 4-CSPis more rich than binary CSP in terms of invariants precision; and less complex than the general CSPin terms of implementation cost, since it is proved to be cubic in the number of system variables. Themain contribution of this paper consists of providing a complete framework for the 4-CSP, including thetheoretical background and the implementation issues.18 nput : output:
Canonical 2D-DBMVariables i, j, p, q, k, l, s: Integers;/* In this algorithm [ i ] denotes the integer value of i and n + 1 the number of domain variables(including the x variable which is always null), and we note: • i = [ l/ ( n + 1)] • j = l − [ l/ ( n + 1)] ∗ ( n + 1) • p = [ k/ ( n + 1)] • q = k − [ k/ ( n + 1)] ∗ ( n + 1) */M: Table; iter := 1; do for k = 1 to pow (( n + 1) , dofor l = 1 to pow (( n + 1) , do /*The following loop serves to update the matrix in order to verify thetwo last points of the Theorem 8. */ for s = 1 to pow (( n + 1) , do M [ k, l ] := min ( M [ k, l ] , M [ k, s ] + M [ s, l ] , M [ p ∗ ( n + 1) + i, s ] + M [ s, q ∗ ( n + 1) + j ] ,M [ p ∗ ( n + 1) + q, s ] + M [ s, i ∗ ( n + 1) + j ] , M [ j ∗ ( n + 1) + q, s ] + M [ s, i ∗ ( n + 1) + p ] ,M [( s/ [ n + 1]) ∗ ( n + 1) + i, q ∗ ( n + 1) + s − [ s/ ( n + 1)] ∗ ( n + 1)]+ M [ j ∗ ( n + 1) + s/ [ n + 1] , ( s − [ s/ ( n + 1)] ∗ ( n + 1)) ∗ ( n + 1) + p ]); end /*The following loop serves to update the matrix in order to verify thethree first points of the Theorem 8. */ for p = 1 to pow (( n + 1) , do M [ k, l ] := min ( M [ k, l ] , M [( p ∗ ( n +1)+ q, i ∗ ( n +1)+ j ] , M [ p ∗ ( n +1)+ i, q ∗ ( n +1)+ j ]); if ([ l/ ( n + 1)] = l − [ l/ ( n + 1)]) then /* M ijkk = M ij */ M [ k, l ] := M [ k, endif ([ k/ ( n + 1)] = l − [ l/ ( n + 1)] and k − [ k/ ( n + 1)] = [ l/ ( n + 1)]) then /* M ijji = 2 M ij */ M [ k, l ] := 2 ∗ M [ k, endendendend iter + +; while iter < = pow (( n + 1) , / Algorithm 2:
Canonical form of a 2D-DBM19 nput :
Constraint Network (
N, D, C ) output: Solutions of the CN1 The hypergraph closure function on 2D-DBM (Algorithm 2)2 Take bounds of variables (for domains D ) and bounds of binary relations from2D-DBM (for constraints C )3 Accomplish the arc consistency algorithm AC2001 Algorithm 3:
The Whole Algorithm SkeletonIn addition, we have also provided the first answer, to the best of our knowledge, to the followingfundamental problem : can we build a scalable and graph theory based algorithms for CSP tractabilitysimilar to those of Bellman? Thanks to the hypergraph theory coupled with positive linear dependencetheory, a positive answer has been proved for the 4-CSP class. This result might be extended to CSPwith constraints similar to those of the Octahedra [21].Finally, in order to represent and manipulate 4-CSP, we have defined a suitable data-structure called2D-DBM, and elaborated the algorithm able to obtain the canonical form for this structure.