0% found this document useful (0 votes)
27 views83 pages

Poai-Unit 1

Uploaded by

vsroshini05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views83 pages

Poai-Unit 1

Uploaded by

vsroshini05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 83

Rajalakshmi Engineering College

An Autonomous Institution
Chennai-602105
PRINCIPLES OF ARTIFICIAL INTELLIGENCE
(AI19341)
UNIT 1
PRINCIPLES OF ARTIFICIAL
INTELLIGENCE (AI19341)

Department
of CSE
SYLLABUS
UNIT-I Introduction to Artificial intelligence and UNIT-III Constraint satisfaction problems and Game
Problem- Solving Agent 9 Theory 9
Problems of AI, AI technique, Tic – Tac – Toe problem. Local search for constraint satisfaction problems.
Intelligent Agents, Agents & environment, nature of Adversarial search, Games, optimal decisions & strategies
environment, structure of agents, goal-based agents, utility- in games, the minimax search procedure, alpha-beta
based agents, learning agents. Defining the problem as state pruning, additional refinements, iterative deepening.
space search, production system, problem characteristics, UNIT-IV Knowledge & reasoning 9
issues in the design of search programs.
Statistical Reasoning: Probability and Bays’ Theorem,
UNIT-II Search techniques 9 Certainty Factors and Rule-Base Systems, Bayesian
Problem solving agents, searching for solutions; uniform Networks, Dempster-Shafer Theory, Fuzzy Logic. AI for
search strategies: breadth first search, depth first search, knowledge representation, rule-based knowledge
depth limited search, bidirectional search, comparing representation, procedural and declarative knowledge,
uniform search strategies. Heuristic search strategies Logic programming, Forward and backward reasoning.
Greedy best-first search, A* search, AO* search, memory UNIT-V Introduction to Machine Learning 9
bounded heuristic search: local search algorithms &
optimization problems: Hill climbing search, simulated Exploring sub-discipline of AI: Machine Learning,
annealing search, local beam search. Supervised learning, Unsupervised learning, Reinforcement
learning, Classification problems, Regression problems,
Clustering problems, Introduction to neural networks and
deep learning.

Department
of CSE
LAB SYLLABUS
1. Programs on Problem Solving
a. Write a program to solve 8 Queens problem
b. Solve any problem using a depth-first search
c. Implement MINIMAX algorithm
d. Implement A* algorithm
2 Programs on Decision Making and Knowledge Representation
a. Introduction to PROLOG
b. Implementation of Unification and Resolution Algorithm
c. Implementation of Backward Chaining
d.Implementation of forwarding
Chaining 3 Programs on Planning and
Learning
e. Implementation of Blocks World
program
f. Implementing a fuzzy inference system
g. Implementing Artificial Neural
Networks for an application using
python
Department
h. Implementation of Decision Tree
of CSEof the K-mean
i. Implementation
algorithm
BOOKS
TEXT BOOKS:
1.S. Russell and P. Norvig, Artificial Intelligence: A Modern
Approach, Prentice Hall, Third Edition,2009.
2.Nils J. Nilsson, Artificial Intelligence: A New Synthesis (1
ed.), Morgan- Kaufmann, 1998. ISBN 978-1558605350.
REFERENCE BOOKS:
1. Elaine Rich, Kevin Knight, & Shivashankar B Nair, Artificial
Intelligence,
McGraw Hill, 3rd ed.,2017.
2. Introduction to Artificial Intelligence & Expert Systems,
Patterson, Pearson, 1st ed. 2015
3. Logic & Prolog Programming, Saroj Kaushik, New Age
International, Ist edition, 2002.
4. Expert Systems: Principles and Programming,11 March 1998.
Edition: 4th.
ISBN: 9788131501672
Department
of CSE
UNIT I
Introduction to Artificial intelligence and Problem-
Solving Agent

Problems of AI, AI technique, Tic – Tac – Toe


problem. Intelligent Agents, Agents &
environment,
environment, agents,
nature goal-based
of
structure of utility-learning
agents,
agents. Defining
based
problem as agents,
state thespace search, production
system, problem characteristics, issues in the
design of search programs.

