0% found this document useful (0 votes)
8 views37 pages

AI - C-Scheme - Lab Manual

The document is a laboratory manual for an Artificial Intelligence lab course at Shivajirao S. Jondhale College of Engineering, outlining the course objectives, outcomes, and experiments for Semester VI. It details the vision and mission of the department, program educational objectives, and specific outcomes related to AI. The manual includes a list of experiments, including case studies and programming assignments, aimed at developing students' understanding of AI concepts and applications.

Uploaded by

SHREYA BHUVAD
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)
8 views37 pages

AI - C-Scheme - Lab Manual

The document is a laboratory manual for an Artificial Intelligence lab course at Shivajirao S. Jondhale College of Engineering, outlining the course objectives, outcomes, and experiments for Semester VI. It details the vision and mission of the department, program educational objectives, and specific outcomes related to AI. The manual includes a list of experiments, including case studies and programming assignments, aimed at developing students' understanding of AI concepts and applications.

Uploaded by

SHREYA BHUVAD
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/ 37

Laboratory Manual

Artificial Intelligence Lab


Subject Code: CSL604 (C Scheme)

Semester – VI

Prepared by
Prof. Poonam Narkhede
Prof. Pallavi Bharambe

Department of Computer Engineering


Shivajirao S. Jondhale College of Engineering,
Dombivli (E)
Affiliated to University of Mumbai
Shivajirao S Jondhale College of Engineering, Dombivli (E)

VISION
To impart quality technical education for creating competent and ethically strong
professionals with capabilities of accepting new challenges.

MISSION

 Our efforts are dedicated to impart quality technical education based on a balanced
program of instructions and practical experiences.
 Our strength is to provide value based technical education to develop core competencies
and ethics for overall personality development.
 Our endeavor is to impart in depth knowledge and versatility to meet the global
challenges.
Shivajirao S Jondhale College of Engineering, Dombivli (E)

Department of Computer Engineering

VISION
To impart quality technical education in the department of Computer Engineering for
creating competent and ethically strong engineers with capabilities of accepting new
challenges.

MISSION

 Our efforts are dedicated to impart quality technical education to prepare engineering
graduates who excel in programming skills.
 Our strength is to serve society by producing globally competent professionals.
 Our endeavor is to provide all possible support to build strong teaching environment to
provide quality education in Computer Engineering.

PROGRAM EDUCATIONAL OBJECTIVES (PEOS)

 To prepare learners with a sound foundation in the mathematical, scientific and


Engineering fundamentals
 To develop among learners ability to formulate, analyze and solve engineering problems in
real life
 To encourage, motivate and prepare learners to inculcate professional and ethical attitude
for lifelong learning
 To prepare learner to become generalist engineers and for pursuing higher studies

Program Specific Outcomes (PSOs)

 Ability to use software methodology and various software tools for developing system
programs, high quality web apps and solutions to complex real world problems.
 Ability to identify and use suitable data structure and analyze the various algorithm for
given problem from different domains
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Artificial Intelligence lab


Semester – VI

Course Objectives:

1. To conceptualize the basic ideas and techniques underlying the design of intelligent
systems.

2. To make students understand and Explore the mechanism of mind that enables
intelligentthought and action.
3. To make students understand advanced representation formalism and search techniques.

4. To make students understand how to deal with uncertain and incomplete information.

Course Outcomes:
Learner will be able to…

CO1: Ability to develop a basic understanding of AI building blocks presented in


intelligent agents.
CO2: Ability to choose an appropriate problem solving method and knowledge
representationtechnique.
CO3: Ability to analyze the strength and weaknesses of AI approaches to knowledge–
intensive problem solving.
CO4: Ability to design models for reasoning with uncertainty as well as the use of
unreliableinformation.
CO5: Ability to design and develop AI applications in real world scenarios
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Artificial Intelligence lab

Semester – VI

List of experiment

Sr. Title of the Experiment Page


