Relaxation and Hybrid constraint processing Different relaxation techniques Some popular hybrid techniques.

Slides:



Advertisements
Similar presentations
Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Advertisements

Constraint Satisfaction Problems
Solving IPs – Cutting Plane Algorithm General Idea: Begin by solving the LP relaxation of the IP problem. If the LP relaxation results in an integer solution,
This lecture topic (two lectures) Chapter 6.1 – 6.4, except
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 Constraint Satisfaction Problems. 2 Intro Example: 8-Queens Generate-and-test: 8 8 combinations.
This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
Traveling Salesperson Problem
Constraint processing An efficient alternative for search.
CIS Intro to AI 1 Interpreting Line Drawings & Constraint Satisfaction II Mitch Marcus CIS 391 – Fall 2008.
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Constraint Satisfaction problems (CSP)
Optimal Rectangle Packing: A Meta-CSP Approach Chris Reeson Advanced Constraint Processing Fall 2009 By Michael D. Moffitt and Martha E. Pollack, AAAI.
1.2 Row Reduction and Echelon Forms
Linear Equations in Linear Algebra
Constraint Satisfaction Problems
Constraint Satisfaction Problem Solving Chapter 5.
General search strategies: Look-ahead Chapter 5 Chapter 5.
Chapter 5 Outline Formal definition of CSP CSP Examples
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 2 Ryan Kinworthy CSCE Advanced Constraint Processing.
3-6 Solving Systems of Linear Equations in Three Variables Objective: CA 2.0: Students solve systems of linear equations and inequalities in three variables.
Linear Systems The definition of a linear equation given in Chapter 1 can be extended to more variables; any equation of the form for real numbers.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding ILPs with Branch & Bound ILP References: ‘Integer Programming’
PLANNING Partial order regression planning Temporal representation 1 Deductive planning in Logic Temporal representation 2.
Constraint Satisfaction Problems
Identifying Solutions
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
Decision Procedures An Algorithmic Point of View
Busby, Dodge, Fleming, and Negrusa. Backtracking Algorithm Is used to solve problems for which a sequence of objects is to be selected from a set such.
Slide 1 CSPs: Arc Consistency & Domain Splitting Jim Little UBC CS 322 – Search 7 October 1, 2014 Textbook §
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Constraint Satisfaction Read Chapter 5. Model Finite set of variables: X1,…Xn Variable Xi has values in domain Di. Constraints C1…Cm. A constraint specifies.
Computer Science CPSC 322 Lecture 13 Arc Consistency (4.5, 4.6 ) Slide 1.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Problem Solving with Constraints Lookahead Schemas 1 Foundations of Constraint Processing CSCE496/896, Fall
Chapter 7 Systems of Equations and Inequalities Copyright © 2014, 2010, 2007 Pearson Education, Inc Systems of Linear Equations in Two Variables.
CSC 423 ARTIFICIAL INTELLIGENCE Constraint Satisfaction Problems.
Chapter 5 Constraint Satisfaction Problems
Principles of Intelligent Systems Constraint Satisfaction + Local Search Written by Dr John Thornton School of IT, Griffith University Gold Coast.
Review Test1. Robotics & Future Technology Future of Intelligent Systems / Ray Kurzweil futurist Ray Kurzweil / A Long Bet A Long Bet / Robot Soccer.
Artificial Intelligence Tutorials
Elimination Method: Solve the linear system. -8x + 3y=12 8x - 9y=12.
Do Now (3x + y) – (2x + y) 4(2x + 3y) – (8x – y)
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Introduction to State Space Search
Constraint processing An efficient alternative for search.
Arc Consistency and Domain Splitting in CSPs CPSC 322 – CSP 3 Textbook Poole and Mackworth: § 4.5 and 4.6 Lecturer: Alan Mackworth October 3, 2012.
1 1.2 Linear Equations in Linear Algebra Row Reduction and Echelon Forms © 2016 Pearson Education, Ltd.
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Traveling Salesperson Problem
Computer Science cpsc322, Lecture 13
Constraint Satisfaction Problems (CSPs)
Artificial Intelligence Problem solving by searching CSC 361
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Constraint Propagation
Computer Science cpsc322, Lecture 13
Linear Equations in Linear Algebra
Running example The 4-houses puzzle:
Notes Solving a System by Elimination
Chapter 5: General search strategies: Look-ahead
Constraint satisfaction problems
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Linear Equations in Linear Algebra
Constraint satisfaction problems
Presentation transcript:

Relaxation and Hybrid constraint processing Different relaxation techniques Some popular hybrid techniques

Relaxation Node consistency Forward check Lookahead check AC1AC3Path-consistency

3 Running example  4 families A, B, C and D live next to each other in houses numbered 1, 2, 3 and 4.  D lives in a house with lower number than B,  B lives next to A in a house with higher number,  There is at least one house between B and C,  D does not live in the house with number 2,  C does not live in the house with number 4.  Which family lives in which house ?  The 4-houses puzzle:

