SlideShare a Scribd company logo
1 of 73
Download to read offline
Solving Problems by
Searching
Well-defined problems and solutions
• A problem can be defined formally by five components:
• Initial state
• The initial state that the agent starts in
• Ex: In(Arad)
• Actions
• A description of the possible actions available to the agent
• Given a particular states, ACTIONS(s) returns the set of actions
that can be executed in s
• Actions(s)  {a1,a2,a3,…,an}
• For example, from the state In(Arad), the applicable actions
are{Go(Sibiu), Go(Timisoara), Go(Zerind)}.
Well-defined problems and solutions
• Transition model
• A description of what each action does
• a function RESULT(s,a) that returns the state that results from doing
action a in state s
Result (s,a)  s’
• We also use the term successor to refer to any state reachable from
a given state by a single action
• Ex: RESULT(In(Arad),Go(Zerind)) =In(Zerind)
• The initial state, actions, and transition model implicitly define the
state space of the problem
• Goal test
• which determines whether a given state is a goal state
• The agent’s goal in Romania is the singleton set{In(Bucharest)}
• GoalTest(s)  T|F
Well-defined problems and solutions
• Path cost
• A path cost function that assigns a numeric cost to each path
pathCost(ss1s2s3)  n (sum of costs)
• For the agent trying to get to Bucharest, time is of the essence, so the
cost of a path might be its length in kilometers
• The step cost of taking action a in state s to reach state s’ is denoted
by c(s,a,s’)
• Stepcost (s,a,s’) n (non negative number)
• We assume that step costs are nonnegative
• Solution quality is measured by the path cost function, and an optimal
solution has the lowest path cost among all solutions
Explored?
Frontier? (End nodes)
Unexplored?
EXAMPLE PROBLEMS
• Toy problems
• The first example we examine is the vacuum world first introduced in Chapter
2
• This can be formulated as a problem as follows:
• States:
• The state is determined by both the agent location and the dirt locations. The agent is in
one of two locations, each of which might or might not contain dirt. Thus, there are
2×22=8 possible world states. A larger environment with n locations has n·2n states.
• Initial state:
• Any state can be designated as the initial state.
• Actions:
• In this simple environment, each state has just three actions: Left, Right, and Suck. Larger
environments might also include Up and Down.
EXAMPLE PROBLEMS
• Transition model:
• The actions have their expected effects, except that moving Left in the
leftmost square, moving Right in the rightmost square, and Sucking in a clean
square have no effect. The complete state space is shown in Figure 3.3.
EXAMPLE PROBLEMS
EXAMPLE PROBLEMS
• Goal test:
• This checks whether all the squares are clean.
• Path cost:
• Each step costs 1, so the path cost is the number of steps in the path.
8-puzzle
8-puzzle
• States: A state description specifies the location of each of the eight tiles
and the blank in one of the nine squares.
• Initial state: Any state can be designated as the initial state.
• Actions: The simplest formulation defines the actions as movements of the
blank space Left, Right, Up, or Down. Different subsets of these are
possible depending on where the blank is.
• Transition model: Given a state and action, this returns the resulting state;
for example, if we apply Left to the start state in Figure, the resulting state
has the 5 and the blank switched.
• Goal test: This checks whether the state matches the goal configuration
shown in Figure
• Path cost: Each step costs 1, so the path cost is the number of steps in the
path.
8-queens problem
8-queens problem
• There are two main kinds of formulation
• An incremental formulation
• A complete-state formulation
• The first incremental formulation
• States: Any arrangement of 0 to 8 queens on the board is a state.
• Initial state: No queens on the board.
• Actions: Add a queen to any empty square.
• Transition model: Returns the board with a queen added to the specified
square.
• Goal test: 8 queens are on the board, none attacked.
Real-world problems
• Route-finding problem
• Consider the airline travel problems that must be solved by a travel-
planning Web site
Airline travel problems
• States: Each state obviously includes a location (e.g., an airport) and the
current time. Furthermore, because the cost of an action (a flight segment)
may depend on previous segments, their fare bases, and their status as
domestic or international, the state must record extra information about
these “historical” aspects.
• Initial state: This is specified by the user’s query.
• Actions: Take any flight from the current location, in any seat class, leaving
after the current time, leaving enough time for within-airport transfer if
needed.
• Transition model: The state resulting from taking a flight will have the
flight’s destination as the current location and the flight’s arrival time as
the current time.
• Goal test: Are we at the final destination specified by the user?
• Path cost: This depends on monetary cost, waiting time, flight time,
customs and immigration procedures, seat quality, time of day, type of
airplane, frequent-flyer mileage awards, and so on.
Real-world problems
• Touring problems
• Consider, for example, the problem “Visit every city in Figure at least once,
starting and ending in Bucharest.”
• Initial state would be In(Bucharest),Visited({Bucharest})
• A typical intermediate state would be In(Vaslui),
Visited({Bucharest,Urziceni,Vaslui})
Real-world problems
• Traveling salesperson problem
• The traveling salesperson problem (TSP) is a touring problem in which each
city must be visited exactly once. The aim is to find the shortest tour.
• A VLSI layout problem
• positioning millions of components and connections on a chip to minimize
area, minimize circuit delays, minimize stray capacitances, and maximize
manufacturing yield
• Robot navigation
• Automatic assembly sequencing
• protein design
SEARCHING FOR SOLUTIONS
• A solution is an action sequence
• First few steps in growing the search tree for finding a route from
Arad to Bucharest
• The root node of the tree corresponds to the initial state, In(Arad)
SEARCHING FOR SOLUTIONS
SEARCHING FOR SOLUTIONS
SEARCHING FOR SOLUTIONS
SEARCHING FOR SOLUTIONS
• A search tree with the initial state at the root; the branches are
actions and the nodes correspond to states in the state space of the
problem
• leaf node, that is, a node with no children in the tree
• The set of all leaf nodes available for expansion at any given point is
called the frontier
SEARCHING FOR SOLUTIONS
Infrastructure for search algorithms
Measuring problem-solving performance
• Completeness: Is the algorithm guaranteed to find a solution when
there is one?
• Optimality: Does the strategy find the optimal solution,
• Time complexity: How long does it take to find a solution?
• Space complexity: How much memory is needed to perform the
search?
UNINFORMED SEARCH STRATEGIES
• Uninformed search (also called blind search)
• The term means that the strategies have no additional information about
states beyond that provided in the problem definition
Breadth-first search
Breadth-first search
Breadth-first search
• complete—if the shallowest goal node is at some finite depth d,
breadth-first search will eventually find it after generating all
shallower nodes (provided the branching factor b is finite).
• Optimal - breadth-first search is optimal if the path cost is a non
decreasing function of the depth of the node. The most common such
scenario is that all actions have the same cost.
Breadth-first search
• Time complexity - Now suppose that the solution is at depth d. In the
worst case, it is the last node generated at that level. Then the total
number of nodes generated is
If the algorithm were to apply the goal test to nodes when selected for expansion, rather than
when generated, the whole layer of nodes at depth d would be expanded before the goal was
detected and the time complexity would be O(bd+1).
Breadth-first search
• space complexity:
• For any kind of graph search, which stores every expanded node in the
explored set, the space complexity is always within a factor of b of the time
complexity.
• There will be O(bd−1)nodes in the explored set and O(bd)nodes in the frontier
• so the space complexity is O(bd)
Breadth-first search
Breadth-first search
• The memory requirements are a bigger problem for breadth-first
search than is the execution time
• If your problem has a solution at depth 16, then (given our
assumptions) it will take about 350 years for breadth-first search (or
indeed any uninformed search) to find it
• Exponential-complexity search problems cannot be solved by
uninformed methods for any but the smallest instances
Uniform-cost search
Uniform-cost search
• Instead of expanding the shallowest node, uniform-cost search
expands the node n with the lowest path cost g(n)
Uniform-cost search
• problem is to get from Sibiu to Bucharest
Sibiu
Rimnicu
Vilcea
80
Fagaras
99
Uniform-cost search
Sibiu
Rimnicu
Vilcea
80
Pitesti
80+97=177
Fagaras
99
Uniform-cost search
Sibiu
Rimnicu
Vilcea
80
Pitesti
80+97=177
Fagaras
99
Bucharest
99+211=310
Uniform-cost search
Sibiu
Rimnicu
Vilcea
80
Pitesti
80+97=177
Bucharest
80+97+101=278
Fagaras
99
Bucharest
99+211=310
Uniform-cost search
Sibiu
Rimnicu
Vilcea
80
Pitesti
80+97=177
Bucharest
80+97+101=278
Fagaras
99
Bucharest
99+211=310
Depth-first search
• Depth-first search always expands the deepest node in the current
frontier of the search tree.
• whereas breadth-first-search uses a FIFO queue, depth-first search
uses a LIFO queue
Depth First Search (DFS)
• Example 4.3
• Explore the following state space using DFS to find the traversal for reaching
the goal node G.
Depth First Search (DFS)
Depth First Search (DFS)
• Tree version of DFS is not complete.
• nonoptimal.
• Better space complexity than BFS
• b number of children nodes for each node
• if a goal node is at level d
• we expand only bd amount of nodes
• Thus space complexity of DFS is of order bd ,i.e. O(bd).
• Time Complexity
• Time complexity of DFS= O(b^d)
Depth First Search (DFS)
Depth-limited search
• Depth limited search is a version of depth-first search. In this case,
depth search is applied for pre-decided depth such as 4. If the goal
node is within the first four levels, we will be able to find a solution as
in DFS. This algorithm has similar features to DFS.
Depth-limited search
Iterative deepening depth-first search
• Iterative deepening search(or iterative deepening depth-first search)
is a general strategy, often used in combination with depth-first tree
search, that finds the best depth limit. It does this by gradually
increasing the limit—first 0, then 1, then 2, and so on—until a goal is
found.
Iterative deepening depth-first search
Bidirectional search
• The idea behind bidirectional search is to run two simultaneous
searches—one forward from the initial state and the other backward
from the goal—hoping that the two searches meet in the middle
Comparing uninformed search strategies
INFORMED(HEURISTIC)SEARCHSTRATEGIES
• This section shows how an informed search strategy—one that uses
problem-specific knowledge beyond the definition of the problem itself—
can find solutions more efficiently than can an uninformed strategy.
• The general approach we consider is called best-first search. Best-first
search is an instance of the general TREE-SEARCH or GRAPH-SEARCH
algorithm in which a node is selected for expansion based on an evaluation
function, f(n)
• Most best-first algorithms include as a component of f a heuristic function,
denoted h(n)
• h(n)=estimated cost of the cheapest path from the state at node n to a goal
state.
Greedy best-first search
• Greedy best-first search tries to expand the node that is closest to the
goal, on the grounds that this is likely to lead to a solution quickly
• f(n)=h(n)
• we use the straight line distance heuristic, which we will call hSLD
Greedy best-first search
Greedy best-first search
• A greedy best-first search using hSLD to find a path from Arad to
Bucharest
Greedy best-first search
Greedy best-first search
Greedy best-first search
• This is not optimal
• The path via Sibiu and Fagaras to Bucharest is 32 kilometers longer than the
path through Rimnicu Vilcea and Pitesti
• Greedy best-first tree search is also incomplete
• Consider the problem of getting from Iasi to Fagaras. The heuristic suggests
that Neamt be expanded first because it is closest to Fagaras, but it is a dead
end
• The solution is to go first to Vaslui—a step that is actually farther from the
goal according to the heuristic—and then to continue to Urziceni, Bucharest,
and Fagaras
• The worst-case time and space complexity for the tree version is
O(bm), where m is the maximum depth of the search space
A* search
• The most widely known form of best-first search is called A∗ search
• It evaluates nodes by combining g(n), the cost to reach the node, and
h(n), the cost to get from the node to the goal:
• f(n)=g(n)+h(n)
• g(n) gives the path cost from the start node to node n
• h(n) is the estimated cost of the cheapest path from n to the goal
• f(n)=estimated cost of the cheapest solution through n
• A ∗ search is both complete and optimal
A* search
A* search
A* search
A* search
A* search
A* search
Problem-solving works when:
• Fully observable
• Known
• Discrete
• Deterministic
• Static
Summary
• Well-defined problems and solutions
• Searching for solutions

