Artificial Intelligence University Politehnica of Bucharest 2007-2008 Adina Magda Florea

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Additional Topics ARTIFICIAL INTELLIGENCE
Review: Search problem formulation
Uninformed search strategies
An Introduction to Artificial Intelligence
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
PROBLEM SOLVING AND SEARCH
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
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.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
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.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Artificial Intelligence Lecture No. 7 Dr. Asad Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Artificial Intelligence for Games Depth limited search Patrick Olivier
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
Review: Search problem formulation
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Informed State Space Search Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Informed (Heuristic) Search
Search Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore, Svetlana Lazebnik,
Artificial Intelligence
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
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;
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
State space representations and search strategies - 2 Spring 2007, Juris Vīksna.
Implementation: General Tree Search
Fahiem Bacchus © 2005 University of Toronto 1 CSC384: Intro to Artificial Intelligence Search II ● Announcements.
3.5 Informed (Heuristic) Searches This section show how an informed search strategy can find solution more efficiently than uninformed strategy. Best-first.
Solving problems by searching A I C h a p t e r 3.
For Monday Read chapter 4 exercise 1 No homework.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
Dept. Computer Science, Korea Univ. Intelligent Information System Lab A I (Artificial Intelligence) Professor I. J. Chung.
Lecture 3 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Last time: Problem-Solving
Uninformed Search Strategies
Artificial Intelligence Problem solving by searching CSC 361
CSE 4705 Artificial Intelligence
Problem Solving and Searching
CSE 4705 Artificial Intelligence
EA C461 – Artificial Intelligence
Artificial Intelligence
Searching for Solutions
Problem Solving and Searching
Principles of Computing – UFCFA3-30-1
HW 1: Warmup Missionaries and Cannibals
ECE457 Applied Artificial Intelligence Fall 2007 Lecture #2
The Rich/Knight Implementation
HW 1: Warmup Missionaries and Cannibals
CS 416 Artificial Intelligence
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
The Rich/Knight Implementation
Presentation transcript:

Artificial Intelligence University Politehnica of Bucharest Adina Magda Florea

Lecture No. 2 Problem solving strategies Representing problem solution Basic search strategies Informed search strategies

1. Representing problem solution Symbolic structure Computational instruments Planning method / approach

1.1. State space representation state, state space, initial state, final state(s), operators (S i, O, S f ) Problem solution

8-puzzle

1.2 AND/OR graph representation Problem decomposition into sub-problems (P i, O, P e ) AND/OR graph Solved node Unsolvable node Problem solution

AND/OR graph OR AND

Towers of Hanoi

1.3 Equivalence of representations State space Problem decomposition

2. Basic search strategies Criteria Completeness Optimality Complexity Possibility to backtrack Informedness Conventions: unknown node, evaluated node, expanded node, OPEN, CLOSED

Computational costs of search

2.1. Uninformed search in state space Algorithm BREADTH:Breadth first search in state space 1.Init lists OPEN  {S i }, CLOSED  {} 2.if OPEN = {} then return FAIL 3.Remove first node S from OPEN and insert it in CLOSED 4.Expand node S 4.1.Generate all direct successors S j of node S 4.2.for each successor S j of S do Make link S j  S if S j is final state then i.Solution is (S j, S,.., S i ) ii.return SUCCESS Insert S j in OPEN, at the end 5.repeat from 2 end.

Features of breadth first search Previous algorithm for tree space not graph For graphs - Insert step 3’ 3’.if S  OPEN  CLOSED then repeat from 2 Depth first search in state space Depth of a node Ad(S i ) = 0, where S i is the initial state, Ad(S) = Ad(S p )+1, where S p is the predecessor node of S.

Algorithm DEPTH(AdMax): Depth first search in state space 1.Init lists OPEN  {S i }, CLOSED  {} 2.if OPEN = {} then return FAIL 3. Remove first node S from OPEN and insert it into CLOSED 3’. if Ad(S) = AdMax then repeat from 2 4.Expand node S 4.1.Generate all successors S j of node S 4.2.for each succesor S j of S do Set link S j  S if S j is final state then i.Solution is (S j,.., S i ) ii.return SUCCESS Insert S j in OPEN, at the beginning 5.repeat from 2 end.