Department
of CSE
UNIT I
Introduction to Artificial intelligence and Problem-
Solving Agent
• What is AI ?
– Artificial Intelligence is concerned with the design of intelligence in an
artificial device.
– The term was coined by McCarthy in 1956.
So, AI is nothing
– There are two ideas in the definition. but a machine with
• 1. Intelligence 2.
thoughts and
• Artificial device
What is intelligence? reason.
– Intelligence
world.
is the computational part of the ability to achieve goals in the

– It is the capacity to acquire and apply knowledge.


– An inherent power of thought and reason.
– In education ,the ability to learn or understand or to deal with new
challenging situations.
• What is artificial device?
– Made by human beings instead of nature.

Department
of CSE
What’s involved in Intelligence?
• Ability to interact with the real world
- to perceive, understand, and act
e.g., speech recognition, understanding and synthesis
-image understanding
- ability to take actions, have an effect
• Reasoning and Planning
- modeling the external world, given input
- solving new problems, planning, and making decisions
- ability to deal with unexpected problems, uncertainties
• Learning and Adaptation
- we are continuously learning and adapting
e.g., a baby learning to categorize and recognize animals

Department
of CSE
Acting humanly: The Turing Test approach
• The Turing Test, proposed by Alan Turing (1950), was
designed to provide a satisfactory operational
definition of intelligence.

• A computer passes the test if a human interrogator, after


posing some written questions, cannot tell
whether the written responses come from a
person or from a computer.

• The computer
capabilities: would need to possess the

following
natural language processing to enable it to
communicate successfully in English;
– knowledge representation to store what it knows or
hears;

– automated reasoning to use the stored information


to answer questions and to draw
new conclusions;
– machine learning to adapt to new
circumstances and to detect and extrapolate patterns.

Department
of CSE
The Turing Test approach(Cont..)
• Turing’s test avoided direct physical interaction between
the interrogator and the computer,
• The total Turing Test includes a video signal so that the interrogator
can test the subject’s perceptual abilities.
• To pass the total Turing Test, the computer will need
– computer vision to perceive objects, and
– robotics to manipulate objects and move about.
• Predicted that by 2000, a machine might have a 30% chance of
fooling a lay person for 5 minutes
• Turing deserves credit for designing a test that remains relevant 60
years later.

• Turing Test is not reproducible , constructive or


amenable to mathematical analysis.
Department
of CSE
AI History

Department
of CSE
AI Tasks

Department
of CSE
Problems in AI
Artificial Intelligence research during the last three decades has
concluded that Intelligence requires knowledge. To compensate
for overwhelming quality, knowledge possesses less desirable
properties.
– It is huge.
– It is difficult to characterize correctly.
– It is constantly varying, continuous in nature
– It differs from data by being organized in a
way that corresponds to its application.
– It is complicated

Department
of CSE
Problems in AI
To deal with the AI model we have to consider the
following questions:
• What are the underlying assumptions about
intelligence?
• What kinds of techniques will be useful for solving
AI problems?
• At what level human intelligence can be modeled?
• When to realize an intelligent program has been
built?

Department
of CSE
What is an AI technique?
It is a method that exploits knowledge that should be represented in such
a way that:
– The knowledge captures generalizations that share properties
– It can be understood by people who must provide it—even
though the bulk of the data for many programs comes
automatically from readings.
– It can easily be modified to correct errors and to reflect changes
in the world
– It can be used in many situations, even if it is not totally accurate
or complete
– It can be used to help overcome its sheer bulk by helping to
narrow the range of possibilities that must usually be considered

Department
of CSE
AI Techniques
 It is possible to solve AI problems without using AI
techniques and also Non-AI-problems can be solved
using AI –techniques.
 AI techniques are problem-independent.

Department
of CSE
POAI-Susmita Mishra
Tic-Tac-Toe Problem(1- approach)
• The Tic-Tac-Toe game consists of a nine-element vector called BOARD; it
represents the numbers 1 to 9 in three rows. An element contains the value
0 for blank, 1 for X, and 2 for O.
• A MOVETABLE vector consists of 19,683 elements (39) and is needed where
each element is a nine-element vector. The contents of the vector are
specially chosen to help the algorithm.
• The algorithm makes moves by pursuing the following:
1. View the vector as a ternary number. Convert it to a decimal number.
2. Use the decimal number as an index in MOVETABLE and access the vector.
3. Set BOARD to this vector indicating how the board looks after the move.
 This approach is capable in time but it has several disadvantages.
 It takes more space and requires stunning effort to calculate the decimal
