Docsity

The Constraint Satisfaction Problem and Constraint Programming, Study notes of Computer Numerical Control

Partial preview of the text

Download The Constraint Satisfaction Problem and Constraint Programming and more Study notes Computer Numerical Control in PDF only on Docsity!

Alan M. Frisch

Artificial Intelligence Group Department of Computer Science University of York

The Constraint Satisfaction Problem

Constraint Programming Last updated: 16 November 2010

The Constraint Satisfaction Problem

  • An instance of the finite-domain Constraint Satisfaction Problem (CSP) consists of - finite set of variables, X 1

,... ,X

n

  • for each variable X i a finite set of values, D i , called its domain , and
  • finite set of constraints. Each restricts the values that the variables can simultaneously take. Examples: x ≠ y. x + y ≤ z
  • A total assignment maps each variable to an element in its domain. (It is a total function)
  • A solution to an instance of the constraint satisfaction problem is a total assignment that satisfies all the constraints.

Example Instance of CSP

  • Four queens problem: put 4 queens on a 4x4 chessboard so that no two queens attack each other.

Q

Q

Q

Q

  • As a CSP
    • Variables: X 1 , X 2 , X 3 , X 4 each with domain {1 , 2 , 3 , 4}
    • Constraints:
      • No 2 on same col: X 1 ≠ X 2 , X 1 ≠ X 3 , X 1 ≠ X 4 , X 2 ≠ X 3 , X 2 ≠ X 4 , X 3 ≠ X 4
      • No 2 on same diag: ( X 1 +1 ≠ X 2 and X 1 − 1 ≠ X 2) and five other pairs of constraints like this.
    • Solution: { X 1 → 2 , X 2 → 4 , X 3 → 1 , X 4 → 3}

Remarks

  • In 4-queens there is no necessity to use numbers as domains. - Could instead use domains of {a, b, c, d}. - Column constraints can stay the same (e.g., X 1 ≠ X 2) - Diagonal constraints are like this one between X 1 and X 2: X1 = a → X2 ≠ b X1 = b → (X2 ≠ c ∨ X2 ≠ a) ∧ X1 = c → (X2 ≠ b ∨ X2 ≠ d) ∧ X1 = d → X2 ≠ c

Some Terminology

  • Every constraint has an arity , which is the number of variables it constrains. - In four-queens formulation all the constraints have arity 2. Also called binary constraints. - Could have used a contraint of arity 4: alldiferent(X1,X2,X3,X4}
  • Every constraint of arity n can be characterised by
    • A scope: the n-tuple of variables that it constrains.
      • The constraints X = Y and X ≠ Y both have the scope < X, Y>
    • A relation : the n-ary relation of values that satisfy it.
      • The relation of X=Y is {<1,1>,<2,2>,<3,3>,<4,4>}

Expressing Constraints Extensionally

  • A constraint among n variables is considered as a set of n tuples. If X 1

,... X

n are variables with domains D 1

,... D

n

then a constraint among these variables is a subset of D 1

× ·· ·× D

n

  • Traditional way, especially for theoretical studies.
  • Abstracts away from any language for expressing constraints, though it can be thought of as DNF.

Expressing Constraints Extensionally Example: Four Queens with No-Goods

Expressing Constraints in a Constraint Language

Some Reductions to CSP

  • SAT to CSP
  • Graph Colouring to CSP
  • Knapsack to CSP

Constraint Solving in General

  • We are looking at constraint satisfaction for discrete domains, indeed for finite domains
  • Other “constraint satisfaction” problems (domain of reals)
    • linear programming (in P)
    • non-linear programming
    • integer linear programming (NP-complete)
  • Other extensions to the basic problem
    • Soft constraints
    • Dynamic constraints
    • Probabilistic constraints

Scene Labelling Problem

  • Given a line drawing of a scene

containing planar objects with

trihedral vertices

  • Interpret the scene by giving each

line one of 4 labels

  • convex edge
  • concave edge

→ or ← object to right,

background to left

Scene Labelling Problem

  • Though 208 junctions are logically possible, only 16

(shown below) are physically possible [Huffman, 1971]

  • This serves as a constraint on correct labelling.

19 Car Sequencing Problem

(CSPLib problem 001)

Figure from Foundations of Constraint Satisfaction [Tsang, 1993]

Companies Specializing in Constraint Solving Technology

  • ILOG (bought by IBM in Jan 2009) : 10 million dollars revenue from suite of software for optimisation (includes ILOG solver, CPLEX for integer-linear problems).
  • i2 Technologies (bought by JDA in Jan 2010) : leading developer of intelligent decision-support software for planning and scheduling of supply chains. www.jda.com
  • COSYTEC: software products and services based on constraint programming technology. www,cosytec.com
  • Parc Technologies (now owned by Cisco): developed software applications for decision support, strategic planning and resource optimisation. Now focuses on networking applications.
  • IQ Software: supplies rota generation & management solutions to the commercial, health & local government sectors.