0% found this document useful (0 votes)
67 views15 pages

Chapter 2 Artificial Intelligence Notes

The document outlines the problem-solving process, which includes goal formulation, problem formulation, searching, and execution. It discusses the concept of state space representation, types of problems, and provides examples such as the water jug problem, 8 puzzle game, and river crossing problems. Additionally, it introduces constraint satisfaction problems and provides examples of solving them through a systematic approach.

Uploaded by

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

Chapter 2 Artificial Intelligence Notes

The document outlines the problem-solving process, which includes goal formulation, problem formulation, searching, and execution. It discusses the concept of state space representation, types of problems, and provides examples such as the water jug problem, 8 puzzle game, and river crossing problems. Additionally, it introduces constraint satisfaction problems and provides examples of solving them through a systematic approach.

Uploaded by

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

2.

Problem Solving
Introduction
A problem is a situation which is experienced by an agent and is solved by a sequence of actions that
reduce the different between the initial situation and the goal.
Four steps of problem solving are:
i. Goal Formulation: Helps to organize
behavior by isolating and representing
the task knowledge necessary to solve
problem.
ii. Problem Formulation: Define the
problem precisely with initial states,
final state and acceptable solutions.
iii. Searching: Find the most appropriate
techniques o sequence among all
possible techniques.
iv. Execution: Once the search algorithm
returns a solution to the problem, the solution is then executed by the agent.
There is no solid description plan for solving the problems because it varies with nature of problem,
various problem solving techniques, various level of problem complexity, priority of problem, etc. A
general strategy for problem solving can be seen on the figure.
Defining problem as a state space search
A set of all possible states for a given problem is known as state space for that problem. A state space
represents a problem in terms of states and operators that changes the states. A state space essentially
consists of a set of nodes representing each state of the problem, arcs between nodes representing the
legal moves from one state to another, an initial state and a goal state
The major components of state space representation are:
 Initial state
 Goal state, and
 Operator or legal moves.
To explain the state space representation in more detailed manner, let us consider a problem of 8 puzzle
game. The puzzle consists of an 8-square frames and an empty slot. The tiles are numbered from 1-8. It is
possible to move the tiles in the square field by moving tile into the empty slot. The objective is to get
square in a numeric order.
Here,
 Initial State

 Operators
– UP: If the empty slot is not touching the up-frame, move it up.
– DOWN: If the empty slot is not touching down-frame, move it down.
– LEFT: If the empty slot is not touching left-frame, move it left.
– RIGHT: If the empty slot is not touching right-frame, move it right.
 Final State

Problem Formulation and Problem types


The process of deciding the initial states to consider for the particular problems so that the operator
perform the specified operation to reach the given a goal is called problem formulation. This activity
aimed at identifying a problem by specifying
 The undesirable and problematic state currently occupied,
 The resources currently available to move away from that problematic state, particularly the
available courses of actions, the combinatorial constraints on using them, etc., and
 The criteria that need to be satisfied to say that a problem no longer exists or is solved.
Type of Problems
a. Single-state Problem
 Deterministic, accessible
 Agent knows everything about world(the exact state)
 Calculate optimum action sequence to reach goal state
 Example: playing chess(any action will result exact state)
b. Multiple-state Problem
 Deterministic, inaccessible
 Agent does not know the exact state(could be in any of the possible state)
 Assumes states while walking forward goal state
 Example: walking in a dark room
c. Contingency Problem
 Non-deterministic, inaccessible
 Must be sensors during execution
 Solution is a tree or police
 Often include search and execution
 Example: a new skater in a ring
d. Exploration Problem
 Unknown state space
 Discover and learn about environment while taking action
Well defined problems
A problem can be defined by
– Initial state
– Actions (Using successor function)
– Goal test (to determine the goal state)
– Path cost
A problem is when defined with these components is called well defined problem. The actions and rules
should be defined in as general way as possible.

Q.A Water Jug Problem


• You have a 4-gallon and a 3-gallon water jug
• You have a faucet with an unlimited amount of water
• You need to get exactly 2 gallons in 4-gallon jug
Here,
 Initial State