numbers.
 This method is specific to this game and cannot be completed.

Department
of CSE
Heuristic Function in AI
(Artificial Intelligence)
A heuristic function in artificial intelligence, also known as a heuristic or
simply a heuristic, is an evaluation function used to estimate the cost or
potential of reaching a goal state from a given state in a problem-solving
domain.

Heuristics are typically rules of thumb or approximate strategies that guide


the search for a solution. They provide a way to assess the desirability of
different options without exhaustively exploring every possibility.
Agents and Environments
• An agent is anything that can be viewed as perceiving its environment through
sensors and acting upon that environment through actuators to achieve a
predetermined goal.
• We use the term percept to refer to the agent’s perceptual inputs at any given
instant.
• An agent’s percept sequence is the complete history of everything the agent
has ever perceived.
Note: an agent’s choice of action at any given instant can depend on the entire
percept sequence observed to date, but not on anything it hasn’t perceived.
• An agent’s behavior is described by the agent function that maps any given
percept sequence to an action
Department
of CSE
Agent

Department
of CSE
Agent Program
• Internally, the agent function for an artificial agent will be
implemented by an agent program.

Department
of CSE
Good Behaviour: The Concept Of Rationality
 A rational
is one that does the right
agent
thing.
 This notion of desirability is captured by a
performance measure that evaluates any
given sequence of environment states.
 Rationality: What is rational at any given time
depends on four things:
 The performance measure that defines the criterion of success.
 The agent’s prior knowledge of the environment.
 The actions that the agent can perform.
 The agent’s percept sequence to date.
Department
of CSE
Rational Agent
Rational Agent: For each possible percept
sequence, a rational agent should select an action
that is expected to maximize its performance
measure, given the evidence provided by the
percept sequence and whatever built-in
knowledge the agent has.

Department
of CSE
The Nature of Environments
• The task environments, which are essentially the “problems”
to which rational agents are the “solutions”.

Department
of CSE
Department
of CSE
Properties of task environments
• Fully observable vs. partially observable
– If an agent’s sensors give it access to the complete state of the
environment at each point in time, then we say that the task
environment is fully observable.
– An environment might be partially observable because of noisy
and inaccurate sensors or because parts of the state are simply
missing from the sensor data
• Single agent vs. multiagent
– crossword puzzle - Single agent
– Chess- Two agents
• Deterministic vs. stochastic
– If the next state of the environment is completely deter mined by
the current state and the action executed by the agent, then we
say the environment is deterministic; otherwise, it is stochastic.

Department
of CSE
Properties of task environments
Episodic vs. sequential
– In an episodic task environment, the agent’s experience is divided
into atomic episodes. In each episode the agent receives a
percept and then performs a single action. Crucially, the
next episode does not depend on the actions taken in
previous episodes.
– In sequential environments, on the other hand, the current
decision could affect all future decisions.
– Chess and taxi driving are sequential: in both cases, short-term
actions can have long-term consequences.
– Episodic environments are much simpler than sequential
environments because the agent does not need to think
ahead.

Department
of CSE
Properties of task environments

Static vs. dynamic


 If the environment can change while an
agent is deliberating, then we say the
environment is dynamic for that agent;
otherwise, it is static.
 Static environments are easy to deal with
because the agent need not keep looking
at the world while it is deciding on an
action, nor need it worry about the
passage of time.
Department
of CSE
Properties of task environments
Discrete vs. continuous
 The discrete/continuous distinction applies
to the state of the environment, to the
way time is handled, and to the percepts
and actions of the agent. For example,
the chess environment has a finite number
of distinct states (excluding the clock).Chess
also has a discrete set of percepts and
actions.
• Taxi driving is a continuous-state and
continuous-time problem: the speed and
location of the taxi and of the other
vehicles sweep through a range of continuous
Department
of CSE
values and do so smoothly over time.
Task Environment Examples

POAI-Susmita Mishra
Department
of CSE
The Structure of Agents
• The job of AI is to design an agent program
that
implements the agent function— the mapping from
percepts to actions.

