תכנון ובעיות " קשות " בינה מלאכותית אבי רוזנפלד. יש בעיות שכנראה המחשב לא יכול לפתור P NP NP-Complete.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Problems Russell and Norvig: Chapter
Constraint Satisfaction Problems (Chapter 6). What is search for? Assumptions: single agent, deterministic, fully observable, discrete environment Search.
Constraint Satisfaction Problems
This lecture: CSP Introduction and Backtracking Search
Lecture 11 Last Time: Local Search, Constraint Satisfaction Problems Today: More on CSPs.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Constraint Satisfaction problems (CSP)
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
Constraint Satisfaction Problems. Constraint satisfaction problems (CSPs) Standard search problem: – State is a “black box” – any data structure that.
Constraint Satisfaction Problems
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Constraint Satisfaction Problems
CS 188: Artificial Intelligence Fall 2009
Constraint Satisfaction
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.
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,
1 Constraint Satisfaction Problems Soup Total Cost < $30 Chicken Dish Vegetable RiceSeafood Pork Dish Appetizer Must be Hot&Sour No Peanuts No Peanuts.
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.
Lecture 5: Solving CSPs Fast! 1/30/2012 Robert Pless – Wash U. Multiple slides over the course adapted from Kilian Weinberger, Dan Klein (or Stuart Russell.
CSE 473: Artificial Intelligence Constraint Satisfaction Daniel Weld Slides adapted from Dan Klein, Stuart Russell, Andrew Moore & Luke Zettlemoyer.
Constraint Satisfaction Problems (Chapter 6)
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
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.
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.
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
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Cse 150, Fall 2012Gary Cottrell: Many slides borrowed from David Kriegman! Constraint Satisfaction Problems Introduction to Artificial Intelligence CSE.
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Constraint Satisfaction Problems (Chapter 6)
ECE 448, Lecture 7: Constraint Satisfaction Problems
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Advanced 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:

תכנון ובעיות " קשות " בינה מלאכותית אבי רוזנפלד

יש בעיות שכנראה המחשב לא יכול לפתור P NP NP-Complete

איך פותרים את הבעיה ??? אין פתרון פולינומיאלי ! צריכים לבדוק כל אפשרות ! BRUTE FORCE = n! תכנות דינאמי – " רק " n 2 2 n כנראה שאין פתרון " סביר " - פולינומיאלי

NP-Complete דוגמאות To prove a problem is NP-Complete show a polynomial time reduction from 3-SAT Other NP-Complete Problems: – PARTITION – SUBSET-SUM – CLIQUE – HAMILTONIAN PATH (TSP) – GRAPH COLORING – MINESWEEPER (and many more)

רוב בעיות של תכנון ואופטימיזציה הם פה !

רק הבעיות המעניות הם NP Deterministic Polynomial Time: The TM takes at most O(n c ) steps to accept a string of length n Non-deterministic Polynomial Time: The TM takes at most O(n c ) steps on each computation path to accept a string of length n

אז מה עושים ? Branch and Bound ( כעין PRUNING) HILLCLIMING HEURISTICS Mixed Integer Programming

Constraint Satisfaction Problems (CSP) Constraint Optimization Problems (COP) Backtracking search for CSP and COPs Problem Structure and Problem Decomposition Local search for COPs 10 דוגמאות CSP ו COP

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 (if the language allows stating this so succinctly), or (WA, NT) in {(red,green), (red,blue), (green,red), (green,blue), (blue,red), (blue,green)} 11 Example: Map-Coloring

This is a solution: complete and consistent assignments (i.e., all variables assigned, all constraints satisfied): e.g., WA = red, NT = green, Q = red, NSW = green, V = red, SA = blue, T = green 12 Example: Map-Coloring

Binary CSP: each constraint relates two variables Constraint graph: nodes are variables, arcs show constraints 13 Constraint graph General-purpose CSP algorithms use the graph structure to speed up search, e.g., Tasmania is an independent subproblem

Discrete variables – finite domains: n variables, domain size d implies O(d n ) complete assignments e.g., Boolean CSPs, including 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 methods 14 Varieties of CSPs

Assignment problems – e.g., who teaches what class? Timetabling problems – e.g., which class (or exam) is offered when and where? Hardware Configuration Spreadsheets Transportation scheduling Factory scheduling Floorplanning Notice that many real-world problems involve real- valued variables 15 Real-world CSPs

Let’s start with the straightforward (dumb) approach, then fix it. States are defined by the values assigned so far. Initial state: the empty assignment { } Successor function: assign a value to an unassigned variable that does not conflict with current assignment  fail if no legal assignments Goal test: the current assignment is complete 1.This is the same for all CSPs (good) 2.Every solution appears at depth n with n variables  use depth-first search 3.Path is irrelevant, so can also use complete-state formulation 4.b = (n - l )d at depth l, hence n! · d n leaves (bad) 16 Standard search formulation (incremental) b is branching factor, d is size of domain, n is number of variables

Let’s say we had 4 variables, each of which could take one of 4 integer values 17 What This Naïve Search Would Look Like ???? 1??? 2??? 3??? 4??? ?1?? ?2???3???4?? ??1???2???3???4????1???2???3???4 Etc.…terrible branching factor 11??12??13??14??1?1?1?2?1?3?1?4?1??11??21??31??43 At start, all unassigned

18 Backtracking example

19 Backtracking example

20 Backtracking example

21 Backtracking example

יש כמה דרכים איך לשפר את התהליך... –איזה ענף בודקים ראשון –איזה בודקים בפעם השנייה, וכו ' –האם אפשר לעצור את התהליך באמצע ? –האם אפשר לנצל מידע על הבעיה ? –האם אפשר לגזום העץ ? 22 שיפורים

Minimum remaining values (MRV): choose the variable with the fewest legal values 23 Minimum Remaining Values All are the same here Two equivalent ones here Clear choice

Tie-breaker among MRV variables Degree heuristic: choose the variable with the most constraints on remaining variables 24 Degree Heuristic

Given a variable, choose the least constraining value: – the one that rules out the fewest values in the remaining variables 25 Least Constraining Value

Given a variable, choose the most constraining value: – This is VERY constrained, so let’s do it first… 26 Most Constraining Value

Idea: – Keep track of remaining legal values for unassigned variables – Terminate search when any variable has no legal values 27 Forward checking

Tasmania and mainland are independent subproblems Subproblems identifiable as connected components of constraint graph 28 Problem Structure

Hill-climbing, simulated annealing typically work with “complete” states, i.e., all variables assigned To apply to CSPs: – use complete states, but with unsatisfied constraints – operators reassign variable values Variable selection: randomly select any conflicted variable Value selection by min-conflicts heuristic: – choose value that violates the fewest constraints – i.e., hill-climb with h(n) = total number of violated constraints 29 Iterative Algorithms for CSPs

Example: Sudoku  Variables:  Each (open) square  Domains:  {1,2,…,9}  Constraints: 9-way alldiff for each row 9-way alldiff for each column 9-way alldiff for each region

Very Important CSPs: Scheduling Many industries. Many multi-million $ decisions. Used extensively for space mission planning. Military uses. People really care about improving scheduling algorithms! Problems with phenomenally huge state spaces. But for which solutions are needed very quickly Many kinds of scheduling problems e.g.: – Job shop: Discrete time; weird ordering of operations possible; set of separate jobs. – Batch shop: Discrete or continuous time; restricted operation of ordering; grouping is important.

Scheduling A set of N jobs, J 1,…, J n. Each job j is composed of a sequence of operations O j 1,..., O j Lj Each operation may use resource R, and has a specific duration in time. A resource must be used by a single operation at a time. All jobs must be completed by a due time. Problem: assign a start time to each job.

יש " מעבר פאזה " Cheeseman 1993

CSPs are a special kind of search problem: – states defined by values of a fixed set of variables – goal test defined by constraints on variable values Backtracking = depth-first search with one variable assigned per node Variable ordering (MRV, degree heuristic) and value selection (least constraining value) heuristics help significantly Forward checking prevents assignments that guarantee later failure Constraint propagation (e.g., arc consistency) does additional work to constrain values and detect inconsistencies The CSP representation allows analysis of problem structure Tree-structured CSPs can be solved in linear time Iterative min-conflicts is usually effective in practice 34 Summary