Name Umer Hussain Qidwai REGNO 40274 Course Artifical Intelligence Theory DR - Aarij Mehmood
Name Umer Hussain Qidwai REGNO 40274 Course Artifical Intelligence Theory DR - Aarij Mehmood
REGNO= 40274
COURSE = ARTIFICAL INTELLIGENCE
THEORY
DR.AARIJ MEHMOOD
QUESTION 1
Find a path between the starting cell and the goal cell in as low of a cost as possible. However,
the grid has special cells marked as ‘W’ and ‘X’, if your agent moves to the ‘W’ cell, then the
agent will be teleported a cell (randomly selected) next to the goal state, but the cost will be
‘+7… the Environment of this grid is 7 x8 and start Cell And goal state with a low Cost Special
Cell Mark W and X.. User required moving the path from one cell to another cell to make the
best decision
ACCESIBLE / INACCESIBLE: All the possible states and moves are clearly in front of an
agent i.e the agent can see all the situation of the environment at all times. Therefore this
scenario is ACCESIBLE.
EPISODIC / NON EPISODIC: All the moves taken by an agent fully depends upon the moves
taken by the agent previously. Hence this scenario is non episodic / sequential.
STATIC / DYNAMIC: The given scenario is static because the grid remains same on every
move/step taken by the agent.
The search strategy contains the evaluation of any given state until the agent does not move to
the goal state or there are no more states left to evaluate.
INITIAL STATE: The agent who is this problem must be fully aware of the starting / initial
state before it start its search so that is can keep track on all the moves it searches.
OPERATOR: An operator is a function taking an agent to one state to another via a cost
undertaken by the agent
GOAL TEST: It is very important to design a goal state while designing a problem. We have to
make sure that what we will get in order to make sure what kind of moves we are taking. We
should know that at which step we can have lowest possible cost to search for the goal state.
State: {(0.0)}
State Space:{(0,0),(0,1),……,(0,7)(1.0),……,(1,7),(2,0),……(2,7),…………….. ,(6,1),…….
…..,(6,7)}
Successor Function:{UP,DOWN,LEFT,RIGHT}
Goal state:{YES OR NO}
Goal Test:{(3,7)}
O(b^m)
7 x 8 = 56
10^56
REASON: BFS algorithm works bottom up without checking any nodes, it uses recursive
function to check whether the agent had reached the goal state or not. DFS can be used to solve
the given problem, but in this problem BFS will not be optimal because BFS is optimal when the
cost remain same at every possible action.
Uniform Cost Search expands the state with the lowest path cost. The path discovered by USC in
this problem is:
NO, BFS and UCS will not give the same answers because this problem contains different cost
value at every move, and BFS is optimal when all steps cost are equal. Because is always
expands the unexpected state. By a simple extension, we can find an algorithm that is optimal
with any step cost function. Instead of expanding the unexpected state, UCS expands the state
with the lowest path cost.
Euclidean distance is an admissible heuristic for the given problem. Because it has the minimum
distance to travel between the initial state and goal point. Otherwise, if the goal is diagonally
away from the agent’s current position then the Euclidean distance will be less than the true
distance.
Manhattan distance is not an admissible heuristic for the given problem because it measure the
distance between two points along x axis.
9. Come up with your own admissible heuristic, and solve the problem above using your
heuristic and A* search?
Suppose g*(n) is the cost of the shortest path from the start state to n.
Suppose the h*(n) is the actual cost of the shortest path from the state n to the goal.
If h(n) <= h*(n) for all states, than any evaluation function f using h(n) and BFS will result in an
A* algorithm.
ANSWER NO: 2
Sudoku is a puzzle played in a 9x9 matrix (standard sudoku) which, at the beginning, is partially
full. This matrix is composed of 3x3 submatrices denominated “regions”. The task is to complete
the empty cells so that each column, row and region contain numbers from 1 to 9 exactly once.
The CSP model consists of the following constraints:
∀i∈ {1, ..., 9} All different {xi1, xi2, ..., xi9} ------------ (1)
∀j ∈ {1, ..., 9} All different {x1j, x2j , ..., x9j} ------------- (2)
On the other hand, each cell in regions Skl with 0 <= k, l <= 2 must be different, which forces to
include in the model.
2. No column, row or box can have two squares with the same number.
Someone has replaced each number from 11 to 99 in the Sudoku puzzle above with a letter.
Given that the number at the end of a row or at the bottom of a column is the sum of the letters
shown in that row or column, can you find which letter corresponds to which number, and then
solve the Sudoku?
For example, in the first and second columns beginning from the left of the 9×99×9 grid, we can
form the following equations:
c+g+k=17,c+g+k=17,
f+g+a=19.f+g+a=19.
In the fourth and fifth rows beginning from the top of the 9×99×9 grid, the following equations
can be formed:
k+g+m+c=23,k+g+m+c=23,
g+p=11
7.SIMULATING ANNEALING:
QUESTION 3:
1. Formulate the Problem As MDP??
Answer
Start State{(0,0)}
Action{( UP,DOWN,LEFT,RIGHT)}
Reward Function{(R(0,0),Action,(0,4))}=r €
q(st,at)←q(st,at)+α(rt+1+γq(st+1,at+1)−q(st,at))
q(st,at)←q(st,at)+α(rt+1+γmaxaq(st+1,a)−q(st,at))
1. (1-1/2)(0)+1/2[-1+1(0)]= -0.5
2. (1-1/2)(0)+1/2[-1+1(-0.5)]= -0.75
3. (1-1/2)(-0.5)+1/2[-1+1(-0.5)]=-1
4. (1-1/2)(-1)+1/2[-1+1(-1)]=-1.5
5. (1-1/2)(-1.5)+1/2[-1+1(-0.75)]=-1.625
6. (1-1/2)(1-625)+1/2[-1+1(0)]=-1.3125
7. (1-1/2)(-1.3215)+1/2[-1+1(0)]=-1.5625
8. (1-1/2)(-1.5625)+1/2[-1+1(0)]=1.078125
9. (1-1/2)(-1.08125)+1/2[-1+1(0)]=-1.03906925
10. (1-1/2)(-1.03906)+1/2[-1+1(1)]=+0.5195
QUESTION 4
Consider the game of LUDO. For LUDO answer the following question.
ANSWER: Firstly the adversarial search is what we examine the problem that arises when we
try to plan ahead in a world where the other agents are planning against each other or like an
opponent
1. Unpredictable:
The unpredictable opponent in games is very common because any single move can make whole
the game in the favor or opponent or the player itself. So for that unpredictable move there can
be a usage of searches.
2. Time Limits:
Time limits means that we have to find the goal state which is approximate.
2. Would you use minimax or expectimax search to solve LUDO? Explain your reasoning?
Minimax is a kind of backtracking algorithm that is used in decision making and game theory to
find the optimal move for a player, assuming that your opponent also plays optimally. It is
widely used in 2 players turn-based games such as tic tac toe, mancala, chess etc.
In minimax the two players are called maximizer an minimizer. The maximizer tries to get the
highest score possible while the minimizer tries to do the opposite and get the lowest score
possible.
Every board state have a value associated with it. In a given state if the maximizer has upper
hand then, then the score of the board will tend to be some positive value. If the minimizer have
the upper hand in that board state then it will tend to be some negative value. The values of the
board are calculated by some heuristic which are unique for every type.
Answer: The complexity of adversarial search for LUDO is that when your are playing the game
and the turn is to the opponent side so now opponent can make every possible move which make
the user state in danger positions.It means that opponent move to those state where the user don't
want to go because from this user cannot take advantage to beat the opponent.Along with the
LUDO game , these complexity also come games likes Chess , and some business tracks.So this
will be the complexity which occurs to the adversarial search for LUDO.
4. Draw the search graph of expectimax search for a turn for each player, assuming there
are four players.One is controlled by you.
Player S
A B
Chance
5. Will it be feasibility to do vanilla search for solving LUDO? Why or why not?
ANSWER: The LUDO game is the multiplayer agent game mean 2 to 4 player can play the
game at a time so it is non-deterministic and there is uncertainty in game in which every player is
playing to win the game by moving to the designated location in the board.So vanilla search is
very easy search so that why it is not applicable for the LUDO game because while using vanilla
search it is easy to win the game.
6 . Will you design an optimistic agent or pessimistic agent for Ludo?Explain your
reasoning?
7. How would you speed up the decision‐making process of your algorithm? Explain the
Improvements you would make and why they will be helpful?
Think for a moment about how an organization makes a decision, first comes the facts, the data
that will inform the decision. Using these facts, someone formulate alternative courses of actions
and revaluates them according to agreed on criteria. The decision maker then chooses the best
alternative and the organization commits itself to action.
Learn continuously and see how to tackle the game and make the opponent in
difficult position from your tricky strategies.
Be active to have and compete with complex problems
Add recourses or get help.
Add tools and techniques that can address complexity.
And solve the difficult problems when the user approaches.
IMPROVEMENTS:
Identify and define the problem that what kind of problem are facing while
playing.
Generate alternate solutions to help it.
Decide on preferred course of action.
Implement the decision
Evaluate results.