Docsity

Advanced Constraint Techniques: Solving Complex Problems with Interleaving & Heuristics, Slides of Robotics

Partial preview of the text

Download Advanced Constraint Techniques: Solving Complex Problems with Interleaving & Heuristics and more Slides Robotics in PDF only on Docsity!

1

Today’s class

  • Interleaving backtracking and consistency

checking

  • Variable-ordering heuristics
  • Value-ordering heuristics
  • Intelligent backtracking

2

Advanced Constraint

Techniques

Kumar, “Algorithms for constraint satisfaction problems: A survey” Barták, “Constraint programming: In pursuit of the holy grail”

4

A famous example:

Labelling line drawings

  • Waltz labelling algorithm – one of the earliest CSP applications
    • Convex interior lines are labelled as +
    • Concave interior lines are labeled as –
    • Boundary lines are labeled as
  • There are 208 labellings (most of which are impossible)
  • Here are the 18 legal labellings:

5

Labelling line drawings II

  • Here are some illegal labelings:
+ +^

7

Ordered constraint graphs

  • Select a variable ordering, V 1 , …, V (^) n
  • Width of a node in this OCG is the number of arcs leading to earlier variables: - w(Vi ) = Count ( (V (^) i , Vk) | k < i)
  • Width of the OCG is the maximum width of any node:
    • w(G) = Max (w (V (^) i )), 1 <= i <= N
  • Width of an unordered CG is the minimum width of all orderings of that graph (“best you can do”)

8

Tree-structured constraint graph

  • An OCG with width 1 is a constraint tree rooted at V (^1)
    • That is, in the ordering V1, …, Vn, every node has zero or one parents
  • If this constraint tree is also node- and arc-consistent (i.e., strongly 2-consistent), then it can be solved without backtracking
  • More generally, if the ordered graph is strongly k- consistent, and has width w < k, then it can be solved without backtracking

V V8 V4 (^) V7^ V^

V9 V

V2 V3 V

10

So what if we don’t have a tree?

  • Answer #1: Try interleaving constraint propagation and backtracking
  • Answer #2: Try using variable-ordering heuristics to improve search
  • Answer #3: Try using value-ordering heuristics during variable instantiation
  • Answer #4: Try using intelligent backtracking methods

11

Interleaving constraint propagation

and search

Generate and Test

No constraint propagation: assign all variable values, then test constraints Simple Backtracking

Check constraints only for variables “up the tree” Forward Checking

Check constraints for immediate neighbors “down the tree” Partial Lookahead

Propagate constraints forward “down the tree” Full Lookahead

Ensure complete arc consistency after each instantiation

13

Variable ordering II

  • Maximal stable set : find largest set of variables

with no constraints between them and save these

for last

  • Cycle-cutset tree creation :
    • Find a set of variables that, once instantiated, leave a

tree of uninstantiated variables;

  • solve these,
  • then solve the tree without backtracking

14

Value ordering

  • Intuition : Choose values that are the least constrained

early on, leaving the most legal values in later variables

  • Maximal options method (least-constraining-value

heuristic): Choose the value that leaves the most legal

values in uninstantiated variables

  • Min-conflicts : Used in iterative repair search

16

Min-conflicts heuristic

  • Iterative repair method
    1. Find some “reasonably good” initial solution
      • E.g., in N-queens problem, use greedy search through rows, putting each queen where it conflicts with the smallest number of previously placed queens, breaking ties randomly
    2. Find a variable in conflict (randomly)
    3. Select a new value that minimizes the number of constraint violations
      • O(N) time and space
    4. Repeat steps 2 and 3 until done
  • Performance depends on quality and informativeness of initial assignment; inversely related to distance to solution

17

Intelligent backtracking

  • Backjumping : if V (^) j fails, jump back to the variable V (^) i with greatest i such that the constraint (V (^) i, V (^) j) fails (i.e., most recently instantiated variable in conflict with V (^) i)
  • Backchecking : keep track of incompatible value assignments computed during backjumping
  • Backmarking : keep track of which variables led to the incompatible variable assignments for improved backchecking

19

Some challenges for constraint reasoning II

  • What if constraints are represented intentionally?
    • Cost of evaluating constraints (time, memory, resources)
  • What if constraints, variables, and/or values change over time? - Dynamic constraint networks - Temporal constraint networks - Constraint repair
  • What if you have multiple agents or systems involved in constraint satisfaction? - Distributed CSPs - Localization techniques