No. No.
1 Case Study on AI application Publication in 1
IEEE/ACM
2 Assignment on state space formulation and PEAS 2
representation for wampus World Problem
3 WAP for BFS algorithm 9
4 WAP for DFS algorithm 11
5 WAP for A* algoritham 13
6 WAP for Tic-Tac- toe using game playing 17
algorithm
7 WAP for Water Jug problem in prolog 20
8 WAP for Block world Problem using planning 23
agent
9 Study of Bayes Belief Network 28
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Artificial Intelligence lab


Semester –VI

Experiments to CO Mapping

Expt Title (Subtopic Prior Concept References CO


No. Name) (Chapter (From Syllabus) Mapping
Name/Concept)
Stuart J. Russell and
Peter Norvig, CO1,CO2,
1 AI application - "Artificial CO3
Intelligence: A
Modern Approach”
Stuart J. Russell and
Peter Norvig, CO1,CO2,
2 IntelligentAgent - "Artificial CO3
Intelligence: A
Modern Approach”
Stuart J. Russell and
Peter Norvig, CO1,CO2,
3 Problem Data Structure "Artificial CO3
Solving Intelligence: A
Modern Approach”

Stuart J. Russell and


4 Problem Data Structure Peter Norvig, CO1, CO2
Solving "Artificial & CO3
Intelligence: A
Modern Approach”
Stuart J. Russell and
Peter Norvig,
5 Problem Data Structure "Artificial CO1, CO2
Solving Intelligence: A & CO3
Modern Approach”

Stuart J. Russell and


Problem Peter Norvig, CO1, CO2
6 Solving Data Structure "Artificial & CO3
Intelligence: A
Modern Approach”
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Stuart J. Russell and


Knowledge and - Peter Norvig, CO1,CO2,
7 Reasoning "Artificial CO3,CO5
Intelligence: A
Modern Approach”
Stuart J. Russell and CO1,CO2,
Planning and Peter Norvig, CO3,CO5
8 learning - "Artificial
Intelligence: A
Modern Approach”
Stuart J. Russell and
Knowledge and Peter Norvig, CO1, CO4
9 Reasoning - "Artificial & CO5
Intelligence: A
Modern Approach”
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 1

Aim:

One case study on AI applications publication in IEEE/ACM/Springer or any


prominent journal.

Theory:

Students can find the research papers based on the artificial neural network,
hybrid systems, genetic algorithm, fuzzy system, fuzzy logic, fuzzy inference
system etc. Students should write technology used, algorithm and survey.
Students need to search recent papers on any of the above mentioned topics,
study it and prepare report on the same

Conclusion:
Thus, we have understood the recent advancements and applications of
various sub-domains of Artificial Intelligence

AI Lab/ VI 1
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 2

Aim:

Assignment on State space formulation and PEAS representation for Wumpus


world Problem.

Theory:
The Wumpus world is a cave which has 4/4 rooms connected with
passageways. So there are total 16 rooms which are connected with each other.
We have a knowledge-based agent who will go forward in this world. The
cave has a room with a beast which is called Wumpus, who eats anyone who
enters the room. The Wumpus can be shot by the agent, but the agent has a
single arrow. In the Wumpus world, there are some Pits rooms which are
bottomless, and if agent falls in Pits, then he will be stuck there forever. The
exciting thing with this cave is that in one room there is a possibility of finding
a heap of gold. So the agent goal is to find the gold and climb out the cave
without fallen into Pits or eaten by Wumpus. The agent will get a reward if he
comes out with gold, and he will get a penalty if eaten by Wumpus or falls in
the pit.

Following is a sample diagram for representing the Wumpus world. It


is showing some rooms with Pits, one room with Wumpus and one agent at (1,
1) square location of the world.

AI Lab/ VI 2
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Fig.2.1 Initial state

Procedure:

PEAS description of Wumpus world:

To explain the Wumpus world we have given PEAS description as below:

Performance measure:

