SlideShare uma empresa Scribd logo
1 de 40
PANKAJ DEBBARMA
Deptt. of CSE, TIT, Narsingarh
Contents
• Production Systems
– A simple string rewriting production system example
• Search Problem
• Basic searching process
• Algorithm’s performance and complexity
– Computational complexity
– ‘Big - O’ notation
• Tower of Hanoi
• 8 Puzzle
• Water Jug Problem
• Can Solution Steps be Ignored
• Is Good Solution Absolute or Relative
• Issues in the Design of Search Programs
Production Systems
• A production system (or production rule system)
is a computer program typically used to 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.
• Productions consist of two parts: a sensory
precondition (or "IF" statement) and an action (or
"THEN").
A simple string rewriting production
system example
• P1: $$ -> *
• P2: *$ -> *
• P3: *x -> x*
• P4: * -> null & halt
• P5: $xy -> y$x
• P6: null -> $
$ABC (P6)
B$AC (P5)
BC$A (P5)
$BC$A (P6)
C$B$A (P5)
$C$B$A (P6)
$$C$B$A (P6)
*C$B$A (P1)
C*$B$A (P3)
C*B$A (P2)
CB*$A (P3)
CB*A (P2)
CBA* (P3)
CBA (P4)
Search Problem
• Search is the process of allowing for several
possible sequences of operators to be applied
to the initial state and finding a sequence that
culminates in a goal state.
• Any search problem consists of the following:
S : full set of states
S0 : initial state
A : S → s is a set of operators
G : set of final states
Initial state
Goal states
actions
Search Problem
• Involves finding a sequence of actions that
transforms the agent from the initial state to a
goal state.
• Represented by a 4 tuple {S,S0,A,G}.
• Sequence of actions is called a solution path.
• It is a path from initial state to a goal state S.
• Plan P is a sequence of actions.
P = {a0, a1, a2, ... aN}
• A sequence of states is called a path.
Basic searching process
• Check the current node.
• Execute an allowable action to find the
successor states.
• Pick one of the new states.
• Check if the new state is a solution state.
• If it is not, the new state becomes the current
state and the process is repeated.
Initial state
Goal states
S0
Initial state
Goal states
S1
Initial state
Goal states
S2
Initial state
Goal states
S3
Initial state
Goal states
S4
Initial state
Goal states
S4
• The example illustrates how we can start from a
given state and follow the successor to find the
solution paths that lead to a goal state.
• The brown node defines the search tree.
• Typically, the search tree is extended one node
at a time.
• The search strategy is used to find the order of
the search tree.
For formal problem description
• Define a state space that contains all the possible
configurations of the relevant objects.
• Specify one or more (initial) states within that
space that describe possible situations from
which the problem solving process may start.
• Specify one or more (goal) states that would be
acceptable as solutions to the problem.
• Specify a set of rules that describe the actions.
Order of application of the rules is called control
strategy.
• Control strategy should cause motion towards a
solution.
Algorithm’s performance and
complexity
• Performance of an algorithm depends on internal
and external factors.
• Internal factors/External factors
– Time required to run
– Size of input to the algorithm
– Space (memory) required to run
– Speed of the computer
– Quality of the compiler
• Complexity is a measure of the performance of
an algorithm. Complexity measures the internal
factors, usually in time than space.
Computational complexity
• It is the measure of resources in terms of Time
and Space.
• If A is an algorithm that solves a decision problem
f, then run-time of A is the number of steps taken
on the input of length n.
• Time Complexity T(n) of a decision problem f is
the run-time of the ‘best’ algorithm A for f.
• Space Complexity S(n) of a decision problem f is
the amount of memory used by the ‘best’
algorithm A for f.
‘Big - O’ notation
• The Big-O, theoretical measure of the execution
of an algorithm, usually indicates the time or the
memory needed, given the problem size n, which
is usually the number of items
• The Big-O notation is used to give an
approximation to the run-time-efficiency of an
algorithm
• The letter ‘O’ is for order of magnitude of
operations or space at run-time
‘Big - O’ notation
• If an algorithm A requires time proportional to
f(n), then algorithm A is said to be of order
f(n), and it is denoted as O(f(n)).
• If algorithm A requires time proportional to
n2, then the order of the algorithm is said to
be O(n2).
• If algorithm A requires time proportional to n,
then the order of the algorithm is said to be
O(n).
‘Big - O’ notation
• Determine the Big-O of an algorithm to
calculate the sum of the n elements in an
integer array a[0..n-1].
Line Instructions No. of
execution steps
line 1 sum 1
line 2 for(i=0; i<n; i++) n+1
line 3 sum += a[i] n
line 4 print sum 1
Total 2n + 3
‘Big - O’ notation
Thus, the polynomial (2n + 3) is dominated by
the 1st term as n while the number of elements
in the array becomes very large.
• In determining the Big-O, ignore constants
such as 2 and 3. So the algorithm is of order n.
• So the Big-O of the algorithm is O(n).
• In other words the run-time of this algorithm
increases roughly as the size of the input data
n, e.g., an array of size n.
Tower of Hanoi
The objective of the puzzle is to move the entire
stack to the last rod, obeying the following rules:
1. Only one disk may be moved at a time.
2. Each move consists of taking the upper disk
from one of the stacks and placing it on top
of another stack or on an empty rod.
3. No disk may be placed on top of a disk that is
smaller than it.
Tower of Hanoi
• With 3 disks, the puzzle can be solved in 7
moves.
• The minimal number of moves required to
solve a Tower of Hanoi puzzle is 2n − 1,
where n is the number of disks.
Tower of Hanoi
• Operators: In the goal state, all the pegs are in
needle B, as shown in figure below.
A B C A B C
Tower of Hanoi
Step 1 : move A → B
Step 2 : move A → C
Step 3 : move B → C
Step 4 : move A → B
Step 5 : move C → A
Step 6 : move C → B
Step 7 : move A → B
• Operators/actions: The
blocks can be moved left,
right, up, or down.
8 Puzzle
• The Hamming distance between a board and the goal
board is the number of tiles in the wrong position.
• The Manhattan distance between a board and the
goal board is the sum of the Manhattan distances (sum
of the vertical and horizontal distance) from the tiles to
their goal positions.
8 Puzzle
8 Puzzle
8 Puzzle
Water Jug Problem
Problem statement: Given two jugs, a 4-gallon and
3-gallon having no measuring markers on them.
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 jug?
Solution:
• State for this problem can be described as the set
of ordered pairs of integers (X, Y) such that
- X represents the number of gallons of water in
4-gallon jug, and
- Y for 3-gallon jug
• Start state is (0, 0)
• Goal state is (2, n) for any value of n
Water Jug Problem: Production Rules
R1: (X, Y | X < 4) (4, Y) Fill 4G
R2: (X, Y | Y < 3) (X, 3) Fill 3G
R3: (X, Y | X > 0) (0, Y) Empty 4G
R4: (X, Y | Y > 0) (X, 0) Empty 3G
R5: (X, Y | X+Y ≥ 4 ꓥ Y > 0) (4, Y – (4-X)) Pour water from 3G into
4G until 4G is full
R6: (X, Y | X+Y ≥ 3 ꓥ X > 0) (X – (3-Y), 3) Pour water from 4G jug
into 3G until 3G is full
R7: (X, Y | X+Y ≤ 4 ꓥ Y > 0) (X+Y, 0) Pour all water from 3G
into 4G
R8: (X, Y | X+Y ≤ 3 ꓥ X > 0) (0, X+Y) Pour all water from 4G
into 3G
Water Jug Problem: Solution 1
# Rules applied 4G 3G
1 Initial state 0 0
2 R2 {Fill 3G} 0 3
3 R7 {Pour all water from 3G to 4G} 3 0
4 R2 {Fill 3G} 3 3
5 R5 {Pour from 3G to 4G until it is full} 4 2
6 R3 {Empty 4G} 0 2
7 R7 {Pour all water from 3G to 4G} 2 0
Water Jug Problem: Solution 2
# Rules applied 4G 3G
1 Initial state 0 0
2 R1 {Fill 4G} 4 0
3 R6 {Pour from 4G to 3G until it is full} 1 3
4 R4 {Empty 3G} 1 0
5 R8 {Pour all water from 4G to 3G} 0 1
6 R1 {Fill 4G} 4 1
7 R6 {Pour from 4G to 3G until it is full} 2 3
8 R4 {Empty 3G} 2 0
Can Solution Steps be Ignored?
1. Ignorable, in which solution steps can be
ignored. Eg: Theorem Proving
2. Recoverable, in which solution steps can be
undone. Eg: 8-Puzzle
3. Irrecoverable, in which solution steps cannot
be undone. Eg: Chess
Is Good Solution Absolute or
Relative?
Consider the problem of answering
questions based on a database of simple
facts such as the following:
1. Jack Dawson was a man.
2. Jack Dawson was travelling in Titanic.
3. Jack Dawson was born in 1891.
4. All men are mortal.
5. All travelling in Titanic died as it sank in the
Atlantic on April 15, 1912.
6. No mortal lives longer than 100 years.
Suppose we ask a question: ‘Is Jack Dawson alive?’
Is Good Solution Absolute or
Relative?
Method I:
1. Jack Dawson was a man.
2. Jack Dawson was born in 1891.
3. All men are mortal.
4. Now it is 2022, so Jack Dawson’s age is 131 years.
5. No mortal lives longer than 100 years.
Method II:
1. Jack Dawson was travelling in Titanic.
2. All travelling in Titanic died as it sank in the Atlantic
on April 15, 1912.
ANSWER: So Jack Dawson is not alive.
Issues in the Design of Search
Programs
• Each search program can be considered to be
a tree traversal.
• The object of the search is to find a path from
the initial state to a goal state using a tree.
• 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.
Issues in the Design of Search
Programs
1. The trees can be searched forward from the
initial node to the goal state or backwards
from the goal state to the initial state.
2. To select applicable rules, it is critical to have
an efficient procedure for matching rules
against states.
3. How to represent each node of the search
process?
Production Systems and Search Algorithms