Start state: (0, 0)

 Operators
 Fill 3-gallon from faucet, fill 4-gallon from faucet
 Fill 3-gallon from 4-gallon , fill 4-gallon from 3-gallon
 Empty 3-gallon into 4-gallon, empty 4-gallon into 3-gallon
 Dump 3-gallon down drain, dump 4-gallon down drain
 Final State
Goal state (0, 2)

Gallons in the 3-Gallon Jug Gallons in the 4-Gallon Jug


0 0
3 0
0 3
3 3
2 4
2 0
0 2
 Solution

Q. You are given two jars of a six gallons and eight gallons capacity. There is no marking on the
jars. There is a water tap, which can be used to fill jar. Your goal is to have exactly four gallons of
water in eight gallons jar without taking any other jar or measuring device. Model the above
problem as an AI production system and draw the search tree.

Q. 8 Puzzle-Game
The puzzle consists of an 8-square frames and an empty slot. The tiles are numbered from 1-8.
It is possible to move the tiles in the square field by moving tile into the empty slot. Manage the
tile square in a numeric order.
Here,
 Initial State
 Operators
– UP: If the empty slot is not touching the up-frame, move it up.
– DOWN: If the empty slot is not touching down-frame, move it down.
– LEFT: If the empty slot is not touching left-frame, move it left.
– RIGHT: If the empty slot is not touching right-frame, move it right.
 Final State

 Solution
- Step 1

- Step 2

- Step 3

- Step 4

Q. River Crossing Problem


A farmer has a Goat, Wolf, and a Cabbage on the west side of a river. He wants to get all of his
animals and Cabbage across the river on the east side. The farmer has raw boat but he only has
enough room for himself and one another thing. The Wolf will eat the Goat if they are left
together alone. The Goat will eat Cabbage if they are left together alone. How can the farmer
get everything on the east side?
Here,
 Initial State
West {Farmer, Cabbage, Wolf, Goat} & East {ϕ}
 Operators
- Move farmer and one of the Cabbage, Wolf, and Goat from West to East and vice-versa.
 Final State
West {ϕ} & East {Farmer, Cabbage, Wolf, Goat}
 Solution
S. West River East
N
1. (Farmer, Cabbage, Wolf, Goat) (ϕ)
2. (Wolf, Cabbage) (Farmer, Goat) (Farmer, Goat)
3. (Wolf, Cabbage, Farmer) (Farmer) (Goat)
4. (Wolf) (Farmer, Cabbage) (Farmer, Cabbage, Goat)
5. (Wolf, Goat, Farmer) (Farmer, Goat) (Cabbage)
6. (Goat) (Wolf, Farmer) (Wolf, Cabbage, Farmer)
7. (Farmer, Goat) (Farmer) (Wolf, Cabbage)
8. (ϕ) (Farmer, Goat) (Farmer, Cabbage, Wolf, Goat)

Q. River Crossing Problem


In a distinct land, bigamy is common. There are six people who want to cross a river in this land.
This group consists of two men, each two wives. No man can tolerate any of his wives being in the
company of another man unless yet least he or his next wife is present in the boat or in next land.
There is a boat that holds two people to be used for crossing the river. How is the trip possible?
Here,
 Initial State
W { H1, W1, W1’ and H2, W2, W2’}, E {ϕ}
 Operation
 No man can tolerate any of his wives being in the company of another man.

 Final State
W {ϕ}, E { H1, W1, W1’ and H2, W2, W2’}
 Solution

S. N West (W) River East (E)


0. H1,W1,W1’, H2,W2,W2’ ( ϕ)
1. H1,H2,W2,W2’ W1, W1’ W1,W1’
2. H1,W1,H2,W2,W2’ W1, W1’
3. H1,W1,H2, W2, W2’ W1’,W2,W2’
4. H1,W1,H2,W2 W2 W1’,W2’
5. H1, H2, W1, W2 W1,W1’,W2,W2’
6. H1, H2, W2 W2 W1, W1’, W2’
7. H1, H2, W2 W1, W1’, H2,W2, W2’
8. H1,H2, H2, W2
9. (ϕ) H1, H2, H1, W1, W1’, H2, W2, W2’