4 Representation:  The variables: A, B, C and D  The domains: d A = d B = d C = d D = { 1, 2, 3, 4}  Constraints:  unary:  c(C) = C  4  c(D) = D  2  binary:  c(A,B) = B = A + 1  c(B,D) = D  B  c(B,C) = |B - C|  1  c(A,C) = A  C  c(A,D) = A  D  c(C,D) = C  D

5 Node-consistency:  Unary constraints are eliminated through domain- reductions:  Or: 1-consistency  (only 1 variable is involved)  c(C) = C  4  c(D) = D  2 d C = { 1, 2, 3} d D = { 1, 3, 4}

6 The constraint network: AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 1, 2, 3, 4} { 1, 2, 3}{ 1, 3, 4}

Weak relaxation Forward Check Lookahead Check

8 Forward Check:  Assume we fix the value for 1 variable zi: zi = a  Forward Check(zi) =  activate each constraint c(zi, zj) or c(zj, zi) once to remove the inconsistent values for zi = a AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D {2} { 1, 2, 3, 4} { 1, 2, 3}{ 1, 3, 4}  Our example: assume A = 2 :

9 Forward check: weak consistency  Requires that 1 variable already obtained a value  suggests use in combination with backtracking AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D {2} { 1, 2, 3, 4} { 1, 2, 3}{ 1, 3, 4}  Does not produce a consistent state  not all relaxation is done

Look ahead check A stronger (weak) relaxation method

11 Look ahead Check:  Look Ahead Check =  activate each constraint c(zi, zj) exactly once to remove the inconsistent values from the domains Di and Dj.  Our example: AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 1, 2, 3, 4} { 1, 2, 3}{ 1, 3, 4} { 1, 2, 3, 4}

12 Example continued: AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 2, 3, 4} { 1, 2, 3}{ 1, 3, 4} { 1, 2, 3}  The 3 other constraints:

13 Look ahead: final results: AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 3, 4} { 1, 2}{ 1, 3} { 1, 2, 3}  Still does not produce a consistent state  not all relaxation is done  Result may depend on the order in which constraints are dealt with.  Removing some values first may allow to find others inconsistent

Arc consistency techniques Techniques that reduce domains to a state that is consistent for each constraint (or arc). Also called: 2-consistency techniques

15 AC 1 (Mackworth) AC1: Repeat Look ahead check; Look ahead check; If some value was removed from If some value was removed from some domain then some domain then Deletion_occurred := true Until (not Deletion_occurred)  Forces Look ahead to reach a consistent state  by reactivating Look ahead until consistency Deletion_occurred := false ;

16 The example (1): AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 1, 2, 3, 4} { 1, 2, 3}{ 1, 3, 4} { 1, 2, 3, 4}  First pass (== Look ahead check): AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 3, 4} { 1, 2}{ 1, 3} { 1, 2, 3}  Deletion_occurred := true

17 The example (2):  Second pass: AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 3, 4} { 1, 2}{ 1, 3} { 1, 2, 3}  Deletion_occurred := true AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 3, 4} { 1, 2}{ 1, 3} { 2, 3}

18 The example (3):  Third pass:  Deletion_occurred := false AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 3, 4} { 1, 2}{ 1, 3} { 2, 3}  Result: A (2 or 3), B (3 or 4), C (1 or 2), D (1 or 3)  Consistent, but NOT REALLY A SOLUTION !!

19 AC-3 (Mackworth) More efficient arc-consistency: AC3: Remove c(x,y) from QUEUE; Remove c(x,y) from QUEUE; End-While QUEUE := {all constraints in the problem} Remove all inconsistent values from domains Remove all inconsistent values from domains D x and D y with respect to c(x,y); D x and D y with respect to c(x,y); While not empty(QUEUE) DO If some value was removed from D x (or D y ) If some value was removed from D x (or D y ) then add all other constraints involving then add all other constraints involving x (or y) to QUEUE;

20 The example (1): AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 1, 2, 3, 4} { 1, 2, 3}{ 1, 3, 4} { 1, 2, 3, 4}  QUEUE = {c(A,B), c(A,C), c(A,D), c(B,C), c(B,D), c(C,D)}:  QUEUE = {c(A,C), c(A,D), c(B,C), c(B,D), c(C,D)}  To be added: c(A,C), c(A,D), c(B,C), c(B,D) All already in QUEUE !

21 The example (2): AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 2, 3, 4} { 1, 2, 3}{ 1, 3, 4} { 1, 2, 3}  QUEUE = {c(A,C), c(A,D), c(B,C), c(B,D), c(C,D)}:  QUEUE = {c(B,C), c(B,D), c(C,D)}

22 The example (3): AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 2, 3, 4} { 1, 2, 3}{ 1, 3, 4} { 1, 2, 3}  QUEUE = {c(B,C), c(B,D), c(C,D)}:  QUEUE = {c(B,D), c(C,D), c(A,B), c(A,C)}  To be added: c(A,B), c(A,C), c(B,D), c(C,D)