Mais conteúdo relacionado

Mais procurados

AI_Session 10 Local search in continious space.pptx
AI_Session 10 Local search in continious space.pptxAI_Session 10 Local search in continious space.pptx
AI_Session 10 Local search in continious space.pptxAsst.prof M.Gokilavani
 
Backtracking Algorithm.ppt
Backtracking Algorithm.pptBacktracking Algorithm.ppt
Backtracking Algorithm.pptSalmIbrahimIlyas
 
Informed search (heuristics)
Informed search (heuristics)Informed search (heuristics)
Informed search (heuristics)Bablu Shofi
 
AI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAsst.prof M.Gokilavani
 
Artificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesArtificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesDr. C.V. Suresh Babu
 
Ai lecture 06(unit-02)
Ai lecture 06(unit-02)Ai lecture 06(unit-02)
Ai lecture 06(unit-02)vikas dhakane
 
Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligencesandeep54552
 
I. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithmI. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithmvikas dhakane
 
I.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AII.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AIvikas dhakane
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy AlgorithmWaqar Akram
 
Artificial intelligence(04)
Artificial intelligence(04)Artificial intelligence(04)
Artificial intelligence(04)Nazir Ahmed
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IMohamed Loey
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen ProblemSukrit Gupta
 
Ai 03 solving_problems_by_searching
Ai 03 solving_problems_by_searchingAi 03 solving_problems_by_searching
Ai 03 solving_problems_by_searchingMohammed Romi
 

