2
Most read
3
Most read
4
Most read
AI Problem Representation
ARTIFICIAL INTELLIGENCE PART #6
Water Jug Problem
A Water Jug Problem: You are given two jugs, a 4-gallon
one and a 3-gallon one, a pump which has unlimited water
which you can use to fill the jug, and the ground on which
water may be poured. Neither jug has any measuring markings
on it. How can you get exactly 2 gallons of water in the 4-
gallon jug?
State Representation
 We will represent a state of the problem as a tuple
(x, y) where x represents the amount of water in the 4-
gallon jug and y represents the amount of water in the 3-
gallon jug.
 Initial state as (0,0).
 Goal state as (2,y).
Production Rules
1. (x,y) If x<4 -> (4,y)
2. (x,y) If y<3 ->(x,3)
3. (x,y) If x>0 ->(x-d,y)
4. (x,y) If y>0 ->(x,y-d)
5. (x,y) If x>0 ->(0,y)
6. (x,y) If y>0 ->(x,0)
7. (x,y) If (x+y>=4 and y>0) ->(4,y-(4-x))
8. (x,y) If (x+y>=3 and x>0) ->(x-(3-y),3)
9. (x,y) If(x+y<=4 and y>0) ->(x+y,0)
10.(x,y) If (x+y<=3 and x>0) ->(0,x+y)
11.(0,2) ->(2,0)
WATER JUG: one of the Solution
4 Gallon
Jug
3 Gallon
Jug
Rule
applied
0 0
4 0 1
1 3 8
1 0 6
0 1 10
4 1 1
2 3 8
4 Gallon jug 3 Gallon jug
pump
Search Tree : Water Jug Problem
(0,0)
(4,0)
(4,3) (0,0) (1,3)
(0,3)
(4,3) (0,0) (3,0)
8 Queen Problem
Problem: Place 8 queens on a chess board so
that none of them attack each other.
Formulation- I
- A state is an arrangement of 0 to 8 queens on
the board
- Operators add a queen to any square.
This formulation is not a systematic way to
find the solution, it takes a long time to get
the solution.
-
Formulation – II
-A state is an arrangement of 0-8 queen with no one
attacked.
-Operators place a queen in the left most empty
column.
- More systematic than formulation-I
8 Queen Problem
Formulation –III
- A state is an arrangement of 8 queens on
in each column.
-Operators move an attacked queen to another
square in the same column.
-Keep on shuffling the queen until the goal is
reached.
- This formulation is more systematic hence ,
it is also called as Iterative Formulation.
8 Queen Problem
8 Queen Problem: one solution
8 Puzzle Problem
Start State Goal State
• State space (S)
• Location of each of the 8 tiles(and the blank tile)
• Start State (s)
• Starting configuration
Operators(O)
• Four Operators : Right, Left, Up, Down
• Goals(G) one of the goal configuration
8 Puzzle Problem
8 Puzzle Tree
Missionaries and Cannibals
• Three missionaries and three cannibals find themselves on a side
of river. They agreed to get to the other side of river.
• But missionaries are afraid of being eaten by cannibals so, the
missionaries want to manage the trip in such a way that no. of
missionaries on either side of the river is never less than the no.
of cannibals on the same side.
• The boat is able to hold only 2 people at a time.
Missionaries and Cannibals:
State representation
• State(#m,#c,1/0)
#m – number of missionaries on first bank #c –
number of cannibals on first bank
• The last bit indicate whether the boat is in
the first bank.
Operators
• Boat carries (1,0) or (0,1) or (1,1) or (2,0) or
(0,2)
FIND SOLUTION ?
Water jug problem ai part 6

More Related Content

PPTX
Presentation on Breadth First Search (BFS)
PPTX
SDLC Models
PPTX
Error Finding in Numerical method
PDF
UNIT 1 -BIG DATA ANALYTICS Full.pdf
PDF
PMP Chap 2- Org. Influence and Project Life Cycle
PPTX
Introduction To Biological Products, Biotechnological Products & Their Appli...
PPTX
Android Layout.pptx
PDF
C programming Workshop
Presentation on Breadth First Search (BFS)
SDLC Models
Error Finding in Numerical method
UNIT 1 -BIG DATA ANALYTICS Full.pdf
PMP Chap 2- Org. Influence and Project Life Cycle
Introduction To Biological Products, Biotechnological Products & Their Appli...
Android Layout.pptx
C programming Workshop

What's hot (20)

PPTX
Problem solving agents
PPT
Randomized algorithms ver 1.0
PPT
Artificial Intelligence: The Nine Phases of the Expert System Development Lif...
PDF
A* Search Algorithm
PDF
Java thread life cycle
PDF
Symbol table in compiler Design
PDF
Artificial Intelligence Notes Unit 2
PPTX
Code generation
PPT
Intermediate code generation (Compiler Design)
PPTX
The n Queen Problem
PDF
Intelligent Agent PPT ON SLIDESHARE IN ARTIFICIAL INTELLIGENCE
PDF
Unit3:Informed and Uninformed search
PPTX
daa-unit-3-greedy method
PDF
Target language in compiler design
PPTX
sum of subset problem using Backtracking
PPTX
Artificial Intelligence- TicTacToe game
PPTX
Knowledge representation In Artificial Intelligence
PDF
Deterministic Finite Automata (DFA)
PPT
Introduction to Compiler design
PPT
Organization and team structures
Problem solving agents
Randomized algorithms ver 1.0
Artificial Intelligence: The Nine Phases of the Expert System Development Lif...
A* Search Algorithm
Java thread life cycle
Symbol table in compiler Design
Artificial Intelligence Notes Unit 2
Code generation
Intermediate code generation (Compiler Design)
The n Queen Problem
Intelligent Agent PPT ON SLIDESHARE IN ARTIFICIAL INTELLIGENCE
Unit3:Informed and Uninformed search
daa-unit-3-greedy method
Target language in compiler design
sum of subset problem using Backtracking
Artificial Intelligence- TicTacToe game
Knowledge representation In Artificial Intelligence
Deterministic Finite Automata (DFA)
Introduction to Compiler design
Organization and team structures
Ad

Similar to Water jug problem ai part 6 (17)

PPTX
AI problem solving.pptx
PPTX
Problem Formulation
PDF
03_UninformedSearch.pdf
PPTX
AI-State Space Representation.pptx
PPTX
AI-State Space Representation.pptx
PPT
Uninformed Search goal based agents Representing states and operations
PDF
Ai lecture 8(unit02)
PPTX
UninformedSearch (2).pptx
PPT
Various Uninform Search Strategies in AI.ppt
PPT
AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek
PPTX
Lecture 09 uninformed problem solving
PDF
module5_backtrackingnbranchnbound_2022.pdf
PPTX
Searching in Artificial Intelligence for UG
PPTX
Presentaion on “MiniMax Algorithm and Water Jug Problem
PPTX
PPTX
Numerical literacy ( week 2 )
PPTX
8-Queens Problem.pptx
AI problem solving.pptx
Problem Formulation
03_UninformedSearch.pdf
AI-State Space Representation.pptx
AI-State Space Representation.pptx
Uninformed Search goal based agents Representing states and operations
Ai lecture 8(unit02)
UninformedSearch (2).pptx
Various Uninform Search Strategies in AI.ppt
AIMA_ch3_L2-complement.ppt kjekfkjekjfkjefkjefkjek
Lecture 09 uninformed problem solving
module5_backtrackingnbranchnbound_2022.pdf
Searching in Artificial Intelligence for UG
Presentaion on “MiniMax Algorithm and Water Jug Problem
Numerical literacy ( week 2 )
8-Queens Problem.pptx
Ad

More from Kirti Verma (20)

PPTX
WORD SENSE DISAMIGUITION, methods to resolve WSD, wordnet,
PPTX
Probabilistic parsing, Parsing In NLP ,Context Free grammer
PPTX
feature structure and unification NLP,what is Unification, Feture structure i...
PPTX
Grammar rules in English, Dependency Parsing, Shallow parsing
PPTX
Role of Parser Words & Word Groups Parsing in NL, Types of parsing, Parsing A...
PPTX
Words _Transducers Finite state transducers in natural language processing
PPTX
Regular-expressions in NLP and regular expression with example
PPTX
NLP Introduction , applications, NLP Pipeline, Steps in NLP
PPT
L-5 BCEProcess management.ppt
PPT
L-3 BCE OS FINAL.ppt
PPT
L-4 BCE Generations of Computers final.ppt
PPT
L-1 BCE computer fundamentals final kirti.ppt
PPT
BCE L-4 Data Type In C++.ppt
PPT
BCE L-3 overview of C++.ppt
PPT
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
PPTX
BCE L-1 Programmimg languages.pptx
PPTX
BCE L-1 networking fundamentals 111.pptx
PPTX
BCE L-2 e commerce.pptx
PPTX
BCE L-3omputer security Basics.pptx
PPTX
L 5 Numpy final learning and Coding
WORD SENSE DISAMIGUITION, methods to resolve WSD, wordnet,
Probabilistic parsing, Parsing In NLP ,Context Free grammer
feature structure and unification NLP,what is Unification, Feture structure i...
Grammar rules in English, Dependency Parsing, Shallow parsing
Role of Parser Words & Word Groups Parsing in NL, Types of parsing, Parsing A...
Words _Transducers Finite state transducers in natural language processing
Regular-expressions in NLP and regular expression with example
NLP Introduction , applications, NLP Pipeline, Steps in NLP
L-5 BCEProcess management.ppt
L-3 BCE OS FINAL.ppt
L-4 BCE Generations of Computers final.ppt
L-1 BCE computer fundamentals final kirti.ppt
BCE L-4 Data Type In C++.ppt
BCE L-3 overview of C++.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-1 Programmimg languages.pptx
BCE L-1 networking fundamentals 111.pptx
BCE L-2 e commerce.pptx
BCE L-3omputer security Basics.pptx
L 5 Numpy final learning and Coding

Recently uploaded (20)

PPTX
CyberSecurity Mobile and Wireless Devices
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PPTX
Module 8- Technological and Communication Skills.pptx
PPT
Total quality management ppt for engineering students
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PPTX
Management Information system : MIS-e-Business Systems.pptx
PDF
Visual Aids for Exploratory Data Analysis.pdf
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PPTX
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
PDF
August -2025_Top10 Read_Articles_ijait.pdf
PPTX
introduction to high performance computing
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
Software Engineering and software moduleing
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
CyberSecurity Mobile and Wireless Devices
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
distributed database system" (DDBS) is often used to refer to both the distri...
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Module 8- Technological and Communication Skills.pptx
Total quality management ppt for engineering students
Categorization of Factors Affecting Classification Algorithms Selection
Fundamentals of safety and accident prevention -final (1).pptx
Management Information system : MIS-e-Business Systems.pptx
Visual Aids for Exploratory Data Analysis.pdf
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
August -2025_Top10 Read_Articles_ijait.pdf
introduction to high performance computing
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Software Engineering and software moduleing
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT

Water jug problem ai part 6

  • 2. Water Jug Problem A Water Jug Problem: You are given two jugs, a 4-gallon one and a 3-gallon one, a pump which has unlimited water which you can use to fill the jug, and the ground on which water may be poured. Neither jug has any measuring markings on it. How can you get exactly 2 gallons of water in the 4- gallon jug?
  • 3. State Representation  We will represent a state of the problem as a tuple (x, y) where x represents the amount of water in the 4- gallon jug and y represents the amount of water in the 3- gallon jug.  Initial state as (0,0).  Goal state as (2,y).
  • 4. Production Rules 1. (x,y) If x<4 -> (4,y) 2. (x,y) If y<3 ->(x,3) 3. (x,y) If x>0 ->(x-d,y) 4. (x,y) If y>0 ->(x,y-d) 5. (x,y) If x>0 ->(0,y) 6. (x,y) If y>0 ->(x,0) 7. (x,y) If (x+y>=4 and y>0) ->(4,y-(4-x)) 8. (x,y) If (x+y>=3 and x>0) ->(x-(3-y),3) 9. (x,y) If(x+y<=4 and y>0) ->(x+y,0) 10.(x,y) If (x+y<=3 and x>0) ->(0,x+y) 11.(0,2) ->(2,0)
  • 5. WATER JUG: one of the Solution 4 Gallon Jug 3 Gallon Jug Rule applied 0 0 4 0 1 1 3 8 1 0 6 0 1 10 4 1 1 2 3 8 4 Gallon jug 3 Gallon jug pump
  • 6. Search Tree : Water Jug Problem (0,0) (4,0) (4,3) (0,0) (1,3) (0,3) (4,3) (0,0) (3,0)
  • 7. 8 Queen Problem Problem: Place 8 queens on a chess board so that none of them attack each other. Formulation- I - A state is an arrangement of 0 to 8 queens on the board - Operators add a queen to any square. This formulation is not a systematic way to find the solution, it takes a long time to get the solution. -
  • 8. Formulation – II -A state is an arrangement of 0-8 queen with no one attacked. -Operators place a queen in the left most empty column. - More systematic than formulation-I 8 Queen Problem
  • 9. Formulation –III - A state is an arrangement of 8 queens on in each column. -Operators move an attacked queen to another square in the same column. -Keep on shuffling the queen until the goal is reached. - This formulation is more systematic hence , it is also called as Iterative Formulation. 8 Queen Problem
  • 10. 8 Queen Problem: one solution
  • 11. 8 Puzzle Problem Start State Goal State
  • 12. • State space (S) • Location of each of the 8 tiles(and the blank tile) • Start State (s) • Starting configuration Operators(O) • Four Operators : Right, Left, Up, Down • Goals(G) one of the goal configuration 8 Puzzle Problem
  • 14. Missionaries and Cannibals • Three missionaries and three cannibals find themselves on a side of river. They agreed to get to the other side of river. • But missionaries are afraid of being eaten by cannibals so, the missionaries want to manage the trip in such a way that no. of missionaries on either side of the river is never less than the no. of cannibals on the same side. • The boat is able to hold only 2 people at a time.
  • 15. Missionaries and Cannibals: State representation • State(#m,#c,1/0) #m – number of missionaries on first bank #c – number of cannibals on first bank • The last bit indicate whether the boat is in the first bank. Operators • Boat carries (1,0) or (0,1) or (1,1) or (2,0) or (0,2)