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

AI Module 1 Lecture 3

This document outlines the scope of Artificial Intelligence (AI) and problem-solving techniques in the context of a B. Tech. (CSE) course. It covers key concepts such as state space representation, problem characteristics, and various problem-solving methods including examples like the 8-puzzle and water jug problems. The document emphasizes the importance of defining problems precisely, analyzing them, and selecting appropriate techniques for effective solutions.

Uploaded by

mi.melonfisher
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

AI Module 1 Lecture 3

This document outlines the scope of Artificial Intelligence (AI) and problem-solving techniques in the context of a B. Tech. (CSE) course. It covers key concepts such as state space representation, problem characteristics, and various problem-solving methods including examples like the 8-puzzle and water jug problems. The document emphasizes the importance of defining problems precisely, analyzing them, and selecting appropriate techniques for effective solutions.

Uploaded by

mi.melonfisher
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

B. Tech.

(CSE)
Artificial Intelligence CSE401
Module 1
Scope of AI & Problem Solving
LEARNING OUTCOMES

• Students will be able to know about artificial intelligence

• Students will be analyze a problem, identify and define the


computing requirements appropriate to its solution
• Students will be able to learn the concept of state space
representation
Amity School of Engineering and Technology

Problem solving

•Problem solving is a process of generating solutions from observed


data.

•Key element of problem solving

–State: A state is a representation of problem at a given moment.


–State space: Contains all the possible states for a given problem.
–Operators: the available actions performed is called operators.
–Initial state: position from which the problem-solving process may start.
–Goal state: solution to the problem.
Amity School of Engineering and Technology

General Problem solving

•To build a system, to solve a particular problem, there are


four things:
1. Define the problem precisely (apply the State Space
representation).
2. Analyze the problem.
3. Isolate and represent the task knowledge that is
necessary to solve the problem.
4. Choose the best problem solving technique(s) and
apply it to the particular problem.
Amity School of Engineering and Technology

Problem Characteristics

To choose an appropriate method for a particular problem:


1.Is the problem decomposable?
2.Can solution steps be ignored or undone?
3.Is the universe predictable?
4.Is a good solution absolute or relative?
5.Is the solution a state or a path?
6.What is the role of knowledge?
7.Does the task require human-interaction?
Amity School of Engineering and Technology

1.Is the problem decomposable?

• Can the problem be broken down to smaller


problems to be solved independently?

• Decomposable problem can be solved easily.


Amity School of Engineering and Technology

1. Is the problem decomposable?


Amity School of Engineering and Technology

2.Can solution steps be ignored or undone?

Theorem Proving
A lemma that has been proved can be ignored for next
steps.

Ignorable!
Amity School of Engineering and Technology

2.Can solution steps be ignored or undone?

The 8-Puzzle

Moves can be undone and backtracked.

Recoverable!
Amity School of Engineering and Technology

2.Can solution steps be ignored or undone?

Playing Chess
Moves cannot be retracted.

Irrecoverable!
Amity School of Engineering and Technology

2.Can solution steps be ignored or undone?

•Ignorable problems can be solved using a simple control


structure that never backtracks.
•Recoverable problems can be solved using backtracking.
•Irrecoverable problems can be solved by recoverable
style methods via planning.
Amity School of Engineering and Technology

3.Is the universe predictable?

The 8-Puzzle
Every time we make a move, we know exactly what will
happen.

Certain outcome!
Amity School of Engineering and Technology

3.Is the universe predictable?

Playing Bridge

We cannot know exactly where all the cards are or what


the other players will do on their turns.

Uncertain outcome!
Amity School of Engineering and Technology

3.Is the universe predictable?

•For certain-outcome problems, planning can used to


generate a sequence of operators that is guaranteed to lead to
a solution.

•For uncertain-outcome problems, a sequence of generated


operators can only have a good probability of leading to a
solution.

Plan revision is made as the plan is carried out and the


necessary feedback is provided.
Amity School of Engineering and Technology

4. Is a good solution absolute or relative?

1.Marcus was a man.


2.Marcus was a Pompeian.
3.Marcus was born in 40 A.D.
4.All men are mortal.
5.All Pompeians died when the volcano erupted in 79 A.D.
6.No mortal lives longer than 150 years.
7.It is now 2004 A.D.
Amity School of Engineering and Technology

4.Is a good solution absolute or relative?

