Encoding Global Constraints in Semiring-based ... - CiteSeerX

1 downloads 0 Views 225KB Size Report
def : D jconj !A. De nition 6 (constraint problem) A constraint problem is a pair hC; coni where con. V and C is a set of constraints. We also assume that there are ...
Encoding Global Constraints in Semiring-based Constraint Solving Yan Georget, Philippe Codognet INRIA-Rocquencourt, BP 105, 78153 Le Chesnay, France fYan.Georget,[email protected]

Abstract In recent works, a general framework for constraint satisfaction over nite domains has been proposed, based on the concept of semiring-valued constraints. Classical CSPs, fuzzy CSPs, hierachical CSPs can be easily cast in this general framework. In this paper, we claim that translating any constraint problem into a semiring-based constraint problem makes it possible to express global informations about the problem more easily, especially in the case of non-crisp or preference constraints. Applying this concept to the case of set-based semirings, we give a theoretical result and two practical applications developed using clp(FD,S ), a full and ecient implementation of semiring-based constraint satisfaction in the CLP paradigm.

Areas: AI algorithms, Knowledge Sharing, Planning and Scheduling, Qualitative Reasoning, Fuzzy Logic and Reasoning Under Uncertainty, Intelligent Control.

1 Introduction Constraint Programming is a powerful framework for solving real-life problems [16]. Problem solving tools with \constraints inside" such as Ilog Solver or CHIP are successful systems showing that constraint-based techniques are competitive for solving large combinatorial problems. Constraint programming makes it possible for the user to describe a problem in a declarative way with a mathematical semantics that gives a real understanding of what is computed. For small-size problems for instance, the most ecient technique used for constraint solving is Arc-Consistency [13], which computes an approximationof the possible instantiations of the variables as the product of the possible domains of the variables. As soon as one deals with medium-size problems, one has to introduce so-called \global" constraints, that is, com-

plex n-ary constraints with associated speci c consistency techniques which can combine more precisely possible instantiations of several variables together. These constraints (for example, the alldi erent constraint [14], the cumulative constraint of CHIP [1], the sort constraint of Prolog IV [6] and the sequencing constraints of Ilog Solver [15]) \remove" some inconsistent instantiations of the variables and thus, prune the search space. Let us take a simple example. Consider three boolean variable X; Y; Z and the three following constraints : X 6= Y ; X 6= Z ; Y 6= Z. AC will not discover the unsatis ability of this problem because when taken one by one each constraint is arc-consistent (for each value of each variable, there is an associated value in the domain of the other variable that could satisfy the constraint). The problem is however unsolvable because it is impossible to associate three distinct values to three variables whose domains contain only values 0 and 1. A global treatment of these constraints (e.g. checking that the cardinality of the union of the domains of the variables linked by \6=" is at least equal to the number of variables) would immediately discover the unsatis ability of the problem. The drawback of these global constraints is that they act like black-boxes and do not have a real semantic (what is computed, when is it computed?). As complete algorithms are intractable in practice, implementations of global constraints usually rely on approximate solving that the user cannot control, creating a discrepancy between their intended declarative semantics and the operational behaviors of the constraint solver. In this paper, we propose an alternative for encoding some instances of global constraints. Our approach is based on a general framework for nite domains constraint satisfaction [4, 5] which generalizes traditional CSP by considering constraint tuples (describing which combination of values are allowed by the constraints) to be valued not only in a boolean algebra (yes/no) but in any semiring. With numerical semirings for instance,

