Constraint Propagation for Soft Constraints: Generalization and Termination Conditions

15

Transcript of Constraint Propagation for Soft Constraints: Generalization and Termination Conditions

Constraint Propagation for Soft Constraints:Generalization and Termination ConditionsS.Bistarelli1, R.Gennari2, F. Rossi31: Universit�a di Pisa, Dipartimento di Informatica, Corso Italia 40, 56125 Pisa.E-mail: [email protected]: ILLC, Institute of Logic, Language and Computation, University of Amsterdam,N. Doelenstraat 15, 1012 CP Amsterdam, The Netherlands. E-mail:[email protected]: Universit�a di Padova, Dipartimento di Matematica Pura ed Applicata, Via Belzoni7, 35131 Padova. E-mail: [email protected]. Soft constraints based on semirings are a generalization ofclassical constraints, where tuples of variables' values in each soft con-straint are uniquely associated to elements from an algebraic structurecalled semiring. This framework is able to express, for example, fuzzy,classical, weighted, valued and over-constrained constraint problems.Classical constraint propagation has been extended and adapted to softconstraints by de�ning a schema for soft local consistency [BMR97]. Onthe other hand, in [Apt99a,Apt99b] it has been proved that most of thewell known constraint propagation algorithms for classical constraintscan be cast within a single schema.In this paper we combine these two schema and we show how the frame-work of [Apt99a,Apt99b] can be used for soft constraints. In doing so,we generalize the concept of soft local consistency, and we prove someconvenient properties about its termination.1 IntroductionSoft constraints allow to model faithfully many real-life problems, especiallythose which possess features like preferences, uncertainties, costs, levels of im-portance, and absence of solutions. Formally, a soft constraint problem (SCSP)is just like a classical constraint problem (CSP), except that each assignmentof values to variables in the constraints is associated to an element taken froma set (usually ordered). These elements will then directly represent the desiredfeatures.There are many formalizations of soft constraint problems. In this paper weconsider the one based on semirings [BMR97], where the semiring speci�es thepartially ordered set and the appropriate operation to use to combine constraintstogether. This formalism has been shown to have many interesting instances,like classical, fuzzy [DFP93], weighted, valued [SFV95], probabilistic [FL93] andpartial [FW92] constraints.

The propagation techniques usually used for classical CSPs have been ex-tended and adapted to deal with soft constraints, provided that certain con-ditions are met. This has led to a general framework for soft constraint prop-agation, where at each step a subproblem is solved, as in classical constraintpropagation [BMR97]. By studying the properties of this schema, it has beenproved that such steps can be seen as applications of functions which are mono-tonic, in ationary, and idempotent over a certain partial order.On an orthogonal line of research, the concept of constraint propagation overclassical constraints has been studied in depth in [Apt99a,Apt99b], and a generalalgorithmic schema (called GI) has been developed. In such a schema, constraintpropagation is achieved whenever we have a set of functions which are monotonicand in ationary over a partial order with a bottom.By studying these two frameworks and comparing them, we noticed that theGI schema can be applied to soft constraints (see Section 5.1), since the functionsand the order used for soft constraints have all the necessary properties for GI.This is proved in this paper by de�ning an appropriate partial order over softconstraint problems (see Section 3).By analyzing the features of the GI algorithm, we also realized (see Sec-tion 5.2) that indeed soft constraint propagation can be extended to deal withfunctions which are not necessarily idempotent. Notice that this is a double gen-eralization: we don't require any longer that each step has to solve a subproblem(it could do some other operation over the problem), nor that it is idempotent.This allows us to model several forms of \approximate" constraint propagationwhich were instead not modeled in [BMR97]. Example are: bounds-consistencyfor classical constraints [MS98], and partial soft arc-consistency for soft con-straints [BCGR00].These two results allow us to use the GI algorithm schema for performing ageneralized form of soft constraint propagation. What is important to study, atthis point, is when the resulting GI schema terminates. In fact, if we work withclassical constraints over �nite domains, it is easy to see that the GI algorithmalways terminates. However, when moving to soft constraints over a semiring,even if the variable domain is �nite, we could have an in�nite behavior due to anin�nite number of elements in the semiring. For example, fuzzy constraints havea semiring containing all reals between 0 and 1, and the semiring of weightedconstraints contains all the reals, or all the naturals.In Section 6 we identify some su�cient conditions for the termination of theGI algorithm over soft constraints. The �rst, predictable, condition that we con-sider is the well-foundedness of the partial order over soft constraint problems: ifthe partial order over which the GI algorithm works has chains of �nite length,since constraint propagation never goes from one chain to another one, obviouslythe whole algorithm terminates.The second condition is in some sense more precise, although less general:when the propagation steps are de�ned via the two semiring operations, then wecan just consider the sub-order over semiring elements obtained by taking theelements initially appearing in the given problem, and closing it under the two