o +1000 reward points if the agent comes out of the cave with the gold.
o -1000 points penalty for being eaten by the Wumpus or falling into the
pit.
o -1 for each action, and -10 for using an arrow.
o The game ends if either agent dies or came out of the cave.

Environment:

o A 4*4 grid of rooms.


o The agent initially in room square [1, 1], facing toward the right.
o Location of Wumpus and gold are chosen randomly except the first
square [1,1].

AI Lab/ VI 3
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

o Each square of the cave can be a pit with probability 0.2 except the
first square.

Actuators:

o Left turn,
o Right turn
o Move forward
o Grab
o Release
o Shoot.

Sensors:

o The agent will perceive the stench if he is in the room adjacent to the
Wumpus. (Not diagonally).
o The agent will perceive breeze if he is in the room directly adjacent to
the Pit.
o The agent will perceive the glitter in the room where the gold is
present.
o The agent will perceive the bump if he walks into a wall.
o When the Wumpus is shot, it emits a horrible scream which can be
perceived anywhere in the cave.
o These percepts can be represented as five element list, in which we
will have different indicators for each sensor.
o Example if agent perceives stench, breeze, but no glitter, no bump, and
no scream then it can be represented as:
[Stench, Breeze, None, None, None].

AI Lab/ VI 4
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

The Wumpus world Properties:

o Partially observable: The Wumpus world is partially observable


because the agent can only perceive the close environment such as an
adjacent room.
o Deterministic: It is deterministic, as the result and outcome of the
world are already known.
o Sequential: The order is important, so it is sequential.
o Static: It is static as Wumpus and Pits are not moving.
o Discrete: The environment is discrete.
o One agent: The environment is a single agent as we have one agent
only and Wumpus is not considered as an agent.

Exploring the Wumpus world:

Now we will explore the Wumpus world and will determine how the agent
will find its goal by applying logical reasoning.

Agent's First step:

Initially, the agent is in the first room or on the square [1,1], and we already
know that this room is safe for the agent, so to represent on the below diagram
(a) that room is safe we will add symbol OK. Symbol A is used to represent
agent, symbol B for the breeze, G for Glitter or gold, V for the visited room, P
for pits, W for Wumpus.

At Room [1,1] agent does not feel any breeze or any Stench which means the
adjacent squares are also OK.

AI Lab/ VI 5
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Fig 2.2 1st step

Agent's second Step:

Now agent needs to move forward, so it will either move to [1, 2], or [2,1].
Let's suppose agent moves to the room [2, 1], at this room agent perceives
some breeze which means Pit is around this room. The pit can be in [3, 1], or
[2,2], so we will add symbol P? to say that, is this Pit room?

Now agent will stop and think and will not make any harmful move. The agent
will go back to the [1, 1] room. The room [1,1], and [2,1] are visited by the
agent, so we will use symbol V to represent the visited squares.

Agent's third step:

At the third step, now agent will move to the room [1,2] which is OK. In the
room [1,2] agent perceives a stench which means there must be a Wumpus

AI Lab/ VI 6
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

nearby. But Wumpus cannot be in the room [1,1] as by rules of the game, and
also not in [2,2] (Agent had not detected any stench when he was at [2,1]).
Therefore agent infers that Wumpus is in the room [1,3], and in current state,
there is no breeze which means in [2,2] there is no Pit and no Wumpus. So it is
safe, and we will mark it OK, and the agent moves further in [2,2].

Fig 2.3 2nd step

Agent's fourth step:

At room [2,2], here no stench and no breezes present so let's suppose agent
decides to move to [2,3]. At room [2,3] agent perceives glitter, so it should
grab the gold and climb out of the cave.

AI Lab/ VI 7
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Program:

Output:

Conclusion: Thus, we have studied PEAS representation for Wumpus world


Problem.

AI Lab/ VI 8
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 3

Aim:

WAP for BFS algorithm using uninformed search method.

Theory:

Breadth-first search is a simple strategy in which the root node is expanded


