Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

MAY19/BCS/004U

KWEEZI JOSEPH

CS 203: ARTIFICIAL INTELLIGENCE


ASSIGNMENT 1
1. Describe the following agent programs
Learning Agent-Give an example of a program that lies under this category
2. Write pseudocode agent programs for
a) Simple-reflex
b) the goal-based and
c) utility-based agents.
d) Learning Agent

SOLUTION;
Question 1
Learning agent is a tool in AI that is capable of learning from its experiences. It starts with some basic
knowledge and is then able to act and adapt autonomously, through learning, to improve its own performance.
Example;
Imagine you've decided to start driving for a cab service. It's a Friday night and you're running your typical route
from the nightlife scene to many of the hotels away from the downtown area. You've become accustomed to
taking the Maple Street exit to pick up your customers, but tonight you opt for Palace Road for a change of pace.
To your surprise, you discover that Palace Road is not only quicker, but you can avoid the accident-prone
intersection at Maple and Vine. You decide that, in the future, you'll be sure to take Palace Road.
You probably guessed there's a deeper meaning to the example. It's an illustration of an idea in artificial
intelligence (AI) known as a learning agent.
Question 2
a) Simple-reflex
A simple reflex agent is the most basic of the intelligent agents out there. It performs actions based on
a current situation. When something happens in the environment of a simple reflex agent, the agent
quickly scans its knowledge base for how to respond to the situation at-hand based on pre-determined
rules.
Example
It would be like a home thermostat recognizing that if the temperature increases to 75 degrees in the
house, the thermostat is prompted to kick on. It doesn't need to know what happened with the
temperature yesterday or what might happen tomorrow.

1
MAY19/BCS/004U
KWEEZI JOSEPH

Pseudocode

b) Goal based Agent


Goal-based agents expand on the concept of model-based agents, which understand the world
around them, by implementing the desired outcome or goal to be reached. 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.

Example
At the start of the new year, Brett set a very specific goal for himself and his wife: a two-week trip to Greece.
Brett knew it was going to take several months of putting a plan into action in order to board the flight and make
his goal a reality.
Among the steps he identified for achieving his goal were saving money for the airline tickets, booking the hotel
and collecting several traveller’s guides for exploring the area. By actively pursuing these steps, Brett was able
to achieve the goal he set for himself by the summer.
Pseudocode

c) Utility based Agent


A utility-based agent is an agent that acts based not only on what the goal is, but the best way to reach that
goal. In short, it's the usefulness (or utility) of the agent that makes itself distinct from its counterparts.
Example

2
MAY19/BCS/004U
KWEEZI JOSEPH

You've been planning a road trip for a few weeks and the big day is finally here. You get everyone loaded into
the car, fire up the GPS, and set off in the direction of your weekend adventure. Two hours into your travel, you
approach bumper-to-bumper traffic. It appears as though there might be a car accident up ahead. Automatically,
your GPS starts to look for a new route around the hazard, and you are able to exit the highway and navigate
around the traffic pile-up.

Pseudocode

d) Learning based Agent


A learning agent is a tool in AI that is capable of learning from its experiences. It begins with some
basic information and can act and adapt autonomously to improve on its experiences.

Example
Imagine you've decided to start driving for a cab service. It's a Friday night and you're running your typical
route from the nightlife scene to many of the hotels away from the downtown area. You've become
accustomed to taking the Maple Street exit to pick up your customers, but tonight you opt for Palace Road
for a change of pace. To your surprise, you discover that Palace Road is not only quicker, but you can avoid
the accident-prone intersection at Maple and Vine. You decide that, in the future, you'll be sure to take
Palace Road.
Pseudocode

function Q-Learning_Agent(percept) returns an action


inputs: percept, a percept indicating the current state s' and reward signal r'
persistent: Q, a table of action values indexed by state and action, initially zero
Nsa, a table of frequencies for state-action pairs, initially zero
s, a, r, the previous state, action, and reward, initially null

if Terminal?(s) then Q[s, None] ← r'


if s is not null then
increment Nsa[s, a]
Q[s, a] ← Q[s, a] + α(Nsa[s, a])(r + γ maxa' Q[s', a'] - Q[s, a])
s, a, r ← s', argmaxa' f(Q[s', a'], Nsa[s', a']), r'
return a

3
MAY19/BCS/004U
KWEEZI JOSEPH

You might also like