Features of depth first search Iterative deepening for AdMax=1, Val do DEPTH(AdMax) Features of iterative deepening Bidirectional search Which strategy to choose ?

2.2. Uninformed search in AND/OR graphs Depth of a node Ad(S i ) = 0, where, S i is the node of the initial problem Ad(S) = Ad(S p ) + 1 if S p is node OR predecesor of node S, Ad(S) = Ad(S p ) if S p is node AND predecesor of node S.

Algorithm BREADTH-ANDOR:Breadth first search in AND/OR trees 1.Init lists OPEN  {S i }, CLOSED  {} 2.Remove first node S from OPEN and insert it into CLOSED 3.Expand node S 3.1.Generate all direct successors S j of node S 3.2.for each successor S j of S do Make link S j  S if S j is a set of at least 2 sub-problems then/* is an AND node*/ i.Generate all successors sub-problems S k j of S j ii.Set link S k j  S j iii.Insert nodes S k j in OPEN, at the end else Insert S j in OPEN, at the end

4.if no successor of S was generated in previous step (3) then 4.1. if S is terminal node labeled with a non-elementary problem then Label S unsolvable Label with unsolvable all nodes predecessor of S which become unsolvable because of S if node AND is unsolvable then return FAIL/* no solution */ Remove from OPEN all nodes which have unsolvable predecessors 4.2. else/* S is terminal node labeled with a non-solvable problem */ Label S solved Label with solved all nodes predecessor of S which become unsolvable because of S if node AND is solved then i. Build solution tree following the links ii. return SUCCESS/* Solution found */ Remove from OPEN all solved nodes and all nodes which have solved predecessors 5.repeat from 2 end.

2.3. Complexity of search strategies B – branching factor of the search space 8-puzzle Number of moves: 2 m for corners = 8 3 m for laterals = 12 4m for center  24 moves B = no. moves / no. pozitions of free square = 2.67 Number of moves : 1 m for corners = 4 2 m for laterals = 8 3m for center  15 moves  B = 1.67

Complexity of search strategies B - branching factor Root – B nodes, B 2 on level 2, etc. Number of states possible to be generated on a search level d is B d T – total number of states generated during a search, d – depth of solution node T = B + B 2 + … + B d = O(B d )

Number of generated nodes Breadth first search B + B 2 + … + B d + (B d+1 -B) = O(B d+1 ) B – branching factor, d – depth of solution Depth first search B - branching factor, m – maximum depth B*m+1 Iterative deepening search d*B+(d-1)*B 2 + … + (1)*B d = O(B d )

Complexity of search strategies CriterionLevelDepthLimited depth Iterative deepening Bidirectio nal TimeBdBd BmBm BlBl BdBd B d/2 SpaceBdBd B*mB*lBdBd B d/2 Optimality ? YesNo Yes Completen ess YesNo Yes if l  d Yes B – branching factor, d – solution depth, m – maximum depth of the tree, l –limit of search (AdMax)

3. Informed search strategies Use heuristic knowledge to incraese efficiency of search: Select which node to expand nex during search While expanding a node decide which successors to generate and which to ignore Remove from the search space some nodes that have previously been generated – prune the search space

3.1 Best-first search Evaluate the information that can be obtained by expanding a node and ist importance in guiding the search The quality of a node is estimated by the heuristic search function w(n) for node n hill climbing strategy best-first strategy

Algorithm BFS:Best-first in state space 1.Init lists OPEN  {S i }, CLOSED  {} 2.Compute w(S i ) and associate this value to S i 3.if OPEN = {} then return FAIL 4. Remove node S with minimum w(S) from OPEN and insert it in CLOSED 5.if S is final state then i.Solution is (S,.., S i ) ii.return SUCCESS 6.Expand node S 6.1. Generate all successors S j of node S 6.2. for each succesor S j of S do 6.2.1Compute w(S j ) and associate it to S j Set link S j  S