Mais procurados (20)

AI_Session 10 Local search in continious space.pptx
AI_Session 10 Local search in continious space.pptxAI_Session 10 Local search in continious space.pptx
AI_Session 10 Local search in continious space.pptx
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Backtracking Algorithm.ppt
Backtracking Algorithm.pptBacktracking Algorithm.ppt
Backtracking Algorithm.ppt
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Informed search (heuristics)
Informed search (heuristics)Informed search (heuristics)
Informed search (heuristics)
 
AI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptx
 
Artificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesArtificial Intelligence Searching Techniques
Artificial Intelligence Searching Techniques
 
Ai lecture 06(unit-02)
Ai lecture 06(unit-02)Ai lecture 06(unit-02)
Ai lecture 06(unit-02)
 
Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligence
 
Informed search
Informed searchInformed search
Informed search
 
I. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithmI. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithm
 
I.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AII.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AI
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy Algorithm
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Artificial intelligence(04)
Artificial intelligence(04)Artificial intelligence(04)
Artificial intelligence(04)
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen Problem
 
Ai 03 solving_problems_by_searching
Ai 03 solving_problems_by_searchingAi 03 solving_problems_by_searching
Ai 03 solving_problems_by_searching
 
Complexity analysis in Algorithms
Complexity analysis in AlgorithmsComplexity analysis in Algorithms
Complexity analysis in Algorithms
 

