2 - U1 - Aiml - Part2
2 - U1 - Aiml - Part2
Part2
Dr.Mrs.Rajani.P.K
Unit1
Introduction to Artificial Intelligence (AI) & Machine Learning (ML)
(8 hours)
• Introduction to AI:
– Intelligent Agents, Agents and environments, Good behavior
• Introduction to ML:
– Why Machine learning, Types of machine learning
?
environm
ent
agent
actuators
Water Jug Problem
Definition:
Some jugs are given which should have non-calibrated properties. At least
any one of the jugs should have filled with water. Then the process through
which we can divide the whole water into different jugs according to the
question can be called as water jug problem.
Procedure:
Suppose that you are given 3 jugs A,B,C with capacities 8,5 and 3 liters
respectively but are not calibrated (i.e. no measuring mark will be there). Jug
A is filled with 8 liters of water. By a series of pouring back and forth among
the 3 jugs, divide the 8 liters into 2 equal parts i.e.
4 liters in jug A and 4 liters in jug B. How?
Water Jug Problem
Step 1:
According to the question, this step will be (B, T, G, Gr) as all the Missionaries
and the Carnivals are at one side of the bank of the river. Different states from
this state can be implemented as
The states (B, T, O, O) and (B, O, O, Gr) will not be countable because at a time the
Boatman and the Tiger or the Boatman and grass cannot go. (According to the question).
Queen Problem
Definition:
“We have 8 queens and an 8x8 Chess board having alternate black and white
squares. The queens are placed on the chessboard. Any queen can attack any
other queen placed on same row, or column or diagonal. We have to find the
proper placement of queens on the Chess board in such a way that no queen
attacks other queen”.
Queen Problem
Procedure: Figure: A possible board configuration of 8 queen problem
In figure , the possible board configuration for 8-queen problem has been shown.
The board has alternative black and white positions on it. The different positions
on the board hold the queens. The production rule for this game is you cannot
put the same queens in a same row or same column or in same diagonal. After
shifting a single queen from its position on the board, the user have to shift other
queens according to the production rule. Starting from the first row on the board
the queen of their corresponding row and column are to be moved from their
original positions to another position. Finally the player has to be ensured that
no rows or columns or diagonals of on the table is same.
Unit1
Introduction to Artificial Intelligence (AI) & Machine Learning (ML)
(8 hours)
• Introduction to AI:
– Intelligent Agents, Agents and environments, Good behavior
• Introduction to ML:
– Why Machine learning, Types of machine learning
?
environm
ent
agent
actuators
Problem-Solving Agent
sensors
?
environm
ent
agent
actuators
• Formulate Goal
• Formulate Problem
•States
•Actions
• Find Solution
Solving Problems by Searching
4 8 - 4 5 6
7 6 5 7 8 -
• Introduction to ML:
– Why Machine learning, Types of machine learning
• Tradeoff:
– (long time, optimal solution with least g)
– vs. (shorter time, solution with slightly larger path cost g)
Unit1
Introduction to Artificial Intelligence (AI) & Machine Learning (ML)
(8 hours)
• Introduction to AI:
– Intelligent Agents, Agents and environments, Good behavior
• Introduction to ML:
– Why Machine learning, Types of machine learning
A D
B D A E
C E E B B F
11
D F B F C E A C G
14 17 15 15 13
G C G F
19 19 17
G 25
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
Fringe : Set of search nodes that have not been
expanded yet.
1
2 3 FRINGE = (1)
4 5 6 7
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
2 3 FRINGE = (2, 3)
4 5 6 7
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
2 3 FRINGE = (3, 4, 5)
4 5 6 7
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
2 3 FRINGE = (4, 5, 6, 7)
4 5 6 7
Breadth First Search (Analysis)
• Breadth First Search
– Complete – find the solution eventually
– Optimal, if step cost is 1
The disadvantage
– if the branching factor of a node is large,
– for even small instances (e.g., chess)
• the space complexity and the time complexity are
enormous
Properties of breadth-first search
• Complete? Yes (if b is finite)
Disadv:
• I) The memory requirements are a bigger problem for
breadth-first search than is the execution time.
• II) Exponential-complexity search problems cannot be
solved by uninformed methods for any but only
suitable for smallest instances problem (i.e.) (number
of levels to be minimum (or) branching factor to be
minimum)
Depth-First Search (DFS)
• Always expands one of the nodes at the deepest
level of the tree
• Only when the search hits a dead end
– goes back and expands nodes at shallower levels
– Dead end leaf nodes but not the goal
• Backtracking search
– only one successor is generated on expansion
– rather than all successors
– fewer memory
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO (Stack), i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue(Stack), i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
• Expand deepest unexpanded node
• Implementation:
– fringe = LIFO queue, i.e., put successors at front
Depth-first search
S
A D
B D A E
C E E B B F
11
D F B F C E A C G
14 17 15 15 13
G C G F
19 19 17
G 25
Depth-First Search (Analysis)
• Not complete
– because a path may be infinite or looping
– then the path will never fail and go back try another option
• Not optimal
– it doesn't guarantee the best solution
• It overcomes
– the time and space complexities
• Adv:
– If more than one solution exists (or) number of levels is
high then DFS is best because exploration is done only in a
small portion of the whole space.
• Disadv:
– Not guaranteed to find a solution.
Properties of Depth First Search
• Complete? No: fails in infinite-depth spaces, spaces
with loops
– Modify to avoid repeated states along path
complete in finite spaces
rajani.pk@pccoepune.org
Mobile:9975266997