More Related Content

What's hot

Search problems in Artificial Intelligence
Search problems in Artificial IntelligenceSearch problems in Artificial Intelligence
Search problems in Artificial Intelligenceananth
 
AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemMohammad Imam Hossain
 
Heuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligenceHeuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligencegrinu
 
Machine Learning with Decision trees
Machine Learning with Decision treesMachine Learning with Decision trees
Machine Learning with Decision treesKnoldus Inc.
 
Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}FellowBuddy.com
 
Adversarial Search
Adversarial SearchAdversarial Search
Adversarial SearchMegha Sharma
 
Expert System Lecture Notes Chapter 1,2,3,4,5 - Dr.J.VijiPriya
 Expert System Lecture Notes Chapter 1,2,3,4,5 - Dr.J.VijiPriya Expert System Lecture Notes Chapter 1,2,3,4,5 - Dr.J.VijiPriya
Expert System Lecture Notes Chapter 1,2,3,4,5 - Dr.J.VijiPriyaVijiPriya Jeyamani
 
State space search and Problem Solving techniques
State space search and Problem Solving techniquesState space search and Problem Solving techniques
State space search and Problem Solving techniquesKirti Verma
 
I. Mini-Max Algorithm in AI
I. Mini-Max Algorithm in AII. Mini-Max Algorithm in AI
I. Mini-Max Algorithm in AIvikas dhakane
 