first, then all the successors of the root node are expanded next, then their
successors, and so on. Breadth-first search can be implemented by calling
TREE-SEARCH with an empty fringe that is a first-in-first-out (FIFO) queue,
assuring that the nodes that are visited first will be expanded first. It uses two
queues for its implementation: open, close Queue. Children are added from
backend of queue.

Performance Comparison:

 Completeness: yes, it gives shallowest goal

 Optimality: yes, provided path cost is non- decreasing

 Time complexity: O(b ͩ + ¹)

 Space complexity: O(b ͩ + ¹)

Algorithm:

1. Create single member queue comprising of root node.

2. If 1st Member of Queue is GOAL then goto Step 5.

AI Lab/ VI 9
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

3. If first member of queue is not GOAL then remove it and add to


CLOSE or Visited Queue. Consider its Children/ successor, if any
add them from BACK/REAR [FIFO]

4. If queue is not empty then goto Step 2, If queue is empty then goto
Step 6

5. Print “SUCCESS” and stop.

6. Print “FALIURE” and stop

* Solve One example based on BFS

Program:

Output:

Conclusion: Thus, the program of Breadth first search has been executed
successfully.
.

AI Lab/ VI 10
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 4

Aim:

WAP for DFS algorithm using uninformed search method.

Theory:

The DFS algorithm is a recursive algorithm that uses the idea of backtracking.
It involves exhaustive searches of all the nodes by going ahead, if possible,
else by backtracking. Here, the word backtrack means that when you are
moving forward and there are no more nodes along the current path, you move
backwards on the same path to find nodes to traverse. All the nodes will be
visited on the current path till all the unvisited nodes have been traversed after
which the next path will be selected.

Performance Analysis: Depth-first search visits every vertex once and checks
every edge in the graph once. Therefore, DFS complexity is O(V + E)O(V+E).
This assumes that the graph is represented as an adjacency list.

Algorithm:

1. If the initial state is a goal state, quit and return success.


2. Otherwise, loop until success or failure is signalled.
A] Generate a state, say E, and let it be the successor of the initial
state.If there is no successor, signal failure.

B] Call Depth-First Search with E as the initial state.

C] If success is returned, signal success. Otherwise continue in this

Loop.

AI Lab/ VI 11
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

* Solve One example based on DFS

Program:

Output:

Conclusion: Thus, the program of Depth first search has been executed
successfully.

AI Lab/ VI 12
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 5

Aim:

WAP for A* algorithm using informed search method.

Theory:

An informed search strategy-one that uses problem-specific


knowledge-can find solutions more efficiently. Akey component of these
algorithms is a heuristic function h(n)
h(n)= estimated cost of the cheapest path from node n to a goal node.
Admissible /heuristic never over estimated i.e. h(n)≤ Actual cost. For
example, Distance between two nodes(cities)=> straight line distance and
for 8-puzzel problem- Admissible heuristic can be number of misplaced tiles
h(n)= 8.

A* Search technique
It is informed search technique. It uses additional information beyond
problem formulation and tree. Search is based on Evaluation function
f(n).Evaluation function is based on both heuristic function h(n) and g(n).
f(n)=g(n) + h(n)
It uses two queues for its implementation: open, close Queue. Open queue is
a priority queue which is arranged in ascending order of f(n).

Algorithm:
1. Create a single member queue comprising of Root node
2. If FIRST member of queue is goal then goto step 5
3. If first member of queue is not goal then remove it from
queue and add to close queue.

AI Lab/ VI 13
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

4. Consider its children if any, and add them to queue in


ascending order of evaluation function f(n).
5. If queue is not empty then goto step 2.
6. If queue is empty then goto step 6
7. Print ‘success’ and stop
8. Print ‘failure’ and stop.
Performance Comparison:
 Completeness: yes
 Optimality: yes
Limitation:
 It generate same node again and again
 Large Memory is required