• This program will run on some sort of computing


device with physical sensors and actuators—we call
this the architecture

Department
of CSE
Agent Program

Department
of CSE
Types of Agents

 Simple reflex agents


 Model-based reflex agents
 Goal-based agents
 Utility-based agents.

Department
of CSE
Simple reflex agent

• The simplest kind of agent is the simple reflex


agent.
• These agents select actions based on the
current percept, ignoring the rest of
the percept history
• if car-in-front-is-braking then initiate-braking

• Rectangles are used to denote the


internal state of the agent’s decision process,
current
and ovals represent the background
information used in the process.

Department
of CSE
Simple reflex agent
INTERPRET-INPUT function generates an
abstracted description of the current
state from the percept.
RULE-MATCH function returns the first
rule in the set of rules that matches the
given state description.
The agent will work only if the correct
decision can be made on the basis of only
the current percept—that is, only if the
environment is fully observable.
Even a little bit of unobservability can
cause serious trouble
Infinite loops are often unavoidable for
simple reflex agents operating in partially
observable environments.

Department
of CSE
Model-based reflex agents
•The agent should maintain
some sort of internal
state ,that depends on the
percept history and thereby
reflects at least some of the
unobserved aspects of
the current state.

•This knowledge about


“how the world works”—
whether implemented in
simple Boolean circuits or in
complete scientific theories —
model is a model
is called model-
of the world.
agen
An agent
called a that uses
basedsuch a
t.

Department
of CSE
Model-based reflex agents(Cont.)
•A model-
based reflex
agent. It
keeps track
of the current
state of the
world,
•using
an internal
model. It then
chooses an
action in
the same way
as the reflex
agent.

Department
of CSE
Goal-based agents
• Knowing something about the
current state of
environment is
enough to decide thewhat
notto do.
For example, atalways a road
junction, the taxi can turn left,
turn right, or go straight on .
The correct decision depends
on where the taxi is trying to
get to.
• In other words, as well as a
current state description,
the GOAL agent needs some
sort of goal information
that
describes situations that are A model-based, goal-based agent. It keeps track of
desirable—for example, being the world state as well as a set of goals it is trying to
at the passenger’s achieve, and chooses an action that will (eventually)
destination. lead to the achievement of its goals.

Department
of CSE
Goal-based agents(Cont..)

The agent program can


combine this with the
model to select actions that
achieve and
Searc the goal.
plannin are
h
subfieldstheof gAI devoted to
finding action sequences that
achieve the agent’s goals

A model-based, goal-based agent. It keeps track of


the world state as well as a set of goals it is trying to
achieve, and chooses an action that will (eventually)
lead to the achievement of its goals.

Department
of CSE
Utility-based agents

Goals alone are not enough to generate


high-quality behavior in most
environments. For example, many action
sequences will get the taxi to its
destination (thereby achieving the goal)
but some are quicker, safer, more
reliable, or cheaper than others.
Goals just provide a crude binary
distinction between “happy” and
“unhappy” states.

Department
of CSE
Utility-based agents(cont..)
A more general performance
shoul allow a
measure comparison
d of different states
happy they would make
world according to the agent.
exactly
how
computerscientists use the term utility
instead “ Happy” not sound
does scientific, very
scientists
economists
use the term utility
and instead
The word “utility” here refers to “the
quality of being useful.” computer
A rational utility-based agent
chooses the action that maximizes
the expected utility of the action
outcomes

Department
of CSE
Learning agents
• Learning element, which is
responsible for
making improvements
• Performance element, which is
responsible for
selecting external actions.
• Critic on how the agent is doing
and ,determines how
the performance element
should be modified to
do better in the
future
• Problem generator is
responsible for suggesting
actions that will lead to new and
informative experiences.

Department
of CSE
PROBLEM FORMULATION

• Problem
formulation is the Formulate a Goal

process of deciding
what actions and Search Problem

states to consider,
Formulatio
n

given a goal. Execute