one can easily cast fuzzy CSPs, weighted CSPs or partial CSPs in this framework. With a few additional conditions on the semiring structure, this framework allows to compute AC in a generic manner. Our approach is to push semiring-based constraint solving further and to use symbolic semirings in order to encode global informations about the problem in the semiring values. We will in particular investigate several instances of setbased semirings, which show to be particularly important for this purpose, and versatile enough for the different kinds of application that we have implemented using the clp(FD,S ) language developed at INRIA [12]. In this system, we have integrated the semiring-based solving techniques in the Constraint Logic programming paradigm, meaning that incrementality is a key feature of the solver. This paper is organized as follows: rst, in Section 2, we recall some de nitions about semiring-based constraint satisfaction; then, in Section 3, we detail the encoding of global informations in semiring values; an application of this concept is given as a theorem in Section 4; Sections 5, 6 and 7 give two examples, developed using clp(FD,Set) (an instance of clp(FD,S )), of such an encoding; we conclude in Section 8.

2 Semiring-based constraint satisfaction The purpose of this section is to describe brie y the semiring-based framework. For more details, and also for the proofs of the properties, the reader should refer to [4].

2.1 Semirings

De nition 1 (semiring) A semiring S is a tuple hA; +; ; 0; 1i such that: A is a set and 0; 1 2 A; + is closed, commutative, associative, 0 is its unit element;  is closed, associative, distribute over +, 1 is its unit element, 0 is its absorbing element.

De nition 3 (lc-semiring) A lc-semiring S is a csemiring hA; +; ; 0; 1i such that: A is nite;  is idempotent.

For any lc-semiring: + distribute over ; hA; S i is a complete distributive lattice and  its glb. The three following semirings are lc-semirings:  Bool = hffalse; trueg; _; ^; false; truei,  Fuzzy = hf0; 0:1;   ; 1g; max; min; 0; 1i,  Set = hP (U); [; \; ;; U i.

2.2 Constraints

De nition 4 (constraint system) A constraint system is a tuple CS = hS; D; V i where S is a c-semiring, D is a nite set and V is an ordered set of variables.

De nition 5 (constraint) A constraint is a pair hdef; coni where con  V (type of the constraint) and def : Djconj ! A. De nition 6 (constraint problem) A constraint problem is a pair hC; coni where con  V and C is a

set of constraints. We also assume that there are not two constraints with the same type. De nition 7 (tuple projection) Assuming that V is ordered via ordering , consider any k-tuple t = ht1 ;    ; tk i, of values of D and two sets W = fw1;    ; wk g and W 0 = fw10 ;    ; wm0 g such that W 0  W  V and wi  wj if i  j and wi0  wj0 if i  j . The projection of t from W to W 0, written t #W W , is de ned as the tuple t0 = ht01 ;    ; t0m i with t0i = tj if wi0 = wj . De nition 8 (combination) Given two constraints c1 = hdef1 ; con1i and c2 = hdef2 ; con2i, their combination c1 c2 is the constraint hdef; coni de ned by con = con con1 [ con2 and def(t) = def1 (t #con con1 )  def(t #con2 ) De nition 9 (projection) Given a constraint c = hdef; coni and a subset I of V , the projection of c over I , written c +I is the constraint hdef 0 ; con0i where P 0 0 0 con = con \ I and def (t ) = t=t#con def(t). I con=t 0

\

0

10 (solution) The solution N of the problem De nition 2 (c-semiring) A c-semiring S is a semir- PDe nition = h C; con i is the constraint Sol(P) = ( C) +con . ing hA; +; ; 0; 1i such that: + is idempotent, 1 is its absorbing element. De nition 11 (best level of consistency) The best level of consistency of the problem P is de ned by Let us consider the relation S over A such that a S blevel(P) = Sol(P) +; . We say that: P is -consistent b i a + b = b, then: S is a partial order; + and  are if blevel(P) = , P is consistent if there exists >S 0 monotone on S ; 0 is its minimum and 1 its maximum; such that P is -consistent, P is inconsistent if it is not hA; S i is a complete lattice and + is its lub. consistent.

De nition 12 (maximal solutions) Given a constraint problem P , consider Sol(P) = hdef; coni. A maximal solution of P is a pair ht; vi satisfying:  def(t) = v,  there is no t0 such that v