Sei sulla pagina 1di 9

SWE 424 | Artificial Intelligence with Lab

Final-Term Assignment
Course Code: SWE 424
Course Title: Artificial Intelligence with Lab
Course Teacher: K. M. Imtiaz-Ud-Din
Assistant Professor
Department of Software Engineering

Date: 24.08.2020

Submitted by:
Name: Abdullah-Al-Yeamin Maruf
ID: 173-35-256
Section: A
Department of Software Engineering
Daffodil International University

1|P a ge
SWE 424 | Artificial Intelligence with Lab

Final-Term Assignment:
Problem:

Problem Description:

A student lives in Younus khan scholar Garden. Which is DIU boys hostel. He want to go DIU
Auditorium for attend concert. There are many possible way to go Boys hostel to DIU
Auditorium.

So now build a simple reflex agent to solve this problem. The agent start from node A, which
is Boys hostel and It’s end node is M, which is DIU Auditorium.

2|P a ge
SWE 424 | Artificial Intelligence with Lab

3|P a ge
SWE 424 | Artificial Intelligence with Lab

Solution:
a. Task Environment:
Hare we see the Daffodil International University Permanent Campus map. Hare every place
has a name. Such as Boys hostel is A, Hall main gate is B, DDBL ATM booth is C, Main gate is
D, DIU golf ground is E, Green garden is F, AB1 is J, food court is N, Admission office is G, AB4
is L, DIU auditorium is M. Here we also see DIU playground, AB3, Bonomaya, Girls hostel.

b. Purpose / Objective:
Now build a goal based agent, which can go from A node which is DIU boys hostel to M
node which is DIU Auditorium.

c. Why this specific task should be solved by an agent of this type:


Goal based Agent is a type of planning agent. Planning Agent will be able to solve a planning
problem by creating a plan on its own without the help of the agent designer. A goal-based
agent takes it a step further by using a goal in the future to help make decisions about how
best to reach that outcome.

d. Percepts:
Location: A node, B node, C node, D node, E node, F node, G node, H node, I node, J node, K
node, L node, M node, N node, O node, P node

e. Sensors:
Location Sensor

f. Actions:
moveForword, moveLeft, moveRight

g. Actuators:
wheel, motor, shaft

4|P a ge
SWE 424 | Artificial Intelligence with Lab

h. List of all the environment states or percepts or situations that will be


faced by agent:
Percept Variables:
Location (A / B / C / D / E / F / G / H / I / J / K / L / M / N / O / P)

All Possible Actions


1. Move Forward
2. Move Left
3. Move Right

List:
1. [A] – move forward / move left / move right
2. [B] – move forward / move left / move right
3. [C] – move forward / move left / move right
4. [D] – move forward / move left / move right
5. [E] – move forward / move left / move right
6. [F] – move forward / move left / move right
7. [G] – move forward / move left / move right
8. [H] – move forward / move left / move right
9. [I] – move forward / move left / move right
10. [J] – move forward / move left / move right
11. [K] – move forward / move left / move right
12. [L] – move forward / move left / move right
13. [M] – move forward / move left / move right
14. [N] – move forward / move left / move right
15. [O] – move forward / move left / move right
16. [P] – move forward / move left / move right

Current environment state or situation - [A]

i. Performance Measure:

For every environment state, the agent will itself choose the action that is most likely to
take the agent to its goal. For this problem in every location of the map, the agent itself
will perform the action that is most likely going to take it to its goal or location "M".

5|P a ge
SWE 424 | Artificial Intelligence with Lab

j. State Space Graph:

Start State - A
Goal State - M

6|P a ge
SWE 424 | Artificial Intelligence with Lab

k. Prolog Source Code:

edge(a,b).
edge(b,c).
edge(c,f).
edge(f,j).
edge(j,k).
edge(k,m).
edge(j,n).
edge(n,o).
edge(n,p).
edge(c,d).
edge(d,g).
edge(g,f).
edge(g,h).
edge(h,l).
edge(l,k).
edge(k,j).
edge(d,e).
edge(e,h).
edge(h,m).

path(X,Y):-edge(X,Y).
path(X,Y):-edge(X,Z),path(Z,Y),write(Z).

7|P a ge
SWE 424 | Artificial Intelligence with Lab

l. Step by Step process of how Prolog finds out the path from the start state
to the goal state :

 How Prolog finds the path from the start to the goal state part 1

k,m(T)(6) k,m(T)(6)
j,m(F)(5) j,m(F)(5)
f,m(F)(4) f,m(F)(4)
c,m(F)(3) c,m(F)(3)
b,m(F)(2) b,m(F)(2)
a,m(F)(1) a,m(F)(1)
path(X,Y):- edge(X,Y).

 How Prolog finds the path from the start to the goal state part 2

j,m(T)(5) j,k(T)(5) k,m(T)(5)


f,m(T)(4) f,j(T)(4) j,m(T)(4)
c,m(T)(3) c,f(T)(3) f,m(T)(3)
b,m(T)(2) b,c(T)(2) c,m(T)(2)
a,m(T)(1) a,b(T)(1) b,m(T)(1)
path(X,Y):-edge(X,Z),path(Z,Y),write(Z).

Output:
?path(a,m).

kjfcb

8|P a ge
SWE 424 | Artificial Intelligence with Lab

m. Output Screenshot:

9|P a ge

Potrebbero piacerti anche