Foundations of Constraint Processing CSCE421/821, Spring 2009
description
Transcript of Foundations of Constraint Processing CSCE421/821, Spring 2009
![Page 1: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/1.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 1
Foundations of Constraint Processing
CSCE421/821, Spring 2009
www.cse.unl.edu/~choueiry/S09-421-821/
All questions to [email protected]
Berthe Y. Choueiry (Shu-we-ri)
Avery Hall, Room 123B
Tel: +1(402)472-5444
Lookahead Schemas
![Page 2: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/2.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 2
Outline
• Looking ahead Schemas– Forward checking (FC)– Directional Arc Consistency (DAC)– Maintaining Arc Consistency (a.k.a. full arc-
consistency)
![Page 3: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/3.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 3
Looking ahead• Rationale:
– As decisions are made (conditioning), • Revise the domain of future variables to propagate the
effects of decisions • i.e., eliminate inconsistent choices in future sub-problem
– Domain annihilation of a future variable avoids expansion of useless portions of the tree
• Techniques– Partial: forward-checking (FC), directional arc-
consistency (DAC)– Full: Maintaining arc-consistency (MAC)– Use: Revise(Vf, Vc), Vf future variable, Vc current
variable
![Page 4: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/4.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 4
Revise the domain of Vi
• Revising the domain of Vi given a constraint CVi,Vj on Vi (i.e., Vi Scope(C))
• General notation: Revise(Vi,CVi,Vj)
• In a binary CSP:
Revise(Vi,CVi,Vj)=Revise(Vi, Vj)
![Page 5: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/5.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 5
Revise(Vi, Vj) NOTE: only DVi may be
updated
Revise(Vi, Vj)
1. revised nil
2. x DVi
3. found nil
4. y DVj
5. If Check((Vi,x),(Vj,y)) Then Begin
6. found t
7. Return()
8. End
9. If found=nil Then Begin
10. revised t
11. DVi DVi \ {x}
12. End
13. Return (revised)
![Page 6: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/6.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 6
Revise(Vi, Vj) Revise(Vi, Vj)
1. revised nil
2. x Dvi
3. y DVj
4. If Check((Vi,x),(Vj,y)) Then Return()
5. revised t
6. DVi DVi \ {x}
7. Return (revised)
Simpler, equivalent code but not as obvious as the previous one
![Page 7: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/7.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 7
Domain filtering in lookahead
• Vc current variable
• Vf future variable
• {Vf} all future variables
• Revise(Vf, Vc)
• FC(Vc):
1. Vf {Vf} connected to Vc
2. Revise(Vf,Vc)
3. If DVf ={} then return(nil)
![Page 8: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/8.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009
Directional Arc Consistency
• Choose an ordering d, stick to it
• After instantiating a variable at level i, do the following1. For k from i to (n-1) in the ordering d Do
2. If FC(Vk)=nil then Return(nil)
8
![Page 9: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/9.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009
Maintaining Arc Consistency• First, FC(Vc),
• If it does not fail, then, form a queue with all constraints (Vi,Vj) and (Vj,Vi) between future variables, and run AC
AC-11. Q {(Vi,Vj),(Vj,Vi), …, (Vk,Vm), (Vm,VK)}
2. Change true
3. While Change Do
4. Change false
5. For all (Va,Vb) in Q Do
6. If Revise(Va,Vb)
7. Then If Dom(Va) =
8. Then Return (nil)
9. Else Change true
9
![Page 10: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/10.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 10
• FC:
• DAC:
– assumes a fixed variable ordering d
• MAC:
– does more pruning (search may visit fewer nodes) at the cost of more consistency checks
Look-ahead techniques: FC, DAC, MAC
FC(Vc); While not failure: For the next Vf in the ordering d, FC(Vf)
FC(Vc); AC({Vf})
FC(Vc)
FC(Vc);
Repeat until quiescence or failure
Vf1,Vf2 {Vf}, Revise(Vf1,Vf2)
![Page 11: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/11.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 11
Terminology overload alert: FC
• FC is used to denote any of the following:– a partial look-ahead schema – a specific chronological backtrack search
algorithm that uses the partial look-ahead schema
• Meaning is inferred from context• Not a healthy situation, but a fact of reality• Advice: state upfront the meaning of your terms
and stick to them throughout your paper
![Page 12: Foundations of Constraint Processing CSCE421/821, Spring 2009](https://reader035.fdocuments.net/reader035/viewer/2022062810/56815a9a550346895dc8176f/html5/thumbnails/12.jpg)
Foundations of Constraint Processing, Spring 2009
Lookahead SchemasFeb. 10, 2009 12
(BT Search +) MAC vs. FC
• Reference: [Sabin & Freuder, ECAI94], [Bessière & Régin, CP97], [Sabin & Freuder, CP97], [Gent & Prosser, APES-20-2000], [Experiments by Lin XU, 2001], [Yang, MS thesis 2003]
• Results: (sketchy)Low tightness High tightness
Low density (sparse) FC MAC
High density (dense) FC FC
Note: Results depend on
• Variable ordering (static vs. dynamic)
• Problem difficulty (positive relative to crossover point)