CS 175 Project in AI. 2 Lectures: ICS 180 Tuesday, Thursday Hours: 9.30-10.50 am Discussion: DBH 1300 Wednesday Hours: 1.00-1.50 pm Instructor: Natalia.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems Russell and Norvig: Chapter
Advertisements

Constraint Satisfaction Problems
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 CMSC 471 Fall 2002 Class #6 – Wednesday, September 18.
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)
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 1 Ryan Kinworthy CSCE Advanced Constraint Processing.
1 Binary C ONSTRAINT P ROCESSING Chapter 2 ICS-275A Fall 2007.
Constraint Satisfaction
University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture.
1 Consistency algorithms Chapter 3. Spring 2007 ICS 275A - Constraint Networks 2 Consistency methods Approximation of inference: Arc, path and i-consistecy.
Constraint Networks ( slides courtesy of Natalia Flerova, based on slides courtesy of Rina Dechter)
General search strategies: Look-ahead Chapter 5 Chapter 5.
Stochastic greedy local search Chapter 7 ICS-275 Spring 2007.
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 2 Ryan Kinworthy CSCE Advanced Constraint Processing.
ICS-270A:Notes 6: 1 Notes 6: Constraint Satisfaction Problems ICS 270A Spring 2003.
Constraint Satisfaction Problems
Constraint Satisfaction Problems
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Local Search CPSC 322 – CSP 5 Textbook §4.8 February 7, 2011.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
CS 484 – Artificial Intelligence1 Announcements Homework 2 due today Lab 1 due Thursday, 9/20 Homework 3 has been posted Autumn – Current Event Tuesday.
Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
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.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
Constraint Networks Overview. Suggested reading Russell and Norvig. Artificial Intelligence: Modern Approach. Chapter 5.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
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.
Constraint Satisfaction Basics strongly influenced by Dr. Rina Dechter: “Constraint Processing”
Chapter 5 Constraint Satisfaction Problems
Stochastic greedy local search Chapter 7 ICS-275 Spring 2009.
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Constraint Propagation influenced by Dr. Rina Dechter, “Constraint Processing”
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.
Constraint Propagation Artificial Intelligence CMSC January 22, 2002.
Lecture 5: Constraint Satisfaction Problems
Domain Splitting, Local Search CPSC 322 – CSP 4 Textbook §4.6, §4.8 February 4, 2011.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Introduction to graphical models. Outline Course goals and policies Overview of graphical models, examples Constraint networks Probabilistic networks.
Alternative Search Formulations and Applications
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 (CSPs) Introduction
Constraint Satisfaction Problems (CSPs) Introduction
Lecture 7 Constraint Satisfaction Problems
CS 188: Artificial Intelligence
Computer Science cpsc322, Lecture 14
Constraint Propagation
Notes 6: Constraint Satisfaction Problems
Chapter 5: General search strategies: Look-ahead
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Constraint Satisfaction Problems (CSP)
Consistency algorithms
Presentation transcript:

CS 175 Project in AI

2 Lectures: ICS 180 Tuesday, Thursday Hours: am Discussion: DBH 1300 Wednesday Hours: pm Instructor: Natalia Flerova DBH TA: TBA Class website:

3 Grading Project proposal: 5% Midterm report: 30% Demo-presentation: 30% Final report: 35%

4 Grading Project proposal: due April 7th Midterm report: due May 5th Demo-presentation: during 10th and finals weeks Final report: due June 11th

5 Project ideas Constraints: Class scheduling TA assignment Sudoku Bayesian networks: Advising a first year student Vision: Image classification Image recognition (e.g. handwritten digits recognition)

6 Project ideas Games: Othello (Reversi) Checkers Go Japanese crossword Etc. Other: RoboSoccer simulation management project Estimating space explored by heuristic search