Constraint satisfaction problems (csp)
Constraint satisfaction problems (csp)   Constraint satisfaction problems (csp)
Constraint satisfaction problems (csp) Archana432045
 
Problem solving agents
Problem solving agentsProblem solving agents
Problem solving agentsMegha Sharma
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search StrategiesAmey Kerkar
 
Adversarial search
Adversarial searchAdversarial search
Adversarial searchNilu Desai
 
Adversarial search
Adversarial searchAdversarial search
Adversarial searchDheerendra k
 
Game Playing in Artificial Intelligence
Game Playing in Artificial IntelligenceGame Playing in Artificial Intelligence
Game Playing in Artificial Intelligencelordmwesh
 

What's hot (20)

Search problems in Artificial Intelligence
Search problems in Artificial IntelligenceSearch problems in Artificial Intelligence
Search problems in Artificial Intelligence
 
AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction Problem
 
Heuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligenceHeuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligence
 
Machine Learning with Decision trees
Machine Learning with Decision treesMachine Learning with Decision trees
Machine Learning with Decision trees
 
AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)
 
Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}
 
Adversarial Search
Adversarial SearchAdversarial Search
Adversarial Search
 
Expert System Lecture Notes Chapter 1,2,3,4,5 - Dr.J.VijiPriya
 Expert System Lecture Notes Chapter 1,2,3,4,5 - Dr.J.VijiPriya Expert System Lecture Notes Chapter 1,2,3,4,5 - Dr.J.VijiPriya
