Chapter 2 · Intelligent Agents

The same world with five agent programs, from a memoryless reflex agent to one that weighs risk against reward. Watch where each one fails. Then play it yourself with only the percepts to go on.

True world what the environment knows

pitwumpusgoldagent

Agent’s view what the agent program knows

B/S/G = breeze/stench/glitter perceived there · OK = inferred safe · P? W? = possible pit / wumpus

Percept → action

percept
action
why
score

Agent program rule that fired is highlighted

    Action log

    Performance measure over many worlds +1000 gold out, −1000 death, −1 per action, −10 arrow

    Uses the size and pit probability set above, with seeds 1…N.
    Chapter notes: PEAS and environment properties

    PEAS description (§7.2)

    Performance+1000 climbing out with gold, −1000 death (pit/wumpus), −1 per action, −10 for using the arrow. Episode ends at death or Climb.
    Environmentn×n grid of rooms, agent starts at [1,1] facing east. Wumpus and gold uniformly among non-start squares; each non-start square is a pit with probability 0.2.
    ActuatorsForward, TurnLeft, TurnRight, Grab, Shoot (one arrow, flies straight), Climb (only at [1,1]).
    SensorsStench (wumpus adjacent or here), Breeze (pit adjacent), Glitter (gold here), Bump (walked into wall), Scream (wumpus killed).

    Task environment properties (§2.3)

    Observable?Partially. Only local percepts, so the agent must remember and infer.
    AgentsSingle. The wumpus is part of the environment. (Ch. 6 makes it an opponent.)
    Deterministic?Deterministic dynamics, but the initial world is unknown. (Ch. 4 adds slippery floors.)
    Episodic?Sequential. Early moves decide what you can learn later.
    Static?Static. Nothing moves while the agent thinks.
    Discrete?Discrete states, percepts, actions and time.
    Known?Known rules (the agent knows what Forward does), unknown layout.

    Questions to try

    1. Why does the simple reflex agent sometimes loop forever? Find a seed where it does, then switch to the randomized version.
      hint§2.4.2: randomization escapes infinite loops of a memoryless agent, but it is rarely rational.
    2. The model-based agent never dies. Why? What does that cost it in the benchmark?
      hintIt only enters squares it has proved safe. Look at how often it climbs out with nothing.
    3. Goal-based and model-based agents share the exact same knowledge. Where does the goal-based one save actions?
    4. Change V for the utility agent (e.g. 100, 500, 2000) and rerun the benchmark. Plot success% against death% in your head. What is the “right” V?
    5. Play yourself on the Book Fig. 7.2 world. After [1,1]→[2,1]→[1,1]→[1,2], can you prove where the wumpus is? That is exactly the inference Chapter 7 automates.