Department
of CSE
State Space Search
A state space is a mathematical representation of a
problem that defines all possible states that the
problem can be in. Furthermore, in search algorithms,
we use a state space to represent the current state of
the problem, the initial state, and the goal state.
Additionally, we represent each state in the state
space by a set of variables.
Components of a Problem
Five components need to define a problem as state space search problem –
Initial state– It is the starting point of an agent. i.e. in (Agent X). The starting
state which agent knows itself.
Actions – A description of the possible actions available to the agent. Given a
particular state s, ACTIONS(s) returns the set of actions that can be executed in s.
Transition model -A description of what each action does; the formal name for
this is the transition model, specified by a function RESULT(s, a) that returns the
state that results from doing action a in state s.
– Successor Function -The set of possible actions available to the agent. The term
operator is used to denote the description of an action in terms of which state
will be reached by carrying out the action in a particular state.
– For a successor function S, given a particular state x, S(x) returns the set of states
reachable from x by any single action.
– Set of all states reachable from initial state is known as state space search.
– State Space – the state space forms a graph in which the nodes are states
and arcs between nodes are actions.

Department
of CSE
Cont..
The goal test – In which the agent can apply to a single state
description to determine if it is a goal state. Sometimes there is an
explicit set of possible goal states, and the test simply checks to see if
we have reached one of them. Sometimes the goal is specified by an
abstract property rather than an explicitly enumerated set of states.
– For example, in chess, the goal is to reach a state called
"checkmate," where the opponent's king can be captured on
the next move no matter what the opponent does.
Path cost– A path cost function is a function that assigns a cost to a
path. In all cases we will consider , the cost of a path is the sum of the
costs of the individual actions along the path. The path cost function is
often denoted by g.
• Path: A path in the state space is a sequence of states connected
by a sequence of actions

Department
of CSE
Formal Description of the problem

 Define a state space that contains all the possible configurations of


the relevant objects.
 Specify one or more states within that space that describe possible
situations from which the problem solving process may start ( initial
state)
 Specify one or more states that would be acceptable as solutions to
the problem. ( goal states)
 Specify a set of rules that describe the actions (operations)
available.

Department
of CSE
Problem Solving Agent

Department
of CSE
Problem Solving Agent-Approach
Goal Formulation-
Goal={world states which achieves desired
Goals help to organize behavior by limiting the
results}
objectives.
Problem Formulation-
After setting the goals ,it is the time to find out what
will be the sequence of action which generate goal
It is the process of deciding what actions and states to
set.
consider
given a ,
goal.
Searching-The agent’s search for desirable sequence of
actions. Execution- Once a solution is found , the actions it
recommends can be carried out in the execution phase.

Department
of CSE
Toy problems - Vacuum world

Department
of CSE
Vacuum world problem

Department
of CSE
8-puzzle problem
• The 8-puzzle problem consists of
a 3 x 3 board with
eight numbered tiles and a
blank space.
• A tile adjacent to the blank space
can slide into the space.
• The object is to reach a specified
goal state.

Department
of CSE
8-puzzle problem …

Department
of CSE
8-QUEENS PROBLEM

Department
of CSE
The Water Jug Problem
You are given two jugs, a 4-gallon one and a 3-gallon one. Neither have any
measuring markers on it. There is a pump that can be used to fill the jugs with
water.
How can you get exactly 2 gallons of water into 4-gallon
• Let x and y be the amounts of water in 4-gallon and 3-gallon
jug?
Gallon respectively
•(x , y) refers to water available at any time in 4-gallon, 3-gallon jugs.
•(x , y) (x - d, y + d) means drop some unknown amount d of water from 4-
gallon and add d onto 3-gallon jug.
The state space for this problem can be described as the set of ordered pairs of
integers (x , y) such that
x = 0, 1,2, 3 or 4 and y = 0,1,2 or 3; x represents the quantity of water in the
4- gallon jug and y represents the quantity of water in 3-gallon jug.

•The start state is (0,0)


•The goal state is (2,n)

