8/13/2019 Some Problems of ai
1/17
Some problems
Cse-402
K3r20,k3r23
8/13/2019 Some Problems of ai
2/17
Tic Tac Toe 1
Board
Move table
A vector of 19,683 elements
8/13/2019 Some Problems of ai
3/17
Tic Tac Toe 2
Board
turn
8/13/2019 Some Problems of ai
4/17
Question Answering Example
Mary went shopping for a new coat. She found a red
one she really lied. !hen she got it home" she
disco#ered that it went perfectly with her fa#orite dress.
Q1 $ !hat did Mary go shopping for%
Q1 $ !hat did Mary find that she lied%
Q1 $ &id Mary 'uy anything%
8/13/2019 Some Problems of ai
5/17
A Structure (epresentation of a Sentence
8/13/2019 Some Problems of ai
6/17
8/13/2019 Some Problems of ai
7/17
Missionaries and Cannibals
There are 3 missionaries, 3 cannibals, and
1 boat that can carry up to two people
on one side of a river. Goal: Move all the missionaries and
cannibals across the river.
Constraint:Missionaries can never be
outnumbered by cannibals on either side of
river, or else the missionaries are killed. State:configuration of missionaries and
cannibals and boat on each side of river.
Operators:Move boat containing some set
of occupants across the river (in either
direction) to the other side.
8/13/2019 Some Problems of ai
8/17
Missionaries and Cannibals
Solution
Near sideFar side
0 nitial setup: !!!CCC " #
1 Two cannibals cross over: !!!C " CC
$ One comes bac%: !!!CC " C3 Two cannibals &o over a&ain: !!! " CCC
' One comes bac%: !!!C " CC
( Two missionaries cross: !C " !!CC
) * missionary + cannibal return: !!CC " !C
Two missionaries cross a&ain: CC " !!!C
- * cannibal returns: CCC " !!!
Two cannibals cross: C " !!!CC
1/ One returns: CC " !!!C
11 *nd brin&s over the third: # " !!!CCC
8/13/2019 Some Problems of ai
9/17
State space (epresentation of )armer" wolf" goat and ca''age pro'lem$
A farmer with wolf, goat & cabbage come to the edge of river. The want to cross
the river. There is a boat at river edge b!t onl the farmer can row, the boat can
carr two things at a time. "f the wolf is ever left alone with the goat, the wolf
will eat the goat, similarl if the goat is left alone with cabbage, the goat will eat
cabbage. #ched!le the things so that all fo!r characters arrive safel on the other
side of the river.
Man $M
%olf $%
oat $
'abbage $'#e(. of crossing the river so that all fo!r character arrive safel is
1. )irst Man cross the river with goat.
*. Man come bac+.
3. Man either ta+es cabbage or wolf with him to another side.
. Man comes bac+ with goat to first side.-. Man ta+en wolf or cabbage/ with him to another side.
6. Man comes bac+.
0. Man ta+es goat with him to another bac+.
8/13/2019 Some Problems of ai
10/17
8/13/2019 Some Problems of ai
11/17
Cryptarithmetic
Find an assignment of digits (0, ..., ) to letters so that a givenarithmetic e!pression is true. e!amples: "#$% & M'# M'$#* and
0OT2 Solution: $-)
T45 -(/
T45 -(/##### #####
S6T2 31'-)
07$, O7, 7, etc.
$ote: +n this problem, the solution is $' a se-uence of actions
that transforms the initial state into the goal state, but rather thesolution is simply finding a goal node that includes anassignment of digits to each of the distinct letters in the given
problem.
8/13/2019 Some Problems of ai
12/17
CRYPTARITHMETIn this method we want result by satisfying all the constraints and get
value of each variable
*+2
*+1
, - E
, - E
, - E
, - E
T E -
S,/0T,-$ E2" -3" *+24"*+15" ,1" T6
8/13/2019 Some Problems of ai
13/17
!ifferent choices of E and corres"onding different choices of # will leads to a
states of "roblems and "roblem will become the state s"ace "roblem
when E1 2 444 2
4442 444 2 16
'5*21 & 26"nvalid 7es!lt/
when E2 - E7E7E7E 3
7-7-7-3737373 42
*+24 A-& E 28 #alid choice9
when E4 2 44423434343212
2* A '5121
'514444214*4*4*4*29
'5*2 & 29 "nvalid res!lt/
8/13/2019 Some Problems of ai
14/17
when !4 "! ### ! 4#4#4#4!$%
"!% & C'$!$
"#"#"#"#C'$ ! %#%#%#%#$ !2(
C'2!2 & !()*n+alid choice
when 2- 2 444 2 -4-4-4- 2 *
2 & '512*
4444'51 2 4444* 2 *
'5*2 & 2*"nvalid 'hoice/
when 26 2 444 2 6464646 2 *
2 & '512*
4444'51 2 4444*218
'5*21 & 28"nvalid choice/
8/13/2019 Some Problems of ai
15/17
when ! "! ### ! ### ! 2
C'$!2 & "!
"#"#"#"#C'$ ! ####2!34
C'2!3 & !4)*n+alid Choice
when ! "! ### ! ### ! 32
C'$!3 & "!2
"#"#"#"#C'$ ! 2#2#2#2#3!$$
C'2!$ & !$)*n+alid Choice
when !/ "! ### ! /#/#/#/ ! 3%
C'$!3 & "!%
"#"#"#"#C'$! %#%#%#%#3! 2 C'2!2 & !)*n+alid choice
"ow his is Con1irm that the +alid choice o1 is 2 and choice o1 " is
8/13/2019 Some Problems of ai
16/17
we want to know the choice o1 the
s we see that the is the summation o1 our and has no carry in result
there is a pre+ious carry C'2)3 in
"ow ! ####C'2)3
So there is only one choice o1 5hich is $ as i1 we take the choice o1 greater
than 1it means the result e6ceeds $0 and there is de1initely one carry in the
result which is not there in the result so we will take the choice !$ in the
problem and this one leads to the 1ollowin7 result
!$#$#$#$#3 !
8/13/2019 Some Problems of ai
17/17
Top Related