Ai Expbm 3
Ai Expbm 3
EXAMPLE AI-PROBLEMS
20MCA188 ARTIFICIAL
INTELLIGENCE (Elective-2) Selma Joseph A.
EXAMPLE PROBLEMS
The vacuum cleaner world
Description
This world has just two locations: squares A and B. The vacuum agent
perceives which
square it is in and whether there is dirt in the square. It can choose to
move left, move right, suck up the dirt, or do nothing. One very simple
agent function is the following: if the Standard formulation
• otherwise,
current square is dirty, then suck; States : The
movestate is determined
to the by
other square.
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 x 22 =
8 possible world states.
• Initial state : Any state can be
designated
• Actions : In this simple environment, eachasstate
the initial state.
has just three
actions: Left, Right,
and Suck.
• 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
The state space for the vacuum world. Links denote actions:
L = Left, R =Right, S = Suck.
8-PUZZLE PROBLEM
Description
The 8-puzzle consists of a 3 x 3 board with eight numbered tiles and a
blank space. A tile
adjacent to the blank space can slide into the space. The
Standard objective is to
formulation
reach a specified
goal state. States: A state description
specifies the location of each of
the eight tiles and the blank in
one of the nine squares. (The total
number of states is 9! = 362880.
Initial state: Any state can be
designated as the initial state.
8-puzzle Actions: Actions may be defined
as movements of the blank space
Left, Right, Up, or Down. Different
subsets of these are possible
8 Puzzle Problem….
7 6 5 7 6 7 6 7 8 6
S S2 S3 S4
1 1 2 3 1 2 3
S5
4 5
S6
4 5 6
GOAL !
Down
Righ 7 8 6 7 8 !
t
MISSIONARIES AND CANNIBALS
PROBLEM
It is an AI famous problem formulation from an analytical viewpoint.
Description
Three missionaries and three cannibals * are on one side of a river, along
with a boat that can hold one or two people. Find a way to get everyone to
the other side without ever leaving a group of missionaries in one
place outnumbered by the cannibals in that place(Figure 1).
* cannibal is a person
who eats the flesh of
other humans.
• States:
Each state is represented by an ordered sequence of 3 numbers (x; y;
z) where
x : number of missionaries on initial river bank
y : number of cannibals on initial river bank Figure 2
+GO
CRYPTARITHMETIC PROBLEM…
Problem formulation
Using the idea of states the problem can be formulated as follows:
States: Let there be n different letters where n≤10. A problem state
is an ordered n-tuple of digits (d1, d2, …… ,dn) representing the
digits to be assigned to the integers.
Initial state: The initial state can be considered as the ordered n-
tuple all of whose elements are 0’s.
Actions: Increase the value assigned to a letter by 1.
Transition model: Given a state and action, this returns the
resulting state.
Goal test: We have reached state (d1, d2, ….., dn) which satisfies
the constraints of the problem.
CRYPTARITHMETIC PROBLEM…
Solution
There are algorithms for solving the cryptarithmetic puzzle.
Implementations of these algorithms by hand computations is
difficult. The method of trial and error keeping in mind
Example problem 1
TO Solution by hand computation
+GO Since leading digits are not 0, we have T ≠ 0, G
------- ≠ 0, O ≠ 0.
OUT Since O is a non-zero carry digit when the two
digits T an G are added, we must have O = 1.
---------
Since O = 1 and O + O = T, we must have T =
2.
Since T = 2 and T + G ≥ 10, T + G must be
either 10 or 11.
If T + G = 10, then G = 8 and U = 0.
T = 2, O = 1, G = 8, U = 0.
This gives a solution to the problem, namely,
21 If T + G = 11, then U = 1 and in that case U =
+81 O = 1 which is not acceptable.
--------- Thus the problem has a unique solution as
102 given above
---------
CRYPTARITHMETIC PROBLEM 2…
Solve the following cryptarithmetic
puzzle:
N=E+1 Charact Code
SEND
N + R = 10 + E er
+MORE
------------------- S 9
MONEY E+1+R +1=10+E
----------------- 1 1 E 5
D+E =Y
9 5 6 7 N 6
2,3,4,5,6,7
D 7
1 0 8 5 M 1
+
O 0
R 8
1 0 6 5 2
Y 2
CRYPTARITHMETIC PROBLEM 2…
Solution
1. We number the columns as
follows: 2. From column 5, we must have
Col : 5 4 3 2 1 M = 1 since it is the only carry
----------------------- possible from the sum of two
SEND single digit numbers.
+ MORE Col:5 4 3 2 1
---------------------- -----------------
MONEY SEND
------------------------ +1ORE
---------------
1ONEY
-----------------
Blocks world (or, the world of blocks) is a model domain used in artificial
intelligence to
explore different approaches to automated reasoning. This model is used to
illustrate that
a given algorithm can perform planning, or that it is efficient in terms of the
number of
calculations required to find a solution or in terms of the length of that
solution.
Description
There is a table on which some uniform blocks (cubes) are placed. Some
blocks may or
BLOCKS WORLD PROBLEM…
States: Configurations of the
blocks satisfying the
conditions. The configurations
can be specified using the
following predicates where X
and Y denote arbitrary blocks:
1. UNSTACK(2, 3)
7. PICKUP(2)
2. PUTDOWN(2) 8. STACK(2, 5)
3. UNSTACK(4, 5)
9. PICKUP(3)
4. PUTDOWN(4) 10. STACK(3, 1)
5. UNSTACK(5, 6)
11. PICKUP(6)
6. STACK(5, 4) 12. STACK(6, 3)
BLOCKS WORLD PROBLEM…
HOMEWORK !!
WATER JUG PROBLEM
Problem statement
We have two jugs of capacity 4 liters and 3 liters, and a
tap with an endless supply of water. The objective is to
obtain 2 liters of water exactly in the 4-liter jug with the
minimum steps possible.
Problem formulation
States: Let x denote the number of liters of water in
the 4-liter jug and y the number of liters of water in the
3-liter jug. Now x = 0, 1, 2, 3, or 4 and y = 0, 1, 2, or 3.
The ordered pair ( x, y ) represents a state.
Initial state: The ordered pair (0 , 0).
Actions: Each action is represented in the form “(x , y)
-> (u , v)” where (x , y) represents the state before the
application of the action and (u , v) represents the state
Transition model: The production system given in
Table also
specifies the transition model.
Goal test: The state (2 , n) where n is some integer.
Path cost: Number of operations performed.
ossible actions and the conditions under which the various actions given in the ta
Solution
One solution
to the water
jug problem
is given