Fc. Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10]

Slides:



Advertisements
Similar presentations
Simple Search Methods for Finding a Nash Equilibrium
Advertisements

The following 5 questions are about VOLTAGE DIVIDERS. You have 20 seconds for each question What is the voltage at the point X ? A9v B5v C0v D10v Question.
Nelson Research, Inc – N. 88 th St. Seattle, WA USA aol.com Gas Fraction Control System for a Gas Evolving Electrochemical.
Doc.: IEEE /0445r0 Submission May 2009 Adrian Stephens, Intel CorporationSlide TGn Editor Report May 2009 Date: Authors:
Focus Area Strategic Goal Grants will positively impact the quality of life of veterans and improve military family strength. Veterans and Military Families.
I am Patrick Prosser I am a senior lecturer at Glasgow I teach AF2 & CP4 I am a member of the algorithms group the apes (distributed, not disbanded) I.
I am Patrick Prosser I am a senior lecturer at Glasgow I teach algorithms & data structures in java I am a member of the algorithms group the apes (distributed,
Slides by Peter van Beek Edited by Patrick Prosser.
Constraint Programming Peter van Beek University of Waterloo.
Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept.
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
Verification of DSMLs Using Graph Transformation: A Case Study with Alloy Zekai Demirezen 1, Marjan Mernik 1,2, Jeff Gray 1, Barrett Bryant 1 1 Department.
Evaluating the Robustness of Learning from Implicit Feedback Filip Radlinski Thorsten Joachims Presentation by Dinesh Bhirud
A Normal Form for XML Documents Marcelo Arenas Leonid Libkin Department of Computer Science University of Toronto.
Basic Laws of Electric Circuits Kirchhoff’s Voltage Law
3D Priors for Scene Learning from a Single View Diego Rother, Kedar Patwardhan, Iman Aganj and Guillermo Sapiro University of Minnesota 1 Search in 3D.
Tutorial 10 Question 2a, 2b, 2c by Kapilesh Ramesh.
Error Detection / Correction Hamming code. Why might we need Error detection/correction? Even & Odd Parity — Error detection Hamming code — Used for error.
Backward Checking Search BT, BM, BJ, CBJ. An example problem Colour each of the 5 nodes, such that if they are adjacent, they take different colours 12.
University of Toronto Mechanical & Industrial Engineering An Introduction to Constraint Programming J. Christopher Beck Dept. of Mechanical & Industrial.
Manipulation of Query Expressions. Outline Query unfolding Query containment and equivalence Answering queries using views.
1 On c-Vertex Ranking of Graphs Yung-Ling Lai & Yi-Ming Chen National Chiayi University Taiwan.
A roadmap for art 19.3 Trine Christiansen March 19, 2013.
1 Performance Monitoring A Guide for Larger Local Councils (First Draft)
“Why are there so many ‘flavours’ of Christianity?”
by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.
Evaluating Coprocessor Effectiveness for the Data Assimilation Research Testbed Ye Feng IMAGe DAReS SIParCS University of Wyoming.
(8) I. Word Processing Package (Mail Merge) Ex: MS Word, Open Office II. Spread sheet package (function) Ex: MS Excel III. Presentation software (picture,
CSE3201/4500 Information Retrieval Systems
From Approximative Kernelization to High Fidelity Reductions joint with Michael Fellows Ariel Kulik Frances Rosamond Technion Charles Darwin Univ. Hadas.
Instructor: Shengyu Zhang 1. Content Two problems  Minimum Spanning Tree  Huffman encoding One approach: greedy algorithms 2.
Foundations of Constraint Processing Lookahead Schemas 1 Foundations of Constraint Processing CSCE421/821, Spring
Backward Checking Search BT, BM, BJ, CBJ. An example problem Colour each of the 5 nodes, such that if they are adjacent, they take different colours.
Lecture 7 March 1, 11 discuss HW 2, Problem 3
MCA 202: Discrete Mathematics Instructor Neelima Gupta
Application of Ensemble Models in Web Ranking
1 CMSC 471 Fall 2002 Class #6 – Wednesday, September 18.
Constraint processing An efficient alternative for search.
CPM!. Just do it! JChoco We jumped in, and took it for a spin Some counting problems Meeting scheduling problem … you got your hands dirty.
Constraint Satisfaction Problems
Constraint Satisfaction CSE 473 University of Washington.
Constraint Satisfaction Problems
Constraint Satisfaction Problems
Foundations of Constraint Processing, Fall 2005 Sep 20, 2005BT: A Theoretical Evaluation1 Foundations of Constraint Processing CSCE421/821, Fall 2005:
Chapter 5 Outline Formal definition of CSP CSP Examples
Subgraph Isomorphism Problem Simple algorithms. Given two graphs G = (V,E) and H = (W,F) is there a subgraph of H that is isomorphic to G?
I am Patrick Prosser I am a senior lecturer at Glasgow (and Strathclyde till mid April) I teach algorithms & data structures in java I am a member of.
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.
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
Problem Solving with Constraints Lookahead Schemas 1 Foundations of Constraint Processing CSCE496/896, Fall
Chapter 5 Constraint Satisfaction Problems
Review Test1. Robotics & Future Technology Future of Intelligent Systems / Ray Kurzweil futurist Ray Kurzweil / A Long Bet A Long Bet / Robot Soccer.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
Cbj. What’s a csp? a set of variables each with a domain of values a collection of constraints (I’m going to assume binary for the present) assign each.
Section 1-3: Solving Equations 8/29/17
I am a senior lecturer at Glasgow
543 cbj fans can’t be wrong.
I am a senior lecturer at Glasgow
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Heuristic Ordering for Asynchronous Backtracking
Lookahead Schemas Foundations of Constraint Processing
Intelligent Backtracking Algorithms
Constraints and Search
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Intelligent Backtracking Algorithms: A Theoretical Evaluation
at Glasgow (and Strathclyde till mid April)
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Artificial Intelligence
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Presentation transcript:

fc

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 A solution is Remember how bt thrashed?

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 V3 V4 V5 V6 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 V4 V5 V6 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 V5 V6 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 V6 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 1 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 1 V7 = 1 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 1 V7 = 2 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 1 V7 = 3 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 2 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 2 V7 = 1 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 2 V7 = 2 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 2 V7 = 3 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 3 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 3 V7 = 1 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 3 V7 = 2 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 1 V6 = 3 V7 = 3 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 1 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 1 V7 = 1 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 1 V7 = 2 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 1 V7 = 3 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 2 V7 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 2 V7 = 1 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 2 V7 = 2 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 2 V7 = 3 V8 V9 V10

Consider the following problem (csp5) variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 V1 = 1 V2 = 1 V3 = 1 V4 = 1 V5 = 2 V6 = 3 V7 V8 V9 V10

Thrashing: Slavishly repeating the same set of actions with the same set of outcomes. Can we minimise thrashing?

Forward Checking Rather than checking backwards (from current to past) check forwards (from current to future) When we instantiate v[i] with a value x remove from the d[j] values inconsistent with v[i] = x where j is in the future Consequently, when we instantiate v[i] we know it is compatible with the past

V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 D1 = {1,2,3} D2 = {1,2,3} D3 = {1,2,3} D4 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V2 V3 V4 V5 V6 V7 V8 V9 V10 instantiate V1 with value 1 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable remove from D4 incompatible values {2,3} D1 = {1,2,3} D2 = {1,2,3} D3 = {1,2,3} D4 = {1} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V2 := 1 V3 V4 V5 V6 V7 V8 V9 V10 instantiate V2 with value 1 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable no forward checking to perform D1 = {1,2,3} D2 = {1,2,3} D3 = {1,2,3} D4 = {1} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V2 := 1 V3 := 1 V4 V5 V6 V7 V8 V9 V10 instantiate V3 with value 1 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable no forward checking to perform D1 = {1,2,3} D2 = {1,2,3} D3 = {1,2,3} D4 = {1} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V2 := 1 V3 := 1 V4 := 1 V5 V6 V7 V8 V9 V10 instantiate V4 with value 1 (no choice!) Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable remove from D7 incompatible values {1,2,3} D1 = {1,2,3} D2 = {1,2,3} D3 = {1,2,3} D4 = {1} D5 = {1,2,3} D6 = {1,2,3} D7 = {} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3} Dead end!

V1 := 1 V2 := 1 V3 := 2 V4 V5 V6 V7 V8 V9 V10 backtrack to v3 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable D1 = {1,2,3} D2 = {1,2,3} D3 = {2,3} D4 = {1} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

Look at fc demo using csp5 set system.verbose := 3 and explicitly call label, unlabel and look [LATER: Also try bt4, cbj, and fc on csp7 (crytal maze)]

We are still going to thrash! But, could you see how we could “heuristically” exploit the FC information?

V1 := 1 V2 V3 V4 V5 V6 V7 V8 V9 V10 instantiate V1 with value 1 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable remove from D4 incompatible values {2,3} D1 = {1,2,3} D2 = {1,2,3} D3 = {1,2,3} D4 = {1} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3} Why not select V4 immediately after V1?

