0% found this document useful (0 votes)
14 views

Module 2 Ai

The document provides an overview of problem solving agents in artificial intelligence. It discusses key concepts like the notion of state, problem formulation, search strategies, and example problems. The document outlines the typical steps problem solving agents use which are goal formulation, problem formulation, search, and execution. It also discusses toy problems like the vacuum cleaner agent and 8 puzzle problem that are commonly used to illustrate search algorithms.

Uploaded by

Norah Eliz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Module 2 Ai

The document provides an overview of problem solving agents in artificial intelligence. It discusses key concepts like the notion of state, problem formulation, search strategies, and example problems. The document outlines the typical steps problem solving agents use which are goal formulation, problem formulation, search, and execution. It also discusses toy problems like the vacuum cleaner agent and 8 puzzle problem that are commonly used to illustrate search algorithms.

Uploaded by

Norah Eliz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

CST401

ARTIFICIAL INTELLIGENCE
MODULE II

1
Syllabus
➢Problem solving Agents: Solving Problems by searching
➢The Notion of ‘STATE’ in AI Problems
➢Steps Required to solve a problem in problem solving agents
➢Examples problems using problem solving approach
➢Searching for solutions
➢ Uninformed search strategies
-DFS
-BFS
-Uniform cost search
-Depth limited search
-Iterative deepening DFS
-Bidirectional State
➢ Informed search strategies
-Greedy best first
-A* Algorithm

➢Heuristic functions

2
Problem solving agents
➢Simplest Goal Based Agent
➢Agent adopt a goal and aim at satisfying them
➢Goals help to organize behavior by limiting the objectives that the
agent is trying to achieve and hence the actions it needs to consider
➢It uses Search based algorithms to solve a problem

3
The Notion of ‘STATE’ in AI Problems
➢To define the input and output of an AI problem,
researchers define the term ‘State’
➢What is meant by a state ?
➢ It is the representation of all information necessary to
make a decision for the problem at hand.

4
Contd..
➢For example in the case of vacuum cleaner agent, the decisions are
made based on the location of the agent and location of the dirt.
Based on that different state of the problem can be represented as

5
Contd..
➢How would we represent a state in an AI problem??
➢Three Representations
1. Atomic Representation: Each state of the world is indivisible, with no
internal structure
2. Factored Representation: Factored representation splits up each state
into a fixed set of variables or attributes, each of which can have a value
3. Structured Representation: Each state is represented as a set of objects
.Each object’s have its own attributes and relationships to other objects

6
Contd..

7
Contd..

8
Problem solving Agents use Atomic representation of state to
solve a problem

9
Steps Required to solve a problem in
problem solving agents
❖First we have to identify different states of the agent in the
given problem. Then follow the steps below;
1. Goal Formulation
2. Problem Formulation
3. Search
4. Execution

10
GOAL FORMULATION
➢First step in problem solving is goal formulation, based on the current
situation and the agent’s performance measure
➢The goal is represented as a set of world states, in which the goal is
satisfied.
➢For example , in the case of route finding problem( to find a path
from a location to another) goal state is specified as the destination
city
➢Another example is in the case of vacuum cleaner agent, the goal
states are the states with cleaned area

11
PROBLEM FORMULATION
➢Problem formulation phase models the problem with
following components;
1. The initial state that the agent starts in.
2. A description of possible actions available to the agent in each state
3. Transition Model: describes what each action does in particular state.
ie ,it specifies list of states that can be reachable from a given state by
doing an action; We also use the term successor to refer to any state
reachable from a given state by a single action
4. A Goal test, Which determines whether a given state is a goal state or
not
5. A path cost ,assigns numerical cost to each path. we assume that the
cost of a path can be described as the sum of the costs of the
individual actions along the path.
The problem-solving agent chooses a cost function that reflects
its own performance measure
12
PROBLEM FORMULATION of Route
finding problems
Suppose our problem is to find a route from Arad to
Bucharest in Romania. The problem can be formulated
as follows;
1.The initial state that the agent starts in. For example,
the initial state for our agent in Romania might be
described as In(Arad).

