Lecture 2-2CS250: Intro to AI/Lisp Implementing Search Lecture 2-2 January 14 th /19 th, 1999 CS250.

Slides:



Advertisements
Similar presentations
Classic AI Search Problems
Advertisements

Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Artificial Intelligence Problem Solving Eriq Muhammad Adams
G5AIAI Introduction to AI
Comp 307 Problem Solving and Search Formalize a problem as State Space Search Blind search strategies Heuristic search.
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Blind Search by Prof. Jean-Claude Latombe
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
CMSC 471 Spring 2014 Class #4 Thu 2/6/14 Uninformed Search Professor Marie desJardins,
G5BAIM Artificial Intelligence Methods Graham Kendall Blind Searches.
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
1 Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3–5.
Lets remember about Goal formulation, Problem formulation and Types of Problem. OBJECTIVE OF TODAY’S LECTURE Today we will discus how to find a solution.
Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack.
Touring problems Start from Arad, visit each city at least once. What is the state-space formulation? Start from Arad, visit each city exactly once. What.
Feng Zhiyong Tianjin University Fall  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving.
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
Search I Tuomas Sandholm Carnegie Mellon University Computer Science Department [Read Russell & Norvig Chapter 3]
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2004.
1 Solving Problems by Searching. 2 Terminology State State Space Initial State Goal Test Action Step Cost Path Cost State Change Function State-Space.
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
Artificial Intelligence Methods Rao Vemuri Searching - 2.
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2002.
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
1 Lecture 3 Uninformed Search
Intro to AI, Fall 2004 © L. Joskowicz 1 Introduction to Artificial Intelligence LECTURE 3: Uninformed Search Problem solving by search: definitions Graph.
For Friday Finish chapter 3 Homework: –Chapter 3, exercise 6 –May be done in groups. –Clarification on part d: an “action” must be running the program.
Solving Problems by Searching
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
1 Problem Solving and Searching CS 171/271 (Chapter 3) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Problem Solving and Search Andrea Danyluk September 11, 2013.
Copyright R. Weber Search in Problem Solving ISYS 370 Dr. R. Weber.
© Kurfess edited 2004 Eggen Search 1 CAP 4630/5605 Artificial Intelligence.
Problem solving.
Search I Tuomas Sandholm Carnegie Mellon University Computer Science Department Read Russell & Norvig Sections (Also read Chapters 1 and 2 if.
Do you drive? Have you thought about how the route plan is created for you in the GPS system? How would you implement a cross-and- nought computer program?
CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #3 Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam.
CS 416 Artificial Intelligence Lecture 4 Uninformed Searches (cont) Lecture 4 Uninformed Searches (cont)
Artificial Intelligence
Vilalta&Eick:Uninformed Search Problem Solving By Searching Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States/Looping.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
G5BAIM Artificial Intelligence Methods Graham Kendall Searching.
Lecture 4-2CS250: Intro to AI/Lisp Better Living through Search II Lecture 4-2 October 21 st, 1999 CS250.
Problem solving by search Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
Lecture 5-1CS250: Intro to AI/Lisp “If I Only had a Brain” Search Lecture 5-1 October 26 th, 1999 CS250.
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2.
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
1 Solving Problems by Searching. 2 Terminology State State Space Goal Action Cost State Change Function Problem-Solving Agent State-Space Search.
Blind Search Russell and Norvig: Chapter 3, Sections 3.4 – 3.6 CS121 – Winter 2003.
Search Part I Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States Partial Information Summary.
Search I Tuomas Sandholm Read Russell & Norvig Sections (Also read Chapters 1 and 2 if you haven’t already.) Next time we’ll cover topics related.
Problem Solving by Searching
Search Tuomas Sandholm Read Russell & Norvig Sections
هوش مصنوعی فصل سوم: حل مسئله با جستجو
Artificial Intelligence
Russell and Norvig: Chapter 3, Sections 3.4 – 3.6
Problem Solving and Searching
Problem Solving and Searching
Presentation transcript:

Lecture 2-2CS250: Intro to AI/Lisp Implementing Search Lecture 2-2 January 14 th /19 th, 1999 CS250

Lecture 2-2CS250: Intro to AI/Lisp 8-Puzzle States? Operators? Goal test? Path cost?

Lecture 2-2CS250: Intro to AI/Lisp 8-Queens Place 8 queens on a chess board, with no one attacking any other Goal test? Path cost? States Operators?

Lecture 2-2CS250: Intro to AI/Lisp Cryptarithmetic Puzzles with numbers replaced by letters FORTY + TEN ===== SIXTY

Lecture 2-2CS250: Intro to AI/Lisp Missionaries & Cannibals Three missionaries and three cannibals wish to cross a river in a boat that won’t hold all three States? Operators? Goal test? Path cost?

Lecture 2-2CS250: Intro to AI/Lisp Real-World Problems Route finding TSP VLSI Robot navigation Paint booth scheduling

Lecture 2-2CS250: Intro to AI/Lisp Search Trees

Lecture 2-2CS250: Intro to AI/Lisp What’s in a Node? State - what state are we in? Parent - Which node generated the current node? Operator - Action which generated node from parent Node depth - Number of nodes from root Cost - Path cost from initial node

Lecture 2-2CS250: Intro to AI/Lisp Lieutenant Node & General Search function GENERAL-SEARCH(problem, QUEUEING-FN) returns solution or failure nodes  MAKE-QUEUE(MAKE-NODE(INITIAL-STATE[problem])) loop do if nodes is empty then return failure node  REMOVE-FRONT(nodes) if GOAL-TEST[problem] applied to STATE(node) succeeds then return node nodes  QUEUING-FN(nodes, EXPAND(node, OPERATORS[problem])) end

Lecture 2-2CS250: Intro to AI/Lisp Coding Goals Create the initial node list –Need the right ordering Write a loop If test Functions for: –QUEUEING-FN, REMOVE-FRONT, GOAL-TEST, EXPAND, MAKE-NODE

Lecture 2-2CS250: Intro to AI/Lisp In Lisp... (defun general-search (problem queuing-fn) "Expand nodes according to the specification of PROBLEM until we find a solution or run out of nodes to expand. The QUEUING-FN decides whichnodes to look at first. [p 73]” (let ((nodes (make-initial-queue problem queuing-fn)) node) (loop (if (empty-queue? nodes) (RETURN nil)) (setq node (remove-front nodes)) (if (goal-test problem (node-state node)) (RETURN node)) (funcall queuing-fn nodes (expand node problem)))))

Lecture 2-2CS250: Intro to AI/Lisp A Few Lisp Ends (setq var1 form1 var2 form2...) return terminates a loop and returns the value of the specified expression as the value of the loop special form: A list (but not a macro), which is a form with special syntax or special evaluation rules or both, possibly manipulating the evaluation environment or control flow or both. The first element of a special form is a special operator.

Lecture 2-2CS250: Intro to AI/Lisp Dumb & Smart Searching Does the search algorithm use information beyond GOAL-TEST? –Uninformed/blind searching does not –Informed/heuristic search does

Lecture 2-2CS250: Intro to AI/Lisp Factors in Search Strategy Completeness - Are we guaranteed to find a solution, if one exists? Time complexity - How long does it take? Space complexity - How much memory? Optimality - Find the best of several solutions?

Lecture 2-2CS250: Intro to AI/Lisp Different Strokes for Different Searches Why is GENERAL-SEARCH general?

Lecture 2-2CS250: Intro to AI/Lisp Breadth-First Search Go sideways before you go down –How do we do this in GENERAL- SEARCH? How good is it? –Completeness? –How long does it take? –How much memory? –Optimality?

Lecture 2-2CS250: Intro to AI/Lisp Uniform Cost BFS: No shorter path is a solution, but what about cost? Uniform cost expands the lowest cost node When is BFS also uniform? g(node) = DEPTH(node)

Lecture 2-2CS250: Intro to AI/Lisp Depth-first Search Go down before you go sideways Saves memory over BFS - why? How good is it? –Completeness? –How long does it take? –Optimality? Depth-limited search

Lecture 2-2CS250: Intro to AI/Lisp Iterative Deepening Search Repeated depth-limited search –Depth 0, depth 1, depth 2, … Same states expanded multiple times –Higher branching factors make repeated expansion less important How good is it? Good choice when: –Big search space – Unknown solution depth

Lecture 2-2CS250: Intro to AI/Lisp Bidirectional Search Start from the beginning and the end, meet in the middle Divide and conquer –Cut the depth of each search in half –From O(b d ) to O(2b d/2 ) –For b = 10, d = 6: BFS searches1,111,111 Bidirectional searches2,222

Lecture 2-2CS250: Intro to AI/Lisp Sounds Great, Where do I Sign Up? Searching backwards? Calculating predecessors can be tricky Many goal states are a problem Generate a node and ask, “Is it in the other half of the tree?” Different halves can have different searches

Lecture 2-2CS250: Intro to AI/Lisp Search Comparison d= depth of the goal m= max tree depth l= depth limit

Lecture 2-2CS250: Intro to AI/Lisp And the Winner is... Depth-first iterative deepening –Asymptotically optimal in time –Asymptotically optimal in space among blind searches that find optimal solutions

Lecture 2-2CS250: Intro to AI/Lisp Constraint Satisfaction Search Constraint Satisfaction Problem (CPS): additional structural properties –States are values of a set of variables –Goal test specifies constraints on variable values Unary - cryptarithmetic Binary - 8-Queens 3rd and higher-order Absolute or just nice to have

Lecture 2-2CS250: Intro to AI/Lisp Why Bother? Less general than the notion of ‘problem’ More efficient algorithms –Constraints are fine-grained

Lecture 2-2CS250: Intro to AI/Lisp Domains Variables V i have domains, D i Discrete or continuous?

Lecture 2-2CS250: Intro to AI/Lisp AIMA Code (for homework) Code from AIMA /courses/current/CS250/Code/AIMA/doc/overview.html