Constraint Propagation - PowerPoint PPT Presentation

About This Presentation
Title:

Constraint Propagation

Description:

Goal state: Set of assignments consistent with constraints ... Only propagate when domain = 1 'Forward checking' Limit constraints to test ... – PowerPoint PPT presentation

Number of Views:135
Avg rating:3.0/5.0
Slides: 36
Provided by: ginal5
Category:

less

Transcript and Presenter's Notes

Title: Constraint Propagation


1
Constraint Propagation
  • Artificial Intelligence
  • CMSC 25000
  • January 22, 2002

2
Agenda
  • Constraint Propagation Motivation
  • Constraint Propagation Example
  • Waltz line labeling
  • Constraint Propagation Mechanisms
  • Arc consistency
  • CSP as search
  • Forward-checking
  • Back-jumping
  • Summary

3
Constraint Satisfaction Problems
  • Very general Model wide range of tasks
  • Key components
  • Variables Take on a value
  • Domains Values that can be assigned to vars
  • Constraints Restrictions on assignments
  • Constraints are HARD
  • Not preferences Must be observed
  • E.g. Cant schedule two classes same room, same
    time

4
Constraint Satisfaction Problem
  • Graph/Map Coloring Label a graph such that no
    two adjacent vertexes same color
  • Variables Vertexes
  • Domain Colors
  • Constraints If E(a,b), then C(a) ! C(b)


5
Constraint Satisfaction Problems
  • Resource Allocation
  • Scheduling N classes over M terms, 4
    classes/term
  • Aircraft at airport gates
  • Satisfiability e.g. 3-SAT
  • Assignments of truth values to variables such
    that 1) consistent and 2) clauses true

6
Constraint Satisfaction Problem
  • N-Queens
  • Place N queens on an NxN chessboard such that
    none attacks another
  • Variables Queens (1/column)
  • Domain Rows
  • Constraints Not same row, column, or diagonal

7
N-queens
Q3
Q1
Q4
Q2
8
Constraint Satisfaction Problem
  • Range of tasks
  • Coloring, Resource Allocation, Satisfiability
  • Varying complexity E.g. 3-SAT NP-complete
  • Complexity Property of problem NOT CSP
  • Basic Structure
  • Variables Graph nodes, Classes, Boolean vars
  • Domains Colors, Time slots, Truth values
  • Constraints No two adjacent nodes with same
    color,
  • No two classes in same time, consistent,
    satisfying asst

9
Constraint Propagation Method
  • For each variable,
  • Get all values for that variable
  • Remove all values that conflict with ALL adjacent
  • AFor each neighbor, remove all values that
    conflict with ALL adjacent
  • Repeat A as long as some label set is reduced

10
Constraint Propagation Example
  • Image interpretation
  • From a 2-D line drawing, automatically determine
    for each line, if it forms a concave, convex or
    boundary surface
  • Segment image into objects
  • Simplifying assumptions
  • World of polyhedra
  • No shadows, no cracks

11
CSP Example Line Labeling
  • 3 Line Labels
  • Boundary line regions do not abut gt
  • Arrow direction right hand side walk
  • Interior line regions do abut
  • Concave edge line _
  • Convex edge line
  • Junction labels
  • Where line labels meet

12
CSP Example Line Labeling
  • Simplifying (initial) restrictions
  • No shadows, cracks
  • Three-faced vertexes
  • General position
  • small changes in view-gt no change in junction
    type
  • 42 labels for 2 line junction L
  • 43 3-line junction Fork, Arrow, T
  • Total 208 junction labelings

13
CSP Example Line Labeling
  • Key observation Not all 208 realizable
  • How many? 18 physically realizable

All Junctions
L junctions Fork Junctions T junctions
Arrow junctions


_

_

_

_



_
_
_
_

_
_
_
_

14
CSP Example Line Labeling
  • Label boundaries clockwise
  • Label arrow junctions




15
CSP Example Line Labeling
  • Label boundaries clockwise

16
CSP Example Line Labeling
  • Label fork junctions with s
















17
CSP Example Line Labeling
  • Label arrow junctions with -s





_


_


_
_

_
_
_



_



_



18
Waltzs Line Labeling
  • For each junction in image,
  • Get all labels for that junction type
  • Remove all labels that conflict with ALL adjacent
  • AFor each neighbor, remove all labels that
    conflict with ALL
  • Repeat A as long as some label set is reduced