Semelhante a Production Systems and Search Algorithms

unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptxGavy11
 
Design and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms Lecture NotesDesign and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms Lecture NotesSreedhar Chowdam
 
Heuristic approach optimization
Heuristic  approach optimizationHeuristic  approach optimization
Heuristic approach optimizationAng Sovann
 
Class13_Quicksort_Algorithm.pdf
Class13_Quicksort_Algorithm.pdfClass13_Quicksort_Algorithm.pdf
Class13_Quicksort_Algorithm.pdfAkashSingh625550
 
Dsoop (co 221) 1
Dsoop (co 221) 1Dsoop (co 221) 1
Dsoop (co 221) 1Puja Koch
 
Sorting Algorithm
Sorting AlgorithmSorting Algorithm
Sorting AlgorithmAl Amin
 
03_UninformedSearch.pdf
03_UninformedSearch.pdf03_UninformedSearch.pdf
03_UninformedSearch.pdfkaxeca4096
 
Search-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdfSearch-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdfMrRRThirrunavukkaras
 
AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek
AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjekAIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek
AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjekpavan402055
 
problem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsproblem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsSlimAmiri
 
UninformedSearch (2).pptx
UninformedSearch (2).pptxUninformedSearch (2).pptx
UninformedSearch (2).pptxSankarTerli
 
AI-State Space Representation.pptx
AI-State Space Representation.pptxAI-State Space Representation.pptx
AI-State Space Representation.pptxRatnakar Mikkili
 
AI-State Space Representation.pptx
AI-State Space Representation.pptxAI-State Space Representation.pptx
AI-State Space Representation.pptxRatnakar Mikkili
 

Semelhante a Production Systems and Search Algorithms (20)

Rai practical presentations.
Rai practical presentations.Rai practical presentations.
Rai practical presentations.
 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
 
Design and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms Lecture NotesDesign and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms Lecture Notes
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Heuristic approach optimization
Heuristic  approach optimizationHeuristic  approach optimization
Heuristic approach optimization
 
Class13_Quicksort_Algorithm.pdf
Class13_Quicksort_Algorithm.pdfClass13_Quicksort_Algorithm.pdf
Class13_Quicksort_Algorithm.pdf
 
Dsoop (co 221) 1
Dsoop (co 221) 1Dsoop (co 221) 1
Dsoop (co 221) 1
 
Sorting Algorithm
Sorting AlgorithmSorting Algorithm
Sorting Algorithm
 
03_UninformedSearch.pdf
03_UninformedSearch.pdf03_UninformedSearch.pdf
03_UninformedSearch.pdf
 
1 blind search
1 blind search1 blind search
1 blind search
 
DAA Notes.pdf
DAA Notes.pdfDAA Notes.pdf
DAA Notes.pdf
 
l2.pptx
l2.pptxl2.pptx
l2.pptx
 
Search-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdfSearch-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdf
 
AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek
AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjekAIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek
AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek
 
problem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsproblem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , probloms
 
Searching Algorithms
Searching AlgorithmsSearching Algorithms
Searching Algorithms
 
UninformedSearch (2).pptx
UninformedSearch (2).pptxUninformedSearch (2).pptx
UninformedSearch (2).pptx
 
l2.pptx
l2.pptxl2.pptx
l2.pptx
 
AI-State Space Representation.pptx
AI-State Space Representation.pptxAI-State Space Representation.pptx
AI-State Space Representation.pptx
 
AI-State Space Representation.pptx
AI-State Space Representation.pptxAI-State Space Representation.pptx
AI-State Space Representation.pptx
 

Mais de Pankaj Debbarma

OS-01 Virtual Memory.pptx
OS-01 Virtual Memory.pptxOS-01 Virtual Memory.pptx
OS-01 Virtual Memory.pptxPankaj Debbarma
 
AI-06 Search Techniques - Informed.pptx
AI-06 Search Techniques - Informed.pptxAI-06 Search Techniques - Informed.pptx
AI-06 Search Techniques - Informed.pptxPankaj Debbarma
 
CP03-Data Structures.pptx
CP03-Data Structures.pptxCP03-Data Structures.pptx
CP03-Data Structures.pptxPankaj Debbarma
 