1.Marcus was a man.


2.Marcus was a Pompeian.
3.Marcus was born in 40 A.D.
4.All men are mortal.
5.All Pompeians died when the volcano erupted in 79A.D.
6.No mortal lives longer than 150 years.
7.It is now 2004 A.D.

Is Marcus alive?
Amity School of Engineering and Technology

4.Is a good solution absolute or relative?


1.Marcus was a man.
2.Marcus was a Pompeian.
3.Marcus was born in 40 A.D.
4.All men are mortal.
5.All Pompeians died when the volcano erupted in 79 A.D.
6.No mortal lives longer than 150 years.
7.It is now 2004 A.D.

Is Marcus alive?
Different reasoning paths lead to the answer. It does not
matter which path we follow.
Amity School of Engineering and Technology

4.Is a good solution absolute or relative?

The Travelling Salesman Problem

We have to try all paths to find the shortest one.


Amity School of Engineering and Technology

4.Is a good solution absolute or relative?

•Any-path problems can be solved using heuristics that


suggest good paths to explore.

•For best-path problems, much more exhaustive search


will be performed.
Amity School of Engineering and Technology

5.Is the solution a state or a path?

Finding a consistent interpretation


“The bank president ate a dish of pasta salad with
the fork”.
–“bank” refers to a financial situation or to a side of a river?
–“dish” or “pasta salad” was eaten?
–Does “pasta salad” contain pasta, as “dog food” does not
contain “dog”?
–Which part of the sentence does “with the fork” modify?
What if “with vegetables” is there?

No record of the processing is necessary.


Amity School of Engineering and Technology

5.Is the solution a state or a path?

The Water Jug Problem


The path that leads to the goal must be reported.
Amity School of Engineering and Technology

5. Is the solution a state or a path?

•A path-solution problem can be reformulated as a state-


solution problem by describing a state as a partial path to
a solution.

•The question is whether that is natural or not.


Amity School of Engineering and Technology

6.What is the role of knowledge

Playing Chess
Knowledge is important only to constrain the search for a
solution.

Reading Newspaper
Knowledge is required even to be able to recognize a
solution.
Amity School of Engineering and Technology

7.Does the task require human-interaction?

•Solitary problem, in which there is no intermediate


communication and no demand for an explanation of the
reasoning process.

•Conversational problem, in which intermediate


communication is to provide either additional assistance to
the computer or additional information to the user.
Amity School of Engineering and Technology

State Space Representation


•By defining it properly, one converts the abstract problem into real
workable states that are really understood.

•A set of all possible states for a given problem is known as the state
space of the problem.

•If the entire state space representations for a problem is given, it is


possible to trace the path from the initial state to the goal state and
identify the sequence of operators necessary for doing it.

•The major deficiency of this method is that it is not possible to


visualize all states for a given problem. Moreover, the resources of
the computer system are limited to handle huge state-space
representation.
Amity School of Engineering and Technology

State space representation of coffee making


Amity School of Engineering and Technology

8-puzzle problem

•In the 8-puzzle problem we have a 3×3 square board and


8 numbered tiles. The board has one blank position.

•Tiles can be slid to adjacent blank positions. We can


alternatively and equivalently look upon this as the
movement of the blank position up, down, left or right.

•The objective of this puzzle is to move the tiles starting


from an initial position and arrive at a given goal
configuration.
Amity School of Engineering and Technology

Initial and Goal State

The start state is some (almost)


random configuration of the tiles
The goal state is as shown
Operators are
Move empty space up
Move empty space down
Move empty space right
Move empty space left
Amity School of Engineering and Technology
Amity School of Engineering and Technology

8-puzzle problem
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology

A Water Jug Problem


You have a 4-gallon
and a 3-gallon water
jug
•You have a pump
with an unlimited
amount of water
•You need to get
exactly 2 gallons in
4-gallon jug
Amity School of Engineering and Technology

Puzzle-solving as Search

•State representation: (x, y)


–x: Contents of four gallon
–y: Contents of three gallon
•Start state: (0, 0)
•Goal state (2, n)
•Operators
–Fill 3-gallon from pump, fill 4-gallon from pump
–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
Amity School of Engineering and Technology

State Space Search: Water Jug Problem...

1. (x, y) -----> (4, y) if x is less than 4, fill the 4 gallon jug