V1 := 1 V4 V2 V3 V5 V6 V7 V8 V9 V10 select as current variable the variable with smallest domain Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable instantiate V4 D1 = {1,2,3} D4 = {1} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V4 := 1 V2 V3 V5 V6 V7 V8 V9 V10 select as current variable the variable with smallest domain Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable instantiate V4 check forwards, against V7 domain wipe out! Backtrack! D1 = {1,2,3} D4 = {1} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V4 := 1 V2 V3 V5 V6 V7 V8 V9 V10 backtrack Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable return values to V7 removed by V4 D1 = {1,2,3} D4 = {1} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V4 V2 V3 V5 V6 V7 V8 V9 V10 backtrack Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable remove from V4 the value it currently has D1 = {1,2,3} D4 = {} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V4 V2 V3 V5 V6 V7 V8 V9 V10 backtrack! Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable V4 has a domain wipe out! D1 = {1,2,3} D4 = {} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 := 1 V4 V2 V3 V5 V6 V7 V8 V9 V10 backtrack! Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable return to V4 values removed by V1 D1 = {1,2,3} D4 = {1,2,3} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1 V4 V2 V3 V5 V6 V7 V8 V9 V10 backtrack! Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable remove the value V1 currently has from its domain D1 = {2,3} D4 = {1,2,3} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1:= 2 V4 V2 V3 V5 V6 V7 V8 V9 V10 instantiate V1 with next value Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable check forwards to V4 D1 = {2,3} D4 = {2} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1:= 2 V4 V2 V3 V5 V6 V7 V8 V9 V10 select variable with smallest domain Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable D1 = {2,3} D4 = {2} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1:= 2 V4:= 2 V2 V3 V5 V6 V7 V8 V9 V10 instantiate V4 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable D1 = {2,3} D4 = {2} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1:= 2 V4:= 2 V2 V3 V5 V6 V7 V8 V9 V10 check forwards to V7 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable D1 = {2,3} D4 = {2} D2 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D7 = {1} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1:= 2 V4:= 2 V7 V2 V3 V5 V6 V8 V9 V10 select variable with smallest domain Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable D1 = {2,3} D4 = {2} D7 = {1} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1:= 2 V4:= 2 V7:= 1 V2 V3 V5 V6 V8 V9 V10 instantiate current variable Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable D1 = {2,3} D4 = {2} D7 = {1} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

