0% found this document useful (0 votes)
39 views6 pages

Wumpus World AI Agent Project Guide

The Wumpus World project involves creating an intelligent agent that navigates a grid environment to find gold while avoiding dangers like Wumpuses and pits. The agent must utilize percepts to infer the state of the environment and make decisions, with the goal of maximizing its score through actions such as grabbing gold and climbing out safely. The project includes implementing an environment simulator, inference engine, planning module, and a report detailing the system design and experimental results.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views6 pages

Wumpus World AI Agent Project Guide

The Wumpus World project involves creating an intelligent agent that navigates a grid environment to find gold while avoiding dangers like Wumpuses and pits. The agent must utilize percepts to infer the state of the environment and make decisions, with the goal of maximizing its score through actions such as grabbing gold and climbing out safely. The project includes implementing an environment simulator, inference engine, planning module, and a report detailing the system design and experimental results.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Artificial Intelligence

Project: Wumpus World Agent


1 Description
The Wumpus World is a classic example of a knowledge-based agent in AI. It involves reasoning, knowledge rep-
resentation, and planning. This agent uses its world knowledge to make decisions and navigate safely in the given
environment.

Figure 1: Example 4x4 Wumpus World map for illustration.

In this project, you are asked to build an intelligent agent for a Wumpus World environment as described below.

Environment
The environment is a static grid of size N x N (default N=8), with coordinates (0,0) at the bottom-left corner. The
X-axis increases to the right (East) and the Y-axis increases upward (North). Cells are bounded by walls; if the agent
moves into a wall, it receives a Bump percept and remains in place. Each cell may contain:

• Wumpus: There are K Wumpus (default K=2) placed randomly. Wumpuses do not move, and their number
K is known to the agent, but their positions are unknown at the start. If multiple Wumpus are aligned when
shooting, only the first Wumpus hit is killed. When a Wumpus is killed, the environment emits a Scream and
its stench disappears. A single room (cell) cannot contain more than one Wumpus.

• Pit: Appears in cells with a probability p (default p=0.2). Pits do not move, and the agent does not know the
number or positions of pits.

• Gold: There is exactly one gold, placed randomly in a cell without pit or wumpus. Gold can appear at any
cell, including (0,0).

The agent starts at cell (0,0) facing East (right). The starting cell is always safe (no pit or wumpus). It has one
arrow to shoot in a straight line, which stops upon hitting a wall or killing the first wumpus encountered. The agent
can perform the following actions:

• Move Forward
Artificial Intelligence

• Turn Left / Turn Right

• Grab

• Shoot Shooting (whether it hits or misses) costs -10 score.

• Climb Out (only at (0,0))

Note: The agent does not know the locations of gold, pits, or wumpus at the start; it must infer them through
percepts as it explores.

Percepts
At each step, the agent perceives:

• Stench: if one or more wumpuses are in adjacent cells (north, south, east, west).

• Breeze: if one or more pits are in adjacent cells.

• Glitter: if gold is in the current cell.

• Bump: if it hits a wall when moving forward.

• Scream: if a wumpus is killed by its arrow.

Percepts for stench and breeze only indicate presence (true/false) but do not reveal the number or direction of
wumpus or pits.

Objective
The agent’s goal is to grab the gold and return to (0,0) to climb out safely, maximizing score. Killing the wumpus is
optional and should only be done if it improves expected utility.

Action / Outcome Score


Grab gold +10
Move forward -1
Turn left/right -1
Shoot -10
Die (fall in pit or eaten by wumpus) -1000
Climb out (with gold) +1000
Climb out (without gold) 0

2 Tasks
You are required to complete the following two main components:
Artificial Intelligence

A. Implementation
Develop a complete Wumpus World Agent System consisting of:

1. Environment Simulator:

• Randomly generate N x N maps with multiple wumpus (default K=2) and adjustable pit density (default
p=0.2).
• Provide percepts (stench, breeze, glitter, bump, scream) to the agent based on its current state and action.
• Ensure visualization (console or graphical) showing:
– Map state (known cells and agent knowledge)
– Agent location, orientation, percepts, visited cells, and inferred safe/unsafe status of cells and action at
each step

2. Inference Engine:

• Implement from scratch (no external logic inference libraries) using forward chaining or model checking.
• Determine whether each cell is safe, dangerous, or uncertain based on percepts and KB rules.

3. Planning Module:

• Implement A*, Dijkstra, or another search algorithm to plan optimal paths considering cost, risk, and
expected utility.

4. Hybrid Agent Integration:

• Integrate all modules (logic inference, planning) into a unified agent capable of achieving maximum score.

5. Random Agent Baseline:

• Implement a simple random agent for comparison in experiments.

6. Advanced Setting: Moving Wumpus Module:


In this advanced setting, the Wumpus is no longer stationary. Instead, each Wumpus will move once after every
5 actions performed by the agent.
Movement Rules:

