• No results found

Solutions for Soft Constraint Satisfaction Problems

2.3 Soft Constraints and Satisfaction Problems

2.3.2 Solutions for Soft Constraint Satisfaction Problems

Using the operations of combination and projection, it is now possible to define the notion of solution of an SCSP. The solution of an SCSP problem P= hC, coni is

Definition 6 (SCSP solution) Given a constraint problem P= hC, coni over a constraint system CS, the solution of P is a constraint defined as Sol(P) = (N C) ⇓con.

That is, all constraints can be combined, and then project over the variables in con. In this way the constraint over con is obtained, which is “induced” by the entire SCSP. Such constraint provides, for each tuple of values of D for the variables in con, a corresponding value of A.

For example, the solution of the fuzzy CSP of Fig. 5 associates a se- miring element to every domain value of variable x. Such an element is obtained by first combining all the constraints together. For instance, for the tuple ha, ai (that is, x = y = a), we have to compute the minimum be- tween 0.9 (which is the value assigned to x = a in constraint c1), 0.8 (which

is the value assigned to hx= a, y = ai in c2) and 0.9 (which is the value for

y= a in c3). Hence, the resulting value for this tuple is 0.8. The same work

can be done for tuple ha, bi → 0.2, hb, ai → 0 and hb, bi → 0. The obtained tuples are then projected over variable x, obtaining the solution hai → 0.8 and hbi → 0.

Sometimes, it is enough to know just the best value associated with such tuples. In our framework, this is still a constraint (over an empty

set of variables), and will be called the best level of consistency of the whole problem, where the meaning of “best” depends on the ordering ≤S

defined by the additive operation.

Definition 7 (Best level of consistency) Given an SCSP P = hC, coni, the blevel(P) ∈ S is defined such that hblevel(P), ∅i = (N C) ⇓∅. Moreover, P is

consistent if 0<Sblevel(P) (otherwise, P is inconsistent), and P isα-consistent

if blevel(P)= α.

Informally, the best level of consistency gives us an idea of how much we can satisfy the constraints of the given problem. Note that blevel(P) does not depend on the choice of the distinguished variables, due to the associative property of the additive operation. Thus, since a constraint problem is just a set of constraints plus a set of distinguished variables, we can also apply function blevel to a set of constraints only. More precisely, blevel(C) will mean blevel(hC, coni) for any con.

Note that blevel(P) can also be obtained by first computing the solution and then projecting such a constraint over the empty set of variables, as the following proposition shows.

Proposition 1 Given an SCSP P, we have that Sol(P) ⇓∅= hblevel(P), ∅i.

The proof is: Sol(P) ⇓∅coincides with ((N C) ⇓con) ⇓∅ by definition of

Sol(P). This coincides with (N C) ⇓∅(Bis04; BMR97b), thus it is the same

as hblevel(P), ∅i by Def. 7.

2.4

Soft Constraint Logic Programming

Constraint logic programming (CLP) (JL87) languages extend logic pro- gramming (LP) by replacing term equalities with constraints and unifi- cation with constraint solving. Programming in CLP means choosing a constraint system for a specific class of constraints (for example, linear arithmetic constraints, or finite domain constraints) and embedding it into a logic programming engine. This approach is very flexible since one can choose among many constraint systems without changing the overall

programming language, and has shown to be very successful in speci- fying and solving complex problems in terms of constraints of various kind (Wal96). It can, however, only handle classical constraint solving. Thus, it is natural to try to extend the CLP formalism in order to also be able to handle soft constraints. In fact, this new programming paradigm, which is called SCLP (for Semiring-based CLP, or also Soft CLP), has the advantage of treating in a uniform way, and with the same underlying machinery, all constraints that can be seen as instances of the semiring- based approach: from optimization to satisfaction problems, from fuzzy to probabilistic, prioritised, or uncertain constraints, and also multi-criteria problems, without losing the ability to treat and solve classical hard con- straints. This leads to a high-level declarative programming formalism where real-life problems involving constraints of all these kinds can be easily modeled and solved.

In passing from CLP to soft CLP languages (i.e. SCLP), classical con- straints will be replaced with the more general SCSP constraints. By doing this, from a technical point of view, the notions of interpretation, model, model intersection, and others must be modified, since we have to take into account the semiring operations and not the usual CLP operations. For example, while CLP interpretations associate a truth value (either true or false) to each ground atom, in this case ground atoms must be given one of the elements of the semiring. Furthermore, whereas in CLP the value associated with an existentially quantified atom is the logical or among the truth values associated to each of its instantiations, here the or must be replaced with another operation that refers to one of the semiring opera- tions. The following content comes from the works (BMR97a; BR01).

The SCLP framework is based on the notion of c-semiring introduced in (BMR95; BMR97c; Bis04) and also described in Ch. 2.2. As usual, a program is a set of clauses. Each clause is composed by a head and a body. The head is just an atom and the body is either a collection of atoms, or a value of the semiring, or a special symbol () to denote that it is empty. Clauses where the body is empty or it is just a semiring element are called facts and define predicates which represent constraints. When the body is empty, it can be interpreted as having the best semiring element (that is,

1).

Atoms are n-ary predicate symbols followed by a tuple of n terms. Each term is either a constant or a variable or an n-ary function symbol followed by n terms. Ground terms are terms without variables. Finally, a goal is a collection of atoms. The BNF for this syntax follows in Tab. 1. P :: CL | CL, P

CL :: H : −B

H :: AT where AT is the category of atoms LAT ::  | LAT0

LAT0:: AT | AT, LAT0

B :: LAT | a where a ∈ A

G :: : −LAT

Table 1:BNF for the SCLP syntax.

In passing from CLP to SCLP languages, the authors of (BR01) replaced classical constraints with the more general SCSP constraints where a level of preference can be assigned to each instantiated constraint (i.e. a ground atom). To do this, the authors also modified the notions of interpretation, model, model intersection, and others, since the semiring operations must be taken into account, and not the usual CLP operations. For example, while CLP interpretations associate a truth value (either true or false) with each ground atom, in SCLP ground atoms must be given one of the ele- ments of the semiring. Also, while in CLP the value associated with an existentially quantified atom is the logical or among the truth values asso- ciated with each of its instantiations, here the authors had to replace the or with another operation which refers to one of the semiring operations (the+). The combination of atoms, which in CLP is modeled via logical and, in SCLP is instead handled via the × operation of the semiring.

Besides the model-theoretic semantics based on models and interpre- tations, SCLP programs come also with a fixpoint and an operational semantics. These semantics are conservative extensions of the corre- sponding ones for logic programming (LP), since by choosing a particular semiring (the one with just two elements, true and false, and the logical

and and or as the two semiring operations) it is possible to get exactly the LP semantics.

The presence of a possibly partial order among the elements of the semiring makes the operational semantics more complex to compute. In fact, there could be several refutations for a goal which lead to different semiring elements which are not comparable in the partial order. In this case, these elements have to be combined in order to get the solution corresponding to the given goal, and their combination could be not reachable by any refutation path in the search tree.

The fact that several refutation paths must be combined when we have a partial order (instead of a total one) can be fruitfully used when we have any problem with a cost vector made of several incomparable costs. In fact, in the case of a partial order, the solution of such a problem should consists of all those solutions which are not “dominated” by others.