You are on page 1of 5

Andrew Emrazian – u0349111

CS 4300 - AI
Oct 20, 2016
Assignment A4b: Hybrid Wumpus Agent

1. Introduction

This assignment implements a Hybrid Wumpus Agent algorithm that is use the algorithms:
Resolution Theorem Prover and A* (for path finding) from previous assignments. The program
maintains a knowledge base (KB) used to prove logical statements. The program also
implements three noteworthy functions: Make_Percept_Sentence, Tell, and Ask. The KB
maintains truths or rules about the Wumpus World. The program will be tested on the following
Wumpus boards:

The following questions are also addressed:

• What are the advantages and disadvantages of using propositional logic to solve the
Wumpus world?
• How large will the knowledge base grow for these boards as the agent navigates the
board?
• Will the KB be able to prove that cell (2,2) is safe on board 2?

1
2. Method

Figure 1: Hybrid Wumpus Agent

This assignment consists of 3 Matlab functions

1. CS4300_Hybrid_Wumpus_Agent.m

This is the main program in observation. The pseudo code is listed in figure 1 above. My
program maps a percept to an action that the agent chooses based on persistent variables. My
implementation did not complete shooting the Wumpus. The helper functions listed above
are used inside this function.

percept = CS4300_get_percept(board,agent,bumped,screamed);
CS4300_Hybrid_Wumpus_Agent(percept);

There is a driver function that calls this program on the three boards listed above.

2. CS4300_KB_rules.m

Another important function in the functionality of the program is CS4300_KB_rules which

2
sets up the rules of the board with regards to how percepts and their references are related to
what they can decipher truth. This function builds the rules for the 3 boards. There were 80
rules total initialized that were able to be derived. They were derived from cells x,y 1:3 (3x3)
instead of writing all of the rules for wumpus, stench, breeze, and pits. The full rules set
would be around 120.

3. Verification of Program
In order to generate the rules for the wumpus world, I wrote a few possibilities out by
hand to see the pattern. A rule of the wumpus world is that:

𝑆12 ⟺ 𝑊13 | 𝑊22 | 𝑊11


~𝑆12 | 𝑊13 𝑊22 𝑊11 & ~ 𝑊13 𝑊22 𝑊11 𝑆12)
~𝑆12 | 𝑊13 𝑊22 𝑊11 & ~𝑊13 &~𝑊11 &~𝑊22 𝑆12)
~𝑆12 | 𝑊13 𝑊22 𝑊11 & ~𝑊13 𝑆12 &~𝑊11 𝑆12 &~𝑊22 𝑆12)

Listed as 4 conjuncts:
1. ~𝑆12 𝑊13 𝑊22 | 𝑊11
2. ~𝑊13 | 𝑆12
3. ~𝑊22 | 𝑆12
4. ~𝑊11 | 𝑆12

This process shows repeated shows a pattern which helped generate the KB (The some
clauses form the quiz also helped verify this).

Part of the verification of the program comes by having verified the traceback and
validity of the A* algorithm. I walked through each example board and the did perform
as expected.

Board 1
0
1
3
3
1
2
1
4
3
3
1
6

3
Board 2
0
1
3
3
1
2
1
2
1
3
1
4
3
3
1
1
2
1
6

*this board would randomly die


Board 3
0
3
1

4. Data and Analysis

The knowledge base on each board started at 83 clauses. Board 1 grew to 86 clauses. Board 2
grew to 92 clauses in the KB and Board 3 grew to just 83 clauses.

I don’t have any hard data to show but the time to run RTP on these tables was very compared to
the rest of the program.

5. Interpretation

The agent that I implemented is able to pass board 1 and 2 without any problems. However, with
the board, I was not able to escape death since I did not fully implement shooting the wumpus.

I wasn’t sure at first if the agent would be able to prove that cell 2,2 is safe on the 2nd board. The
agent was able to prove this since it visited 2 sides of 2,2 and did not percept a stench with both
sides. RTP was able to resolve this.

One of the main advantages of using propositional logic is that I can determine seeming difficult
problems for humans to prove, the problem is that it is a very slow algorithm.

4
6. Critique

I feel like the work load of the class didn’t allow much time for testing or experimenting on very
different knowledge base sizes.

7. Log

I spent about 16 hours coding the assignment.


I spent about 4 hours on this write up.
20 hours in total

You might also like