Constraint Satisfaction Problems

Similar documents
What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems

CS 343: Artificial Intelligence

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set:

CS 188: Artificial Intelligence Fall 2011

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm

Announcements. CS 188: Artificial Intelligence Fall 2010

CSE 473: Artificial Intelligence

Announcements. CS 188: Artificial Intelligence Spring Today. Example: Map-Coloring. Example: Cryptarithmetic.

CS 4100 // artificial intelligence

What is Search For? CS 188: Ar)ficial Intelligence. Constraint Sa)sfac)on Problems Sep 14, 2015

CS 188: Artificial Intelligence Fall 2008

Announcements. CS 188: Artificial Intelligence Fall Large Scale: Problems with A* What is Search For? Example: N-Queens

CS 188: Artificial Intelligence. Recap: Search

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17

What is Search For? CS 188: Artificial Intelligence. Example: Map Coloring. Example: N-Queens. Example: N-Queens. Constraint Satisfaction Problems

Constraint Satisfaction Problems (CSPs)

Space of Search Strategies. CSE 573: Artificial Intelligence. Constraint Satisfaction. Recap: Search Problem. Example: Map-Coloring 11/30/2012

Announcements. CS 188: Artificial Intelligence Spring Today. A* Review. Consistency. A* Graph Search Gone Wrong

Constraint Satisfaction Problems. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe

Constraint Satisfaction Problems

Recap: Search Problem. CSE 473: Artificial Intelligence. Space of Search Strategies. Constraint Satisfaction. Example: N-Queens 4/9/2012

Constraint Satisfaction

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Spring Announcements

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides)

Constraint Satisfaction Problems

Lecture 6: Constraint Satisfaction Problems (CSPs)

Constraint Satisfaction Problems

Constraint Satisfaction Problems

Artificial Intelligence Constraint Satisfaction Problems

Australia Western Australia Western Territory Northern Territory Northern Australia South Australia South Tasmania Queensland Tasmania Victoria

CS W4701 Artificial Intelligence

Outline. Best-first search

Iterative improvement algorithms. Today. Example: Travelling Salesperson Problem. Example: n-queens

Constraint Satisfaction Problems

Chapter 6 Constraint Satisfaction Problems

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 30 January, 2018

Constraint Satisfaction Problems

Constraint Satisfaction. AI Slides (5e) c Lin

CONSTRAINT SATISFACTION

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3)

Artificial Intelligence

CS 188: Artificial Intelligence Spring Today

Example: Map-Coloring. Constraint Satisfaction Problems Western Australia. Example: Map-Coloring contd. Outline. Constraint graph

Constraint satisfaction problems. CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search

Constraint Satisfaction Problems

CS 188: Artificial Intelligence Fall 2011

Constraints. CSC 411: AI Fall NC State University 1 / 53. Constraints

Week 8: Constraint Satisfaction Problems

Constraint Satisfaction Problems

CSE 573: Artificial Intelligence

Constraint Satisfaction Problems

Constraint Satisfaction Problems

CS 188: Artificial Intelligence

CS 188: Artificial Intelligence

CS 188: Artificial Intelligence

Announcements. CS 188: Artificial Intelligence Fall Reminder: CSPs. Today. Example: 3-SAT. Example: Boolean Satisfiability.

CS 188: Artificial Intelligence Fall 2008

10/11/2017. Constraint Satisfaction Problems II. Review: CSP Representations. Heuristic 1: Most constrained variable

CS 771 Artificial Intelligence. Constraint Satisfaction Problem

Today. CS 188: Artificial Intelligence Fall Example: Boolean Satisfiability. Reminder: CSPs. Example: 3-SAT. CSPs: Queries.

Lecture 18. Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1

Constraint Satisfaction Problems

Constraint Satisfaction. CS 486/686: Introduction to Artificial Intelligence

Constraint Satisfaction Problems

Moving to a different formalism... SEND + MORE MONEY

CONSTRAINT SATISFACTION

Reading: Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Thursday: Chapter 8

Map Colouring. Constraint Satisfaction. Map Colouring. Constraint Satisfaction

Constraint Satisfaction Problems. Chapter 6

Outline. Best-first search

CS 4100/5100: Foundations of AI

Foundations of Artificial Intelligence

Announcements. Reminder: CSPs. Today. Example: N-Queens. Example: Map-Coloring. Introduction to Artificial Intelligence

Comments about assign 1. Quick search recap. Constraint Satisfaction Problems (CSPs) Search uninformed BFS, DFS, IDS. Adversarial search

Constraint Satisfaction Problems Chapter 3, Section 7 and Chapter 4, Section 4.4 AIMA Slides cstuart Russell and Peter Norvig, 1998 Chapter 3, Section

CONSTRAINT SATISFACTION

Constraint Satisfaction Problems Part 2

Spezielle Themen der Künstlichen Intelligenz

Admin. Quick search recap. Constraint Satisfaction Problems (CSPs)! Intro Example: 8-Queens. Where should I put the queens in columns 3 and 4?

K-Consistency. CS 188: Artificial Intelligence. K-Consistency. Strong K-Consistency. Constraint Satisfaction Problems II

General Methods and Search Algorithms

Example: Map coloring

Constraint Satisfaction Problems (CSP)

Mathematical Programming Formulations, Constraint Programming

