600.325/425 Declarative Methods - J. Eisner1 Constraint Programming.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Problems Russell and Norvig: Chapter
Constraint Satisfaction Problems
This lecture: CSP Introduction and Backtracking Search
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 CMSC 471 Fall 2002 Class #6 – Wednesday, September 18.
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. Constraint satisfaction problems (CSPs) Standard search problem: – State is a “black box” – any data structure that.
Constraint Satisfaction Problems
CPSC 322, Lecture 11Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Computer Science cpsc322, Lecture 11 (Textbook Chpt 4.0 – 4.2) January,
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Constraint Satisfaction Problems
Constraint Satisfaction
University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture.
Constraint Satisfaction Problem Solving Chapter 5.
Chapter 5 Outline Formal definition of CSP CSP Examples
Constraint Satisfaction Problems
Constraint Satisfaction Problems
Constraint Satisfaction Problems
ISC 4322/6300 – GAM 4322 Artificial Intelligence Lecture 4 Constraint Satisfaction Problems Instructor: Alireza Tavakkoli September 17, 2009 University.
1 Constraint Satisfaction Problems Slides by Prof WELLING.
Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Jim Little UBC CS 322 – CSP 1 September 27, 2014 Textbook §
CSPs Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew Moore,
CSPs Tamara Berg CS Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew.
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
CSC 8520 Spring Paula Matuszek Based on Hwee Tou Ng, aima.eecs.berkeley.edu/slides-ppt, which are based on Russell, aima.eecs.berkeley.edu/slides-pdf.
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,
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
1 Chapter 5 Constraint Satisfaction Problems. 2 Outlines  Constraint Satisfaction Problems  Backtracking Search for CSPs  Local Search for CSP  The.
CSC 8520 Spring Paula Matuszek CS 8520: Artificial Intelligence Search 3: Constraint Satisfaction Problems Paula Matuszek Spring, 2013.
CSPs Tamara Berg CS Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew.
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3 Grand Challenge:
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
Constraint Satisfaction Problems University of Berkeley, USA
Constraint Satisfaction Problems Chapter 6. Outline CSP? Backtracking for CSP Local search for CSPs Problem structure and decomposition.
4/18/2005EE5621 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 5, 4/18/2005 University of Washington, Department of Electrical Engineering Spring.
G51IAI Introduction to Artificial Intelligence
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Computing & Information Sciences Kansas State University Friday, 08 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 7 of 42 Friday, 08 September.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
EXAMPLE: MAP COLORING. Example: Map coloring Variables — WA, NT, Q, NSW, V, SA, T Domains — D i ={red,green,blue} Constraints — adjacent regions must.
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Dr. Shazzad Hosain Department of EECS North South University Lecture 01 – Part C Constraint Satisfaction Problems.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Constraint Satisfaction Problems
Introduction to graphical models. Outline Course goals and policies Overview of graphical models, examples Constraint networks Probabilistic networks.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Constraint Satisfaction Problems (CSPs) Introduction
Constraint Satisfaction Problems (CSPs)
Constraint Satisfaction Problems (CSPs) Introduction
Advanced Artificial Intelligence
CS 188: Artificial Intelligence
Constraint Satisfaction Problems
Constraint Satisfaction Problems
Artificial Intelligence
Constraint Satisfaction Problems
CSP Warm-up Assign Red, Green, or Blue
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

/425 Declarative Methods - J. Eisner1 Constraint Programming

/425 Declarative Methods - J. Eisner 2 Constraint Programming: Extending the SAT language We’ve seen usefulness of SAT and MAX-SAT  Candidate solutions are assignments  Clauses are a bunch of competing constraints on assignments Constraint programming offers a richer language:  convenient Don’t have to express each constraint as a disjunction of literals Encodings closer to how you think about problem  maybe more efficient Fewer constraints: saves on storage, indexing, and propagation Special handling for particular types of constraints  maybe more general Leads toward generalizations, e.g., real-valued variables

/425 Declarative Methods - J. Eisner 3 ECLiPSe (= ECLiPSe Constraint Logic Programming System) One of many constraint programming software packages Free for academic use Nice constraint language Several solver libraries Extensible – you can define your own new constraint types and new solvers

