Você está na página 1de 48

IM Study Peshawar University

Artificial Intelligence

Lecture# 9,10

Problem Solving

Compiled by Bilal Mustafa


The Two-One Problem
 In order to explain the four components of
problem solving we have an interesting problem
called The Two-One Problem.

Problem statement to the problem is:


The Two-One Problem
The Two-One Problem
 You are given a rectangular container that has 5 slots in
it.
The left most container is the Start state while the right
most is the Goal state.
 Each slot can hold only one coin at a time.
Our goal is to place the Rs. 1 coins into the right slots
and to place Rs. 2 coins into the left slots.
The Rules say that Rs. 1 coins can slide or hop only
toward right and Rs. 2 coins can slide or hop towards the
left.
You can only move one coin at a time.
The Two-One Problem
 Let us try to solve the problem by using a hit
and trail method without addressing the problem
in a systematic manner.
The Two-One Problem
Trials to solve the problem
Trial One
The Two-One Problem
Trials to solve the problem
Trial One
The Two-One Problem
Trials to solve the problem
Trial One
The Two-One Problem
Trials to solve the problem
Trial One
The Two-One Problem
Trials to solve the problem
Trial One
The Two-One Problem
Trials to solve the problem
Trial One
The Two-One Problem
Trials to solve the problem
Trial One

Stuck!!!
The Two-One Problem
Trials to solve the problem
Trial One Trial Two

Stuck!!!
The Two-One Problem
Trials to solve the problem
Trial One Trial Two

Stuck!!!
The Two-One Problem
Trials to solve the problem
Trial One Trial Two

Stuck!!!
The Two-One Problem
Trials to solve the problem
Trial One Trial Two

Stuck!!!
The Two-One Problem
Trials to solve the problem
Trial One Trial Two

Stuck!!!

Stuck!!!
The Two-One Problem
 Hence solving the problem on Hit and Trial
might not give us the solution.
 Let us now try to address the problem in a
systematic manner.
The Two-One Problem
 Consider the diagram below:

Starting from the goal state if we hop, we get stuck. If we


slide we can further carry on. Keeping this observation in
mind let us now try to develop all the possible combinations
that can happen after we slide.
The Two-One Problem
The Two-One Problem
The Two-One Problem
The Two-One Problem
The Two-One Problem
The Two-One Problem
The Two-One Problem
The Two-One Problem
The Two-One Problem
The Two-One Problem
 Therefore, if a problem is represented like this
that is called solution space which gives us the
entire information about a problem.

Information like what is the starting state? What


are the dead ends? and how to reach the goal
state?

That was a type of well structured problem.


Tree and Graph Terminology
Tree and Graph Terminology

 One of the good representation mechanism of


problem is Graph and Trees.
Graphs determines that how nodes are
connected to teach other?
 Every graph can be converted into a tree.
 If a graph is converted into tree representation it
can captured the solution space that easily lead us
to the goal state.
Tree and Graph Terminology
Tree and Graph Terminology
 Graphs can be directed or undirected.
Tree and Graph Terminology
 Graphs can be directed or undirected.
Tree and Graph Terminology
 Graphs can be used to represent city routes.
Tree and Graph Terminology
 Graphs can be used to represent city routes.
Tree and Graph Terminology
Example: You are landed on a new city airport and you
want to reach the hotel.
Tree and Graph Terminology
Example: You are landed on a new city airport and you
want to reach the hotel.
Tree and Graph Terminology
 Graphs can be used to plan actions.
Tree and Graph Terminology
 Graphs can be used to plan actions.
Tree and Graph Terminology
 Every graphs can be converted into a tree.

Consider the following example.


Tree and Graph Terminology
 Every graphs can be converted into a tree.

Consider the following example.


Tree and Graph Terminology
Tree and Graph Terminology

 Now if we can develop understanding of algorithms for


tree searching and traversal then we will be able to solve
problems efficiently.
Searching
 All the problems that we have looked at can be
converted to a form where we have to start from a
start state and search for a goal state by traveling
through a solution space.

 Searching is a formal mechanism to explore


alternatives.
Summary
 So for we have seen three examples of problem space.

 Where we had represented the problems that made it


easier for us to understand the problem immediately.
Summary
Q&A

Você também pode gostar