13
Contd..
2.Description of possible actions in each state:The possible actions in
each state is moving from one city to another
eg: Go(zerind),Go (sibiu) etc..
t

14
Contd..
3.Transition Model: Description of what each action does
For example, we have RESULT(In(Arad),Go(Zerind)) = In(Zerind)
The initial state, actions, and transition model implicitly define the
state space of the problem—the set of all states reachable from the
initial state by any sequence of actions. The state space forms a directed
network or graph in which the nodes are states and the links between
nodes are actions.
A path in a state space is a sequence of states connected by sequence of
actions.

15
State space

16
Contd..
5.A Goal test, Which determines whether a given state is a goal
state or not

6.A path cost ,assigns numerical cost to each path. The problem-
solving agent chooses a cost function that reflects its own
performance measure. For the agent trying to get to Bucharest, time is
of the essence, so the cost of a path might be its length in kilometers

17
SEARCH
➢The process of looking for a sequence of actions that reaches from
initial state to the goal state is called search
➢A search algorithm takes a problem definition as input and returns a
solution in the form of an action sequence to reach a goal .

18
EXCECUTION
➢Once a solution is found, the actions it recommends can be
carried out. This is called the execution phase

19
Agent h

PROBLEM SOLVING AGENT


has a “formulate, search, execute” design

20
Assumptions about the properties of the Environment
in problem solving agents

◦ Observable: agent always knows the current state


◦ Discrete: at any given state there are only finitely many actions to
choose from
◦ Known: agent knows which states are reached by each action.
◦ Deterministic: each action has exactly one outcome
Under these assumptions, the solution to any problem is a fixed sequence of
actionsUnder these assumptions, the solution to any problem is a fixed sequence of
actions.
DEPARTMENT OF CSE SNGCE 13

21
Example Problems
➢The problem solving approach has been applied to a vast array of task
environments . They can be classified as toy and real-world problems
➢Toy Problem is intended to illustrate or exercise various problem
solving methods . E.g., puzzle, chess, etc.
➢A real-world problem is one whose solutions people actually care
about. E.g., Design, planning, etc.

22
Toy problems

1. Vacuum cleaner Agent


2. 8 Puzzle problem
3. 8 Queens problem

23
1)Vacuum cleaner Agent
The state is determined by both the Agent location and the dirt locations. The
agent is in one of two locations, each of which might or might not contain dirt.
Thus, there are 2 × 22 = 8 possible world states. A larger environment with n
locations has n * 2n states.

24
Contd..
The problem can be formulated as
➢Initial state: Any state can be designated as the initial state.

➢Actions: In this simple environment, each state has just three actions:
Left, Right, and Suck. Larger environments might also include Up and
Down.

25
Contd..

➢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. The complete state space is shown in Figure

➢Goal test: This checks whether all the squares are clean.
➢Path cost: Each step costs 1, so the path cost is the number of steps in the path

26
2)8 PUZZLE Problem
➢Given a 3×3 board with 8 tiles (every tile has one number from 1 to 8) and one
empty space. The objective is to place the numbers on tiles to match the final
configuration using the empty space. We can slide four adjacent (left, right,
above, and below) tiles into the empty space.

27
Contd..
➢In 8 puzzle problems ,each configuration of 8 numbers and blank
space can be considered as a state.
• Initial state: Any state can be designated as the initial state. Note
that any given goal
• Actions: The simplest formulation defines the actions as movements
of the blank space Left, Right, Up, or Down. Different subsets of these
are possible depending on where the blank is.

28
Contd..
• Transition model: Given a state and action, this returns the
resulting state; for example,if we apply Left to the start state
in Figure , the resulting state has the 5 and the blank
switched.
• Goal test: This checks whether the state matches the
given goal configuration
• Path cost: Each step costs 1, so the path cost is the number
of steps in the path.

29
3)8 Queens problem
➢The goal of the 8-queens problem is to place eight queens on a
chessboard such that no queen attacks any other. (A queen attacks any
piece in the same row, column or diagonal.)
➢There are two main kinds of Problem formulation.
❖In incremental formulation starting with an empty state, that
each action adds a queen to the chessboard
❖A complete-state formulation starts with all 8 queens on the
board and moves them around.