Department
of CSE
Sl No Current state Next State Description
1 (x,y) if x < 4 (4,y) Fill the 4 gallon jug
2 (x,y) if y <3 (x,3) Fill the 3 gallon jug
3 (x,y) if x > 0 (x-d, y) Pour some water out of the 4 gallon jug
4 (x,y) if y > 0 (x, y-d) Pour some water out of the 3-gallon jug
5 (x,y) if x>0 (0, y) Empty the 4 gallon jug
6 (x,y) if y >0 (x,0) Empty the 3 gallon jug on the ground
7 (x,y) if x+y >= 4 and y >0 (4, y-(4-x)) Pour water from the 3 –gallon jug into the 4 –gallon
jug until the 4-gallon jug is full
8 (x, y) if x+y >= 3 and x>0 (x-(3-y), 3) Pour water from the 4-gallon jug into the 3-
gallon jug until the 3-gallon jug is full
9 (x, y) if x+y <=4 and y>0 (x+y, 0) Pour all the water from the 3-gallon jug into the
4- gallon jug
10 (x, y) if x+y <= 3 and x>0 (0, x+y) Pour all the water from the 4-gallon jug into the
3- gallon jug
11 (0,2) (2,0) Pour the 2 gallons from 3-gallon jug into the 4-
gallon jug
12 (2,y) (0,y) Empty the 2 gallons in the 4-gallon jug on
the ground

Department
of CSE
Solution of water-jug problem

Gallons in the 4-gallon Gallons in the 3-gallon


Rule applied
jug jug

0 0 2

0 3 9

3 0 2

3 3 7

4 2 5 or 12

0 2 9 0r 11

2 0

Department
of CSE
Another solution of water-jug problem

Gallons in the 4-gallon jug Gallons in the 3-gallon jug Rule applied
0 0 1
4 0 8
1 3 4
1 0 8
0 1 1
4 1 8
2 3

Department
of CSE
Production
typically used toSystems
Production system or production rule system is a computer program
provide some form of artificial intelligence, which
consists primarily of a set of rules about behavior but it also includes
the mechanism necessary to follow those rules as the system
responds to states of the world.

 A production system consists of:


• A set of rules, each consisting of a left side that
determines the applicability of the rule and a right side that
describes the operation to be performed if that rule is applied.
• One or more knowledge/databases that contain whatever
information is appropriate for the particular task. Some parts of the
database may be permanent, while other parts of it may pertain
only to the solution of the current problem.
• A control strategy that specifies the order in which the rules
will be compared to the database and a way of resolving the
conflicts that arise when several rules match at once.
•A rule applier
Department
of CSE
Components of Production
System
The major components of Production System in Artificial
Intelligence are:

•Global Database: The global database is the central data


structure used by the production system in Artificial Intelligence.

•Set of Production Rules: The production rules operate on the


global database. Each rule usually has a precondition that is either
satisfied or not by the global database. If the precondition is
satisfied, the rule is usually be applied. The application of the rule
changes the database.

•A Control System: The control system then chooses which


applicable rule should be applied and ceases computation when a
termination condition on the database is satisfied. If multiple rules
are to fire at the same time, the control system resolves the
conflicts.
To solve a
problem
• We must first reduce it to one for which a precise statement
can be given. This can be done by defining the
problem’s state space (start and goal states) and a set
of operators for moving that space.

• The problem can then be solved by searching for a path


through the space from an initial state to a goal state.

• The process of solving the problem can usefully be modeled


as a production system.

Department
of CSE
Control Strategies
Control strategy decides which rule to apply next during the process of
searching for a solution to a problem.

Requirements for a good Control Strategy


•It should cause motion - In water jug problem, if we apply a simple
control strategy of starting each time from the top of rule
list and choose the first applicable one, then we will never move
towards solution.

• It should explore the solution space in a systematic manner -If


we choose another control strategy, say, choose a rule randomly from
the applicable rules then definitely it causes motion and eventually
will lead to a solution. But one may arrive to same state several times.
This is because control strategy is not systematic.

Department
of CSE
Breadth First Search
Algorithm:
1. Create a variable called NODE-LIST and set it to initial state
2. Until a goal state is found, or NODE-LIST is empty do
a. Remove the first element from NODE-LIST and call it E.
If NODE-LIST was empty, quit
b. For each way that each rule can match the state described
in E do:
i. Apply the rule to generate a new state
ii. If the new state is a goal state, quit and return this
state
iii. Otherwise, add the new state to the end of NODE-
LIST
Advantages of BFS
 BFS will not get trapped exploring a blind alley. This
contrasts with DFS, which may follow a single unfruitful path
for a very long time, perhaps forever, before the path terminates
in a state that has no successors.
 If there is a solution, BFS is guaranteed to find it.
 If there are multiple solutions, then a minimal solution will
