1. Artificial
Intelligence
By
NAME - KARAN PANJA.
ROLL NO. – CSE/20/092.
UNIVERSITY ROLL NO. - 10700120067.
DEPARTMENT– COMPUTER SCIENCE AND ENGINEERING(2020 - 24).
2. 1. STATE SPACE SEARCH
State Space Search is a process used in the field of computer science, including artificial
intelligence (AI), in which successive configurations or states of an instance are
considered, with goal of finding a goal state with a desired property.
It is complete set of states including start and goal states, where answer of the problem
is to be searched. It is the question which is to be solved. For solving the problem it
needs to be precisely defined. By definition it means defining the start state, goal state,
other valid states and transitions.
2
3. Why it is useful to reach certain goal?
A state space representation allows for the formal definition of a
problem which makes the movement from initial state to the goal
state quite easily.
We can say various problems like planning, learning, theorem proving
etc., are all essentially search problems only.
It provides a set of all possible states, operations and goals.
If the entire state space is for a problem then it is possible to trace the
path from initial to goal state and identify the sequence of operation
required for doing it.
3
4. 2.
Three tigers & three missionaries come to a crocodile infested river. There is a boat on either
side that can be used by either one or two members. If tigers outnumber the missionaries at any
time, the tigers eat the missionaries. How can they use the boat to cross the river so that all
missionaries survive?
Solution :
Step – 1:
Let, T= tigers; M = Missionaries; B = Boat.
• Initial State:
3 tigers, 3 missionaries and the boat are on the near bank, so ([TTT,MMM], B, [ ]).
• Final State:
Move all the tigers and missionaries across the river, becomes ([ ], B, [TTT,MMM])
• Constraints:
If tigers outnumber the missionaries at any time, the tigers eat the missionaries.
• Operators:
Move boat containing some set of occupants across the river (in either direction) to the other
side.
5. Step – 2:
Initial setup: ( [ TTT,MMM ], B , [ ] )
Two tigers cross over : ( [ T,MMM ], B , [ TT ] )
One tiger comes back : ( [ TT,MMM ], B , [ T ] )
Two tigers go over again : ( [ MMM ], B , [ TTT ] )
One tiger comes back : ( [ T, MMM ], B , [ TT] )
Two missionaries cross over: ( [ T, M ], B, [ TT, MM] )
A missionary and a tiger return: ( [ TT,MM ], B , [ T,M ] )
Two missionaries cross again : ( [ TT ], B, [ T, MMM ] )
One tiger returns: ( [ TTT ], B , [ MMM ] )
Two tigers cross again: ( [ T ], B , [ TT, MMM ])
One tiger returns : ( [ TT ], B , [ T, MMM ])
And brings over the third tiger : ( [ ] , B , [ TTT, MMM ])
>> This is the goal state.
5
Therefore, all the missionaries and
tigers cross the river safely.
6. T W O
+ T W O
...........................
F O U R
3.
PROBLEM ON CONSTRAINT SATISFACTORY
METHOD
6
Step – 1:
A quick look at the constraints shows that the variable F can only take
the value 1, assign F = 1
For this problem, we use the minimum remaining value heuristic to
choose a variable and the least constraint value heuristic to assign
values to the chosen variables.
The constraints are:
O + O = R + 10 C1 ………………… (i)
C1 + W + W = U + 10 C2 ………… (ii)
C2 + T + T = O + 10 F ………….…(iii)
The main variables here are F, T, U, W, R, O and they all must have
different values. In addition, C1, C2, represent the carries that depend on
the assigned values. The carries can take the values (0,1).
7. 7
Step – 2:
From equation (iii),
=> C2 + T + T = O + 10F
[putting values F = 1 ]
=> C2 + T + T = O + 10
[C2 can be either 0 or 1., consider C2=0]
=> 0 + 2T = O + 10
[ consider O = 4 ]
=> 2T = 4 + 10
=> 2T = 14
=> T = 7
At the end of Step – 2 we get:
T = 7
O = 4
F = 1
Step – 3:
From equation (ii),
=> C1 + W + W = U + 10C2
[putting value C2 = 0]
=> C1 + W + W = U + 0
[C1 can be either 0 or 1., consider C1
= 0]
=> 0 + 2W = U
[consider U = 6]
=> 2W = 6
=> W = 3
At the end of Step – 3 we get:
T = 7 W = 4
O = 4 U = 6
F = 1
8. Step – 4:
From equation (i),
=> O + O = R + 10C1
[C1 can be either 0 or 1., consider C1 = 0]
=> 2O = R + 0
[ putting O = 4 ]
=> 2*4 = R
=> R = 8
At the end of Step – 4 we get:
T = 7 W = 4
O = 4 U = 6
F = 1 R = 8
Now,
The required solution is:
T(7) W(4) O(4)
+ T(7) W(4) O(4)
...............................................................
F(1) O(4) U(6) R(8)
................................................................
8