Expert System Lecture Notes Chapter 1,2,3,4,5 - Dr.J.VijiPriya
 
State space search and Problem Solving techniques
State space search and Problem Solving techniquesState space search and Problem Solving techniques
State space search and Problem Solving techniques
 
Problems, Problem spaces and Search
Problems, Problem spaces and SearchProblems, Problem spaces and Search
Problems, Problem spaces and Search
 
I. Mini-Max Algorithm in AI
I. Mini-Max Algorithm in AII. Mini-Max Algorithm in AI
I. Mini-Max Algorithm in AI
 
Constraint satisfaction problems (csp)
Constraint satisfaction problems (csp)   Constraint satisfaction problems (csp)
Constraint satisfaction problems (csp)
 
Problem solving agents
Problem solving agentsProblem solving agents
Problem solving agents
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search Strategies
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Game Playing in Artificial Intelligence
Game Playing in Artificial IntelligenceGame Playing in Artificial Intelligence
Game Playing in Artificial Intelligence
 

Similar to Lecture 3 problem solving

PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptxPPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptxRaviKiranVarma4
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithmsMinakshi Atre
 
Artificial intelligence(04)
Artificial intelligence(04)Artificial intelligence(04)
Artificial intelligence(04)Nazir Ahmed
 
Problem solving in Artificial Intelligence.pptx
Problem solving in Artificial Intelligence.pptxProblem solving in Artificial Intelligence.pptx
Problem solving in Artificial Intelligence.pptxkitsenthilkumarcse
 
chapter 2 Problem Solving.pdf
chapter 2 Problem Solving.pdfchapter 2 Problem Solving.pdf
chapter 2 Problem Solving.pdfMeghaGupta952452
 
Search-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdfSearch-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdfMrRRThirrunavukkaras
 
UNIT - I PROBLEM SOLVING AGENTS and EXAMPLES.pptx.pdf
UNIT - I PROBLEM SOLVING AGENTS and EXAMPLES.pptx.pdfUNIT - I PROBLEM SOLVING AGENTS and EXAMPLES.pptx.pdf
UNIT - I PROBLEM SOLVING AGENTS and EXAMPLES.pptx.pdfJenishaR1
 
AI_Session 3 Problem Solving Agent and searching for solutions.pptx
AI_Session 3 Problem Solving Agent and searching for solutions.pptxAI_Session 3 Problem Solving Agent and searching for solutions.pptx
AI_Session 3 Problem Solving Agent and searching for solutions.pptxAsst.prof M.Gokilavani
 
Heuristic search
Heuristic searchHeuristic search
Heuristic searchNivethaS35
 
Informed Search Techniques new kirti L 8.pptx
Informed Search Techniques new kirti L 8.pptxInformed Search Techniques new kirti L 8.pptx
Informed Search Techniques new kirti L 8.pptxKirti Verma
 
Heuristic search
Heuristic searchHeuristic search
Heuristic searchNivethaS35
 

Similar to Lecture 3 problem solving (20)

Lecture 3 Problem Solving.pptx
Lecture 3 Problem Solving.pptxLecture 3 Problem Solving.pptx
Lecture 3 Problem Solving.pptx
 
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptxPPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithms
 
Artificial intelligence(04)
Artificial intelligence(04)Artificial intelligence(04)
Artificial intelligence(04)
 
l2.pptx
l2.pptxl2.pptx
l2.pptx
 
l2.pptx
l2.pptxl2.pptx
l2.pptx
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
 