7 Project proposal Single page report describing the 2 ideas for your project (indicate priorities). Be sure to address the following issues: What is the main purpose of your project? What tasks will your end product solve? What AI techniques and approaches are you planning to use (it's OK to provide only high level description) How are you planning to split the responsibilities between group members?

Constraint Networks Overview

Suggested reading Russell and Norvig. Artificial Intelligence: Modern Approach. Chapter 5.

10 Good source of advanced information Rina Dechter, Constraint Processing, Morgan Kaufmann

11 Outline CSP: Definition, and simple modeling examples Representing constraints Basic search strategy Improving search: –Consistency algorithms –Look-ahead methods –Look-back methods

12 Outline CSP: Definition, and simple modeling examples Representing constraints Basic search strategy Improving search: –Consistency algorithms –Look-ahead methods –Look-back methods

AB redgreen redblack greenred greenblack blackgreen black red Constraint Satisfaction Example: map coloring Variables - countries (A,B,C,etc.) Values - colors (e.g., red, green, black) Constraints: C A B D E F G

14 Constraint Network; Definition A constraint network is: R= (X,D,C) X variables D domain C constraints R expresses allowed tuples over scopes A solution is an assignment to all variables that satisfies all constraints (join of all relations). Tasks: consistency?, one or all solutions, counting, optimization

Example The 4-queen problem Q Q Q Q Q Q Q Q Place 4 Queens on a chess board of 4x4 such that no two queens reside in the same row, column or diagonal. Standard CSP formulation of the problem: Variables: each row is a variable. Q Q Q Q Domains:

Example The 4-queen problem Q Q Q Q Q Q Q Q Place 4 Queens on a chess board of 4x4 such that no two queens reside in the same row, column or diagonal. Standard CSP formulation of the problem: Variables: each row is a variable. Q Q Q Q Domains: Constraints: There are = 6 constraints involved: 4 2 ( ) Constraint Graph :

19 Outline CSP: Definition, and simple modeling examples Representing constraints Basic search strategy Improving search: –Consistency algorithms –Look-ahead methods –Look-back methods

20 Constraint’s representations Relation: allowed tuples Algebraic expression: Propositional formula: Constraint graph

21 Figure 1.8: Example of set operations intersection, union, and difference applied to relations.

22 Constraint Graphs: Primal, Dual and Hypergraphs A (primal) constraint graph: a node per variable arcs connect constrained variables. A dual constraint graph: a node per constraint’s scope, an arc connect nodes sharing variables =hypergraph

26 Outline CSP: Definition, and simple modeling examples Representing constraints Basic search strategy Improving search: –Consistency algorithms –Look-ahead methods –Look-back methods

Search space

28 Backtracking search

Backtracking

The search space A tree of all partial solutions A partial solution: (a1,…,aj) satisfying all relevant constraints The size of the underlying search space depends on:  Variable ordering  Level of consistency possessed by the problem

Search space and the effect of ordering

Backtracking Complexity of extending a partial solution:  Complexity of consistent O(e log t), t bounds tuples, e constraints  Complexity of selectvalue O(e k log t)

A coloring problem example

Backtracking search for a solution

Backtracking Search for a Solution

Backtracking Search for All Solutions

41 Outline CSP: Definition, and simple modeling examples Representing constraints Basic search strategy Improving search: –Consistency algorithms –Look-ahead methods –Look-back methods

Before search : (reducing the search space) –Arc-consistency, path-consistency, i-consistency –Variable ordering (fixed) During search : –Look-ahead schemes: Value ordering/pruning (choose a least restricting value), Variable ordering (Choose the most constraining variable) –Look-back schemes: Backjumping Constraint recording Dependency-directed backtracking Improving Backtracking

43 Consistency methods Constraint propagation – inferring new constraints Can get such an explicit network that the search will find the solution without dead-ends. Approximation of inference:  Arc, path and i-consistency Methods that transform the original network into a tighter and tighter representations

44 Arc-consistency 32,1, 32,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,1,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

45 Arc-consistency 32,1, 32,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,1,1,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

46 Arc-consistency 32,1, 32,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,2,1,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

47 Arc-consistency 32,2,1,1, 32,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,2,1,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

48 Arc-consistency 32,2,1,1, 32,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,2,1,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

49 Arc-consistency 32,2,1,1, 32,2,1,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,2,1,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

50 Arc-consistency 32,2,1,1, 32,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,2,1,1,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

51 Arc-consistency 32,1, 32,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,1,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

52 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ  =   Arc-consistency

Arc-consistency algorithm domain of x domain of y Arc is arc-consistent if for any value of there exist a matching value of Algorithm Revise makes an arc consistent Begin 1. For each a in D i if there is no value b in D j that matches a then delete a from the D j. End. Revise is, k is the number of value in each domain.

Algorithm AC-3 Begin –1. Q <--- put all arcs in the queue in both directions –2. While Q is not empty do, –3. Select and delete an arc from the queue Q 4. Revise 5. If Revise cause a change then add to the queue all arcs that touch X i (namely ( X i,X m ) and ( X l,X i )). –6. end-while End Complexity: –Processing an arc requires O(k^2) steps –The number of times each arc can be processed is 2·k –Total complexity is

55 Sudoku – Constraint Satisfaction Each row, column and major block must be alldifferent “Well posed” if it has unique solution: 27 constraints Variables: empty slots Domains = {1,2,3,4,5,6,7,8,9} Constraints: 27 all-different Constraint Propagation Inference

56 Path-consistency

57 I-consistency

The Effect of Consistency Level After arc-consistency z=5 and l=5 are removed After path-consistency –R’_zx –R’_zy –R’_zl –R’_xy –R’_xl –R’_yl Tighter networks yield smaller search spaces

59 Outline CSP: Definition, and simple modeling examples Representing constraints Basic search strategy Improving search: –Consistency algorithms –Look-ahead methods –Look-back methods

73 Outline CSP: Definition, and simple modeling examples Representing constraints Basic search strategy Improving search: –Consistency algorithms –Look-ahead methods –Look-back methods

Look-back: Backjumping / Learning Backjumping: – In deadends, go back to the most recent culprit. Learning: – constraint-recording, no-good recording. – good-recording

Backjumping (X1=r,x2=b,x3=b,x4=b,x5=g,x6=r,x7={r,b}) (r,b,b,b,g,r) conflict set of x7 (r,-,b,b,g,-) c.s. of x7 (r,-,b,-,-,-,-) minimal conflict-set Leaf deadend: (r,b,b,b,g,r) Every conflict-set is a no-good

The cycle-cutset method An instantiation can be viewed as blocking cycles in the graph Given an instantiation to a set of variables that cut all cycles (a cycle-cutset) the rest of the problem can be solved in linear time by a tree algorithm. Complexity (n number of variables, k the domain size and C the cycle-cutset size):

Tree Decomposition

GSAT – local search for SAT (Selman, Levesque and Mitchell, 1992) 1.For i=1 to MaxTries 2. Select a random assignment A 3. For j=1 to MaxFlips 4. if A satisfies all constraint, return A 5. else flip a variable to maximize the score 6. (number of satisfied constraints; if no variable 7. assignment increases the score, flip at random) 8. end 9.end Greatly improves hill-climbing by adding restarts and sideway moves

WalkSAT (Selman, Kautz and Cohen, 1994) With probability p random walk – flip a variable in some unsatisfied constraint With probability 1-p perform a hill-climbing step Adds random walk to GSAT:

More Stochastic Search: Simulated Annealing, reweighting Simulated annealing: – A method for overcoming local minimas – Allows bad moves with some probability: With some probability related to a temperature parameter T the next move is picked randomly. – Theoretically, with a slow enough cooling schedule, this algorithm will find the optimal solution. But so will searching randomly. Breakout method (Morris, 1990): adjust the weights of the violated constraints