operations. In fact, in this case the GI algorithm cannot reach other elements.Therefore, if such a set (or a superset of it) is well-founded, the GI algorithmterminates.Each of these two conditions is su�cient for termination. However, they couldbe di�cult to check, unless the partial order has a well-known structure of whichwe know the well-foundedness. Nevertheless, in a special case we can formallyprove that there exists a well-founded set of the shape required by the secondcondition above, and thus we can automatically deduce termination. This specialcase is related to the idempotence of the multiplicative operation of the semiring,the one that we use to combine constraints: if this operation is idempotent, thenGI terminates. For example, in classical constraints the multiplicative operationis logical and, and in fuzzy constraints it is the minimum, thus we can formallyprove that the algorithm GI over any classical or fuzzy constraint problem al-ways terminates, provided that the functions are de�ned via the two semiringoperations.We believe that the generalizations and termination conditions that we havedeveloped and proved will make soft constraints more widely applicable, andsoft constraint propagation more practically usable.2 Soft ConstraintsIn the semiring-based formalism for soft constraints [BMR97], a soft constraint isjust a constraint where each instantiation of its variables has an associated value.Combining constraints will then have to take into account such additional values,and thus the formalism has also to provide suitable operations for combination(�) and comparison (+) of tuples of values and constraints. This is why theformalization adopted in [BMR97] uses a semiring structure, which is just a setplus two operations.Semirings and SCSPs. A semiring is a tuple hA;+;�;0;1i such that: A isa set and 0;1 2 A; + is commutative, associative and 0 is its unit element; �is associative, distributes over +, 1 is its unit element and 0 is its absorbingelement. Further, we enforce some additional properties, leading to the notion ofc-semiring: a c-semiring is a semiring hA;+;�;0;1i such that + is idempotentwith 1 as its absorbing element and � is commutative.The partial order �S over the set A, de�ned as a �S b i� a+ b = b, is usedto compare elements in the semiring: a �S b means that b is \better" than a.A constraint system is a tuple CS = hS;D; V i where S is a c-semiring, D is a�nite set (the domain of the variables) and V is a �nite ordered set of variables.Given a semiring S = hA;+;�;0;1i and a constraint system CS = hS;D; V i,a constraint is a pair hdef; coni where con � V and def : Djconj ! A. Thereforea constraint speci�es a set con of variables and assigns each tuple of values ofthese variables an element of the semiring.A Soft Constraint Satisfaction Problem (SCSP) on a constraint system CS isa pair P = hC; coni, where con � V and C is a set of constraints: con represents