V1:= 2 V4:= 2 V7:= 1 V2 V3 V5 V6 V8 V9 V10 check forwards Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable D1 = {2,3} D4 = {2} D7 = {1} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {}

V1:= 2 V4:= 2 V7:= 1 V2 V3 V5 V6 V8 V9 V10 domain wipeout! Backtrack! Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variable D1 = {2,3} D4 = {2} D7 = {1} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {}

V1 V4 V7 V2 V3 V5 V6 V8 V9 V10 backtrack to V1 Forward checking variables V[1] to V[10] uniform domains D[1] to D[10] = {1,2,3} constraints V[1] = V[4] V[4] > V[7] V[7] = V[10] + 1 current variableD1 = {3} D4 = {1,2,32} D7 = {1,2,3} D3 = {1,2,3} D5 = {1,2,3} D6 = {1,2,3} D8 = {1,2,3} D9 = {1,2,3} D10 = {1,2,3}

That was a dvo, a dynamic variable ordering heuristic select next the variable with smallest current domain aka sdf, mrv, ff dvo Was it a good heuristic? If so, why was it a good heuristic? Will it always be a good heuristic? Can you think of a situation where it will be a bad heuristic? Could you use this heuristic with bt or with cbj?

Is forward checking always better than backward checking? That is, is fc better than bt (cbj) always Does fc entirely eliminate thrashing? Could we incorporate cbj into fc? That is check forwards and jump back?