19
Waltz Propagation Example
C
D
X
B
X
A
X
20
Waltzs Line Labeling
  • Full version
  • Removes constraints on images
  • Adds special shadow and crack labels
  • Includes all possible junctions
  • Not just 3 face
  • Physically realizable junctions
  • Still small percentage of all junction labels
  • O(n) n lines in drawing

21
Constraint Propagation Mechanism
  • Arc consistency
  • Arc V1-gtV2 is arc consistent if for all x in D1,
    there exists y in D2 such that (x,y) is allowed
  • Delete disallowed xs to achieve arc consistency

22
Arc Consistency Example
  • Graph Coloring
  • Variables Nodes
  • Domain Colors (R,G,B)
  • Constraint If E(a,b), then C(a) ! C(b)
  • Initial assignments

X
R,G,B
B
R,B
Z
Y
23
Arc Consistency Example
Arc Rm Value
Assignments X G Y R Z B
X -gt Y None
X -gt Z XB
gt
Y-gt Z YB
X -gt Y XR
X -gt Z None
Y -gt Z None
X
R,G,B
B
R,B
Z
Y
24
Limitations of Arc Consistency
X
G,B
  • Arc consistent
  • No legal assignment
  • Arc consistent
  • gt1 legal assignment

G,B
G,B
Z
Y
X
R,G
G,B
G,B
Z
Y
25
CSP as Search
  • Constraint Satisfaction Problem (CSP) is a
    restricted class of search problem
  • State Set of variables assignment info
  • Initial State No variables assigned
  • Goal state Set of assignments consistent with
    constraints
  • Operators Assignment of value to variable

26
CSP as Search
  • Depth Number of Variables
  • Branching Factor Domain
  • Leaves Complete Assignments
  • Blind search strategy
  • Bounded depth -gt Depth-first strategy
  • Backtracking
  • Recover from dead ends
  • Find satisfying assignment

27
CSP as Search
No!
No!
No!
No!
No!
Yes!
No!
Yes!
No!
No!
28
Backtracking Issues
  • CSP as Search
  • Depth-first search
  • Maximum depth of variables
  • Continue until (partial/complete) assignment
  • Consistent return result
  • Violates constraint -gt backtrack to previous
    assignment
  • Wasted effort
  • Explore branches with no possible legal
    assignment

29
Backtracking with Forward Checking
  • Augment DFS with backtracking
  • Add some constraint propagation
  • Propagate constraints
  • Remove assignments which violate constraint
  • Only propagate when domain 1
  • Forward checking
  • Limit constraints to test

30
BacktrackingForward Checking
No!
No!
Yes!
Yes!
31
Heuristic CSP
  • Improving Backtracking
  • Standard backtracking
  • Back up to last assignment
  • Back-jumping
  • Back up to last assignment that reduced current
    domain
  • Change assignment that led to dead end

32
Heuristic CSP
  • Backtracking
  • Pick first/leftmost node to expand
  • Heuristic CSP
  • Most constrained variable
  • Minimize branching factor
  • Least constraining value
  • Pick value that removes fewest values from other
    vars
  • Improve chance of finding SOME assignment
  • Can increase feasible size of CSP problem

33
Iterative Improvement
  • Alternate formulation of CSP
  • Rather than DFS through partial assignments
  • Start with some complete, valid assignment
  • Search for optimal assignment wrt some criterion
  • Example Traveling Salesman Problem
  • Minimum length tour through cities, visiting each
    one once

34
Iterative Improvement Example
  • TSP
  • Start with some valid tour
  • E.g. find greedy solution
  • Make incremental change to tour
  • E.g. hill-climbing - take change that produces
    greatest improvement
  • Problem Local minima
  • Solution Randomize to search other parts of
    space
  • Other methods Simulated annealing, Genetic algs

35
CSP Summary
  • General problem structure
  • Variables Domain values to assign
  • Constraints Restrictions on valid assignments
  • N-Queens Graph-coloring 3-Sat Scheduling
  • Constraint propagation mechanisms
  • Arc consistency
  • Search model BacktrackForward-checking
  • Heuristics Back-jump Variablevalue selection
  • Iterative improvement reformulation
Write a Comment
User Comments (0)
About PowerShow.com