ARTIFICIAL INTELLIGENCE (CS 370D)

Announcements. CS 188: Artificial Intelligence Spring Production Scheduling. Today. Backtracking Search Review. Production Scheduling

CS188 Spring 2010 Section 2: CSP s

CMU-Q Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on Artificial Intelligence,

Artificial Intelligence

Artificial Intelligence

Constraint Satisfaction Problems (CSPs)

Today. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 5. Constraint Satisfaction Problems (CSP) CSP Definition

CS 188: Artificial Intelligence. Recap Search I

Constraint satisfaction search. Combinatorial optimization search.

Constraint Satisfaction Problems

Transcription:

Constraint Satisfaction Problems [These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available at http://ai.berkeley.edu.]

What is Search For? Assumptions about the world: a single agent, deterministic actions, fully observed state, discrete state space Planning: sequences of actions The path to the goal is the important thing Paths have various costs, depths Heuristics give problem-specific guidance Identification: assignments to variables The goal itself is important, not the path All paths at the same depth (for some formulations) CSPs are specialized for identification problems

Constraint Satisfaction Problems

Constraint Satisfaction Problems Standard search problems: State is a black box : arbitrary data structure Goal test can be any function over states Successor function can also be anything Constraint satisfaction problems (CSPs): A special subset of search problems State is defined by variables X i with values from a domain D (sometimes D depends on i) Goal test is a set of constraints specifying allowable combinations of values for subsets of variables Simple example of a formal representation language Allows useful general-purpose algorithms with more power than standard search algorithms

CSP Examples

Example: Map Coloring Variables: Domains: Constraints: adjacent regions must have different colors Implicit: Explicit: Solutions are assignments satisfying all constraints, e.g.:

Example: N-Queens Formulation 1: Variables: Domains: Constraints (i = row, j = column) (Same row, different columns) (Different row, same column) (Diagonal, down and right) (Diagonal, down and left) (N queens on the board)

Example: N-Queens Formulation 2: Variables: (where queen is in row k) Domains: Constraints: Implicit: Explicit:

Constraint Graphs

Constraint Graphs Binary CSP: each constraint relates (at most) two variables Binary constraint graph: nodes are variables, arcs show constraints General-purpose CSP algorithms use the graph structure to speed up search. E.g., Tasmania is an independent subproblem!

Example: Cryptarithmetic Variables: Domains: Constraints:

Example: Sudoku Variables: Each (open) square Domains: {1,2,,9} Constraints: 9-way alldiff for each column 9-way alldiff for each row 9-way alldiff for each region (or can have a bunch of pairwise inequality constraints)

Example: The Waltz Algorithm The Waltz algorithm is for interpreting line drawings of solid polyhedra as 3D objects An early example of an AI computation posed as a CSP? Approach: Each intersection is a variable Adjacent intersections impose constraints on each other Solutions are physically realizable 3D interpretations

Varieties of CSPs and Constraints

Varieties of CSPs Discrete Variables Finite domains Size d means O(d n ) complete assignments E.g., Boolean CSPs, including Boolean satisfiability (NPcomplete) Infinite domains (integers, strings, etc.) E.g., job scheduling, variables are start/end times for each job Linear constraints solvable, nonlinear undecidable Continuous variables E.g., start/end times for Hubble Telescope observations Linear constraints solvable in polynomial time by LP methods

Varieties of Constraints Varieties of Constraints Unary constraints involve a single variable (equivalent to reducing domains), e.g.: Binary constraints involve pairs of variables, e.g.: Higher-order constraints involve 3 or more variables: e.g., cryptarithmetic column constraints Preferences (soft constraints): E.g., red is better than green Often representable by a cost for each variable assignment Gives constrained optimization problems (We ll ignore these until we get to Bayes nets)

Real-World CSPs Assignment problems: e.g., who teaches what class Timetabling problems: e.g., which class is offered when and where? Hardware configuration Transportation scheduling Factory scheduling Circuit layout Fault diagnosis lots more! Many real-world problems involve real-valued variables

Solving CSPs

Standard Search Formulation Standard search formulation of CSPs States defined by the values assigned so far (partial assignments) Initial state: the empty assignment, {} Successor function: assign a value to an unassigned variable Goal test: the current assignment is complete and satisfies all constraints We ll start with the straightforward, naïve approach, then improve it

Search Methods What would BFS do? What would DFS do? What problems does naïve search have? [Demo: coloring -- dfs]

Backtracking Search

Backtracking Search Backtracking search is the basic uninformed algorithm for solving CSPs Idea 1: One variable at a time Variable assignments are commutative, so fix ordering I.e., [WA = red then NT = green] same as [NT = green then WA = red] Only need to consider assignments to a single variable at each step Idea 2: Check constraints as you go I.e. consider only values which do not conflict previous assignments Might have to do some computation to check the constraints Incremental goal test Depth-first search with these two improvements is called backtracking search (not the best name) Can solve n-queens for n 25

Backtracking Example

Backtracking Search Backtracking = DFS + variable-ordering + fail-on-violation What are the choice points? [Demo: coloring -- backtracking]

Next time: Improving Backtracking General-purpose ideas give huge gains in speed Ordering: Which variable should be assigned next? In what order should its values be tried? Filtering: Can we detect inevitable failure early? Structure: Can we exploit the problem structure?