23 The example (4): AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 3, 4} { 1, 2}{ 1, 3, 4} { 1, 2, 3}  QUEUE = {c(B,D), c(C,D), c(A,B), c(A,C)}:  QUEUE = {c(C,D), c(A,B), c(A,C), c(A,D)}  To be added: c(A,D), c(C,D)

24 The example (5): AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 3, 4} { 1, 2}{ 1, 3} { 1, 2, 3}  QUEUE = {c(C,D), c(A,B), c(A,C), c(A,D)}:  QUEUE = {c(A,C), c(A,D)}  To be added: c(A,C), c(A,D)

25 The example (6): AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 3, 4} { 1, 2}{ 1, 3} { 2, 3}  QUEUE = {c(A,C), c(A,D)}:  QUEUE = empty STOP !

26 Comparison:  Same result: full arc-consistency:  A = {2,3}, B = {3,4}, C= {1,2}, D = {1,3}  Efficiency:  AC1:  3 times 6 checks = 18  AC3:  9 constraint checks

27K-consistency:  1-consistency (node-consistency):  unary constraints (on 1 variable) are consistent  2-consistency (arc-consistency):  binary constraints (on 2 variables) are consistent  3-consistency:  all constraints involving 3 variables are consistent AB DC B = A + 1 A  C D  BD  B A  D |B - C|  1 C  D { 1, 2, 3, 4} { 1, 2, 3}{ 1, 3, 4} { 1, 2, 3, 4}  A value remains in the domain if there are consistent values in the domains of the 2 other variables (for all connecting constraints) Example:

28 Practicality of k-consistency:  Checking k-consistency for k  2 is very hard to do efficiently !!  Example: 4-consistency for the 4-houses puzzle is equivalent to finding solutions to the original problem.

Hybrid constraint processing Combine the power of exhaustive (backtrack) search with (relaxation) pruning

Forward checking Backtracking combined with Forward Check

31 Forward checking: Forward Checking: Execute Standard Backtracking After each assignment of a After each assignment of a value to a variable zi DO value to a variable zi DO Forward Check(zi) BUT

32 1A Forward checking at work B2 AB CD{1}{1,2,3,4}{1,2,3} {1,3,4} B=A+1 ADADADAD ACACACAC AB CD{1}{2}{2,3} {3,4} |B-C|  1 D BD BD BD B fail AB CD{2}{1,2,3,4}{1,2,3} {1,3,4} B=A+1 ADADADAD ACACACAC 2 B3 AB CD{2}{3}{1,3} {1,3,4} D BD BD BD B C1 AB C D{4}{3}{1}{1} CDCDCDCD fail AB CD{3}{1,2,3,4}{1,2,3} {1,3,4} B=A+1 ADADADAD ACACACAC 3 B4 AB CD{3}{4}{1,2} {1,4} D BD BD BD B AB C D{3}{4}{1}{1} CDCDCDCD AB C D{3}{4}{2}{1} CDCDCDCD 1C 2failsuccess

Lookahead checking Backtracking combined with Look ahead check

34 Lookahead checking: Execute Standard Backtracking Look Ahead Check BUT Look Ahead Check ; Lookahead Checking: After each assignment of a After each assignment of a value to some variable DO value to some variable DO

35 Lookahead checking at work AB C D{1,2,3,4}{1,2,3,4}{1,2,3}{1,3,4} B=A+1 ADADADAD ACACACAC D BD BD BD B |B-C|  1 CDCDCDCD AB CD{1}{3,4}{1,2} {1,3} B=A+1 fail AB C D{2}{3,4}{1,2}{1,3} B=A+1 ADADADAD ACACACAC D BD BD BD B CDCDCDCD fail AB C D{3}{3,4}{1,2}{1,3} B=A+1 ADADADAD ACACACAC D BD BD BD B CDCDCDCD AB C D{3}{4}{2}{1} D BD BD BD B CDCDCDCD AB C D{3}{4}{2}{1} CDCDCDCD 1A 2 3 B4 C2 success

36 Which is best?  Forward checking:  does less consistency checking  has more branching  closer to backtracking  Lookahead checking:  spends more work on consistency  tries less alternative values  Usually: forward checking is best trade-off  For VERY strongly constrainted problems:  Lookahead checking is needed to prune more

37 Applications:  All combinatorial search problems  Scheduling problems:  Ex.: reschedule the trains when some railway problem has occurred  Rostering problems:  Ex.: compute work-shifts, given various expertise constraints and personal preferences  Production planning:  Ex.: schedule the optimal workfloor traversal  Loading problems:  Ex.: optimize truck-space given various types of loads

38 Alternative techniques  Linear programming  numerical techniques for solving systems of linear equations (and inequalities) + optimization problems  Ex.: simplex algorithm  Works VERY well for ‘linear’ constraints 4*X - 3*Y  Z + 2 X 3 - 3*Y  Z YES ! NO !  Works, but not VERY well, for discrete problems  In such cases: Constraint Processing is a better option  Also: for constraint problems on non-numerical data !