be found.

Department
of CSE
Depth First Search
1. If the initial state is a goal state, quit and
return success
2. Otherwise, do the following until success
or failure is signaled:
a. Generate a successor, E, of initial state. If there are no
more successors, signal failure.
b. Call Depth-First Search, with E as the initial state
c. If success is returned, signal success. Otherwise
continue in this loop.
Advantages of Depth-First Search
• DFS requires less memory since only
the nodes on the current path are stored.
• By chance, DFS may find a
solution without examining much of the
search space at all.

Department
of CSE
POAI-Susmita Mishra
Problem Characteristics
In order to choose the most appropriate method(s) for
a particular problem , we must analyze the problem
along several dimensions.
1. Is the problem decomposable into a set of
independent smaller sub problems?

Example: Decomposable Problem


Decomposable problems can be solved by the divide-
and-conquer technique. In divide and conquer
technique, divide the problem into sub-problems,
find the solutions for the sub-problems. Finally,
integrate the solutions for the sub-problems, we will
get the solution for the original problem. Suppose we
want to solve the problem of computing the integral
of the following expression
∫(x2+ 3x + sin2x * cos2x) dx

Department
of CSE
Problem Characteristics

Example : Non-Decomposable
problem There are non-
decomposable problems. For
example, Block world problem
is non-decomposable.

Department
of CSE
Problem Characteristics
2. Can Solution Steps be ignored or at least undone if they prove to
be unwise?

In real life, there are three important types of



• Recoverable ( 8-puzzle)
problems: Ignorable ( theorem proving)
• Irrecoverable ( Chess)
• •
Ignorable
Suppose (wetheorem
have proved some lemma in order to prove a
theorem and eventually realized that lemma is no help at all, then
ignore it and prove another lemma.
proving)
• It can be solved by using simple control strategy.
• •
Recoverable
Objective of( 8-8 puzzle game is to rearrange a given initial
configuration of eight numbered tiles on 3 X 3 board (one place is
puzzle)
empty) into a given final configuration (goal state). Rearrangement
is done by sliding one of the tiles into empty square.

Department
of CSE
Problem Characteristics

2 8 3 1 2 3 2 8 3 2 8 3 2 8 2 8

1 6 4 4 5 6 1 4 1 4 1 4 3 1 4 3
7 6 5 7 6 5 7 6 5 7 6 5
7 5 7 8

Start
2 8 1 2 8 1 2 8 1 2 8
Final
state state 1 4 3 4 3 4 3 4 6 3
7 6 5 7 6 5 7 6 5 7 5

1 2 8 1 2 8 1 2

4 6 3 4 6 4 6

7 5 7 5 3 7 5 3

Department
of CSE
Problem Characteristics
• Irrecoverable ( Chess)
A stupid move cannot be undone.
Can be solved by planning process.
3. Is the universe predictable?
There are two types of problems.

Certain
Able outcome
to plan (8-puzzle
the entire sequenceproblem)
of moves.

Certain outcome and uncertain
Uncertain outcome (Bridge game)
outcome.
It is not possible to plan the entire sequence of actions. We do not know
exactly where all the cards are or what the other players will do on their turns.
To overcome this, investigate several plans and use probabilities of the various
outcomes to choose a plan that has the highest estimated probability of leading
to a good score on the hand.

Department
of CSE
Problem Characteristics
4. Isa good solution absolute or relative?
There are two types of problems
Any path problem
Best path problem
Any path problem
Any path problems can often
be solved in a reasonable
amount of time by using
heuristics that suggest good
paths to explore.
Consider a problem of
answering questions based on
the database of simple facts.
1. Marcus was a man.
2. Marcus was a Pompeian.
3. Marcus was born in
40AD.
4. All men are mortal.
Department
5. All Pompeian died in 79
AD. of CSE
6. No mortal lives longer
Problem Characteristics
Suppose we ask a question ,”Is Marcus is alive?”. From the facts given we can easily derive an answer to the
question.
1. Marcus was a man. 1
4. All men are mortal. 4
8. Marcus was a mortal. 1, 4
3. Marcus was born in 40AD. 3
7. It is now 1991 AD. 7
9. Marcus age is 1951 years. 3, 7
6. No mortal lives longer than 150 years. 6
10. Marcus was dead 6.8.9
OR