CP02-Structure and Union.pptx
CP02-Structure and Union.pptxCP02-Structure and Union.pptx
CP02-Structure and Union.pptxPankaj Debbarma
 
Computer Graphics & Visualization - 06
Computer Graphics & Visualization - 06Computer Graphics & Visualization - 06
Computer Graphics & Visualization - 06Pankaj Debbarma
 
NETWORK LAYER - Logical Addressing
NETWORK LAYER - Logical AddressingNETWORK LAYER - Logical Addressing
NETWORK LAYER - Logical AddressingPankaj Debbarma
 
TRANSPORT LAYER - Process-to-Process Delivery: UDP, TCP and SCTP
TRANSPORT LAYER - Process-to-Process Delivery: UDP, TCP and SCTPTRANSPORT LAYER - Process-to-Process Delivery: UDP, TCP and SCTP
TRANSPORT LAYER - Process-to-Process Delivery: UDP, TCP and SCTPPankaj Debbarma
 

Mais de Pankaj Debbarma (14)

AI-09 Logic in AI
AI-09 Logic in AIAI-09 Logic in AI
AI-09 Logic in AI
 
OS-02 Segmentation.pptx
OS-02 Segmentation.pptxOS-02 Segmentation.pptx
OS-02 Segmentation.pptx
 
AI-08 Game Playing.pptx
AI-08 Game Playing.pptxAI-08 Game Playing.pptx
AI-08 Game Playing.pptx
 
OS-01 Virtual Memory.pptx
OS-01 Virtual Memory.pptxOS-01 Virtual Memory.pptx
OS-01 Virtual Memory.pptx
 
AI-06 Search Techniques - Informed.pptx
AI-06 Search Techniques - Informed.pptxAI-06 Search Techniques - Informed.pptx
AI-06 Search Techniques - Informed.pptx
 
CP03-Data Structures.pptx
CP03-Data Structures.pptxCP03-Data Structures.pptx
CP03-Data Structures.pptx
 
CP02-Structure and Union.pptx
CP02-Structure and Union.pptxCP02-Structure and Union.pptx
CP02-Structure and Union.pptx
 
CP01.pptx
CP01.pptxCP01.pptx
CP01.pptx
 
Computer Graphics & Visualization - 06
Computer Graphics & Visualization - 06Computer Graphics & Visualization - 06
Computer Graphics & Visualization - 06
 
HTTP and Email
HTTP and EmailHTTP and Email
HTTP and Email
 
Ppt World Wide Web
Ppt World Wide WebPpt World Wide Web
Ppt World Wide Web
 
Ppt congestion control
Ppt congestion controlPpt congestion control
Ppt congestion control
 
NETWORK LAYER - Logical Addressing
NETWORK LAYER - Logical AddressingNETWORK LAYER - Logical Addressing
NETWORK LAYER - Logical Addressing
 
TRANSPORT LAYER - Process-to-Process Delivery: UDP, TCP and SCTP
TRANSPORT LAYER - Process-to-Process Delivery: UDP, TCP and SCTPTRANSPORT LAYER - Process-to-Process Delivery: UDP, TCP and SCTP
TRANSPORT LAYER - Process-to-Process Delivery: UDP, TCP and SCTP
 

Último

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Último (20)

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