6.2.3.if S j  OPEN  CLOSED then insert S j in OPEN with associated w(S j ) else i. Be S’ j the copy of S j from OPEN or CLOSED ii. if w(S j ) < w(S’ j ) then - Remove link S’ j  S p, with S p pred. of S’ j - Set link S’ j  S, and update cost of S’ j to w(S j ) - if S’ j is in CLOSED - then remove S’ j from CLOSED and insert S’ j in OPEN iii. else ignore node S j 7.repeat from 3 end.

Cases Best-first strategy is a generalization of uninformed search strategies - Breadth first search w(S) = Ad(S) - Depth first search w(S) = -Ad(S) Uniform cost strategy Minimize the search effort – heuristic search w(S) = heuristic function

3.2 Optimal solutions: A*Algorithm w(S) becomes f(S) with 2 components: g(S), estimates the real cost g*(S) of the search path from S i to S, h(S), estimates the real cost h*(S) of the search path from S to S f. f(S) = g(S) + h(S) f*(S) = g*(S) + h*(S)

Components of A*

Computing f(S) Computation of g(S) Computation of h(S) Must be admissible A heuristic function is called admissible if for any state S, h(S)  h*(S). This definition gives the admissibility condition of function h and is used to define the property of admissibility of an algorithm A*.

A* admissibility Consider an algorithm A* which uses g and h compenents of f if (1)h satisfies the admissibility condition (2) for any 2 states S, S', where c > 0 is a constant and the cost is finite then A* algorithm is admissible, i.e., is guaranteed to find the path of minimal cost to solution. Completeness

Implementation of A* Modify the algorithm correspnding to the "best-first" strategy in state space as such: … 2.Compute w(S i )=g(S i ) + h(S i ) and associate this value to S i 3.if OPEN = {} then return FAIL - unmodified 4. Remove node S with w(S) minimum from OPEN and insert it into CLOSED - unmodified … else i. Be S’ j the copy of S j from OPEN or CLOSED ii. if g(S j ) < g(S’ j ) then …

The heuristic of A* Consider 2 algorithms A*, A1 and A2, with evaluation functions h 1 and h 2 admissibile, g 1 =g 2 It is said that A2 is more informed than A1 if for any state S with S  S f We say that h2 dominates h1 monotony

How we compute f 8-puzzle Traveling salesman h2(S) = the cost of the minimum spanning tree of unvisited cities until S

Missionaries and cannibals

Relaxing the admissibility condition of A* An heuristic function h is called  -admissible if with  > 0 An A* algorithm which uses an evaluation function f with a component h  -admissible will find a solution which has a cost greater than the cost of the optimal solution with at most . such an algorithm - an  -admissible algorithm and the solutions is called  -optimal solution.

Relaxing the admisibility condition of A* 8-puzzle

Recursive Best First Best first with linear space Recursive implementation Remembers the value f of the best alternate path which starts from any precedent node of the current node Finds the minimum cost solution if h is admissible but has a space complexity of O(B*d)

S1 S3 S8 S5 S2 S6 S7 S4 S9 S10S inf S1 S3 S8 S5 S2 S6 S7 S4 S12S inf

S1 S3 S8 S5 S2 S6 S7 S4 S9 S10S inf S14S S BestFR(S) Recursive Best First strategy /* returns the solution or FAIL */ BFR(Si, inf)

Algorithm BFR(S, f_lim): Recursive Best First strategy /* Returns a solution or FAIL and a new limit f_limit */ 1. if S final state then return S, f_lim 2. Generate all successors S j of S 3. if there are no successors then return FAIL, inf 4. for each successor Sj do f(S j )  max(g(S j ) + h(S j ), f(S)) 5. Best  S j min, node with minimal value f(S j ) among successors 6. if f(Best) > f_lim then return FAIL, f(Best) 7. Alternat  f(S j min2 ), the 2 nd smallest value f(S j ) 8. Rez, f(Best)  BFR(Best, min(f_lim, Alternat) 9. if Rez  FAIL then return Rez, f(Best) 10. repeat from step 5 end.