7. It is now 1991 AD. 7


5. All Pompeian died in 79 AD. 5
11. All Pompeian are dead now. 7, 5
2. Marcus was a Pompeian. 2
10. Marcus was dead 11, 2

Either of two reasoning paths will lead to the answer. We need to find only the answer to the question.
No need to go back and see if some other path might also lead to a solution.

Department
of CSE
Problem Characteristics
Best path problem
• In travelling salesman problem, our goal is to find the shortest route that
visits each city exactly once.

Department
of CSE
Problem Characteristics
5. Is the solution a state or
path? State
Finding a consistent interpretation for the sentence “The bank
president ate a dish of pasta salad with the fork”. We need to find
the interpretation but not the record of the processing.
Path
In water jug problem, it is not sufficient to report that the problem
is solved, and the goal is reached, it is (2,0). For this problem, we
need the path from the initial state to the goal state.

Department
of CSE
Problem Characteristics
6. What is the role of knowledge?
For e.g., Chess playing
Knowledge about the legal moves of the problem is needed. Without the
knowledge, we can not be able to solve the problem.
7. Does the task require Interaction with a person?
Solitary in which the computer is given a problem description and produces
an answer with no intermediate communication and no demand for an
explanation of the reasoning process.
Conversational in which there is intermediate communication between a
person and the computer, either to provide additional assistance to the
computer or to provide additional information to the user, or both.

Department
of CSE
Production System Characteristics
• Production systems provide us with good ways of
describing the operations that can be performed in a
search for a solution to a problem.
• At this time, two questions may arise:
1. Can production systems be described by a set of
characteristics? And how can they be easily implemented?
2.What relationships are there between the problem
types and the types of production systems well suited for
solving the problems?

Department
of CSE
Production Characteristics
1. A monotonic production system A monotonic production
system is when two rules are simultaneously applied to the
machine. Using one rule doesn’t affect the other rule in any
way, which makes their co-existence easy.
2. A non-monotonic production This production system
increases the problem-solving efficiency of the machine and
eliminates previous records. However, since this production
system does not allow backtracking the previous record, it is
believed to be mostly used for solving ignorable problems.

Department
of CSE
3. A partially commutative production system In a partially communicative
production system, when two or more rules are used to derive a result, any
combination of the same rules produces the same result. Simply put, it
means any permutation and combination of a set of rules will produce a
similar result every time.
4. A communicative production system is utilized for problems in which
changes can reverse the outcome. That means the sequence of the operation
is not critical in this class of production system.
Production Characteristics

Blocks world
problem

8-puzzle problem

Department
of CSE
Production Characteristics
Partially commutative non-monotonic Production
System Example: Robot Navigation
The Robot has the following operators: go north (N), go east (E), go
south (S), and go west (W). To reach its goal, it does not matter
whether the robot executes N-N-E or N-E-N.

Non-partially commutative monotonic Production System


Example: Chemical synthesis
“Add chemical x to pot” OR “Change temperature to t degrees”
These operators may cause irreversible changes to the potion being
brewed. The order in which they are performed can be very important
in determining the final output.

Department
of CSE
Issues in the Design of Search
Programs
 Each search process can be considered to be a tree
traversal.
 The objective of the search is to find a path from the
initial state to a goal state using a tree.
 The number of nodes generated might be huge; and in
practice many of the nodes would not be needed.
 The secret of a good search routine is to generate only
those nodes that are likely to be useful, rather than having
a precise tree.
 The rules are used to represent the tree implicitly and only
to create nodes explicitly if they are actually to be of use
Department
of CSE
Issues in the Design of Search
Programs
 The tree can be searched forward from the initial node to
the goal state or backwards from the goal state to the
initial state.
 To select applicable rules, it is critical to have an efficient
procedure for matching rules against states.
 How to represent each node of the search process?
 This is the knowledge representation problem or the
frame problem. In games, an array suffices; in other
problems, more complex data structures are needed.

Department
of CSE
Issues in the Design of Search
Programs

Department
of CSE
Check duplicate nodes

Department
of CSE

You might also like