Docsity

Constraint Processing and Constraint Satisfaction Problems: Algorithms and Applications, Slides of Robotics

Partial preview of the text

Download Constraint Processing and Constraint Satisfaction Problems: Algorithms and Applications and more Slides Robotics in PDF only on Docsity!

Today’s class

  • Constraint Processing / Constraint Satisfaction

Problem (CSP) paradigm

  • Algorithms for CSPs
    • Backtracking (systematic search)
    • Constraint propagation (k-consistency)
    • Variable ordering heuristics
    • Backjumping and dependency-directed backtracking
  • Viewing scheduling as a CSP

Constraint

Processing

Russell & Norvig 3.7, 4.2 end, 4.4 end

Kumar, “Algorithms for constraint

satisfaction problems: A survey”

Barták, “Constraint programming: In

pursuit of the holy grail”

Informal Definition of CSP

  • CSP = Constraint Satisfaction Problem
  • Given

(1) a finite set of variables (2) each with a domain of possible values (often finite) (3) a set of constraints that limit the values the variables can take on

  • A solution is an assignment of a value to each

variable such that the constraints are all satisfied.

  • Tasks might be:
    • to decide if a solution exists,
    • to find a solution,
    • to find all solutions, or
    • to find the “best solution” according to some metric.

Informal Example: Map Coloring

  • Color the following map using three colors

(red, green, blue) such that no two adjacent

regions have the same color.

5

E

D A

C

B

Example: SATisfiability

  • Given a set of propositions containing variables,

find an assignment of the variables to {false,true}

that satisfies them.

  • Example, the clauses:
    • A or B or ~C, ~A or D
    • (equivalent to C -> A or B, D -> A)
  • Are satisfied by
A = false
B = true
C = false
D = false

Real-world problems

  • Scheduling
  • Temporal reasoning
  • Building design
  • Planning
  • Optimization/satisfaction
  • Vision
    • Graph layout
    • Network management
    • Natural language processing
    • Molecular biology / genomics
    • VLSI design

Useful in the projects Docsity.com 8

Formal definition of a CN (cont.)

  • Instantiations
    • An instantiation of a subset of variables S is an
assignment of a legal domain value to each
variable in in S
  • An instantiation is legal iff it does not violate any
(relevant) constraints.
  • A solution is an instantiation of all of the

variables in the network.

Typical Tasks for CSP

  • Solutions:
    • Does a solution exist?
    • Find one solution
    • Find all solutions
    • Given a partial instantiation, do any of the above
  • Transform the CN into an equivalent CN that is

easier to solve.

Example: Crossword Puzzle

13

1 2 3

4

5

Running Example: XWORD Puzzle

  • Variables and their domains
    • X1 is 1 across D1 is 5-letter words
    • X2 is 2 down D2 is 4-letter words
    • X3 is 3 down D3 is 3-letter words
    • X4 is 4 across D4 is 4-letter words
    • X5 is 5 across D5 is 2-letter words
  • Constraints (implicit/intensional)
    • C12 is “the 3rd letter of X1 must equal the 1st letter of X2”
    • C13 is “the 5th letter of X1 must equal the 1st letter of X3”.
    • C24 is …
    • C25 is …
    • C34 is ...

Solving Constraint Problems

  • Systematic search
    • Generate and test
    • Backtracking
  • Constraint propagation (consistency)
  • Variable ordering heuristics
  • Backjumping and dependency-directed

backtracking

Generate and test: XWORD

  • Try each possible combination until you find

one that works:

  • Hoses – hike – run – hike – no
  • Hoses – hike – run – hike – be
  • Hoses – hike – run – hike – us
  • Doesn’t check constraints until all variables

have been instantiated

  • Very inefficient way to explore the space of

possibilities Docsity.com^17

Backtracking: XWORD

19

(^1 2 )

4 5

∅

X1=hoses X1=laser

X2=aron (^) X2=same

X2=hike

X2=hike …

…

… X3=run (^) X3=sun X3=let

X4=hike … X4=same

h o s e s u n

a m e

Problems with backtracking

  • Thrashing: keep repeating the same failed

variable assignments

  • Consistency checking can help
  • Intelligent backtracking schemes can also help
  • Inefficiency: can explore areas of the search

space that aren’t likely to succeed

  • Variable ordering can help