• After the agent has performed 5 actions (of any type: move, turn, grab, shoot, climb), each Wumpus will:
– Move to one of its valid adjacent cells (North, South, East, or West), chosen uniformly at random.
– The Wumpus movement is not observable to the agent, only inferred from percept changes.
– If the intended move would hit a wall, overlap with another Wumpus, or enter a pit, it stays in place.

Collision Rule:

• If a Wumpus moves into the agent’s current cell during its movement phase, the agent is immediately
killed (eaten by the Wumpus).

Purpose: Because the Wumpus can move, the environment becomes dynamic. The agent’s previous knowledge
about Wumpus locations can become outdated after each movement phase. Therefore, the agent must:
Artificial Intelligence

• Continuously update its internal map based on new percepts.


• Act cautiously, as Wumpus positions change over time.

Requirements:

• Modify your environment simulator to:


– Count the agent’s total actions and trigger Wumpus movement after every 5 actions.
– Implement Wumpus movement according to the rules above.
– Detect and handle agent-Wumpus collision (agent death).
• Update your inference engine to: Maintain agent knowledge consistency with percept updates after each
Wumpus movement phase.

This module challenges the agent to plan risk-aware decisions in a dynamic and partially observable environ-
ment.

B. Report
Prepare a comprehensive report (PDF) including:

1. Problem introduction and objectives

2. Formulation of Knowledge Base (KB) rules for breeze, stench, pit, wumpus, and gold using Propositional Logic,
with explanation for multiple wumpus and multiple pits encoding.

3. System architecture and module design

4. Inference engine approach, including handling of moving Wumpus in the advanced setting.

5. Knowledge base update strategy to handle moving Wumpus percept changes.

6. Planning algorithm description

7. Experiment results:

• Compare your agent with the random agent baseline in terms of success rate, average score, and decision
efficiency.

8. Team member contributions (who did what)

9. An estimation of the completion level for each requirement (in %)

10. References and citations (if any)

3 Submission requirements
1. Source code (any language). Must be well-organized with clear instructions on how to run. Include a “testcases”
folder with at least three different maps of different sizes, their input configurations, and output results (agent
action log, final map state).
The source code must include a visualization module (console-based or graphical) that displays:
Artificial Intelligence

• Current map state (known cells and agent knowledge)


• Agent location and orientation
• Percepts and actions at each step

Your source code submission must include clear instructions on how to execute the program (e.g., a README
file with installation requirements, commands to run, and expected outputs). Submissions without runnable
instructions will be penalized.

2. Video demo (max 10 minutes) showing:

• Environment simulator
• Agent percepts and decisions
• Final outcome and performance analysis

3. Report (PDF) including:

• Problem introduction and objectives


• System architecture and module design
• Knowledge base encoding and inference explanation
• Planning algorithm
• Result of advanced setting
• Experiment results and evaluation
• Team member contributions (who did what)
• An estimation of the completion level for each requirement (in %)
• References and citations (if any)

4 Requirements and Grading


The project will be graded based on the following criteria:

No. Criteria Weight


1 Problem formulation and knowledge base design 10%
2.1 Environment simulator implementation 10%
2.2 Inference engine implementation 20%
2.3 Planning module implementation 10%
2.4 Hybrid agent integration 10%
2.5 Advanced moving Wumpus module 10%
3 Report quality and analysis 30%

5 Submission
Please follow the following submission guidelines:
Artificial Intelligence

• Your source code and report must be contributed in the form of a compressed file (.zip, .rar) and named according
to the format StudentID1 StudentID2 ...

• If the compressed file is larger than 25MB, upload it to Google Drive and share it via a link. Absolutely no
modifications are allowed after the deadline.

Example details of the directory organization:

StudentID1_StudentID2_...
|-- Source
| |-- (source code)
| |-- [Link] (how to run source code)
| |-- [Link] (libraries to be installed)
|-- [Link] (included demo video URLs)

6 Notices
Please pay attention to the following notices:

• This is a GROUP assignment. Each group has 3 - 4 members.


Groups with fewer or more members than the specified limit require lab instructor approval.

• Duration: about 3 weeks.

• All tools are not restricted; however, students should use them wisely. Lab instructors have the right to conduct
additional oral interviews with random groups to assess their knowledge of the project.

• You are NOT allowed to use external logic solver libraries such as PySAT for the inference engine implementation.
All inference modules must be implemented from scratch.

• Any submission found to have code similarity of 50% or higher with other groups or public projects on the
Internet will be considered academic dishonesty and treated as plagiarism.

• Any form of plagiarism, dishonesty, or misconduct will result in a grade of zero for the course.

Common questions

Powered by AI