Fig.5.1. Example of A*
OPEN/FRINGE CLOSE
[A] [ ]
[C,B] [A]
[D,B,E,A] [A,C]

AI Lab/ VI 14
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

[F,E,B,C,A] [A,C,D]
[G,E,B,C,A,D] [A,C,D,F]
SUCCESS

Node A:
f(B)=g(B) + h(B)=3+5=8
f(C) =g(C) + h(C)=1 + 6=7
Node C:
f(A) = g(A) + h(A)=2+7=10
f(D) = g(D) + h(D)=3+4=7
f(E) = g(E) + h(E)=7+1=8
Node D:
f(F) = g(F) + h(F)=6+1=7
f(C) = g(C) + h(C)= 5+6=11
f(B) = g(B) + h(B)=4+5=9
Node F:
f(E) = g(E) + h(E)=7+1=8
f(D) = g(D) + h(D)= 9+4=13
f(G) = g(G) + h(G)=7+0=7

Final path: A  C  DF  G


Total cost= 7

AI Lab/ VI 15
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Program:

Output:

Conclusion: Thus, the program of A*algorithm has been executed


successfully

AI Lab/ VI 16
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 6

Aim:

WAP for Tic-Tac-Toe using game playing algorithm.

Theory:
The min-max algorithm computes the min-max decision from the
current state. It uses a simple recursive computation of the min-max values of
each successor state, directly implementing the defining equations. The
recursion process all the way down to the leaves of the tree, and then the min-
max values are backed up through the tree as the recursion unwinds.
The min-max algorithm performs a complete depth-first exploration of the
game tree. If the maximum depth of the tree is m, and there are b legal moves
at each point, then the time complexity of the min-max algorithm is O(bm).
The space complexity is O(bm) for an algorithm that generates all successors
at once, or O(m) for an algorithm that generates successors one at a time. For
real games, of course, the time cost is totally impractical, but this algorithm
serves as the basis for the mathematical analysis of games and for more
practical algorithms.

Algorithm:
function MINIMAX-DECISION(state)returns an action
inputs: state, current state in game
v  MAX-VALUE(state)
return the action in SUCCESSORS(state) v

function MAX-VALUE(state)returns a utility value


if TERMINAL-TEST(state) then return UTILITY(state)

AI Lab/ VI 17
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

v  -infinity
for a, s in SUCCESSORS(state)do
v  MAX(V, MIN-VALUE(S))
return v

function MIN-VALUE
if TERMINAL-TEST(state) then return UTILITY(state)
V infinity
for a , s in SUCCESSORS(state)do
v  MIN(V, MAX-VALUE(S))
return v

Fig.6.1. Tic-Tac-Toe

AI Lab/ VI 18
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Program:

Output:

Conclusion: Thus, the program for Tic-Tac-Toe game has been executed
successfully

AI Lab/ VI 19
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 7

Aim:

WAP for Water Jug Problem in Prolog.

Theory:
This is the jug problem using simple depth-first search of a graph. The
modified water-jug problem is as follows: Jug A holds 4 liters, and jug B
holds 3 liters. There is a pump, which can be used to fill either Jug. How
can you get exactly 2 liters of water into the 4-liter jug?
Assumptions:
 We can fill a jug from the pump
 We can pour water out of the jug onto the ground
 We can pour water from one jug to another
 There are no other measuring devices available

To solve the water jug problem, apart from problem statement we also need a
control structure that loops through a simple cycle in which some rule whose
left side matches the current state is chosen, the appropriate change to state is
made as described in corresponding right side and the resulting state is
checked to see if it corresponds to a goal state. As long as it does not the cycle
continues.

Algorithm:

Rules for water jug problem

AI Lab/ VI 20
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Table 7.1. Rules