Q. Pegs and Disks problem


Here,
 Initial State
 Operation
One may move the topmost disk on any needle to the topmost position to any other needle.
 Final State

 Solution
- Step 1

- Step 2

- Step 3

- Step 4

- Step 5

- Step 6
- Step 7

Q. 8 queen’s problem
The problem is to place 8 queens on a chessboard so that no two queens are in the same row, column or
diagonal

Here,
 Initial State

 Operation
Add a queen in any square
 Final State

Constraint Satisfaction Problem (or Crypto Arithmetic Problem)


In artificial intelligence, constraint satisfaction is the process of finding a solution to set of variables Vi
(V1, V2, …, Vn ) and a set of constraint Ci (C1, C2, …, Cm), where each variable has a domain of allowed
values. There is no any specified rule to define the procedure to solve the CSP; the technique depends
upon the kind of constraints being considered. The main features of CSP are:
 A CSP is a high level description of a problem.
 A model for the problem is represented by a set of variables and their domain.
 The problem is stated as constraints specifying the relation between the variables.
 The constraints only specify the relationship without specifying a
computational procedure to enforce that relationship.
 The computer has to find the solution of the specified problem.
The CSP is a two-step process: first the constraints are discovered and propagated as far as possible
throughout the system then if there is still not found solution, search began. A guess about something is
made and added as new constraints. The propagation then occurs with new constraints and forth. The
main benefits of CSP are listed as:
 Standard representation pattern
 Generic goal and successor functions
 Generic heuristics (no domain specific expertise).
Problem 1
A B C
+ D E F
G H I
Solution:
Tree Searching Rules:
1. A≠B≠C≠D≠E≠F≠G≠H≠I
2. C+F=I
C + F = 10 + I (I as carry)
3. B+E=H
B + E = 10 + H
B+E+1=H
B + E + 1 =10 + H (H as carry)
4. A+D=G
A+D+1=G
Now,
Step 1:
Domain of C = {1, 2, 3, 4, 5, 6, 7, 8, 9}
Domain of F = {1, 2, 3, 4, 5, 6, 7, 8, 9}
So, Domain of I = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Select C = 4 & F = 9 Then I = 3 (Carry = 1)
So,
A B 4
+ D E 9
G H 3
Step 2:
Domain of B = {1, 2, 5, 6, 7, 8}
Domain of E = {1, 2, 5, 6, 7, 8}
So, Domain of H = {0, 1, 2, 5, 6, 7, 8}
Select B = 2 & E = 8 Then H = 10+1-previous carry = 1 + (Carry = 1)
So,

A 2 4
+ D 8 9
G 1 3
Step 3:
Domain of A = {0, 5, 6, 7}
Domain of D = {0, 5, 6, 7}
So, Domain of G = {5, 6}
Select A = 0 & D = 5 Then G = 6 (with addition of Carry)
So,
Hence, the required solutions are:
A = 0, B = 2, C = 4, D = 5, E = 8, F = 9, G = 6, H = 1, I = 3.
Problem 2
T R U E

+ T R U E

F A L S E

Solution:
Step 1:
Domain of F = {1}
So, Select F = 1
Now we have,
T R U E

+T R U E
1 A L S E

Step 2:
Domain of E = {0}
So, Select E = 0
Now we have,
T R U 0

+ T R U 0
1 A L S 0
Step 3:
Domain of U = {2, 3, 4, 6, 7, 8, 9}
So, Domain of S = {2, 4, 6, 8}
Select U = 4 Then S = 8
So,
T R 4 0

+T R 4 0

1 A L 8 0

Step 4:
Domain of R = {3, 6}
So, Domain of L = {2, 6}
Select R = 6 Then L = 2 (Carry = 1)
So,
T 6 4 0
+ T 6 4 0
1 A 2 8 0