The knowledge-based agent in the Wumpus World project uses percepts such as Stench, Breeze, Glitter, Bump, and Scream to gather information about the environment. With these percepts, the agent applies inference rules to deduce possible locations of hazards like Wumpuses and pits, and determines areas marked safe or unsafe. The inference engine, which is implemented from scratch, applies methods like forward chaining or model checking to update the agent's knowledge base dynamically as it explores the grid. This allows the agent to plan its moves carefully by choosing paths that maximize the likelihood of survival and success, such as progressing towards cells identified as safe and avoiding potentially dangerous ones .

Deciding when to 'Climb Out' involves strategic considerations centered around the agent’s current knowledge, remaining opportunities to improve its score, and risk assessments. If the agent has successfully secured the gold, the best option is to climb out to achieve a significant score boost, as a successful exit with gold yields +1000 points, whereas exiting without it gives zero. The agent must weigh the risks of staying for further exploration against the safe choice of exiting, especially if its knowledge suggests high uncertainty or imminent danger in unexplored areas. Optimizing this decision requires balancing exploration benefits and securing hard-earned rewards .

Formulating KB rules to handle multiple Wumpuses and pits presents challenges like accounting for overlapping percepts, ensuring accurate deductions about safe cells, and avoiding contradictory inferences. These pitfalls can be addressed by clearly defining rules that account for the presence and interaction of multiple hazards, such as ensuring the stench and breeze percepts correctly map to possible adjacency scenarios without false positives. Consistently applying propositional logic systematically through forward chaining allows the agent to handle complex deductive tasks and avoid misinterpretations or ambiguities, thereby ensuring safe exploration and maximizing knowledge utility in decision-making .

The 'Stench' percept is crucial for the Wumpus World agent as it indicates the presence of at least one Wumpus in adjacent cells (north, south, east, or west). This perception helps the agent infer which areas are potentially dangerous, as encountering a Wumpus can lead to the agent's early demise. By using the Stench percept in conjunction with knowledge base rules, the agent makes educated guesses about Wumpus locations and thus makes safer navigation decisions or plans when to use its limited arrow to eliminate immediate threats .

Implementing a random agent serves as a baseline to evaluate the performance of the intelligent agent. The random agent moves arbitrarily without using percepts or any knowledge-based decision-making, providing a control to compare against the knowledge-based agent's efficiency. Performance metrics compared include success rate, average score, and decision efficiency, allowing the project to quantify how well the intelligent agent performs relative to chance-driven moves by the random agent .

The planning module in the Wumpus World agent is tasked with optimizing the path the agent takes through the environment to maximize its score. This involves using algorithms like A* or Dijkstra's to consider not just the shortest path, but the safest and most cost-effective route. The planner must incorporate environmental complexities such as the presence of pits, Wumpuses, and potential score penalties (from actions like shooting or unnecessary moves) into its calculations. It also factors in the objective of retrieving the gold and climbing out with it to maximize the score, often requiring balancing between short-term safety and long-term goal achievement .

Shooting an arrow, whether it hits a Wumpus or not, incurs a score penalty of -10. This cost makes it crucial for the agent to carefully plan when to use its arrow, ensuring that it only takes the shot if the potential benefit (such as removing a nearby Wumpus threat) outweighs the cost. This means the agent should gather sufficient evidence of a Wumpus's location through percepts and only decide to shoot where it increases expected utility, such as paving an easier path to the gold or ensuring a safe return. Thus, the agent must judiciously balance risk and reward, factoring in the penalty for shooting .

In the advanced module with a moving Wumpus, the Wumpus moves once after every five agent actions, which introduces dynamism and uncertainty into the environment. This movement means the agent's prior knowledge about Wumpus locations can become outdated, requiring it to update its internal map based on new percepts continuously. The agent must integrate frequent updates and percepts into its knowledge base to maintain consistency and plan effectively despite the changing environment. This requires the inference engine to continuously reason about potential Wumpus locations and adjust the agent's strategy to minimize risk and optimize for goals like finding the gold and climbing out safely .

Teamwork and role distribution are essential for completing the Wumpus World project due to the multidisciplinary nature of tasks, such as coding the environment simulator, developing the inference engine, and testing the planning module. Clearly defined roles prevent overlap and ensure that all necessary components progress simultaneously. Project management challenges may include coordinating efforts, resolving conflicts among members, and ensuring timely submissions, especially given the three-week timeframe and the comprehensive nature of tasks like report writing and system testing. Effective communication and adherence to the project timeline are crucial to overcoming these challenges .

The inference engine is tailored to handle the advanced setting's dynamic environment by continuously updating the agent's knowledge base as new percepts are received. It must anticipate changes such as moving Wumpuses and adjust the possible interpretations of perceptual data accordingly. The engine uses updated logic rules to maintain an accurate model of the environment, inferring possible locations for hazards while accommodating the uncertainty of moving elements. Strategies such as probabilistic reasoning or adaptive updates help mitigate the unpredictability, allowing the agent to still make informed decisions despite the inherent instability .

You might also like