Rule Current New state Rules
state
(x, y) (4,y) Fill the 4-gallon jug.
1 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 4-gallon
if x>0 jug.
4 (x, y) (x, y-d) Pour some water out of 3-gallon
if y>0 jug.
5 (x, y) (0, y) Empty the 4-gallon jug on
if x>0 ground.
6 (x, y) (x, 0) Empty the 3-gallon jug on
if y>0 ground.
7 (x, y) (4,y-(4-x)) Pour water from 3-gallon jug
if into the 4-gallon jug until the 4-
(x+y)>=4 gallon jug is full.
&(y>0)
8 if (x-(3-y),3) Pour water from 4-gallon jug
(x+y)>=3 into the 3-gallon jug until the 3-
&(x>0) gallon jug is full.
9 (x, y) (x+y,0) Pour all the water from 3-gallon
if jug into the 4-gallon jug.
(x+y)<=4
&(y>0)
10 (x, y)if (0,x+y) Pour all the water from 4-gallon

AI Lab/ VI 21
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

(x+y)<=3 jug into the 3-gallon jug.


&(x>0)
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 2 gallons in the 4-gallon
jug on the ground.

Program:

Output:

Conclusion: Thus, the program of water jug problem has been executed
successfully.

AI Lab/ VI 22
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 8

Aim:

WAP for Block world Problem using planning agent.

Theory:

Fig. 8.1.Block word Problem


What is Blocks World Problem?

This is how the problem goes — There is a table on which some blocks are
placed. Some blocks may or may not be stacked on other blocks. We have a
robot arm to pick up or put down the blocks. The robot arm can move only
one block at a time, and no other block should be stacked on top of the block
which is to be moved by the robot arm.
Our aim is to change the configuration of the blocks from the Initial State to
the Goal State, both of which have been specified in the diagram above.

What is Goal Stack Planning?


Goal Stack Planning is one of the earliest methods in artificial intelligence in
which we work backwards from the goal state to the initial state.

AI Lab/ VI 23
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

We start at the goal state and we try fulfilling the preconditions required to
achieve the initial state. These preconditions in turn have their own set of
preconditions, which are required to be satisfied first. We keep solving these
“goals” and “sub-goals” until we finally arrive at the Initial State. We make
use of a stack to hold these goals that need to be fulfilled as well the
actions that we need to perform for the same.

Apart from the “Initial State” and the “Goal State”, we maintain a “World
State” configuration as well. Goal Stack uses this world state to work its way
from Goal State to Initial State. World State on the other hand starts off as the
Initial State and ends up being transformed into the Goal state.
At the end of this algorithm we are left with an empty stack and a set of
actions which helps us navigate from the Initial State to the World State.

Representing the configurations as a list of “predicates”


Predicates can be thought of as a statement which helps us convey the
information about a configuration in Blocks World.
Given below are the list of predicates as well as their intended meaning
1. ON(A,B) : Block A is on B
2. ONTABLE(A) : A is on table
3. CLEAR(A) : Nothing is on top of A
4. HOLDING(A) : Arm is holding A.
5. ARMEMPTY : Arm is holding nothing
Using these predicates, we represent the Initial State and the Goal State in our
example like this:
Initial State — ON(B,A) ∧ ONTABLE(A) ∧ ONTABLE(C) ∧
ONTABLE(D) ∧ CLEAR(B) ∧ CLEAR(C) ∧ CLEAR(D) ∧ ARMEMPTY

AI Lab/ VI 24
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Fig 8.2 Initial State


Goal State — ON(C,A) ∧ ON(B,D) ∧ ONTABLE(A) ∧ ONTABLE(D) ∧
CLEAR(B) ∧ CLEAR(C) ∧ ARMEMPTY

Fig 8.3 Goal State


Thus a configuration can be thought of as a list of predicates describing the
current scenario.
“Operations” performed by the robot arm
The Robot Arm can perform 4 operations:
1. STACK(X,Y) : Stacking Block X on Block Y
2. UNSTACK(X,Y) : Picking up Block X which is on top of Block Y

AI Lab/ VI 25
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

3. PICKUP(X) : Picking up Block X which is on top of the table