Step 5:
Domain of T = {7}
So, Domain of A = {5}
Finally we have,
7 6 4 0
+7 6 4 0
1 5 2 8 0
Hence, the required solutions are:
T = 7, R = 6, U = 4, E = 0, F = 1, A = 5, L = 2, S = 8.
Problem 3
S E N D

+ M O R E

M O N E Y

Solution:
Step 1:
Domain of M = {1}
Select M = 1
So we have,

S E N D

+ 1 O R E

1 O N E Y

Step 2:
Domain of S = {9}
Select S = 9 Then O = 0 (Carry = 1)
So,
9 E N D
+ 1 0 R E
1 0 N E Y
Step 3:
Domain of D = {2, 3, 4, 5, 6, 7, 8}
Domain of E = {2, 3, 4, 5, 6, 7, 8}
So, Domain of Y = {2, 3, 4, 5,}
Select D = 7 & E = 5 Then Y = 2 (Carry =1)
So,
9 5 N 7
+ 1 0 R 5
1 0 N 5 2

Step 4:
Domain of N = {3, 4, 6, 8}
Domain of R = {3, 4, 6, 8}
So, Domain of E will be 5 (with carry = 1) when we select N = 6 & R = 8.
Now we have,
9 5 6 7
+ 1 0 8 5
1 0 6 5 2
Hence, the required solutions are:
S = 9, E = 5, N = 6, D = 7, M = 1, O = 0, R = 8, Y = 2.

Production System
Production systems were among the earliest forward-chaining systems in widespread use. The word
production in production systems denotes a condition (or "IF" statement) which implies an action (or
"THEN") rule. If a production's precondition matches the current state of the world, then the production
is said to be triggered. If a production's action is executed, it is said to have fired. The IF-THEN rules are
found useful in automated planning, expert systems and action selection.
A production system has four basic components as enumerated below.
 A set of production rules following the classical IF-THEN construct. If the conditions on the
left-hand side are satisfied, the rule is fired, resulting in the performance of actions on the right-
hand side of the rule.
 A database (or working memory) of current facts established during the process of inference.
 A control strategy which specifies the order in which the rules are selected for
matching of antecedents by comparing the facts in the database. It also specifies how
to resolve conflicts in selection of rules or selection of facts. The rule interpreter must provide a
mechanism for prioritizing productions when more than one is triggered
 A rule firing module, which is the computational system that implements the control strategy
and applies the rules. The rules are generally applied either forward chaining or backward
chaining process.
A Production System is best suited AI Technique to solve the State Space Problems like Water Jug and
crossing river problem. These problems consist of:
 State = Initial state of the Problem.
 State space = Intermediate States between Initial State and Goal State.
 Goal State = Final state of the problem.
Type of production system
Production systems describe the operations that can be performed in a search for a solution to the
problem. Four classes of production systems:
 A monotonic production system
 A no-monotonic production system
 A partially commutative production system
 A commutative production system.
Monotonic production system:
A system in which the application of a rule never prevents the later application of another rule that
could have also been applied at the time the first rule was selected. Monotonic reasoning is what a
knowledge base is of fixed size and cannot be updated. But in non-monotonic reasoning, a
Machine got a capability to learn self by getting possible operations on it so when u give some
clauses to it, it does update database if it doesn't create conflicting situations with the database.
Partially commutative production system:
A production system in which the application of a particular sequence of rules transforms state X
into state Y, then any permutation of those rules that is allowable also transforms state x into state
Y. Monotonic partially commutative systems are useful for problems in which changes occur but
can be reversed and in which the order of operation is not critical (ex: 8 puzzle problem). Playing
the game of bridge comes under non monotonic, not partially commutative system.
Advantages:
 Production systems provide an excellent tool for structuring AI programs.
 Production Systems are highly modular because the individual rules can be added,
removed or modified independently.
 The production rules are expressed in a natural form, so the statements contained in the
knowledge base should the recording of an expert thinking out loud.
Disadvantages:
 One important disadvantage is the fact that it may be very difficult to analyze the flow of control
within a production system because the individual rules don’t call each other.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy