Constraint Satisfaction Model and Notions of Local Consistency

Constraint Satisfaction Model and Notions of Local Consistency

DM877 Constraint Programming Notions of Local Consistency Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Outline 1. Resume 2. Local Consitency: Definitions 2 Constraint Programming The domain of a variable x, denoted D(x), is a finite set of elements that can be assigned to x. A constraint C on X is a subset of the Cartesian product of the domains of the variables in X, i.e., C ⊆ D(x1) × · · · × D(xk ). A tuple (d1;:::; dk ) 2 C is called a solution to C. Equivalently, we say that a solution (d1; :::; dk ) 2 C is an assignment of the value di to the variable xi for all1 ≤ i ≤ k, and that this assignment satisfies C. If C = ;, we say that it is inconsistent. 3 Constraint Programming Constraint Satisfaction Problem (CSP) A CSP is a finite set of variables X with domain extension D = D(x1) × · · · × D(xn), together with a finite set of constraints C, each on a subset of X .A solution to a CSP is an assignment of a value d 2 D(x) to each x 2 X , such that all constraints are satisfied simultaneously. Constraint Optimization Problem (COP) A COP is a CSP P defined on the variables x1;:::; xn, together with an objective function f : D(x1) × · · · × D(xn) ! Q that assigns a value to each assignment of values to the variables. An optimal solution to a minimization (maximization) COP is a solution d to P that minimizes (maximizes) the value of f (d). 4 Task: I determine whether the CSP/COP is consistent (has a solution): I find one solution I find all solutions I find one optimal solution I find all optimal solutions 5 Solving CSPs I Systematic search: I choose a variable xi that is not yet assigned I create a choice point, i.e. a set of mutually exclusive & exhaustive choices, e.g. xi = v vs xi 6= v I try the first & backtrack to try the other if this fails I Constraint propagation: I add xi = v or x 6= v to the set of constraints I re-establish local consistency on each constraint remove values from the domains of future variables that can no longer be used because of this choice I fail if any future variable has no values left 6 Representing a Problem I a CSP P = hX ; D; Ci represents a problem P, if every solution of P corresponds to a solution of P and every solution of P can be derived from at least one solution of P I More than one solution of P can represent the same solution of P or viceversa, if symmetries are present I The variables and values of P represent entities in P I The constraints of P ensure the correspondence between solutions I we must make sure that any solution to P yields exactly one solution to P, and that any solution to P corresponds to a solution to P or is symmetrically equivalent to such a solution, and that if P has no solutions, this is because P itself has no solutions. I The aim is to find a model P that can be solved as quickly as possible (Note that shortest run-time might not mean least search!) 7 Interactions with Search Strategy Whether a model is better than another can depend on the search algorithm and search heuristics I Let’s assume that the search algorithm is fixed although different level of consistency can also play a role I Let’s also assume that choice points are always xi = v vs xi 6= v I Variable (and value) order still interact with the model a lot I Is variable & value ordering part of modelling? In practice it is. but it depends on the modeling language used 8 Outline 1. Resume 2. Local Consitency: Definitions 9 Goals I Establish formalism around constraint handling I Learning general constraint propagation algorithms 10 Reasoning with Constraints Constraint Propagation, related notions: I constraint relaxation I filtering algorithms I narrowing algorithms I constraint inference I simplification algorithms I label inference I local consistency enforcing I rules iteration I propagation loop I proof rules 11 Local Consistency define properties that the constraint problem must satisfy after constraint propagation Rules Iteration defines properties on the process of propagation itself, that is, kind and order of operations of reduction applied to the problem 12 Notation and Terminology Finite domains w.l.g. D ⊆ Z Constraint C: relation on a (ordered) subsequence of variables I X (C) = (xi1 ;:::; xijX (C)j ) is the scheme or scope of C I jX (C)j is the arity of C (unary/binary/non-binary) I C ⊆ ZjX (C)j containing combinations of valid values (or tuples) τ 2 ZjX (C)j I constraint check: testing whether a τ satisfies C I C: a t-tuple of constraints C = (C1;:::; Ct ) I expression I extensional: specifies satisfying tuples (aka table or regular via DFA). eg. c(x1; x2) = f(2; 2); (2; 3); (3; 2); (3; 3)g I intensional: specifies the characteristic function. eg. alldiff(x1; x2; x3) 13 CSP Input: I Variables X = (x1;:::; xn) I Domain Expression D = fx1 2 D(x1);:::; xn 2 D(xn)g I C finite set of constraints each on a subsequence Y of X . C 2 C on Y = (y1;:::; yk ) is C ⊆ D(y1) × ::: × D(yk ) a constraint satisfaction problem (CSP) is P = hX ; D; Ci (v1;:::; vn) 2 D(x1) × ::: × D(xn) is a solution of P if for each constraint Ci 2 C on xi1 :::; xim it is (vi1 ;:::; vim ) 2 Ci CSP normalized: iff two different constraints do not involve exactly the same vars CSP binary iff for all Ci 2 C; jX (C)j = 2 14 Notation and Terminology Given a tuple τ on a sequence Y of variables and W ⊆ Y , I τ[W ] is the restriction of τ to variables in W (ordered accordingly) I τ[xi ] is the value of xi in τ I if X (C) = X (C 0) and C ⊆ C 0 then for all τ 2 C the reordering of τ according to X (C 0) satisfies C 0. Example C(x1; x2; x3): x1 + x2 = x3 0 0 C ⊆ C C (x1; x2; x3): x1 + x2 ≤ x3 15 Notation and Terminology I Given Y ⊆ X (C), πY (C) denotes the projection of C on Y . It contains tuples on Y that can be extended to a tuple on X (C) satisfying C. I given X (C1) = X (C2), the intersection C1 \ C2 contains the tuples τ that satisfy both C1 and C2 k I join of fC1 ::: Ck g is the relation with scheme [i=1X (Ci ) that contains tuples such that τ[X (Ci )] 2 Ci for all1 ≤ i ≤ k. Example P = hX = (x1; x2; x3; x4); D = fD(xi ) = f1::5g; 8ig; C = fC1 ≡ alldiff(x1; x2; x3); C2 ≡ x1 ≤ x2 ≤ x3; C3 ≡ x4 ≥ 2x2gi πx1;x2 (C1) ≡ (x1 6= x2) C1 \ C2 ≡ (x1 < x2 < x3) join fC1;:::; C3g ≡ (x1 < x2 < x3 ^ x4 ≥ 2x2) 16 Notation and Terminology Given P = hX ; D; Ci the instantiation I is a tuple on Y = (x1;:::; xk ) ⊆ X : ((x1; v1);:::; (xk ; vk )) I I on Y is valid iff 8xi 2 Y , I [xi ] 2 D(xi ) I I on Y is locally consistent iff it is valid and for all C 2 C with X (C) ⊆ Y , I [X (C)] satisfies C (some constraints may have X (C) 6⊆ Y ) I a solution to P is an instantiation I on X (C) which is locally consistent I I on Y is globally consistent if it can be extended to a solution, i.e., there exists s 2 sol(P) with I = s[Y ] Example P = hX = (x1; x2; x3; x4); D = fD(xi ) = f1::5g; 8ig; C = fC1 ≡ alldiff(x1; x2; x3); C2 ≡ x1 ≤ x2 ≤ x3; C3 ≡ x4 ≥ 2x2gi πfx1;x2g(C1) ≡ (x1 6= x2) I1 = ((x1; 1); (x2; 2); (x4; 7)) is not valid I2 = ((x1; 1); (x2; 1); (x4; 3)) is local consistent since C3 only one with X (C3) ⊆ Y and I2[X (C3)] satisfies C3 I2 is not global consistent: sol(P) = f(1; 2; 3; 4); (1; 2; 3; 5)g 17 Notation and Terminology I An instantiation I on P is globally consistent if it can be extended to a solution of P, globally inconsistent otherwise. I A globally inconsistent instantiation is also called a (standard) nogood. (a partial instantiation that does not lead to a solution.) I Remark: A locally inconsistent instantiation is a nogood. The reverse is not necessarily true 18 Example 19 Example 19 Notation and Terminology CSP solved by extending partial instantiations to global consistent ones and backtracking at local inconsitencies is NP-complete! Idea: make the problem more explicit (tighter) 0 P P iff XP0 = XP and any instantiation I on Y ⊆ XP locally inconsistent for P is locally inconsistent for P0. Example P =hX = (x1; x2; x3); D = fD(xi ) = [1::4]; 8ig; C = fC1 ≡ x1 < x2; C2 ≡ x2 < x3; C3 ≡ f(111); (123); (222); (333); (234)ggi 0 0 0 0 P =hX ; D; C i; C = fC1; C2; C3 ≡ f(123)ggi 0 0 P P: All locally inconsitent instantiations on Y ⊆ XP for P are locally inconsistent for P . 0 0 0 0 Indeed XP0 = XP ; DP0 = D and C1 = C1; C2 = C2; X (C3) = X (C3); C3 ⊂ C3. However not all solutions are preserved! 20 Example P = hX = (x1; x2; x3); D = fD(xi ) = [1::4]; 8ig; C = fC1 ≡ x1 < x2; C2 ≡ x2 < x3; C3 ≡ f(111); (123); (222); (333)ggi 0 0 0 0 P = hX ; D; C i; C = fC1; C2; C3 ≡ f(123); (231); (312)gg For any tuple τ on X (C) that does not satisfy C there exists a constraint C 0 in C0 with X (C 0) ⊆ X (C) such that τ[X (C 0)] 62 C 0 (τ local inconsistent).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    33 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us