Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

21FE27 Artificial Intelligence - : III Year/V Semester IT Module-2

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 38

21FE27

ARTIFICIAL INTELLIGENCE

III YEAR/V SEMESTER – IT


Module-2
Module-2 Outline
2.1 Problem solving by searching
2.1.1. Problem solving agents and Example problems
2.1.2. Searching for Solutions
2.1.3. Uninformed search strategies
2.1.4. Informed (heuristics search strategies
2.1.5. Heuristics functions
2.2.Beyond classical search
2.2.1. Local search algorithms and optimization problems
2.2.2. Searching with partial observations
2.2.3. online search agents and unknown environments
2.3 Adversial search
2.3.1. Games
2.3.2. optimal decisions in games
2.3.3. Alpha-beta pruning
2.4. Constraint satisfaction problems
2.4.1. Backtracking search
2.4.2. Local search for constraint satisfaction problems .
Solving Problems by Searching
• Reflex agent is simple
– base their actions on
– a direct mapping from states to actions
– but cannot work well in environments
• which this mapping would be too large to store
and would take too long to learn
• Hence, goal-based agent is used i.e. problem
solving agent.
– Goal Based-Consider future actions & desirability
of their outcome
Problem-solving agent
• Problem-solving agent
– A kind of goal-based agent
– It solves problem by
• finding sequences of actions that lead to desirable
states (goals)
– To solve a problem,
• the first step is the goal formulation, based on the
current situation
• The second is problem formulation and third is
search function.
Goal formulation
• The goal is formulated
– as a set of world states, in which the goal is
satisfied
• Reaching from initial state  goal state
– Actions are required
• Actions are the operators
– causing transitions between world states
– Actions should be abstract enough at a
certain degree, instead of very detailed
– E.g., turn left VS turn left 30 degree,
degree etc.
Problem formulation
• The process of deciding
– what actions and states to consider
• E.g., driving Amman  Zarqa
– in-between states and actions defined
– States: Some places in Amman & Zarqa
– Actions: Turn left, Turn right, go straight,
accelerate & brake, etc.
Search
• Because there are many ways to achieve
the same goal
– Those ways are together expressed as a tree
– Multiple options of unknown value at a point,
• the agent can examine different possible
sequences of actions, and choose the best
– This process of looking for the best sequence
is called search
– The best sequence is then a list of actions,
called solution
Search algorithm
• Defined as
– taking a problem
– and returns a solution
• Once a solution is found
– the agent follows the solution
– and carries out the list of actions –
execution phase
• Design of an agent
– “Formulate, search, execute”
• The Three steps of solving problems
are------------,------------and --------------
• Goal based agents uses structured or
factored representation called
as……………
• The Three steps of solving problems are
Goal formulation,Problem formulation and
search.
• Goal based agents uses structured or
factored representation called asPlanning
agents.
Well-defined problems and solutions
A problem is defined by 5 components:
• Initial state
• Actions
• Transition model or
(Successor functions)
• Goal Test.
• Path Cost.
Well-defined problems and solutions
• A problem is defined by 4 components:
– The initial state
• that the agent starts in
– The set of possible actions
– Transition model: description of what each action
does.
(successor functions): refer to any state reachable
from given state by a single action
– Initial state, actions and Transition model define the
state space
• the set of all states reachable from the initial state by any
sequence of actions.
– A path in the state space:
• any sequence of states connected by a sequence of actions.
Well-defined problems and solutions
• The goal test
– Applied to the current state to test
• if the agent is in its goal
-Sometimes there is an explicit set of possible goal
states. (example: in Amman).
-Sometimes the goal is described by the properties
• instead of stating explicitly the set of states
– Example: Chess
• the agent wins if it can capture the KING of the opponent on
next move ( checkmate).
• no matter what the opponent does
Well-defined problems and solutions
• A path cost function,
– assigns a numeric cost to each path
– = performance measure
– denoted by g
– to distinguish the best path from others
• Usually the path cost is
– the sum of the step costs of the individual
actions (in the action list)
Well-defined problems and solutions
• Together a problem is defined by
– Initial state
– Actions
– Successor function
– Goal test
– Path cost function
• The solution of a problem is then
– a path from the initial state to a state satisfying the goal
test
• Optimal solution
– the solution with lowest path cost among all solutions
Formulating problems
• Besides the four components for problem
formulation
– anything else?
• Abstraction
– the process to take out the irrelevant information
– leave the most essential parts to the description of the
states
( Remove detail from representation)
– Conclusion: Only the most important parts that are
contributing to searching are used
Evaluation Criteria
• formulation of a problem as search task
• basic search strategies
• important properties of search strategies
• selection of search strategies for specific
tasks
(The ordering of the nodes in FRINGE
defines the search strategy)
Problem-Solving Agents
• agents whose task is to solve a particular
problem (steps)
– goal formulation
• what is the goal state
• what are important characteristics of the goal state
• how does the agent know that it has reached the goal
• are there several possible goal states
– are they equal or are some more preferable
– problem formulation
• what are the possible states of the world relevant for solving
the problem
• what information is accessible to the agent
• how can the agent progress from state to state
Example
From our Example
1. Formulate Goal

- Be In Amman

2. Formulate Problem

- States : Cities
- actions : Drive Between Cities

3. Find Solution

- Sequence of Cities : ajlun – Jarash - Amman


Our Example

1. Problem : To Go from Ajlun to Amman

2. Initial State : Ajlween

3. Operator : Go from One City To another .

4. State Space : {Jarash , Salat , irbed,……..}

5. Goal Test : are the agent in Amman.

6. Path Cost Function : Get The Cost From The Map.

7. Solution : { {Aj  Ja  Ir  Ma  Za  Am} , {Aj Ir  Ma  Za  Am} …. {Aj  Ja  Am} }


8. State Set Space : {Ajlun  Jarash  Amman}
Example: Romania
• On holiday in Romania; currently in Arad.
• Flight leaves tomorrow from Bucharest

• Formulate goal:
– be in Bucharest
• Formulate problem:
– states: various cities
– actions: drive between cities

• Find solution:
– sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest


Example: Romania
Single-state problem formulation
A problem is defined by four items:
1. actions or successor function S(x) = set of action–state pairs
– e.g., S(Arad) = {<Arad  Zerind, Zerind>, … }

2. goal test, can be


– explicit, e.g., x = "at Bucharest"
– implicit, e.g., Checkmate(x)

3. 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

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


goal state

• initial state e.g., "at Arad"


Example problems
• Toy problems
– those intended to illustrate or exercise various
problem-solving methods
– E.g., puzzle, chess, etc.
• Real-world problems
– tend to be more difficult and whose solutions
people actually care about
– E.g., Design, planning, etc.
Toy problems
• Example: vacuum world
Number of states: 8
Initial state: Any
Number of actions: 4
 left, right, suck,

noOp
Goal: clean up all dirt
 Goal states: {7, 8}

 Path Cost:

 Each step costs 1


The 8-puzzle
The 8-puzzle
• States:
– a state description specifies the location of each of
the eight tiles and blank in one of the nine squares
• Initial State:
– Any state in state space
• Successor function:
– the blank moves Left, Right, Up, or Down
• Goal test:
– current state matches the goal configuration
• Path cost:
– each step costs 1, so the path cost is just the length
of the path
The 8-queens
• There are two ways to formulate the
problem
• All of them have the common followings:
– Goal test: 8 queens on board, not attacking
to each other
– Path cost: zero
The 8-queens

• (1) Incremental formulation


– involves operators that augment the state
description starting from an empty state
– Each action adds a queen to the state
– States:
• any arrangement of 0 to 8 queens on board
– Successor function:
• add a queen to any empty square
The 8-queens
• (2) Complete-state formulation
– starts with all 8 queens on the board
– move the queens individually around
– States:
• any arrangement of 8 queens, one per column in
the leftmost columns
– Operators: move an attacked queen to a row,
not attacked by any other
The 8-queens
• Conclusion:
– the right formulation makes a big difference
to the size of the search space
Example: River Crossing

• Items: Man, Wolf, Corn, Chicken.


• Man wants to cross river with all items.
– Wolf will eat Chicken
– Chicken will eat corn.
– Boat will take max of two.
TEST Your Knowledge
Match the following
A B
States All squares clean
Initial State R,L,U,D
Actions Dirty or not
Transition model Return S
Goal test No Queen on board
Path Cost Number of steps in path
TEST Your Knowledge
Match the following -Answer
A B
States Dirty or not
Initial State No Queen on board

Actions R,L,U,D
Transition model Return S
Goal test All squares clean

Path Cost Number of steps in path


Next Session…
2.1.2. Searching for Solutions

You might also like