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

Problem-solving agents

Recall from last class, the three types of agents:

 reflex agents (observe and act)


 reflex agents with memory (observe and act based on current and past
observations)
 goal-based agents (chooses best action based on whether it will advance toward
goal

Although interesting behaviours can be achieved by all three types, we will concentrate
on goal-based agents.

Motivation

 car driving: only the goal-based agent will try to get from point A to B
 RoboCup (or any other adverserial game): there are clear objectives that we want
our agents to fulfill
 in general: goals are an important characteristic of intelligent behaviour

Simple Goal-based agents: Problem-solving agents


 decide what to do by finding sequences of actions that lead to desirable states
 make simplifying assumptions about the environment, possible actions, and goals
 tend to be too simple for dealing with real-world problems; generally limited to
artificial games and puzzles

Problem-solving agents work as follows:

 perception: observe the world state


 goal formulation: based on current situation, agent must determine its objectives
 search: looking for a sequence of actions that achieve a goal; the returned action
sequence is known as the solution
 execution: once a solution exists, agent can carry out the recommended sequence
of actions

For now, we will only deal with agents that perform these four steps in sequential order.

Problem Formulation

Representation is very important, as we shall soon see. The problem can be specified by
the following four items:

 states: description of the relevant properties of the world; the state space is the
set of all states reachable from the initial state through any sequence of actions

B. Okuku Page 1
 operators: the actions that cause a transition from one state to another
 goal test: apply to state to determine whether it is a goal state; sometimes an
explicit set can be defined, but other times, it is an abstract property (e.g.
checkmate in chess); the solution is a path in the state space from the initial state
to a goal state
 path cost: how much effort/cost it takes us to reach that state; note that for some
problems, the path is irrelevant -- we just care about getting a solution

Toy Problems

8-puzzle

 states: location of each of the eight tiles in one of the nine squares
 operators: for each tile, move up, down, left, or right
 goal test: state matches the configuration:
 path cost: each step costs 1, so the path cost is the length of the path

Our choice of operators is not very good because there are so many (8 * 4 = 32) and this
will influence the efficiency of our search (big state space). Can you think of a better
alternative?

8 Queen's problem

 states: arrangement of 0 to 8 queens on board


 operators: add a queen to any unoccupied square
 goal test: 8 queens on board, none attacked
 path cost: zero

What data structure might you use to represent state? What if we generalized the
problem to the n x n case? Regardless of memory efficiency, our choice of state
representation is not very good because there are so many (64^8) possibilities to explore.

Once we place a queen in a square where it is attacked, we cannot have a solution that
builds from that point. Recognizing this, we can come up with an improved
representation:

 states: arrangement of 0 to 8 queens on board with none attacked


 operators: place a queen in the left-most empty column such that it is not
attacked by any other queen

This reduces the state space dramatically (to 2057 possible sequences).

B. Okuku Page 2
Missionaries and Cannibals [Amarel 68]

 3 missionaries (Alfred, Bob, Charles), 3 cannibals (Xtapa, Yurch, Zarg), 1 boat


 boat can carry at most 2 people
 task is for everyone to get across the river
 if the missionaries are ever outnumbered by the cannibals in one place, the former
will become dinner

What kind of representation do we need? Intuitively:

 cannibals on left bank


 missionaries on right bank
 cannibals on right bank
 missionaries on right bank
 cannibals on boat
 missionaries on boat

Do we need to know which of the missionaries and cannibals are on each side of the
river?

Abstraction:

 removal of unecessary detail without sacrificing validity


 helps reduce the size of the state space

But can we do better? Let's look at constraints:

 for left bank: ML= 0 ^ ML= CL ^ ML > CL


 for right bank: (3-ML = 0) ^ (3-ML = 3-CL) ^ (3-ML > 3-CL)
 and boat carries at most 2 people
 so...?

States: ?

B. Okuku Page 3
Operators: based on boat capacity, there are only five possibile operators:

 1M, 2M, 1C, 2C, 1M+1C


 use constraints to determine valid operations from each state
 operators applied by alternatively adding/subtracting their values and toggling
"boat bit"

Goal test: ?

Path cost:

 could be a unit cost per arc in path (pay per number of boat crossings)
 could be a unit cost per missionary or cannibal carried per arc in path (pay per
passenger)
could be a more complex function (tourists pay "foreigner price")

Real-world problems

Traveling salesman problem (aka "Hamiltonian circuit")

 given a network of cities (nodes) connected by roads (arcs), find the shortest path
that visits every city exactly once
 problem is NP-hard
 very important problem -- results applied to military supply operations and
automatic circuit board drills

VLSI layout

 cell layout and channel routing - minimize area and connection lengths
 constraints: cells cannot overlap and must allow enough room for connecting wire

B. Okuku Page 4

You might also like