30
Contd..
➢ In 8 queens problem, any arrangement of 0 to 8 queens on the
board is a state.
➢The incremental formulation can be described as follows:
• Initial state: No queens on the board.
• Actions: Add a queen to any empty square.
• Transition model: Returns the board with a queen added to
the specified square.
• Goal test: 8 queens are on the board, none attacked.
➢In this formulation, we have 64 * 63 * ・ * 57 ≈ 1.8×1014 possible
sequences to investigate
31
Contd..
➢A better formulation of incremental formulation would prohibit placing a queen in any square
that is already attacked:

Here , all possible arrangements of n queens (0 ≤ n ≤ 8), one per column in the leftmost n
columns, with no queen attacking another can be considered as a state.

• Initial state: No queens on the board.


• Actions: Add a queen to any square in the leftmost empty column such that it is not attacked
by any other queen.
• Transition model: Returns the board with a queen added to the specified square.
• Goal test: 8 queens are on the board, none attacked.

• This formulation reduces the 8-queens state space from 1.8×1014 to just 2,057, and solutions
are easy to find

32
Contd..

The Complete formulation can be described as follows:


➢Initial State: Any state with all 8 queens on the board
➢Actions: Move the queens individually around
➢Transition Model :Returns the board with queen in new position
➢Goal state: 8 queens are on the board, none attacked

33
Real-world problems
❑ Route-finding problems
❑ Airline Travel problem
❑ Touring problems
❑ Travelling Salesman problem
❑ VLSI layout problem
❑ Robot navigation
❑ Automatic assembly sequencing

34
Airline travel problems
Consider the Airline travel problems(To find a set of connection flights from a source to
destination) that must be solved by a travel-planning Web site:

35
Touring problems
➢ Touring problems are closely related to route-finding problems, but with an
important difference;
Touring problems are required to find a path ,which must visit every
intermediate city at least once and return back to the staring city
For example ; Suppose our Touring problem includes 5 cities,say A,B,C,D,E ,and
our staring city is A ,Touring problem is required to find a path , which includes
all the cities at least once and staring and ending at A.
➢ As with route finding, the actions correspond to trips between adjacent cities.
The state space, however, is quite different. Each state must include not just
the current location but also the set of cities the agent has visited

36
Contd..
➢ So the initial state would be In(A), Visited({A}), a typical intermediate state
would be In(C), Visited({A,D}),
➢ Goal test would check whether the agent is in Bucharest and all 20 cities
have been visited.

37
Traveling salesperson problem
➢ The traveling salesperson problem (TSP) is a touring problem in which each
city must be visited exactly once.
➢ The aim is to find the shortest tour.
➢ The problem is known to be NP-hard, but an enormous amount of effort
has been expended to improve the capabilities of TSP algorithms.
➢ In addition to planning trips for traveling salespersons, these algorithms
have been used for tasks such as planning movements of automatic
circuit-board drills and of stocking machines on shop floors

38
VLSI layout
VLSI layout problem requires positioning millions of components and connections on a chip to
minimize area, minimize circuit delays, minimize stray capacitances, and maximize
manufacturing yield.
The layout problem comes after the logical design phase and is usually split into two parts:
◦ cell layout and channel routing.
Cell layout
◦ The primitive components of the circuit are grouped into cells, each of which performs some recognized
function.
◦ Each cell has a fixed footprint and requires a certain number of connections to each of the other cells.
◦ The aim is to place the cells on the chip so that they do not overlap and so that there is room for the
connecting wires to be placed between the cells.
Channel routing
◦ Finds a specific route for each wire through the gaps between the cells.

39
Automatic assembly sequencing
➢ Aim is to find an order in which to assemble the parts of
some object.
➢ If the wrong order is chosen, there will be no way
to add some part later in the sequence without
undoing some of the work already done.
➢ Checking a step in the sequence for feasibility is a
difficult geometrical search problem closely related to
robot navigation.
➢ Thus, the generation of legal actions is the expensive
part of assembly sequencing.

40

You might also like