Problem solving in Artificial Intelligence.pptx
Problem solving in Artificial Intelligence.pptxProblem solving in Artificial Intelligence.pptx
Problem solving in Artificial Intelligence.pptx
 
chapter 2 Problem Solving.pdf
chapter 2 Problem Solving.pdfchapter 2 Problem Solving.pdf
chapter 2 Problem Solving.pdf
 
3 probsolver edited.ppt
3 probsolver edited.ppt3 probsolver edited.ppt
3 probsolver edited.ppt
 
Rai practical presentations.
Rai practical presentations.Rai practical presentations.
Rai practical presentations.
 
Search-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdfSearch-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdf
 
UNIT - I PROBLEM SOLVING AGENTS and EXAMPLES.pptx.pdf
UNIT - I PROBLEM SOLVING AGENTS and EXAMPLES.pptx.pdfUNIT - I PROBLEM SOLVING AGENTS and EXAMPLES.pptx.pdf
UNIT - I PROBLEM SOLVING AGENTS and EXAMPLES.pptx.pdf
 
AI_Session 3 Problem Solving Agent and searching for solutions.pptx
AI_Session 3 Problem Solving Agent and searching for solutions.pptxAI_Session 3 Problem Solving Agent and searching for solutions.pptx
AI_Session 3 Problem Solving Agent and searching for solutions.pptx
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
Informed Search Techniques new kirti L 8.pptx
Informed Search Techniques new kirti L 8.pptxInformed Search Techniques new kirti L 8.pptx
Informed Search Techniques new kirti L 8.pptx
 
Lec2 state space
Lec2 state spaceLec2 state space
Lec2 state space
 
chapter3part1.ppt
chapter3part1.pptchapter3part1.ppt
chapter3part1.ppt
 
state-spaces29Sep06.ppt
state-spaces29Sep06.pptstate-spaces29Sep06.ppt
state-spaces29Sep06.ppt
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 

More from Vajira Thambawita

Lecture 4 principles of parallel algorithm design updated
Lecture 4   principles of parallel algorithm design updatedLecture 4   principles of parallel algorithm design updated
Lecture 4 principles of parallel algorithm design updatedVajira Thambawita
 
Lecture 3 parallel programming platforms
Lecture 3   parallel programming platformsLecture 3   parallel programming platforms
Lecture 3 parallel programming platformsVajira Thambawita
 
Lecture 2 more about parallel computing
Lecture 2   more about parallel computingLecture 2   more about parallel computing
Lecture 2 more about parallel computingVajira Thambawita
 
Lecture 1 introduction to parallel and distributed computing
Lecture 1   introduction to parallel and distributed computingLecture 1   introduction to parallel and distributed computing
Lecture 1 introduction to parallel and distributed computingVajira Thambawita
 
Lecture 12 localization and navigation
Lecture 12 localization and navigationLecture 12 localization and navigation
Lecture 12 localization and navigationVajira Thambawita
 
Lecture 11 neural network principles
Lecture 11 neural network principlesLecture 11 neural network principles
Lecture 11 neural network principlesVajira Thambawita
 
Lecture 10 mobile robot design
Lecture 10 mobile robot designLecture 10 mobile robot design
Lecture 10 mobile robot designVajira Thambawita
 
Lecture 08 robots and controllers
Lecture 08 robots and controllersLecture 08 robots and controllers
Lecture 08 robots and controllersVajira Thambawita
 
Lecture 06 pic programming in c
Lecture 06 pic programming in cLecture 06 pic programming in c
Lecture 06 pic programming in cVajira Thambawita
 
Lecture 05 pic io port programming
Lecture 05 pic io port programmingLecture 05 pic io port programming
Lecture 05 pic io port programmingVajira Thambawita
 
Lecture 04 branch call and time delay
Lecture 04  branch call and time delayLecture 04  branch call and time delay
Lecture 04 branch call and time delayVajira Thambawita
 
Lecture 02 mechatronics systems
Lecture 02 mechatronics systemsLecture 02 mechatronics systems
Lecture 02 mechatronics systemsVajira Thambawita
 
Lecture 1 - Introduction to embedded system and Robotics
Lecture 1 - Introduction to embedded system and RoboticsLecture 1 - Introduction to embedded system and Robotics
Lecture 1 - Introduction to embedded system and RoboticsVajira Thambawita
 
Lec 09 - Registers and Counters
Lec 09 - Registers and CountersLec 09 - Registers and Counters
Lec 09 - Registers and CountersVajira Thambawita
 
Lec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS
Lec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITSLec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS
Lec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITSVajira Thambawita
 
Lec 06 - Synchronous Sequential Logic
Lec 06 - Synchronous Sequential LogicLec 06 - Synchronous Sequential Logic
Lec 06 - Synchronous Sequential LogicVajira Thambawita
 

