29
Problem Solving Agents

Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Embed Size (px)

Citation preview

Page 1: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Solving Agents

Page 2: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

So Far…

• Traditional AI begins with some simple premises: – An intelligent agent lives in a particular environment.

– An intelligent agent has goals that it wants to achieve.

• The environment in which an agent is expected to operate has a large effect on what sort of behaviors it will need and what we should expect it to be able to do.

Page 3: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Chapter 3 :Problem Solving by Searching

• “In which we see how an agent can find a sequence of actions that achieves its goals when no single action will do.”

• Such agents must be able to:– Formulate a goal– Formulate the overall problem– Find a solution

Page 4: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Last time I gave you this problem

• Three missionaries and three cannibals• Want to cross a river using one canoe.• Canoe can hold up to two people.• Can never be more cannibals than

missionaries on either side of the river.• Aim: To get all safely across the river

without any missionaries being eaten.

Page 5: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Solving Agents• Formulate goal:

– get everyone across the river

• Formulate problem:– states: various combinations of people on either

side of the river– actions: take the canoe (with some people) across

the river– restrictions: certain combinations of people are

“illegal”

• Find solution:– sequence of canoe trips that get everybody

(safely) across the river

Page 6: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Solving Agents• Example: Traveling in Romania• On holiday in Romania; currently in Arad.

Flight leaves tomorrow from Bucharest

Page 7: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Solving Agents• Example: Traveling in Romania• On holiday in Romania; currently in Arad.

Flight leaves tomorrow from Bucharest

Formulate goal: be in BucharestFormulate problem:

states: various citiesactions: drive between cities

Find solution:sequence of cities, e.g., Arad, Sibiu,

Fagaras, Bucharest

Page 8: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Solving Agents

• Formulate goal:– get the set of rooms clean

• Formulate problem:– states: various combinations of dirt and vacuum location– actions: right, left, suck, no-op

• Find solution:– sequence of actions that cause all rooms to be clean

Page 9: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Appropriate environment for Searching Agents

• Observable??• Deterministic??• Episodic??• Static??• Discrete??• Agents??

• Yes• Yes• Either• Yes• Yes• Either

Page 10: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Types• Deterministic, fully observable single-state problem

– Agent knows exactly which state it will be in– Solution is a sequence

• Non-observable conformant problem– Agent may have no idea where it is– Solution (if any) is a sequence

• Nondeterministic and/or partially observable contingency problem– percepts provide new information about current state– solution is a tree or policy– often interleave search, execution

• Unknown state space exploration problem ( “online” )

Page 11: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Types

• Example: vacuum world

• Start in #5.

• Solution??

[Right, Suck]

Page 12: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Types• Deterministic, fully observable single-state problem

– Agent knows exactly which state it will be in– Solution is a sequence

• Non-observable conformant problem– Agent may have no idea where it is– Solution (if any) is a sequence

• Nondeterministic and/or partially observable contingency problem– percepts provide new information about current state– solution is a tree or policy– often interleave search, execution

• Unknown state space exploration problem ( “online” )

Page 13: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Types

• Conformant, start in {1,2,3,4,5,6,7,8}

Solution??

Page 14: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Types

• Conformant, start in {1,2,3,4,5,6,7,8}

• e.g., Right goes to {2,4,6,8}.

[Right, Suck, Left, Suck]

Page 15: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Types• Deterministic, fully observable single-state problem

– Agent knows exactly which state it will be in– Solution is a sequence

• Non-observable conformant problem– Agent may have no idea where it is– Solution (if any) is a sequence

• Nondeterministic and/or partially observable contingency problem– percepts provide new information about current state– solution is a tree or policy– often interleave search, execution

• Unknown state space exploration problem ( “online” )

Page 16: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Types

• Contingency, start in #5

• Murphy’s Law: Suck can dirty a clean carpet

• Local Sensing: dirt, location only.

• Solution??[Right, if dirt then Suck]

Page 17: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Types• Deterministic, fully observable single-state problem

– Agent knows exactly which state it will be in– Solution is a sequence

• Non-observable conformant problem– Agent may have no idea where it is– Solution (if any) is a sequence

• Nondeterministic and/or partially observable contingency problem– percepts provide new information about current state– solution is a tree or policy– often interleave search, execution

• Unknown state space exploration problem – “online” search

Page 18: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Single-State Problem Formulation• For the time being, we are only interested in the single-

state problem formulation• A problem is defined by four items:

1. initial state e.g., “at Arad”2. successor function S(x) = set of action-state pairs

e.g., S(Arad) = { <Arad Zerind, Zerind>, …}3. goal test, can be

explicit, e.g., x = “at Bucharest”implicit, e.g., NoDirt(x)

4. path cost (additive)e.g., sum of distances, number of actions

executed, etc.C(x,a,y) is the step cost, assumed to be 0

Page 19: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Single-State Problem Formulation

• A solution is a sequence of actions leading from the initial state to a goal state

Page 20: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Formulation• Example: vacuum cleaner world state space graph

• States?? Actions?? Goal test?? Path cost??

Page 21: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Problem Formulation

• States?? Integer dirt and robot locations (ignore dirt amounts)

• Actions?? Left, Right, Suck, NoOp

• Goal test?? No dirt

• Path cost?? 1 per action (0 for NoOp)

Page 22: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Example: the 8-puzzle

• States?? Actions?? Goal test?? Path cost??

Page 23: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Example: The 8-puzzle• States?? 9!/2 integer locations of tiles (ignore

intermediate positions)• Actions?? Move blank left, right, up, down • Goal test?? = goal state (given)• Path cost?? 1 per move

• Note: optimal solution of n-Puzzle family is NP-hard (although 8-Puzzle is NP-complete)

Page 24: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Why do we look at “toy” problems.

• Real world is absurdly complex state space must be abstracted for

problem solving• (Abstract) state = set of real states

(Abstract) action = complex combination of real actions e.g., “Arad Zerind” represents a complex set of possible route, detours, rest stops, etc.For guaranteed realizability, any real state “in Arad” must get to some real state “in Zerind”

• (Abstract) solution = set of real paths that are solutions in the real worldeach abstract action should e “easier” than the original problem!

Page 25: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent
Page 26: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Last time I gave you this problem

• Three missionaries and three cannibals• Want to cross a river using one canoe.• Canoe can hold up to two people.• Can never be more cannibals than

missionaries on either side of the river.• Aim: To get all safely across the river

without any missionaries being eaten.

Page 27: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Original Problem Solution• Send over 2 Cannibals• Send one Cannibal back• Send over 2 Cannibals• Send one Cannibal back• Send over 2 Missionaries• Send one Cannibal and one Missionary back• Send over 2 Missionaries• Send one Cannibal back• Send over 2 cannibals• Send one cannibal back• Send over 2 cannibals

Page 28: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Revised problem

• Five missionaries and five cannibals• Want to cross a river using one canoe.• Canoe can hold up to three people.• Can never be more cannibals than

missionaries on either side of the river.• Aim: To get all safely across the river

without any missionaries being eaten.

• States?? Actions?? Goal test?? Path cost??

Page 29: Problem Solving Agents. So Far… Traditional AI begins with some simple premises: –An intelligent agent lives in a particular environment. –An intelligent

Revised Problem Solution• Send over 3 Cannibals• Send 1 Cannibal back• Send over 2 Cannibals• Send 1 Cannibal back• Send over 3 Missionaries• Send one Cannibal and one Missionary back• Send over 3 Missionaries• Send one Cannibal back• Send over 3 cannibals• Send one cannibal back• Send over 2 cannibals