4. PUTDOWN(X) : Put Block X on the table
All the four operations have certain preconditions which need to be satisfied to
perform the same. These preconditions are represented in the form of
predicates.
The effect of these operations is represented using two
lists ADD and DELETE. DELETE List contains the predicates which will
cease to be true once the operation is performed. ADD List on the other hand
contains the predicates which will become true once the operation is
performed.
The Precondition, Add and Delete List for each operation is rather intuitive
and have been listed below.
Table 8.1 Operations

Operations performed by the Robot Arm


For example, to perform the STACK(X,Y) operation i.e. to Stack Block X on
top of Block Y, No other block should be on top of Y (CLEAR(Y)) and the
Robot Arm should be holding the Block X (HOLDING(X)).

AI Lab/ VI 26
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Once the operation is performed, these predicates will cease to be true, thus
they are included in DELETE List as well. (Note : It is not necessary for the
Precondition and DELETE List to be the exact same).
On the other hand, once the operation is performed, The robot arm will be free
(ARMEMPTY) and the block X will be on top of Y (ON(X,Y)).

Program:

Output:

Conclusion: Thus, the program for Block world problem has been executed
successfully.

AI Lab/ VI 27
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Experiment Number: 9

Aim:

Study of Bayes Belief Network

Theory:
Bayesian belief network is key computer technology for dealing with
probabilistic events and to solve a problem which has uncertainty. We can
define a Bayesian network as:
"A Bayesian network is a probabilistic graphical model which represents a set
of variables and their conditional dependencies using a directed acyclic
graph."
It is also called a Bayes network, belief network, decision network,
or Bayesian model. Bayesian networks are probabilistic, because these
networks are built from a probability distribution, and also use probability
theory for prediction and anomaly detection.
Real world applications are probabilistic in nature, and to represent the
relationship between multiple events, we need a Bayesian network. It can also
be used in various tasks including prediction, anomaly detection, diagnostics,
automated insight, reasoning, time series prediction, and decision making
under uncertainty.
Bayesian Network can be used for building models from data and
experts opinions, and it consists of two parts: Directed Acyclic Graph and
Table of conditional probabilities.
The generalized form of Bayesian network that represents and solve
decision problems under uncertain knowledge is known as an Influence
diagram.

AI Lab/ VI 28
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

A Bayesian network graph is made up of nodes and Arcs (directed links),


where:

Fig 9.1 Graph


o Each node corresponds to the random variables, and a variable can
be continuous or discrete.
o Arc or directed arrows represent the causal relationship or
conditional probabilities between random variables. These directed
links or arrows connect the pair of nodes in the graph.
These links represent that one node directly influence the other node,
and if there is no directed link that means that nodes are independent
with each other
o In the above diagram, A, B, C, and D are random variables
represented by the nodes of the network graph.
o If we are considering node B, which is connected with node
A by a directed arrow, then node A is called the parent of
Node B.
o Node C is independent of node A.

AI Lab/ VI 29
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

The Bayesian network has mainly two components:


o Causal Component
o Actual numbers
Each node in the Bayesian network has condition probability
distribution P(Xi |Parent(Xi) ), which determines the effect of the parent on
that node.
Bayesian network is based on Joint probability distribution and conditional
probability. So let's first understand the joint probability distribution:
Joint probability distribution:
If we have variables x1, x2, x3,....., xn, then the probabilities of a different
combination of x1, x2, x3.. xn, are known as Joint probability distribution.

P[x1, x2, x3,....., xn], it can be written as the following way in terms of the joint
probability distribution.
 P[x1| x2, x3,....., xn]P[x2, x3,....., xn]
 P[x1| x2, x3,....., xn]P[x2|x3,....., xn]....P[xn-1|xn]P[xn].
In general for each variable Xi, we can write the equation as:
P(Xi|Xi-1,........., X1) = P(Xi |Parents(Xi ))

Conclusion: Thus, we have studied Belief networks.

AI Lab/ VI 30

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