More from Vajira Thambawita (20)

Lecture 4 principles of parallel algorithm design updated
Lecture 4   principles of parallel algorithm design updatedLecture 4   principles of parallel algorithm design updated
Lecture 4 principles of parallel algorithm design updated
 
Lecture 3 parallel programming platforms
Lecture 3   parallel programming platformsLecture 3   parallel programming platforms
Lecture 3 parallel programming platforms
 
Lecture 2 more about parallel computing
Lecture 2   more about parallel computingLecture 2   more about parallel computing
Lecture 2 more about parallel computing
 
Lecture 1 introduction to parallel and distributed computing
Lecture 1   introduction to parallel and distributed computingLecture 1   introduction to parallel and distributed computing
Lecture 1 introduction to parallel and distributed computing
 
Lecture 12 localization and navigation
Lecture 12 localization and navigationLecture 12 localization and navigation
Lecture 12 localization and navigation
 
Lecture 11 neural network principles
Lecture 11 neural network principlesLecture 11 neural network principles
Lecture 11 neural network principles
 
Lecture 10 mobile robot design
Lecture 10 mobile robot designLecture 10 mobile robot design
Lecture 10 mobile robot design
 
Lecture 09 control
Lecture 09 controlLecture 09 control
Lecture 09 control
 
Lecture 08 robots and controllers
Lecture 08 robots and controllersLecture 08 robots and controllers
Lecture 08 robots and controllers
 
Lecture 07 more about pic
Lecture 07 more about picLecture 07 more about pic
Lecture 07 more about pic
 
Lecture 06 pic programming in c
Lecture 06 pic programming in cLecture 06 pic programming in c
Lecture 06 pic programming in c
 
Lecture 05 pic io port programming
Lecture 05 pic io port programmingLecture 05 pic io port programming
Lecture 05 pic io port programming
 
Lecture 04 branch call and time delay
Lecture 04  branch call and time delayLecture 04  branch call and time delay
Lecture 04 branch call and time delay
 
Lecture 03 basics of pic
Lecture 03 basics of picLecture 03 basics of pic
Lecture 03 basics of pic
 
Lecture 02 mechatronics systems
Lecture 02 mechatronics systemsLecture 02 mechatronics systems
Lecture 02 mechatronics systems
 
Lecture 1 - Introduction to embedded system and Robotics
Lecture 1 - Introduction to embedded system and RoboticsLecture 1 - Introduction to embedded system and Robotics
Lecture 1 - Introduction to embedded system and Robotics
 
Lec 09 - Registers and Counters
Lec 09 - Registers and CountersLec 09 - Registers and Counters
Lec 09 - Registers and Counters
 
Lec 08 - DESIGN PROCEDURE
Lec 08 - DESIGN PROCEDURELec 08 - DESIGN PROCEDURE
Lec 08 - DESIGN PROCEDURE
 
Lec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS
Lec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITSLec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS
Lec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS
 
Lec 06 - Synchronous Sequential Logic
Lec 06 - Synchronous Sequential LogicLec 06 - Synchronous Sequential Logic
Lec 06 - Synchronous Sequential Logic
 

Recently uploaded

भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