/425 Declarative Methods - J. Eisner 4 Integer constraints X :: [2,4,6,8,10..20] % X has one of these vals X #= Y % # for a constraint X #< Y % less than X #\= 3 % inequality X + Y #= Z % arithmetic X*Y + Z^2 #= 70 ordered([A,B,C,D]) alldifferent([A,B,C,D]) sum([A,B,C,D], E) minlist([A,B,C,D], C) minlist([A,B,C,D], 3) occurrences(…) Which of these are syntactic sugar? What happens if you don’t say this? Global constraints

/425 Declarative Methods - J. Eisner 5 Real-number constraints X :: Inf % X has a real value in this range X $= Y % $ for a constraint on real numbers X $< Y % less than X $\= 3 % inequality X + Y $= Z % arithmetic X*Y + Z^2 $= 70 ordered([A,B,C,D]) alldifferent([A,B,C,D]) sum([A,B,C,D], E) minlist([A,B,C,D], C) minlist([A,B,C,D], 3) occurrences(…) How about numeric precision? (How do we check if $= is satisfied?) Interval arithmetic...

/425 Declarative Methods - J. Eisner 6 Logical operators A #= B or A #= C A #= B and neg A #= C Cost #= (A #= B) + (A #= C)  Cost has value 0, 1, or 2  If we know A,B,C, we have information about Cost … and vice-versa!  Another constraint might say Cost #< 1.

/425 Declarative Methods - J. Eisner 7 Set constraints Variables whose values are sets (rather than integers or reals) Constrain A to be a subset of B Constrain intersection of A, B to have size 2 Etc.

/425 Declarative Methods - J. Eisner 8 Constraint Logic Programming ECLiPSe is an extension of Prolog  actually a full-fledged language with recursion, etc. So a typical ECLiPSe program does the encoding as well as the solving. Advantages?  don’t have to read/write millions of constraints  don’t have to store millions of constraints at once (generate new constrained variables during search, eliminate them during backtracking)  easier to hide constraint solving inside a subroutine  less overhead for small problems But for simplicity, we’ll just worry about the “little language” of constraints.  You can do the encoding yourself in Perl.

/425 Declarative Methods - J. Eisner 9 Example: Map-Coloring Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red,green,blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, or (WA,NT) in {(red,green),(red,blue),(green,red), (green,blue),(blue,red),(blue,green)} slide thanks to Tuomas Sandholm

/425 Declarative Methods - J. Eisner 10 Example: Map-Coloring Solutions are complete and consistent assignments e.g., WA = red, NT = green, Q = red, NSW = green, V = red, SA = blue, T = green slide thanks to Tuomas Sandholm

/425 Declarative Methods - J. Eisner 11 We’ll talk about solvers next week slide thanks to Tuomas Sandholm

/425 Declarative Methods - J. Eisner 12 Varieties of CSPs Discrete variables  finite domains: n variables, domain size d  O(d n ) complete assignments e.g., Boolean CSPs, incl. Boolean satisfiability (NP-complete)  infinite domains: integers, strings, etc. e.g., job scheduling, variables are start/end days for each job need a constraint language, e.g., StartJob ≤ StartJob 3 Continuous variables  e.g., start/end times for Hubble Space Telescope observations  linear constraints solvable in polynomial time by Linear Programming slide thanks to Tuomas Sandholm

/425 Declarative Methods - J. Eisner 13 Varieties of constraints Unary constraints involve a single variable,  e.g., SA ≠ green in the map coloring example Binary constraints involve pairs of variables,  e.g., SA ≠ WA in the map coloring example Higher-order constraints involve 3 or more variables,  e.g., cryptarithmetic column constraints (next slide) slide adapted from Tuomas Sandholm

/425 Declarative Methods - J. Eisner 14 Example: Cryptarithmetic Variables: F T U W R O X 1 X 2 X 3 Domains: {0,1,2,3,4,5,6,7,8,9} Constraints: Alldiff (F,T,U,W,R,O)  O + O = R + 10 · X 1  X 1 + W + W = U + 10 · X 2  X 2 + T + T = O + 10 · X 3  X 3 = F, T ≠ 0, F ≠ 0 slide thanks to Tuomas Sandholm

/425 Declarative Methods - J. Eisner 15 More examples At the ECLiPSe website: Let’s play with these in a running copy of ECLiPSe!