if x < 4
2. (x, y)----->(x, 3) fill the 3-gallon jug
if y < 3
3. (x, y)----->(x - d, y) pour some water out of the 4 gallon jug
if x > 0
4. (x, y)----->(x, y - d) pour some water out of the 3 gallon jug
if y > 0
5. (x, y)----->(0, y) empty the 4-gallon jug on the ground
if x > 0
6. (x, y)----->(x, 0) empty the 3-gallon jug on the ground
if y >0
Amity School of Engineering and Technology

7. (x, y) ----->(4, y -(4 - x)) pour water from the 3- gallon jug into the 4-gallon
if x + y >= 4, y > 0 jug until the 4-gallon jug is full

8. (x, y) ----->(x - (3 - y), 3) pour water from the 4- gallon jug into the 3-gallon
if x + y >= 3, x > 0 jug until the 3-gallon jug is full

9. (x, y) ----->(x + y, 0) pour all the water from the 3-gallon jug into the 4-
if x + y <= 4, y > 0 gallon jug

10. (x, y) ----->(0, x + y) pour all the water from the 4-gallon jug into the 3-
if x + y <= 3, x > 0 gallon jug

11. (0, 2) ----->(2, 0) pour the 2 gallons from the 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
Amity School of Engineering and Technology

State Space Search: Water Jug Problem...

1.Current state = (0, 0)


2.Loop until reaching the goal state (2, 0)

-Apply a rule whose left side matches the current state


-Set the new current state to be the resulting state

Gallons in the 4-Gallon Jug Gallons in the 3-Gallon Jug Rule Applied
0 0 ?
0 3 ?
3 0 ?
3 3 ?
4 2 ?
0 2 ?
2
Amity School of Engineering and Technology

State Space Search: Water Jug Problem...

1.Current state = (0, 0)


2.Loop until reaching the goal state (2, 0)

-Apply a rule whose left side matches the current state


-Set the new current state to be the resulting state

Gallons in the 4-Gallon Jug Gallons in the 3-Gallon Jug Rule Applied
0 0 2
0 3 9
3 0 2
3 3 7
4 2 5
0 2 9
2
Amity School of Engineering and Technology

Missionaries and cannibals

The missionaries and


cannibals wish to cross a
river
They have a boat that can
hold two people
It is unsafe to have
cannibals outnumber
missionaries
Amity School of Engineering and Technology

Missionaries and cannibals


Amity School of Engineering and Technology

States
•A state can be represented by the number of missionaries and
cannibals on each side of the river

•State(#m, #c, riverbank)


#m -----> no. of missionaries
#c -----> no. of cannibals

Bank of river -----> indicates whether the boat in the left bank or
right bank 0 -----> left bank, 1 -----> right bank
•Initial state (3,3,0)
•Goal state: (0,0,0)
Amity School of Engineering and Technology

Operations

•An operation takes us from one state to another


•Here are five possible operations:
–boat takes 1 missionary across river (1m)
–boat takes 1 cannibal across river (1c)
–boat takes 2 missionaries across river (2m)
–boat takes 2 cannibals across river (2c)
–boat takes 1 missionary and 1 cannibal across river (1m1c)
Amity School of Engineering and Technology
Amity School of Engineering and Technology

Solution
1.(3, 3,0) ----> (0,0,1) Initial state
2.(3, 1,0) ----> (0,2,1) two cannibal will go
3.(3,2,0) ----> (0,1,1) one cannibal will return
4.(3,0,0) ---->(0,3,1) two cannibal will go
5.(3,1,0) ---->(0,2,1) one cannibal will return
6.(1,1,0) ---->(2,2,1) two Missionaries will go
7.(2,2,0) ---->(1,1,1) one cannibal and one Missionaries will return
8.(0,2,0) ---->(3,1,1) two Missionaries will go
9.(0,3,0) ----> (3,0,1) one cannibal will return
10.(0,1,0) ---->(3,2,1) two cannibal will go
11.(0,2,0) ---->(3,1,1) one cannibal will return
12.(0,0,0) ---->(3,3,1) two cannibal will go
Amity School of Engineering and Technology

n-queens
•States: 4 queens in 4 columns (44 = 256 states)
•Actions: move queen in column
•Goal test: no attacks
•Evaluation: h(n) = number of attacks

• Given random initial state, we can solve n-queens for large n


with high probability
Amity School of Engineering and Technology

Thank You

You might also like