the set of variables of interest for the constraint set C, which however maycontain constraints de�ned on variables not in con.Combining and projecting soft constraints. Given two constraints c1 =hdef1; con1i and c2 = hdef2; con2i, their combination c1 c2 is the constrainthdef; coni de�ned by con = con1[con2 and def(t) = def1(t #concon1)�def(t #concon2),where t #XY denotes the projection of tuple t from X onto Y . In words, combiningtwo constraints means building a new constraint involving all the variables ofthe original one; the new constraint associates to each tuple of domain values asemiring element obtained by multiplying the elements associated by the originalconstraints to the appropriate subtuples.Given a constraint c = hdef; coni and a subset I of V , the projection of c ontoI , written c +I , is the constraint hdef 0; con0i where con0 = con\I and def 0(t0) =Ptjt#conI\con=t0 def(t). Thus, projecting means eliminating some variables. This isdone by associating each tuple t over the remaining variables a semiring element;the last one is the sum of the elements associated by the original constraint toall the extensions of the tuple t over the eliminated variables.In brief: combination is performed via the multiplicative operation of thesemiring, and projection via the additive one.Examples. Classical CSPs are SCSPs where the chosen c-semiring is Bool =hffalse; trueg; _;^; false; truei. By means of Bool we can associate each tupleof elements in D a Boolean value, false or true, then project and combineconstraints via the Boolean connectives.Fuzzy CSPs [DFP93] can instead be modeled by choosing the c-semiringFuzzy = h[0; 1]; max;min; 0; 1i. In fact, there each tuple has a value between0 and 1; constraints are combined via the min operation and compared via themax operation.Solutions. The solution of an SCSP P = hC; coni is the constraint Sol(P ) =(NC) +con: it is obtained by combining all constraints of P and then projectingover the variables in con. In this way we get the constraint over con that is\induced" by the entire problem P .Two problems P1 = hC1; coni and P2 = hC2; coni (notice that they have thesame con) are considered equivalent, and written as P1 �P P2, when Sol(P1) =Sol(P2).Soft local consistency. Most of the traditional local consistency (also calledpropagation) algorithms can be generalized to SCSPs [BMR97]. In order to de�nelocal consistency algorithms for SCSPs, the notion of local consistency rule isintroduced. The application of one of such rules consists of solving a subproblemof the given problem.To model this, we use the notion of typed location. Informally, a typed locationis just a location l (as in ordinary store-based programming languages) whichhas a set of variables con as type, and thus can only be assigned a constraint

c = hdef; coni with the same type. In the following we assume to have a locationfor every set of variables, and thus we identify a location with its type.Given an SCSP P = hC; coni, the value [l]P of the location l in P is de�nedas the constraint hdef; li 2 C if it exists, as h1; li otherwise. Given n locationsl1; : : : ; ln, the value [fl1; : : : ; lng]P of this set of locations in P is de�ned as theset of constraints f[l1]P ; : : : ; [ln]P g.An assignment is a pair l := c where c = hdef; li. Given an SCSP P =hC; coni, the result of the assignment l := c is the problem [l := c](P ) de�nedas: [l := c](P ) = hfhdef 0; con0i 2 C j con0 6= lg [ c; coni:Thus an assignment l := c is seen as a function from constraint problemsto constraint problems, that modi�es a given problem by changing just oneconstraint, namely the one with type l. The change consists in substituting such aconstraint with c. If there is no constraint of type l, then the constraint c is addedto the given problem. In other words, the assignment l := c in P produces a newproblem P 0 which is the same as P , except that it has an additional constraintc over the variables in l, and that the old constraints over l are removed. Notealso that when j l j= 1 we are able to modify domains, since a domain can beseen as a unary constraint.Consider a constraint system CS = hS;D; V i, a location l and a set of loca-tions L, where l 2 L; a local consistency rule rLl is a function rLl which, takenany problem P over CS, returns rLl (P ) = [l := Sol(h[L]P ; li)](P ):Intuitively, the application of rLl to P adds the constraint Sol(h[L]P ; li) overthe variables in l to P . This constraint, by de�nition of Sol, is obtained bycombining all constraints of P identi�ed by L and then projecting the resultingconstraint over l.Since a local consistency rule is a function from problems to problems, theapplication of a sequence S of rules to a problem is easily provided by func-tion composition: we write [r;S](P ) = [S]([r1](P )) and mean that the problem[r;S](P ) is obtained applying �rst the rule r and then the rules of the sequenceS in the speci�ed order.An in�nite sequence T of rules of a set R is called a strategy. A strategy isfair if each rule of R occurs in it in�nitely often.We are now ready to de�ne local consistency algorithms. Given a problemP , a set of rules R and a fair strategy T for R, a local consistency algorithmapplies to P the rules in R in the order given by T . The algorithm stops whenthe current problem is a �xpoint of all functions from R. In that case, we writelc(P;R; T ) to denote the resulting problem.3 Some useful orderings over semiring constraintsWe now review and modify some of the orderings among semiring elements,constraints, and problems, which have been introduced in [BMR97]; moreover,we also de�ne new orderings that will be used in the next sections.

3.1 Semiring orderAll the orderings we will consider in this section are derived from the partialorder �S over semiring elements, which, we recall, is de�ned as follows: a �S bi� a+ b = b. This intuitively means that b is \better" than a.De�nition 1. Consider any partial ordering hD;vi and the component-wiseordering hDn;vni, with n � 1, where hd1; : : : ; dni vn hd01; : : : ; d0ni i� di v d0i foreach i = 1; : : : ; n. Let f be a function from Dn to D. Then:{ f is monotonic i� hd1; : : : ; dni vn hd01; : : : ; d0ni implies f(hd1; : : : ; dni) vf(hd01; : : : ; d0ni);{ f is in ationary w.r.t. v i� di v f(hd1; : : : ; dni) for every i = 1; : : : ; n.Given the de�nition above, it is easy to see that the following results holdwhen D is the semiring set A and the order considered is �S :{ �S is a partial order;{ 0 is the minimum;{ 1 is the maximum.{ if � is idempotent, then hA;�Si is a distributive lattice where + is the luband � is the glb.{ + and � are monotonic with respect to �S ;{ + is in ationary with respect to �S ; instead � is in ationary with respectto �S .3.2 Constraint orderFrom the ordering �S over A, we can also de�ne a corresponding order betweenconstraints. Before introducing the new order we de�ne its domain, namely theset of all possible constraints over a constraint system.De�nition 2. Given a semiring S = hA;+;�;0;1i and a constraint systemCS = hS;D; V i, we de�ne the Constraint Universe related to the constraintsystem CS as follows: CCS = Scon�V fhdef; coni j def : Djconj ! Ag.We will write C (instead of CCS) when the constraint system CS is clearfrom the context.De�nition 3. Consider two constraints c1; c2 over a constraint system CS; as-sume that con1 � con2 and j con2 j= k. Then we write c1 vS c2 if and only if,for all k-tuples t of values from D, def2(t) �S def1(t #con2con1).Loosely speaking, a constraint c1 is smaller than c2 in the order vS i� it con-strains possibly less variables and assigns to each tuple a greater value withrespect to �S than c2 does.Theorem 1 (vS is a po). Given a semiring S = hA;+;�;0;1i with � idem-potent and a constraint system CS = hS;D; V i, we have the following:

� the relation vS is a partial order over the set CCS;� its bottom is h1; ;i, where the 0-arity function 1 : ; ! A is the constant 1of the semiring.Proof. We prove our �rst claim. We need to demonstrate that vS is a re exive,antisymmetric and transitive relation. Re exivity holds trivially. To prove anti-symmetry, suppose that c1 vS c2 and c2 vS c1; this yields that con1 = con2.Now, for all t 2 Djcon1j, we have both def1(t) �S def2(t) and def2(t) �S def1(t),hence def1(t) = def2(t) and so c1 = c2. The transitivity of vS follows from thetransitivity of �S. The other claim immediately follows from the de�nition ofvS . 23.3 Constraint set orderWe can easily extend the ordervS over constraints to a new order over constraintsets as follows.De�nition 4. Consider two sets of constraints C1; C2 over a constraint systemCS. Suppose furthermore that C1 = fc1i : i 2 Ig, C2 = fc2j : j 2 Jg, I � J andthat, for every i 2 I, the relation c1i vS c2i holds. Then we write C1 vC C2.The intuitive reading of C1 vC C2 is that C2 is a problem generally \moreconstraining" than C1 is, because C2 has (possibly) a larger number of \morerestrictive" constraints than C1 has.Theorem 2 (vC is a partial order). Given a semiring S = hA;+;�;0;1i,and a constraint system CS = hS;D; V i, we have that:� the relation vC is a partial order over }(C);� the bottom of the relation is ;.Proof. We only prove the �rst claim, the other one being straightforward. Re- exivity trivially holds. As far as antisymmetry is concerned, suppose thatC1 = fc1i gi2I , C2 = fc2jgj2J and both C1 vC C2 and C2 vC C1 hold; this meansthat I = J . Moreover, the following relations hold for every i 2 I : c1i vS c2i andc2i vS c1i . Hence c1i = c2i for every i 2 I , because vS is a partial order relation, cf.Theorem 1. Transitivity follows similarly, by exploiting the transitivity of vS .23.4 Problem orderSo far, we have introduced two partial orders: one between constraints (vS) andanother one between constraint sets (vC). However, local consistency algorithmstake constraint problems as input; therefore we need an ordering relation betweenproblems if we want the GI algorithm to be used for soft local consistency.First we de�ne the set of all problems that can be built over a constraintsystem CS.

De�nition 5. Given a semiring S = hA;+;�;0;1i and a constraint systemCS = hS;D; V i, we de�ne the Problem Set Universe related to the constraintsystem CS as PCS = fhC; coni j C � CCS ; con � var(C)g. When no confusioncan arise, we shall simply write P instead of PCS.De�nition 6. Given a constraint system CS, consider two problems P1 = hC1; con1iand P2 = hC2; con2i in PCS. We write P1 vP P2 i� C1 vC C2 and con1 � con2.We now need to de�ne a partially ordered structure that contains all SC-SPs that can be generated by enforcing local consistency, starting from a givenproblem.De�nition 7. Consider a constraint system CS and an SCSP P over it. Theup-closure of P , brie y P ", is the class of all problems P 0 on CS such thatP vP P 0.Proposition 1. Consider a constraint system CS, an SCSP P over it and itsup-closure P ". Then the following statements hold:1. if P1 vP P2 and P1 2 P ", then P2 2 P ";2. if P1 vP P2, then P2 "� P1 ".The proof of the above proposition is an immediate consequence of the pre-vious de�nition and of the fact that vC is transitive, cf. Theorem 2.Theorem 3 (vP is a po). Given a constraint system CS = hS;D; V i and aproblem P on it, we have:� the relation vP is a partial order over PCS;� in particular hP ";vP jP"i is a partial ordering, where vP jP" is the restrictionof vP to P "; when no confusion can arise, we simply write hP ";vP i;� the bottom ?CS of hP ";vP i is P .Proof. We prove the �rst claim, the other ones following immediately from thede�nition of P " and Proposition 1. As usual, we only prove that the relationis antisymmetric, because transitivity can be proved similarly and re exivitytrivially holds. Hence, suppose that both P1 vP P2 and P2 vP P1 hold. Thismeans that we have the following relations: con1 � con2, C1 vC C2, con2 � con1,C2 vC C1. From the two previous relations and Theorem 2, it follows thatcon1 = con2 and C1 = C2; hence P1 = P2. 23.5 Order-related properties of soft local consistency rulesWe recall, from Section 2, that two problems P1 and P2, that share the sameset of variables, are equivalent if they have the same solution set, and we writeP1 �P P2.Now we can list some useful properties of soft local consistency rules, whichare related to equivalence and to problem ordering [BMR97]. Here we assumethat we are given a constraint system C and a rule r on CS:

{ (equivalence) P �P rLl (P ) if � is idempotent.{ (in ationarity) P vP rLl (P ). This means that the new semiring values as-signed to tuples by the rule application are always smaller than or equal tothe old ones with respect to �S .{ (monotonicity) Consider two SCSPs P1 = hC1; con1i and P2 = hC2; con2iover CS. If P1 vP P2, then r(P1) vP r(P2).It is easy to prove that all the results about local consistency rules hold alsofor a whole local consistency algorithm. Moreover, we can prove also that thestrategy does not in uence the result, if it is fair [BMR97].4 The Generic Iteration algorithmIn [Apt99b] the Generic Iteration (GI) algorithm is introduced to �nd the least�xpoint of a �nite set of functions de�ned on a partial ordering with bottom.This was then used as an algorithmic schema for classical constraint propaga-tion: each step of constraint propagation was seen as the application of one ofthese functions. Our idea is to compare this schema with the one used for softconstraints, with the aim of obtaining a new schema which is the most general(that is, it can be applied both to classical and to soft constraints) and has theadvantages of both of them.Given a partial ordering with bottom, say hD;v;?i, consider now a set offunctions F := ff1; : : : ; fkg on D. The following algorithm can compute the leastcommon �x point of the functions in F .Generic Iteration Algorithm (GI)d := ?;G := F ;while G 6= ; dochoose g 2 G;G := G� fgg;G := G [ update(G; g; d);d := g(d)od where for all G; g; d the set of functions update(G; g; d) from F is such that:A. ff 2 F �G j f(d) = d ^ f(g(d)) 6= g(d)g � update(G; g; d);B. g(d) = d implies update(G; g; d) = ;;C. g(g(d)) 6= g(d) implies g 2 update(G; g; d).Assumption A states that update(G; g; d) at least contains all the functionsfrom F �G for which d is a �x point but g(d) is not. So at each loop iterationsuch functions are added to the set G. In turn, assumption B states that nofunctions are added to G in case the value of d did not change. Note that,

even though after the assignment G := G � fgg we have g 2 F � G, stillg 62 ff 2 F �G j f(d) = d ^ f(g(d)) 6= g(d)g holds. So assumption A does notprovide any information when g is to be added back to G. This information isprovided in assumption C. On the whole, the idea is to keep in G at least allfunctions f for which the current value of d is not a �x point.We now recall the results which state the (partial) correctness of the GIalgorithm, cf. [Apt99b]:i. Every terminating execution of the GI algorithm computes in d a common�xpoint of the functions from F .ii. Suppose that all functions in F are monotonic. Then every terminating ex-ecution of the GI algorithm computes in d the least common �xpoint of allthe functions from F .iii. Suppose that all functions in F are in ationary and that D is �nite. Thenevery execution of the GI algorithm terminates. 25 Generalized local consistency for soft constraints viaalgorithm GIIn this section we will try to combine the two formalisms described so far (softconstraints and the GI algorithm). Our goal is to exploit the GI algorithm toperform local consistency over soft constraint problems.5.1 GI for standard local consistency over soft constraintsThe functions that GI needs in input are de�ned on a partial ordering withbottom. In the case of local consistency rules for SCSPs, the partial orderingis hP ";vP i, and the bottom is the problem P itself, cf. Theorem 3. Moreover,the local consistency rules (and also the more general local consistency func-tions) have all the \good" properties that GI needs. Namely, those functions aremonotonic and in ationary. Thus algorithm GI can be used to perform constraintpropagation over soft constraint problems. More precisely, we can see that algo-rithm GI and the local consistency algorithm schema for soft constraints obtainthe same result.Theorem 4 (GI for soft local consistency rules). Given an SCSP P overa constraint system CS, consider the SCSP lc(P;R; T ) obtained by applying toP a local consistency algorithm using the rules in R and with a fair strategy T .Consider also the partial order hP ";vP i, and the set of functions R, and applyalgorithm GI to such input. Then the output of GI coincides with lc(P;R; T ).5.2 GI for generalized local consistency over soft constraintsWhile all local consistency rules are idempotent (since they solve a subproblem),algorithm GI does not need this property. This means that we can de�ne ageneralized notion of local consistency rules for soft constraints, by droppingidempotence.

De�nition 8 (local consistency functions). Consider an SCSP problem Pover a semiring S. A local consistency function for P is a function f : P "! P "which is monotonic and in ationary over vP .With this de�nition of a local consistency function we relax two conditionsabout a local consistency step:{ that it must solve a subproblem;{ that it must be idempotent.The second generalization has been triggered by the results about the GI al-gorithm, which have shown that idempotence is not needed for the desiredresults. Moreover, many practical local consistency algorithms do not exactlysolve subproblems, but generate an approximation of the solution (see for ex-ample the de�nition of bounds consistency in [MS98] or the notion of partialsoft arc-consistency in [BCGR00]). Thus the �rst extension allows one to modelmany more practical propagation algorithms.Theorem 5 (GI for soft local consistency functions). Given a constraintsystem CS and an SCSP problem P on it, let us apply the GI algorithm to thepartial order hP ";vP i and a �nite set R of local consistency functions. Thenevery terminating execution of the GI algorithm computes in the output problemP 0 the least common �xpoint of all the functions from R.What is now important to investigate is when the algorithm terminates. Thisis particularly crucial for soft constraints, since, even when the variable domainsare �nite, the semiring may contain an in�nite number of elements, which isobviously a source of possible non-termination.6 Termination of the GI algorithm over soft constraintsAs noted above, the presence of a possibly in�nite semiring may lead to a con-straint propagation algorithm which does not terminate. In the following we willgive several independent conditions which guarantee termination in some specialcases.The �rst condition is a predictable extension of the one given in Section4: instead of requiring the �niteness of the domain of computation, we justrequire that its chains have �nite length, since it is easy to see that constraintpropagation moves along a chain in the partial order.Theorem 6 (termination 1). Given a constraint system CS and an SCSPproblem P on it, let us instantiate the GI algorithm with the po hP ";vP i and a�nite set R of local consistency functions. Suppose that the order =CS restrictedto P " is well founded. Then every execution of the GI algorithm terminates.This theorem can be used to prove termination in many case. For example,classical constraints over �nite domains generate a partial order which is �nite

(an thus trivially well-founded), so the above theorem guarantees termination.Another example occurs when dealing with weighted soft constraints, where wedeal with the naturals. Here the semiring is hN;min;+; 0;+1i. Thus we havean in�nite order, but well-founded.However, there are also many interesting cases in which the ordering hP ";<P i is not well-founded. Consider for instance the case of fuzzy or probabilisticCSPs. For fuzzy CSPs, the semiring is h[0; 1];max;min; 0; 1i. Thus the partiallyordered structure containing all problems that are smaller than the given one,according to the semiring partial order, is not well-founded, since we have allthe reals between 0 and a certain element in [0,1]. Thus the above theoremcannot say anything about termination of GI in this case. However, this doesnot mean that GI does not terminate, but only that the theorem above cannotbe applied. In fact, later we will give another su�cient condition which willguarantee termination in the last two cases as well.In fact, if we restrict our attention to local consistency functions de�ned via+ and �, we can de�ne another condition on our input problem that guaranteesthe termination of the GI algorithm; this condition exploits the fact that thelocal consistency functions are de�ned by means of the two semiring operations,and the properties of such operations.De�nition 9 (semiring closure). Consider a constraint system CS with semir-ing S = hA;+;�; 0; 1i, and an SCSP P on CS. Consider also the set of semiringvalues appearing in P : Cl(P ) = Shdef 0;con0i2Cfdef 0(d) j d 2 Djcon0jg. Then, asemiring closure of P is any set B such that: Cl(P ) � B � A; B is closed withrespect to + and �; <S restricted to B is well founded.Theorem 7 (termination 2). Consider a constraint system CS with semiringS = hA;+;�; 0; 1i, an SCSP P on it and a �nite set of local consistency functionsR de�ned via + and �. Assume also there exists a semiring closure of P . Thenevery execution of the GI algorithm terminates.Proof. The proof is similar to the one in [Apt99b] for the termination theorem;just replace the order =CP with <S and accordingly the set D with B, where Bis a semiring closure of P . 2Notice that this theorem is similar to the one in [BMR97] about termination;however in [BMR97] they force the set B to be �nite in order to guarantee thetermination of a local consistency algorithm (cf. Theorem 4.14 of [BMR97]); ahypothesis that is implied by ours.If we have a fuzzy constraint problem, then we can take B as the set of allsemiring values appearing in the initial problem. In fact, this set is closed withrespect to min and max, which are the two semiring operations in this case.Moreover, it is well-founded, since it is �nite. Another example is constraintoptimization over the reals: if the initial problem contains only natural numbers,then the set B can be the set of all naturals, which is is a well-founded subsetof the reals and it is closed w.r.t. + (min) and � (sum).

Therefore, by using Theorem 7 we can prove that also constraint propagationover fuzzy constraint problems always terminates, provided that each step of thealgorithm uses a local consistency function which is de�ned in terms of the twosemiring operations only.However, it is not always easy to �nd a semiring closure of a given SCSP P ,mainly because we should check that the order restricted to a tentative set B,closed and containing Cl(P ), is well-founded. Nevertheless, there is a special casein which we don't have to �nd such a set, because we can prove that it alwaysexists (which is what Theorem 7 requires). This special case occurs when themultiplicative operation of the semiring is idempotent. In fact, we can prove thatin this case there exists always a �nite (and thus well-founded) semiring closureof any given problem over that semiring. This obviously is very convenient, sinceit provides us with an easy way to check whether Theorem 7 can be applied.Theorem 8 (idempotence of � and termination). Consider a constraintsystem CS, an SCSP P on it and a �nite set of local consistency functions Rde�ned via + and �. Assume also that � is idempotent. Then there exists a �nitesemiring closure of P , and thus every execution of the GI algorithm terminates.Proof. Consider the set Cl(P ) of all semiring elements appearing in P . If wecombine any subset of them via the + operation, we generate a set of elements,which contains Cl(P ), that we denote by Cl+. Notice that this set is �nite,because the number of subsets of Cl(P ) is �nite.Let us now combine any subset of elements of Cl+ via the � operation: inthis way we generate a larger set of elements, containing Cl+, which we denoteby Cl+�. Again, this set is �nite. Therefore Cl+� is a �nite semiring closureof P . 2Consider again the fuzzy constraint example. Here � is min, thus it is idem-potent. Therefore, by Theorem 8, GI over such problems always terminates.This is an alternative, and easier, way (to Theorem 7) to guarantee that softconstraint propagation over fuzzy constraints terminates. In fact, we don't haveto �nd a semiring closure of the problem, but just check that the multiplicativeoperation is idempotent.Considering all the above results, we can devise the following steps towardsproving the termination of algorithm GI on a soft constraint problem P over asemiring S:{ If the local consistency functions are de�ned via the two operations of S,and the multiplicative operation of S is idempotent, then GI terminates (byTheorems 8).{ If instead � is not idempotent, but we still have local consistency functionsde�ned via the two semiring operations, we can try to �nd a semiring closureof P . If we �nd it, then GI terminates (by Theorem 7).{ If we cannot �nd a semiring closure of P , or the local consistency functionsare more general, then we can try to prove that the partial order of problemsis well-founded. If it is so, the GI terminates (by Theorem 6).

While Theorem 8 applies in a special case of the hypothesis of Theorem 7, itis interesting to investigate the relationship between the hypothesis of Theorem6 and 7. What can be proved is that these two conditions, namely, the well-foundedness of the partial order of problems and the existence of a semiringclosure, are independent. In other words, there are cases in which one holds andnot the other one, and vice versa. To prove this result, we need the followingde�nition.De�nition 10. Let S = hA;+;�;0;1i be a semiring and B a subset of A. Theset B is a down-set (or an order ideal) if, whenever a 2 B, a0 2 A and a0 �S a,then a0 2 B. Given any subset B of A, the downward closure of B isB #:= fd0 2 A : 9d (d 2 B and d0 �S d)g:Observe that the class F of down-sets containing a subset B of A is not empty,since A itself is such a set. Moreover, it is easy to check that the downwardclosure of B is the smallest down-set of F ; hence the downward closure of a setis well de�ned.Given a semiring S = hA;+;�;0;1i, the following result links the upwardclosure of a problem P with the downward closure of Cl(P ), thus allowing us tocompare the conditions in Theorem 6 and 7.Proposition 2. Given a constraint system CS and a problem P de�ned on it,consider the set B := fdef(t) 2 A : 9P 0 2 P " (c := hdef; coni 2 P 0; t 2Djconj)g: Then B = Cl(P ) #.Proof. It follows immediately from the de�nition of vP , of P " and Cl(P ) #. 2Now we can notice that, given a subset B of a semiring, if <S restricted toB is well founded, then so is <S restricted to B̂ := B [ f0;1g. Furthermore, ifB is �nite, so is B̂. In fact it is su�cient to check that the following identitieshold because of the fact that S = hA;+;�;0;1i is a c-semiring: if a 2 B thena + 0 = a 2 B; if a 2 B then a � 1 = a 2 B; if a 2 B then a + 1 = 1 2 B̂; ifa 2 B then a� 0 = 0 2 B̂. Hence, in Theorem 7, we can replace the hypothesis\Cl(P ) � B and B a semiring closure of Cl(P )" with the condition that \Cl(P)is a subset of a well founded sub-c-semiring B of S = hA;+;�;0;1i".Moreover, + is the least upper bound operation and, if � is idempotent, �is the greatest lower bound operation, cf. Theorem 2.9 and 2.10 of [BMR97].Hence a sub-c-semiring is also a sub-lattice of S = hA;+;�;0;1i and vice versaif � is idempotent. Thus a subset B of a semiring can be a down-set and yet itmay be not closed with respect to � and +. For instance, the set of negative realnumbers augmented with �1 is a down-set in the lattice R1 of reals extendedwith f+1;�1g and the usual linear ordering; however it is not a sub-latticeitself. Vice versa, there are sub-lattices of R1 - hence sets that are closed withrespect to the least upper bound and the greatest lower bound operations -that are not down-sets. For instance, the extended interval [0; 1] [ f+1;�1g.Therefore the two conditions that guarantee the termination of algorithm GI inTheorems 6 and 7 are independent.

7 ConclusionsThe results of this paper show that indeed it is possible to treat in a uniform wayhard and soft constraints. This was already shown in [BMR97], but restricted toa notion of local consistency where each step solves a subproblem. Here insteadwe have extended this result also to more general propagation algorithms, whichapproximate the classical notion in order to be more e�cient. Moreover, wehave also studied the conditions under which constraint propagation terminates.Some results were already present in [BMR97] and [Apt99b], but here we havegeneralized and extended them, providing more general, and also more easilycheckable, su�cient conditions.References[Apt99a] K.R. Apt, The Essence of Constraint Propagation, Theoretical ComputerScience, 221(1-2), pp. 179-210, 1999.[Apt99b] K.R. Apt, The Rough Guide to Constraint Propagation, Proc. of the 5thInternational Conference on Principles and Practice of Constraint Programming(CP'99), (invited lecture), Springer-Verlag Lecture Notes in Computer Science1713, pp. 1-23.[B94] C. Bessi�ere. Arc-consistency and Arc-consistency again. Arti�cial Intelligence,65(1), 1994.[BCGR00] S. Bistarelli, P. Codognet, Y. Georget and F. Rossi Labeling and PartialLocal Consistency for Soft Constraint Programming Proc. of the 2nd InternationalWorkshop on Practical Aspects of Declarative Languages (PADL'00), Springer-Verlag Lecture Notes in Computer Science 1753, 2000.[BMR95] S. Bistarelli, U. Montanari and F. Rossi. Constraint Solving over Semirings.Proceedings of IJCAI'95, Morgan Kaufman, 1995.[BMR97] S. Bistarelli, U. Montanari and F. Rossi. Semiring-based Constraint Solvingand Optimization. Journal of ACM, vol. 44, no. 2, March 1997.[DFP93] D. Dubois, H. Fargier and H. Prade. The calculus of fuzzy restrictions as abasis for exible constraint satisfaction. Proc. IEEE International Conference onFuzzy Systems, IEEE, pp. 1131{1136, 1993.[FL93] H. Fargier and J. Lang Uncertainty in Constraint Satisfaction Problems: aProbabilistic Approach Proc. European Conference on Symbolic and QualitativeApproaches to Reasoning and Uncertainty (ECSQARU), Springer-Verlag, LNCS747, pp. 97{104, 1993.[FW92] E. C. Freuder and R. J. Wallace. Partial Constraint Satisfaction. AI Journal,1992, 58.[AC5] P. Van Hentenryck, Y. Deville and C-M. Teng. A generic arc-consistency algo-rithm and its specializations. Arti�cial Intelligence 57 (1992), pp 291-321.[MS98] K. Marriott and P. Stuckey. Programming with Constraints. MIT Press, 1998.[SFV95] T. Schiex and H. Fargier and G. Verfaille. Valued Constraint SatisfactionProblems: Hard and Easy Problems. Proc. IJCAI95, Morgan Kaufmann, pp. 631{637, 1995.