Forward Checking NOTE: arrows go forward!

Forward Checking Variables 1 to 9 Domains {A,B} Constraints/nogoods: {(1/A,9/A),(3A/,4/A), (4/B,6/A), (6/B,9/B)} State is: 1/A 2/A 3/A 4/B 5/A 6/B 7/{A,B} 8/{A,B} 9/{}

Forward Checking Variables 1 to 9 Domains {A,B} Constraints/nogoods: {(1/A,9/A),(3A/,4/A), (4/B,6/A), (6/B,9/B)} State is: 1/A 2/A 3/A 4/B 5/A 6/B 7/{A,B} 8/{A,B) 9/{} Possible action: Backjump to V4 so that V6 can then take value A Backjump (step) to V3 so that V4 can take value A and Then V6 can take A also

Without backjumping FC can thrash! Replace 5 with a collection of variables with large domains to convince yourself

The mechanics of FC assume we have n variables each with domain of m values two dimensional array fcRed[1..n][1..n] if v[i] checks forwards against v[j] and removes values then fcRed[i][j] := true two dimensional array disallowed[1..n][1..m] if v[i] removes value x from domain of v[j] then disallowed[j][x] := i i.e. the “culprit” for x removed from domain[j] is v[i] When we uninstantiate v[i] we must undo the effects of forward checking for j in (i+1.. n) if fcRed[i][j] // variable v[i] disallows values in v[j] then for x in (1.. m) if disallowed[j][x] = i // this is a value disallowed by v[i] then domain[j] := domain[j] U {x} // return a disallowed value Reversible Variables

Check Forwards, Jump Back! There are no values in cd[6] compatible with v[9] get more values into cd[9] (undo v[1]?) OR get more values into cd[6] (undo v[4]) … and if that doesn’t work? undo v[3] so cd[4] gets value compatible with cd[6] that is then compatible with cd[9]

Check forwards and jump back? assume we have n variables each with domain of m values two dimensional array fcRed[1..n][1..n] if v[i] checks forwards against v[j] and removes values then fcRed[i][j] := true two dimensional array disallowed[1..n][1..m] if v[i] removes value x from domain of v[j] then disallowed[j][x] := i If v[i] := x wipes out domain[j] then confSet[i] := confSet[i] U variables checking against v[j] If we backtrack from v[i] jump back to v[h], where h is the deepest variable in confSet[i] U variables forward checking against v[i] Why?

Lets look at the crystal maze puzzle again! csp7.cl use bt4, cbj, and fc!

See source code clairExamples/fc.cl

why FC? Fail 1st? Does FC suggest heuristics? Static? Dynamic But FC still thrashes! We saw that FC could be worse than BT! An example Could we combine FC with CBJ?