Download Problem Solving by searching and more Lecture notes Artificial Intelligence in PDF only on Docsity!
SOLVING PROBLEMS
BY SEARCHING
Nguyแป
n Ngแปc Thแบฃo [email protected] CS420 โ Artificial Intelligence
Outline
- Problem-Solving Agents
- Example Problems
- Searching for Solutions
A touring holiday in Romania
What makes a good trip at Arad?
- take in the sights, enjoy the foods, etc.
- avoid hangovers
- โฆ However, there will be your friendโs wedding tomorrow at Bucharest!!!
Goal-based agents
- Intelligent agents are supposed to maximize their
performance measure.
- Different factors for performance measure โ making decisions involves many tradeoffs
- Goals help organize behavior by limiting the objectives that
the agent is trying to achieve and the actions it considers.
Traveling from Arad to Bucharest
Goal-based agents in Romania
- The agent initially does not know which road to follow
โ unknown environment, try an action randomly
- Suppose the agent has a map of Romania.
An agent with several immediate options of unknown value
can decide what to do by first examining future actions that
eventually lead to states of known value.
- The agent discovers many hypothetical
journey and finds a journey that
eventually gets to Bucharest.
Solving problem by searching
- Search: the process of looking for a sequence of actions
that reaches the goal
- A search algorithm takes a problem as input and returns a
solution in the form of an action sequence.
- Execution phase: once a solution is found, the
recommended actions are carried out.
- While executing the solution, the agent ignores its percepts when choosing an action โ open-loop system
Solving problem by searching
function SIMPLE-PROBLEM-SOLVING-AGENT( percept ) returns an action persistent : seq , an action sequence, initially empty state , some description of the current world state goal , a goal, initially null problem , a problem formulation state โ UPDATE-STATE( state, percept ) if seq is empty then goal โ FORMULATE-GOAL( state ) problem โ FORMULATE-PROBLEM( state, goal ) seq โ SEARCH( problem ) if seq = failure then return a null action action โ FIRST( seq ) seq โ REST( seq ) return action
The state space
- The set of all states reachable from the initial state by any
sequence
- Implicitly defined by the initial state, actions, and transition model
- Directed graph โ nodes are states and the links between
nodes are actions.
- A path in the state space is a sequence of states connected by a sequence of actions.
Well-define problems and solutions
- Goal test: determine whether a given state is a goal state
- The goal is specified by either an explicit set of possible goal states or an abstract property.
- E.g., ๐ผ๐(๐ต๐ข๐โ๐๐๐๐ ๐ก), checkmate
- Path cost: a function that assigns a numeric cost to each
path
- Nonnegative, reflecting the agentโs performance measure
- E.g., ๐ ๐ผ๐ ๐ด๐๐๐ , ๐บ๐ ๐๐๐๐๐๐ , ๐ผ๐ ๐๐๐๐๐๐ = 75
- An optimal solution has the lowest path cost.
Formulating problems by abstraction
- Abstraction is critical for automated problem solving
- Real-world is too detailed to model exactly
- Create an approximate, simplified, model of the world for the computer to deal with
- The choice of a good abstraction thus involves
- Removing as much detail as possible while
- Retaining validity and ensuring that the abstract actions are easy to carry out
Example Problems
- Toy Problems
- Real-world Problems
The Vacuum-cleaner world
- States: determined by both the agent location and the dirt
locations
- 2 ร 2 2 = 8 possible world states (๐ ร 2 ๐ in general)
- Initial state: Any state can be designated as the initial state.
- Actions: Left, Right, and Suck
- Larger model may include Up and Down, etc.
- Transition model: The actions have their expected effects.
- Except that moving Left in the leftmost square, moving Right in the rightmost square, and Sucking in a clean square have no effect.
- Goal test: whether all the squares are clean
- Path cost: each step costs 1
The Vacuum-cleaner world
The state space for the vacuum world Links denote actions: L = Left, R = Right, S = Suck.