Lecture 3 problem solving

  • 2.
  • 3. Well-defined problems and solutions • A problem can be defined formally by five components: • Initial state • The initial state that the agent starts in • Ex: In(Arad) • Actions • A description of the possible actions available to the agent • Given a particular states, ACTIONS(s) returns the set of actions that can be executed in s • Actions(s)  {a1,a2,a3,…,an} • For example, from the state In(Arad), the applicable actions are{Go(Sibiu), Go(Timisoara), Go(Zerind)}.
  • 4. Well-defined problems and solutions • Transition model • A description of what each action does • a function RESULT(s,a) that returns the state that results from doing action a in state s Result (s,a)  s’ • We also use the term successor to refer to any state reachable from a given state by a single action • Ex: RESULT(In(Arad),Go(Zerind)) =In(Zerind) • The initial state, actions, and transition model implicitly define the state space of the problem • Goal test • which determines whether a given state is a goal state • The agent’s goal in Romania is the singleton set{In(Bucharest)} • GoalTest(s)  T|F
  • 5. Well-defined problems and solutions • Path cost • A path cost function that assigns a numeric cost to each path pathCost(ss1s2s3)  n (sum of costs) • For the agent trying to get to Bucharest, time is of the essence, so the cost of a path might be its length in kilometers • The step cost of taking action a in state s to reach state s’ is denoted by c(s,a,s’) • Stepcost (s,a,s’) n (non negative number) • We assume that step costs are nonnegative • Solution quality is measured by the path cost function, and an optimal solution has the lowest path cost among all solutions
  • 7. EXAMPLE PROBLEMS • Toy problems • The first example we examine is the vacuum world first introduced in Chapter 2 • This can be formulated as a problem as follows: • States: • The state is determined by both the agent location and the dirt locations. The agent is in one of two locations, each of which might or might not contain dirt. Thus, there are 2×22=8 possible world states. A larger environment with n locations has n·2n states. • Initial state: • Any state can be designated as the initial state. • Actions: • In this simple environment, each state has just three actions: Left, Right, and Suck. Larger environments might also include Up and Down.
  • 8. EXAMPLE PROBLEMS • Transition model: • The actions have their expected effects, except that moving Left in the leftmost square, moving Right in the rightmost square, and Sucking in a clean square have no effect. The complete state space is shown in Figure 3.3.
  • 10. EXAMPLE PROBLEMS • Goal test: • This checks whether all the squares are clean. • Path cost: • Each step costs 1, so the path cost is the number of steps in the path.
  • 12. 8-puzzle • States: A state description specifies the location of each of the eight tiles and the blank in one of the nine squares. • Initial state: Any state can be designated as the initial state. • Actions: The simplest formulation defines the actions as movements of the blank space Left, Right, Up, or Down. Different subsets of these are possible depending on where the blank is. • Transition model: Given a state and action, this returns the resulting state; for example, if we apply Left to the start state in Figure, the resulting state has the 5 and the blank switched. • Goal test: This checks whether the state matches the goal configuration shown in Figure • Path cost: Each step costs 1, so the path cost is the number of steps in the path.
  • 14. 8-queens problem • There are two main kinds of formulation • An incremental formulation • A complete-state formulation • The first incremental formulation • States: Any arrangement of 0 to 8 queens on the board is a state. • Initial state: No queens on the board. • Actions: Add a queen to any empty square. • Transition model: Returns the board with a queen added to the specified square. • Goal test: 8 queens are on the board, none attacked.
  • 15. Real-world problems • Route-finding problem • Consider the airline travel problems that must be solved by a travel- planning Web site
  • 16. Airline travel problems • States: Each state obviously includes a location (e.g., an airport) and the current time. Furthermore, because the cost of an action (a flight segment) may depend on previous segments, their fare bases, and their status as domestic or international, the state must record extra information about these “historical” aspects. • Initial state: This is specified by the user’s query. • Actions: Take any flight from the current location, in any seat class, leaving after the current time, leaving enough time for within-airport transfer if needed. • Transition model: The state resulting from taking a flight will have the flight’s destination as the current location and the flight’s arrival time as the current time. • Goal test: Are we at the final destination specified by the user? • Path cost: This depends on monetary cost, waiting time, flight time, customs and immigration procedures, seat quality, time of day, type of airplane, frequent-flyer mileage awards, and so on.
  • 17. Real-world problems • Touring problems • Consider, for example, the problem “Visit every city in Figure at least once, starting and ending in Bucharest.” • Initial state would be In(Bucharest),Visited({Bucharest}) • A typical intermediate state would be In(Vaslui), Visited({Bucharest,Urziceni,Vaslui})
  • 18.
  • 19. Real-world problems • Traveling salesperson problem • The traveling salesperson problem (TSP) is a touring problem in which each city must be visited exactly once. The aim is to find the shortest tour. • A VLSI layout problem • positioning millions of components and connections on a chip to minimize area, minimize circuit delays, minimize stray capacitances, and maximize manufacturing yield • Robot navigation • Automatic assembly sequencing • protein design
  • 20. SEARCHING FOR SOLUTIONS • A solution is an action sequence • First few steps in growing the search tree for finding a route from Arad to Bucharest • The root node of the tree corresponds to the initial state, In(Arad)
  • 21.
  • 25. SEARCHING FOR SOLUTIONS • A search tree with the initial state at the root; the branches are actions and the nodes correspond to states in the state space of the problem • leaf node, that is, a node with no children in the tree • The set of all leaf nodes available for expansion at any given point is called the frontier
  • 28. Measuring problem-solving performance • Completeness: Is the algorithm guaranteed to find a solution when there is one? • Optimality: Does the strategy find the optimal solution, • Time complexity: How long does it take to find a solution? • Space complexity: How much memory is needed to perform the search?
  • 29. UNINFORMED SEARCH STRATEGIES • Uninformed search (also called blind search) • The term means that the strategies have no additional information about states beyond that provided in the problem definition
  • 32. Breadth-first search • complete—if the shallowest goal node is at some finite depth d, breadth-first search will eventually find it after generating all shallower nodes (provided the branching factor b is finite). • Optimal - breadth-first search is optimal if the path cost is a non decreasing function of the depth of the node. The most common such scenario is that all actions have the same cost.
  • 33. Breadth-first search • Time complexity - Now suppose that the solution is at depth d. In the worst case, it is the last node generated at that level. Then the total number of nodes generated is If the algorithm were to apply the goal test to nodes when selected for expansion, rather than when generated, the whole layer of nodes at depth d would be expanded before the goal was detected and the time complexity would be O(bd+1).
  • 34. Breadth-first search • space complexity: • For any kind of graph search, which stores every expanded node in the explored set, the space complexity is always within a factor of b of the time complexity. • There will be O(bd−1)nodes in the explored set and O(bd)nodes in the frontier • so the space complexity is O(bd)
  • 36. Breadth-first search • The memory requirements are a bigger problem for breadth-first search than is the execution time • If your problem has a solution at depth 16, then (given our assumptions) it will take about 350 years for breadth-first search (or indeed any uninformed search) to find it • Exponential-complexity search problems cannot be solved by uninformed methods for any but the smallest instances
  • 38. Uniform-cost search • Instead of expanding the shallowest node, uniform-cost search expands the node n with the lowest path cost g(n)
  • 39. Uniform-cost search • problem is to get from Sibiu to Bucharest Sibiu Rimnicu Vilcea 80 Fagaras 99
  • 44. Depth-first search • Depth-first search always expands the deepest node in the current frontier of the search tree. • whereas breadth-first-search uses a FIFO queue, depth-first search uses a LIFO queue
  • 45.
  • 46. Depth First Search (DFS) • Example 4.3 • Explore the following state space using DFS to find the traversal for reaching the goal node G.
  • 48. Depth First Search (DFS) • Tree version of DFS is not complete. • nonoptimal. • Better space complexity than BFS • b number of children nodes for each node • if a goal node is at level d • we expand only bd amount of nodes • Thus space complexity of DFS is of order bd ,i.e. O(bd). • Time Complexity • Time complexity of DFS= O(b^d)
  • 50. Depth-limited search • Depth limited search is a version of depth-first search. In this case, depth search is applied for pre-decided depth such as 4. If the goal node is within the first four levels, we will be able to find a solution as in DFS. This algorithm has similar features to DFS.
  • 52. Iterative deepening depth-first search • Iterative deepening search(or iterative deepening depth-first search) is a general strategy, often used in combination with depth-first tree search, that finds the best depth limit. It does this by gradually increasing the limit—first 0, then 1, then 2, and so on—until a goal is found.
  • 54.
  • 55. Bidirectional search • The idea behind bidirectional search is to run two simultaneous searches—one forward from the initial state and the other backward from the goal—hoping that the two searches meet in the middle
  • 57. INFORMED(HEURISTIC)SEARCHSTRATEGIES • This section shows how an informed search strategy—one that uses problem-specific knowledge beyond the definition of the problem itself— can find solutions more efficiently than can an uninformed strategy. • The general approach we consider is called best-first search. Best-first search is an instance of the general TREE-SEARCH or GRAPH-SEARCH algorithm in which a node is selected for expansion based on an evaluation function, f(n) • Most best-first algorithms include as a component of f a heuristic function, denoted h(n) • h(n)=estimated cost of the cheapest path from the state at node n to a goal state.
  • 58. Greedy best-first search • Greedy best-first search tries to expand the node that is closest to the goal, on the grounds that this is likely to lead to a solution quickly • f(n)=h(n) • we use the straight line distance heuristic, which we will call hSLD
  • 60. Greedy best-first search • A greedy best-first search using hSLD to find a path from Arad to Bucharest
  • 63. Greedy best-first search • This is not optimal • The path via Sibiu and Fagaras to Bucharest is 32 kilometers longer than the path through Rimnicu Vilcea and Pitesti • Greedy best-first tree search is also incomplete • Consider the problem of getting from Iasi to Fagaras. The heuristic suggests that Neamt be expanded first because it is closest to Fagaras, but it is a dead end • The solution is to go first to Vaslui—a step that is actually farther from the goal according to the heuristic—and then to continue to Urziceni, Bucharest, and Fagaras • The worst-case time and space complexity for the tree version is O(bm), where m is the maximum depth of the search space
  • 64. A* search • The most widely known form of best-first search is called A∗ search • It evaluates nodes by combining g(n), the cost to reach the node, and h(n), the cost to get from the node to the goal: • f(n)=g(n)+h(n) • g(n) gives the path cost from the start node to node n • h(n) is the estimated cost of the cheapest path from n to the goal • f(n)=estimated cost of the cheapest solution through n • A ∗ search is both complete and optimal
  • 66.
  • 72. Problem-solving works when: • Fully observable • Known • Discrete • Deterministic • Static
  • 73. Summary • Well-defined problems and solutions • Searching for solutions