Production Systems and Search Algorithms

  • 1. PANKAJ DEBBARMA Deptt. of CSE, TIT, Narsingarh
  • 2. Contents • Production Systems – A simple string rewriting production system example • Search Problem • Basic searching process • Algorithm’s performance and complexity – Computational complexity – ‘Big - O’ notation • Tower of Hanoi • 8 Puzzle • Water Jug Problem • Can Solution Steps be Ignored • Is Good Solution Absolute or Relative • Issues in the Design of Search Programs
  • 3. Production Systems • A production system (or production rule system) is a computer program typically used to 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. • Productions consist of two parts: a sensory precondition (or "IF" statement) and an action (or "THEN").
  • 4. A simple string rewriting production system example • P1: $$ -> * • P2: *$ -> * • P3: *x -> x* • P4: * -> null & halt • P5: $xy -> y$x • P6: null -> $ $ABC (P6) B$AC (P5) BC$A (P5) $BC$A (P6) C$B$A (P5) $C$B$A (P6) $$C$B$A (P6) *C$B$A (P1) C*$B$A (P3) C*B$A (P2) CB*$A (P3) CB*A (P2) CBA* (P3) CBA (P4)
  • 5. Search Problem • Search is the process of allowing for several possible sequences of operators to be applied to the initial state and finding a sequence that culminates in a goal state. • Any search problem consists of the following: S : full set of states S0 : initial state A : S → s is a set of operators G : set of final states
  • 7. Search Problem • Involves finding a sequence of actions that transforms the agent from the initial state to a goal state. • Represented by a 4 tuple {S,S0,A,G}. • Sequence of actions is called a solution path. • It is a path from initial state to a goal state S. • Plan P is a sequence of actions. P = {a0, a1, a2, ... aN} • A sequence of states is called a path.
  • 8. Basic searching process • Check the current node. • Execute an allowable action to find the successor states. • Pick one of the new states. • Check if the new state is a solution state. • If it is not, the new state becomes the current state and the process is repeated.
  • 14. Initial state Goal states S4 • The example illustrates how we can start from a given state and follow the successor to find the solution paths that lead to a goal state. • The brown node defines the search tree. • Typically, the search tree is extended one node at a time. • The search strategy is used to find the order of the search tree.
  • 15. For formal problem description • Define a state space that contains all the possible configurations of the relevant objects. • Specify one or more (initial) states within that space that describe possible situations from which the problem solving process may start. • Specify one or more (goal) states that would be acceptable as solutions to the problem. • Specify a set of rules that describe the actions. Order of application of the rules is called control strategy. • Control strategy should cause motion towards a solution.
  • 16. Algorithm’s performance and complexity • Performance of an algorithm depends on internal and external factors. • Internal factors/External factors – Time required to run – Size of input to the algorithm – Space (memory) required to run – Speed of the computer – Quality of the compiler • Complexity is a measure of the performance of an algorithm. Complexity measures the internal factors, usually in time than space.
  • 17. Computational complexity • It is the measure of resources in terms of Time and Space. • If A is an algorithm that solves a decision problem f, then run-time of A is the number of steps taken on the input of length n. • Time Complexity T(n) of a decision problem f is the run-time of the ‘best’ algorithm A for f. • Space Complexity S(n) of a decision problem f is the amount of memory used by the ‘best’ algorithm A for f.
  • 18. ‘Big - O’ notation • The Big-O, theoretical measure of the execution of an algorithm, usually indicates the time or the memory needed, given the problem size n, which is usually the number of items • The Big-O notation is used to give an approximation to the run-time-efficiency of an algorithm • The letter ‘O’ is for order of magnitude of operations or space at run-time
  • 19. ‘Big - O’ notation • If an algorithm A requires time proportional to f(n), then algorithm A is said to be of order f(n), and it is denoted as O(f(n)). • If algorithm A requires time proportional to n2, then the order of the algorithm is said to be O(n2). • If algorithm A requires time proportional to n, then the order of the algorithm is said to be O(n).
  • 20. ‘Big - O’ notation • Determine the Big-O of an algorithm to calculate the sum of the n elements in an integer array a[0..n-1]. Line Instructions No. of execution steps line 1 sum 1 line 2 for(i=0; i<n; i++) n+1 line 3 sum += a[i] n line 4 print sum 1 Total 2n + 3
  • 21. ‘Big - O’ notation Thus, the polynomial (2n + 3) is dominated by the 1st term as n while the number of elements in the array becomes very large. • In determining the Big-O, ignore constants such as 2 and 3. So the algorithm is of order n. • So the Big-O of the algorithm is O(n). • In other words the run-time of this algorithm increases roughly as the size of the input data n, e.g., an array of size n.
  • 22. Tower of Hanoi The objective of the puzzle is to move the entire stack to the last rod, obeying the following rules: 1. Only one disk may be moved at a time. 2. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack or on an empty rod. 3. No disk may be placed on top of a disk that is smaller than it.
  • 23. Tower of Hanoi • With 3 disks, the puzzle can be solved in 7 moves. • The minimal number of moves required to solve a Tower of Hanoi puzzle is 2n − 1, where n is the number of disks.
  • 24. Tower of Hanoi • Operators: In the goal state, all the pegs are in needle B, as shown in figure below. A B C A B C
  • 25. Tower of Hanoi Step 1 : move A → B Step 2 : move A → C Step 3 : move B → C Step 4 : move A → B Step 5 : move C → A Step 6 : move C → B Step 7 : move A → B
  • 26. • Operators/actions: The blocks can be moved left, right, up, or down. 8 Puzzle
  • 27. • The Hamming distance between a board and the goal board is the number of tiles in the wrong position. • The Manhattan distance between a board and the goal board is the sum of the Manhattan distances (sum of the vertical and horizontal distance) from the tiles to their goal positions. 8 Puzzle
  • 30. Water Jug Problem Problem statement: Given two jugs, a 4-gallon and 3-gallon having no measuring markers on them. 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 jug? Solution: • State for this problem can be described as the set of ordered pairs of integers (X, Y) such that - X represents the number of gallons of water in 4-gallon jug, and - Y for 3-gallon jug • Start state is (0, 0) • Goal state is (2, n) for any value of n
  • 31. Water Jug Problem: Production Rules R1: (X, Y | X < 4) (4, Y) Fill 4G R2: (X, Y | Y < 3) (X, 3) Fill 3G R3: (X, Y | X > 0) (0, Y) Empty 4G R4: (X, Y | Y > 0) (X, 0) Empty 3G R5: (X, Y | X+Y ≥ 4 ꓥ Y > 0) (4, Y – (4-X)) Pour water from 3G into 4G until 4G is full R6: (X, Y | X+Y ≥ 3 ꓥ X > 0) (X – (3-Y), 3) Pour water from 4G jug into 3G until 3G is full R7: (X, Y | X+Y ≤ 4 ꓥ Y > 0) (X+Y, 0) Pour all water from 3G into 4G R8: (X, Y | X+Y ≤ 3 ꓥ X > 0) (0, X+Y) Pour all water from 4G into 3G
  • 32. Water Jug Problem: Solution 1 # Rules applied 4G 3G 1 Initial state 0 0 2 R2 {Fill 3G} 0 3 3 R7 {Pour all water from 3G to 4G} 3 0 4 R2 {Fill 3G} 3 3 5 R5 {Pour from 3G to 4G until it is full} 4 2 6 R3 {Empty 4G} 0 2 7 R7 {Pour all water from 3G to 4G} 2 0
  • 33. Water Jug Problem: Solution 2 # Rules applied 4G 3G 1 Initial state 0 0 2 R1 {Fill 4G} 4 0 3 R6 {Pour from 4G to 3G until it is full} 1 3 4 R4 {Empty 3G} 1 0 5 R8 {Pour all water from 4G to 3G} 0 1 6 R1 {Fill 4G} 4 1 7 R6 {Pour from 4G to 3G until it is full} 2 3 8 R4 {Empty 3G} 2 0
  • 34. Can Solution Steps be Ignored? 1. Ignorable, in which solution steps can be ignored. Eg: Theorem Proving 2. Recoverable, in which solution steps can be undone. Eg: 8-Puzzle 3. Irrecoverable, in which solution steps cannot be undone. Eg: Chess
  • 35. Is Good Solution Absolute or Relative? Consider the problem of answering questions based on a database of simple facts such as the following: 1. Jack Dawson was a man. 2. Jack Dawson was travelling in Titanic. 3. Jack Dawson was born in 1891. 4. All men are mortal. 5. All travelling in Titanic died as it sank in the Atlantic on April 15, 1912. 6. No mortal lives longer than 100 years. Suppose we ask a question: ‘Is Jack Dawson alive?’
  • 36. Is Good Solution Absolute or Relative? Method I: 1. Jack Dawson was a man. 2. Jack Dawson was born in 1891. 3. All men are mortal. 4. Now it is 2022, so Jack Dawson’s age is 131 years. 5. No mortal lives longer than 100 years. Method II: 1. Jack Dawson was travelling in Titanic. 2. All travelling in Titanic died as it sank in the Atlantic on April 15, 1912. ANSWER: So Jack Dawson is not alive.
  • 37. Issues in the Design of Search Programs • Each search program can be considered to be a tree traversal. • The object of the search is to find a path from the initial state to a goal state using a tree. • 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.
  • 38.
  • 39. Issues in the Design of Search Programs 1. The trees can be searched forward from the initial node to the goal state or backwards from the goal state to the initial state. 2. To select applicable rules, it is critical to have an efficient procedure for matching rules against states. 3. How to represent each node of the search process?