SlideShare a Scribd company logo
1 of 14
INDEX
S. No. Program Page No. Signature Remarks
1.
Given the following information as a
database:
WAP in PROLOG for supports(book, cup)
1
2.
WAP to define the family member
relationship.
2
3. WAP for monkey banana problem. 4
4. WAP for Tower of Hanoi problem. 6
5.
WAP for Depth First Search using suitable
example.
7
6.
WAP for Breadth First Search using
suitable example.
8
7.
WAP for login so that user can attempt 3
times. After 3rd attempt program must
terminate with message “NOT
PERMITTED FOR LOGIN”.
9
8.
WAP to check whether graph is connected
or not. If connected then whether
unidirectional or bidirectional.
10
9.
WAP to see all elements are present in list
or not.
12
10.
Mini project on any expert system using
PROLOG.
13
1
EXPERIMENT NO.: 01
AIM: Given following information as a database:
A1: If x is on top of y then y supports x.
A2: If x is above y then they touching each other than x is on top of y.
A3: A cup is above book.
A4: A cup is touching book
Write a program in PROLOG for supports(book, cup).
OBJECTIVE:To study basic of PROLOG commands.
LOGIC:
In domain side declare the variables say x and y of type string as mentioned in the
problem statement.
In predicate section define four statement A1 to A4 in form of predicates like:
support(string, string)
on_top(string, string)
above(string, string)
touch(string, string)
In clause section clauses defined are:
on_top(x, y): -
above(x, y)
touch(x, y)
supports(y, x): -
on_top(x, y)
above(cup, book)
Touch(cup, book)
CONCLUSION:Successfulcompletion of goal.
2
EXPERIMENT NO.: 02
AIM: Write program to define family member relationship.
 If x is father of y or x is mother of y, then x is parent of y.
 If x is parent of z and z is parent of y, then x is grandparent of y.
 Y is parent of x and x is male then x is sonof y.
 Cousins.
 Grandchild
 Uncle
 Brother and sister.
LOGIC:
In domain section declare variable say x, y, z, A, N of type string. Establish the
relationship as below:
1) parent(x, y): -
father(x, y).
parent (x, y): -
mother(x, y).
2) grandparent(x, y): -
parent(x, z).
parent(z, y).
3) son(x, y): -
male(x).
parent(y, x).
4) uncle (x, y): -
parent(z, y).
brother(x, y).
5) brother(x, y): -
male(X).
parent(z, x).
parent(z, y).
3
6) cousins(x, y): -
uncle(z, y).
parent(z, x).
7) grandchild(x, y): -
son(x, z).
son(z, y).
8) sister(x, y): -
female(x).
parent(z, x).
parent(z, y).
Now create database in the form of the fact as below:
father(john, smith).
father(mohit, meera).
mother(sheela, suni1).
mother(reeta, meera).
male(john).
male(smith).
male(mohit).
male(suni1).
female(sheela).
female(meera).
female(reeta).
CONCLUSION:The goal is successfully-achieved for family relationship
4
EXPERIMENT NO.: 03
AIM: Write a program for monkey banana problem.
OBJECTIVE:To study the monkey banana problem.
THEORY:
Monkey banana is the real life problem which can be solved with the AI concept.
In monkey banana problem it is stated that a room is containing a chair, a room,
and some banana that have been hung from a centre of ceiling, out of reach from
monkey. If a monkey clever enough the he can reach banana by placing the chair
directly below the banana and climbing on chair. The problem is to use FOPL
(First Order Predicate logic) to represent this monkey banana world and using
resolution, prove the monkey can reach the banana.
In creating the knowledge base, it is essential first to identify all relevant objects
which will play some role in anticipated inference. Irrelevant object should be
removed, E.g. In this problem, monkey, banana and chair are essential. Other
object such door, windows and wall of the room can be omitted.
Next step is to establish the important properties of the objects, relation between
objects, these include such as the chair is tall enough to raise the monkey within
reach of the banana and so on.
All the items needed for actual knowledge base are listed as axioms. These are
essential facts and rules. All variables are universally quantified.
RELEVENT FACTORS FOR THE PROBLEM
Constants
{floor, chair, banana, monkey}
Variables
{x, y, z}
Predicates
5
{can_reach(x, y); x can reach y
dexterous(x); x is dexterous animal
close(x, y); x is close to y
get_on(x, y); x can get on y
under(x, y); x is under y
tall(x); x is tall
in_room(x); x is room
can_move(x, y, z); x can move y near z
can_climb(x, y); x can climb on y
Axioms
{in_room(bananas)
In_room(chair)
In_room(monkey)
dexterous(monkey)
tall(chair)
close(banana, floor)
can_move(monkey, chair, bananas)
can_climb(monkey, chair(dexterous(x)&
close(x, y)->can_reach(x, y((get_on(x, y)
&under(y, bananas)&tall(y)>close
(x, bananas)(in_room(x)
CONCLUSION:Monkey banana problem has been studied.
6
EXPERIMENT NO.: 04
AIM: Write a program for Tower of Hanoi problem.
OBJECTIVE: To solve the Tower of Hanoi problem using the programming logic.
RULES:
1) Only one disc can move at a time.
2) Larger disc cannot be placed over smaller disc.
3) For n number of disc there is 2n-1 moves.
ALGORITHM:
1) N-Number of discs to be moved.
2) A, B, C are the pegs on which the discs are to be moved.
3) Hanoi(N, A, B, C, moves)
Hanoi is the allows to perform the sequence of moves for solving this problem.
The Tower of Hanoi is consisting of three rods and a number of disc of different
sizes slid onto any rod. The puzzle starts with the discs neatly stacked in ordered of
size on one rod, smaller at top and making the conical shape. The objective of the
puzzle is to move the entire disc to another rod obeying the following rule:
1) Only one disc can move at a time.
2) Each move consists of taking upper disc from a rod and moving it to another
rod, on top other disc that may already be present on the rod.
3) No larger disc is to be placed on the top of smaller disc.
CONCLUSION:The goal is successfully-achieved for Tower of Hanoi
7
EXPERIMENT NO.: 05
AIM: Write a program for Depth First Search using the suitable example.
OBJECTIVE:To study depth first search using PROLOG.
DFS (Depth First Search) is an algorithm for traversing or searching a tree, tree
structure or graph.one starts at root (selecting any node at the root of the graph
case) and explore as far along each branch before backtracking. DFS is the
uniformed search that progress by expanding the first child node of search tree that
appears and thus going deeper and deeper until a goal node is found, or until it hit
the node which has no children. Then search backtracks, returning to the most
recent node it hadn't finished exploring. In a non-recursive implementation, all
freshly expanded nodes are added to LIFO stack for exploration. Space complexity
of DFS is much lower than BFS. Depth First Search are performed by dividing
downward into a tree as quickly as possible. It does not always generate a child
node from most recently expanded node and generates anther of its children this
process continues until goal is found.
ALGORITHM:
1) Place starting node in the queue.
2) If queue is empty, then failure and stop.
3) If first node in queue is goal node g, return success and stop.
Otherwise
1) Remove and expand the first element and place the children at front of the
queue.
2) Return to step 2.
CONCLUSION:Depth First Search has been achieved.
8
EXPERIMENT NO.: 06
AIM: Write the program for Breadth First Search using the suitable example.
THEORY:
Breadth first searches are performed by exploring all the node at given depth
before processing to the next level. All immediate children of node at given depth
before any of the children's children are considered. It always finds the minimal
path solution when one exists. Algorithm uses a queue structure to hold all
generated but still unexplored nodes. The order in which node are placed in the
queue for removal and exploration determines the type of search.
ALGORITHM:
1) Place the starting node in the queue.
2) If queue is empty, then return failure and stop.
3) If first node on the queue is the goal node g, return success and stop.
4) Remove and expand the first element from the queue and place all the
children at end of queue in any order.
5) Return to step 2.
CONCLUSION:
Breadth First Search has been implemented successfully.
9
EXPERIMENT NO.: 07
AIM: Write a program for login so that user can attempt 3 times. After 3rd attempt
program should with message-"NOT PERMITTED TO LOGIN".
LOGIC:
Domains
NAME, PASSWORD=symbol
Predicates
getentry(NAME, PASSWORD)
logon(integer)
user(NAME, PASSWORD)
go
Clauses
go: -
logon(3)
write("you are now logged on"0, nl.
logon(0): -
write("sorry you cannot logon"), nl, fail.
logon(-): -
getentry(NAME, PASSWORD)
user(NAME, PASSWORD)
logon(x): -
write("illegal entry"), nl
xx=x-1
logon(xx)
getentry(NAME, PASSWORD):-
write("please enter your name:"), nl.
readln(PASSWORD), nl
user(smith, abc)
10
EXPERIMENT NO.: 08
Aim: Write a program to determine whether the graph is connected or not, if
connected then whether it unidirectional or bidirectional.
Objective: To study kinds of graphs using PROLOG.
Theory:
Graph G= (V, E) is a set of vertices and edges. A normal graph in which the edges
are undirected is said to be unidirectional. Otherwise if arrow may be placed on
one or both end point of the edge of a to indicate directedness. The graph is said to
be directed. A directed graph in which each edge is given a unique direction (i.e.
the edges may not be bidirectional and point on both directions at once) is called an
oriented graph. An undirected graph is said to be connected if for any pair of nodes
of graph, the two nodes reachable from each other. This definition cannot be
applied for directed graphs without some further modifications. Because in
directed graph if node u is reachable from another node v, the node v may not be
reachable from u hence we call digraph weakly connected. If for any pairs of the
node of the graph both the nodes are reachable from each other then it is called
strongly connected graph. If the direction of graph is omitted, then graph is
connected.
LOGIC:
Domains
x, y, z = symbol
Predicates
edge(string, string)
pathuni(string, string)
pathbi(string, string)
pathpresent(string, string)
Clauses
pathpresent(x, y): -
pathuni(x, y)
11
pathbi(x, y)
pathuni(x, y): -
edge(x, y)ni
write("path is unidirectional"), n!
write("path is present from "x" "to" y),
edge(x, z)
edge(z, y), n!
write(path is present from "x" to "z" and from "z" to "y"),
x<>y
pathbi(x, y): -
edge (x, y),
edge(y, x), n!
write("path is bidirectional"), n!
write("path is present from "x" "to" y and vice versa),
x<>y
edge(a, b)
edge(a, c)
edge(b, a)
edge(a, b)
edge(c, a)
edge(d, b)
edge(b, c)
edge(d, a)
edge(d, e)
edge(d, f)
CONCLUSION:Graph has been studied and implemented.
12
EXPERIMENT NO.:09
AIM: Write to see all element are present in the list or not.
OBJECTIVE:To study the conceptof list using PROLOG.
THEORY:
Link list is a sequence of the nodes. Each node has two part viz. node data and
pointer field. Pointer field points to the next node in the list. The last node's pointer
field contains NULL indicating that pointing to nothing. If first node pointer
consist field consist NULL it means that the link list consists of a single node.
LOGIC:
Domains
List=symbol*
Predicates
list(symbol, list)
Clauses
list(x, [H|-]): -
x=H
write("Element “, x," is present in the list"), nl
list(x, [-|T])
list(x, T),
list(x, T)
list(x, |]): write(x, "is not in the list"), fail.
CONCLUSION:Goal is successfulfor above mentioned aim.
13
EXPERIMENT NO.:10
AIM: Mini project on expert system.
EXPERT SYSTEM:
Expert system is set of program which manipulates encoded knowledge to solve
the problems in a specialized domain that normally require human expertise. An
expert system's knowledge is obtained from expert sources and coded in a form
suitable for the system to use in its inference or reasoning process. Expert
knowledge require much training and experience in some specialized field such as
machine.
CHARACTERISTICS:
1) Expert system uses the knowledge rather than data to control solution of
process.
2) The knowledge is encoded and maintained as an entity separate from the
control program.
3) Expert systems are capable of explaining how a particular conclusion was
reached why requested information is need during consultation.
4) These are the symbolic representations for knowledge and perform their
inferences through symbolic computation.
5) These often reasons with meta knowledge. Meta knowledge is knowledge
about data.
APPLICATION:
1) Different type medical diagnosis.
2) Diagnosis of complex electronic and electromechanical systems.
3) Diagnosis of diesel electric locomotion systems.
4) Diagnosis of software development projects.
5) Forecasting the crop damage.
6) Identification of chemical compound structures.
7) Location of fault in the computer and communication systems.
8) Evaluation of loan application for lending institutions.
9) Assessment of geological structure from dip meter logs.
10) Estate planning for minimal tax.
11) Design of VLNI system.
12) Spaceplanning.

More Related Content

What's hot

Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)SHUBHAM KUMAR GUPTA
 
L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicManjula V
 
Loops and functions in r
Loops and functions in rLoops and functions in r
Loops and functions in rmanikanta361
 
Semantic net in AI
Semantic net in AISemantic net in AI
Semantic net in AIShahDhruv21
 
First order logic in knowledge representation
First order logic in knowledge representationFirst order logic in knowledge representation
First order logic in knowledge representationSabaragamuwa University
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structureAbrish06
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithmsswapnac12
 
First order predicate logic (fopl)
First order predicate logic (fopl)First order predicate logic (fopl)
First order predicate logic (fopl)chauhankapil
 
First Order Logic resolution
First Order Logic resolutionFirst Order Logic resolution
First Order Logic resolutionAmar Jukuntla
 
Hash table in data structure and algorithm
Hash table in data structure and algorithmHash table in data structure and algorithm
Hash table in data structure and algorithmAamir Sohail
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logicAmey Kerkar
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design MAHASREEM
 
Multilayer perceptron
Multilayer perceptronMultilayer perceptron
Multilayer perceptronomaraldabash
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic Junya Tanaka
 
Knowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceKnowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceRamla Sheikh
 
Propositional logic
Propositional logicPropositional logic
Propositional logicRushdi Shams
 
Fuzzy logic and application in AI
Fuzzy logic and application in AIFuzzy logic and application in AI
Fuzzy logic and application in AIIldar Nurgaliev
 
Dempster Shafer Theory AI CSE 8th Sem
Dempster Shafer Theory AI CSE 8th SemDempster Shafer Theory AI CSE 8th Sem
Dempster Shafer Theory AI CSE 8th SemDigiGurukul
 

What's hot (20)

Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 
L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logic
 
Loops and functions in r
Loops and functions in rLoops and functions in r
Loops and functions in r
 
Semantic net in AI
Semantic net in AISemantic net in AI
Semantic net in AI
 
First order logic in knowledge representation
First order logic in knowledge representationFirst order logic in knowledge representation
First order logic in knowledge representation
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
First order predicate logic (fopl)
First order predicate logic (fopl)First order predicate logic (fopl)
First order predicate logic (fopl)
 
First Order Logic resolution
First Order Logic resolutionFirst Order Logic resolution
First Order Logic resolution
 
Hash table in data structure and algorithm
Hash table in data structure and algorithmHash table in data structure and algorithm
Hash table in data structure and algorithm
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
lattice
 lattice lattice
lattice
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
 
Multilayer perceptron
Multilayer perceptronMultilayer perceptron
Multilayer perceptron
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic
 
Knowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceKnowledge representation In Artificial Intelligence
Knowledge representation In Artificial Intelligence
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Fuzzy logic and application in AI
Fuzzy logic and application in AIFuzzy logic and application in AI
Fuzzy logic and application in AI
 
Dempster Shafer Theory AI CSE 8th Sem
Dempster Shafer Theory AI CSE 8th SemDempster Shafer Theory AI CSE 8th Sem
Dempster Shafer Theory AI CSE 8th Sem
 

Similar to Artificial Intelligence Lab File

(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 aiRadhika Srinivasan
 
Computer investigatroy project c++ class 12
Computer investigatroy project c++ class 12Computer investigatroy project c++ class 12
Computer investigatroy project c++ class 12meenaloshiniG
 
Artificial Intelligence_Searching.pptx
Artificial Intelligence_Searching.pptxArtificial Intelligence_Searching.pptx
Artificial Intelligence_Searching.pptxRatnakar Mikkili
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial IntelligenceJay Nagar
 
Artificial intelligence cs607 handouts lecture 11 - 45
Artificial intelligence   cs607 handouts lecture 11 - 45Artificial intelligence   cs607 handouts lecture 11 - 45
Artificial intelligence cs607 handouts lecture 11 - 45Sattar kayani
 
Deep learning tutorial 9/2019
Deep learning tutorial 9/2019Deep learning tutorial 9/2019
Deep learning tutorial 9/2019Amr Rashed
 
Deep Learning Tutorial
Deep Learning TutorialDeep Learning Tutorial
Deep Learning TutorialAmr Rashed
 
problem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsproblem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsSlimAmiri
 
Neural Nets Deconstructed
Neural Nets DeconstructedNeural Nets Deconstructed
Neural Nets DeconstructedPaul Sterk
 
Genetic operators
Genetic operatorsGenetic operators
Genetic operatorsDEEPIKA T
 
An introduction to Prolog language slide
An introduction to Prolog language slideAn introduction to Prolog language slide
An introduction to Prolog language slide2021uam4641
 
What Deep Learning Means for Artificial Intelligence
What Deep Learning Means for Artificial IntelligenceWhat Deep Learning Means for Artificial Intelligence
What Deep Learning Means for Artificial IntelligenceJonathan Mugan
 
Cs229 notes-deep learning
Cs229 notes-deep learningCs229 notes-deep learning
Cs229 notes-deep learningVuTran231
 
Relations and functions
Relations and functionsRelations and functions
Relations and functionsDreams4school
 

Similar to Artificial Intelligence Lab File (20)

(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai
 
ppt
pptppt
ppt
 
ppt
pptppt
ppt
 
Computer investigatroy project c++ class 12
Computer investigatroy project c++ class 12Computer investigatroy project c++ class 12
Computer investigatroy project c++ class 12
 
L1
L1L1
L1
 
Artificial Intelligence_Searching.pptx
Artificial Intelligence_Searching.pptxArtificial Intelligence_Searching.pptx
Artificial Intelligence_Searching.pptx
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Artificial intelligence cs607 handouts lecture 11 - 45
Artificial intelligence   cs607 handouts lecture 11 - 45Artificial intelligence   cs607 handouts lecture 11 - 45
Artificial intelligence cs607 handouts lecture 11 - 45
 
Deep learning tutorial 9/2019
Deep learning tutorial 9/2019Deep learning tutorial 9/2019
Deep learning tutorial 9/2019
 
Deep Learning Tutorial
Deep Learning TutorialDeep Learning Tutorial
Deep Learning Tutorial
 
Neural_Network
Neural_NetworkNeural_Network
Neural_Network
 
problem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , problomsproblem solve and resolving in ai domain , probloms
problem solve and resolving in ai domain , probloms
 
Neural Nets Deconstructed
Neural Nets DeconstructedNeural Nets Deconstructed
Neural Nets Deconstructed
 
Genetic operators
Genetic operatorsGenetic operators
Genetic operators
 
An introduction to Prolog language slide
An introduction to Prolog language slideAn introduction to Prolog language slide
An introduction to Prolog language slide
 
What Deep Learning Means for Artificial Intelligence
What Deep Learning Means for Artificial IntelligenceWhat Deep Learning Means for Artificial Intelligence
What Deep Learning Means for Artificial Intelligence
 
P5
P5P5
P5
 
Cs229 notes-deep learning
Cs229 notes-deep learningCs229 notes-deep learning
Cs229 notes-deep learning
 
Relations and functions
Relations and functionsRelations and functions
Relations and functions
 
Module 2 topic 1 notes
Module 2 topic 1 notesModule 2 topic 1 notes
Module 2 topic 1 notes
 

More from Kandarp Tiwari

Speed Detecting Camera by Kandarp Tiwari
Speed Detecting Camera by Kandarp TiwariSpeed Detecting Camera by Kandarp Tiwari
Speed Detecting Camera by Kandarp TiwariKandarp Tiwari
 
Speed Detecting Camera by Kandarp Tiwari
Speed Detecting Camera by Kandarp TiwariSpeed Detecting Camera by Kandarp Tiwari
Speed Detecting Camera by Kandarp TiwariKandarp Tiwari
 
Web Technology Lab File
Web Technology Lab FileWeb Technology Lab File
Web Technology Lab FileKandarp Tiwari
 
Web Technology Front Page
Web Technology Front PageWeb Technology Front Page
Web Technology Front PageKandarp Tiwari
 
Compiler design front page
Compiler design front pageCompiler design front page
Compiler design front pageKandarp Tiwari
 
Computer Networks Front Page
Computer Networks Front PageComputer Networks Front Page
Computer Networks Front PageKandarp Tiwari
 
Computer Networks Lab File
Computer Networks Lab FileComputer Networks Lab File
Computer Networks Lab FileKandarp Tiwari
 
Compiler Design Lab File
Compiler Design Lab FileCompiler Design Lab File
Compiler Design Lab FileKandarp Tiwari
 
Os lab file c programs
Os lab file c programsOs lab file c programs
Os lab file c programsKandarp Tiwari
 
Java Programs Lab File
Java Programs Lab FileJava Programs Lab File
Java Programs Lab FileKandarp Tiwari
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C ProgramsKandarp Tiwari
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsKandarp Tiwari
 

More from Kandarp Tiwari (13)

Speed Detecting Camera by Kandarp Tiwari
Speed Detecting Camera by Kandarp TiwariSpeed Detecting Camera by Kandarp Tiwari
Speed Detecting Camera by Kandarp Tiwari
 
Speed Detecting Camera by Kandarp Tiwari
Speed Detecting Camera by Kandarp TiwariSpeed Detecting Camera by Kandarp Tiwari
Speed Detecting Camera by Kandarp Tiwari
 
Web Technology Lab File
Web Technology Lab FileWeb Technology Lab File
Web Technology Lab File
 
Web Technology Front Page
Web Technology Front PageWeb Technology Front Page
Web Technology Front Page
 
Web technology
Web technologyWeb technology
Web technology
 
Compiler design front page
Compiler design front pageCompiler design front page
Compiler design front page
 
Computer Networks Front Page
Computer Networks Front PageComputer Networks Front Page
Computer Networks Front Page
 
Computer Networks Lab File
Computer Networks Lab FileComputer Networks Lab File
Computer Networks Lab File
 
Compiler Design Lab File
Compiler Design Lab FileCompiler Design Lab File
Compiler Design Lab File
 
Os lab file c programs
Os lab file c programsOs lab file c programs
Os lab file c programs
 
Java Programs Lab File
Java Programs Lab FileJava Programs Lab File
Java Programs Lab File
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 

Recently uploaded

Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 

Recently uploaded (20)

Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 

Artificial Intelligence Lab File

  • 1. INDEX S. No. Program Page No. Signature Remarks 1. Given the following information as a database: WAP in PROLOG for supports(book, cup) 1 2. WAP to define the family member relationship. 2 3. WAP for monkey banana problem. 4 4. WAP for Tower of Hanoi problem. 6 5. WAP for Depth First Search using suitable example. 7 6. WAP for Breadth First Search using suitable example. 8 7. WAP for login so that user can attempt 3 times. After 3rd attempt program must terminate with message “NOT PERMITTED FOR LOGIN”. 9 8. WAP to check whether graph is connected or not. If connected then whether unidirectional or bidirectional. 10 9. WAP to see all elements are present in list or not. 12 10. Mini project on any expert system using PROLOG. 13
  • 2. 1 EXPERIMENT NO.: 01 AIM: Given following information as a database: A1: If x is on top of y then y supports x. A2: If x is above y then they touching each other than x is on top of y. A3: A cup is above book. A4: A cup is touching book Write a program in PROLOG for supports(book, cup). OBJECTIVE:To study basic of PROLOG commands. LOGIC: In domain side declare the variables say x and y of type string as mentioned in the problem statement. In predicate section define four statement A1 to A4 in form of predicates like: support(string, string) on_top(string, string) above(string, string) touch(string, string) In clause section clauses defined are: on_top(x, y): - above(x, y) touch(x, y) supports(y, x): - on_top(x, y) above(cup, book) Touch(cup, book) CONCLUSION:Successfulcompletion of goal.
  • 3. 2 EXPERIMENT NO.: 02 AIM: Write program to define family member relationship.  If x is father of y or x is mother of y, then x is parent of y.  If x is parent of z and z is parent of y, then x is grandparent of y.  Y is parent of x and x is male then x is sonof y.  Cousins.  Grandchild  Uncle  Brother and sister. LOGIC: In domain section declare variable say x, y, z, A, N of type string. Establish the relationship as below: 1) parent(x, y): - father(x, y). parent (x, y): - mother(x, y). 2) grandparent(x, y): - parent(x, z). parent(z, y). 3) son(x, y): - male(x). parent(y, x). 4) uncle (x, y): - parent(z, y). brother(x, y). 5) brother(x, y): - male(X). parent(z, x). parent(z, y).
  • 4. 3 6) cousins(x, y): - uncle(z, y). parent(z, x). 7) grandchild(x, y): - son(x, z). son(z, y). 8) sister(x, y): - female(x). parent(z, x). parent(z, y). Now create database in the form of the fact as below: father(john, smith). father(mohit, meera). mother(sheela, suni1). mother(reeta, meera). male(john). male(smith). male(mohit). male(suni1). female(sheela). female(meera). female(reeta). CONCLUSION:The goal is successfully-achieved for family relationship
  • 5. 4 EXPERIMENT NO.: 03 AIM: Write a program for monkey banana problem. OBJECTIVE:To study the monkey banana problem. THEORY: Monkey banana is the real life problem which can be solved with the AI concept. In monkey banana problem it is stated that a room is containing a chair, a room, and some banana that have been hung from a centre of ceiling, out of reach from monkey. If a monkey clever enough the he can reach banana by placing the chair directly below the banana and climbing on chair. The problem is to use FOPL (First Order Predicate logic) to represent this monkey banana world and using resolution, prove the monkey can reach the banana. In creating the knowledge base, it is essential first to identify all relevant objects which will play some role in anticipated inference. Irrelevant object should be removed, E.g. In this problem, monkey, banana and chair are essential. Other object such door, windows and wall of the room can be omitted. Next step is to establish the important properties of the objects, relation between objects, these include such as the chair is tall enough to raise the monkey within reach of the banana and so on. All the items needed for actual knowledge base are listed as axioms. These are essential facts and rules. All variables are universally quantified. RELEVENT FACTORS FOR THE PROBLEM Constants {floor, chair, banana, monkey} Variables {x, y, z} Predicates
  • 6. 5 {can_reach(x, y); x can reach y dexterous(x); x is dexterous animal close(x, y); x is close to y get_on(x, y); x can get on y under(x, y); x is under y tall(x); x is tall in_room(x); x is room can_move(x, y, z); x can move y near z can_climb(x, y); x can climb on y Axioms {in_room(bananas) In_room(chair) In_room(monkey) dexterous(monkey) tall(chair) close(banana, floor) can_move(monkey, chair, bananas) can_climb(monkey, chair(dexterous(x)& close(x, y)->can_reach(x, y((get_on(x, y) &under(y, bananas)&tall(y)>close (x, bananas)(in_room(x) CONCLUSION:Monkey banana problem has been studied.
  • 7. 6 EXPERIMENT NO.: 04 AIM: Write a program for Tower of Hanoi problem. OBJECTIVE: To solve the Tower of Hanoi problem using the programming logic. RULES: 1) Only one disc can move at a time. 2) Larger disc cannot be placed over smaller disc. 3) For n number of disc there is 2n-1 moves. ALGORITHM: 1) N-Number of discs to be moved. 2) A, B, C are the pegs on which the discs are to be moved. 3) Hanoi(N, A, B, C, moves) Hanoi is the allows to perform the sequence of moves for solving this problem. The Tower of Hanoi is consisting of three rods and a number of disc of different sizes slid onto any rod. The puzzle starts with the discs neatly stacked in ordered of size on one rod, smaller at top and making the conical shape. The objective of the puzzle is to move the entire disc to another rod obeying the following rule: 1) Only one disc can move at a time. 2) Each move consists of taking upper disc from a rod and moving it to another rod, on top other disc that may already be present on the rod. 3) No larger disc is to be placed on the top of smaller disc. CONCLUSION:The goal is successfully-achieved for Tower of Hanoi
  • 8. 7 EXPERIMENT NO.: 05 AIM: Write a program for Depth First Search using the suitable example. OBJECTIVE:To study depth first search using PROLOG. DFS (Depth First Search) is an algorithm for traversing or searching a tree, tree structure or graph.one starts at root (selecting any node at the root of the graph case) and explore as far along each branch before backtracking. DFS is the uniformed search that progress by expanding the first child node of search tree that appears and thus going deeper and deeper until a goal node is found, or until it hit the node which has no children. Then search backtracks, returning to the most recent node it hadn't finished exploring. In a non-recursive implementation, all freshly expanded nodes are added to LIFO stack for exploration. Space complexity of DFS is much lower than BFS. Depth First Search are performed by dividing downward into a tree as quickly as possible. It does not always generate a child node from most recently expanded node and generates anther of its children this process continues until goal is found. ALGORITHM: 1) Place starting node in the queue. 2) If queue is empty, then failure and stop. 3) If first node in queue is goal node g, return success and stop. Otherwise 1) Remove and expand the first element and place the children at front of the queue. 2) Return to step 2. CONCLUSION:Depth First Search has been achieved.
  • 9. 8 EXPERIMENT NO.: 06 AIM: Write the program for Breadth First Search using the suitable example. THEORY: Breadth first searches are performed by exploring all the node at given depth before processing to the next level. All immediate children of node at given depth before any of the children's children are considered. It always finds the minimal path solution when one exists. Algorithm uses a queue structure to hold all generated but still unexplored nodes. The order in which node are placed in the queue for removal and exploration determines the type of search. ALGORITHM: 1) Place the starting node in the queue. 2) If queue is empty, then return failure and stop. 3) If first node on the queue is the goal node g, return success and stop. 4) Remove and expand the first element from the queue and place all the children at end of queue in any order. 5) Return to step 2. CONCLUSION: Breadth First Search has been implemented successfully.
  • 10. 9 EXPERIMENT NO.: 07 AIM: Write a program for login so that user can attempt 3 times. After 3rd attempt program should with message-"NOT PERMITTED TO LOGIN". LOGIC: Domains NAME, PASSWORD=symbol Predicates getentry(NAME, PASSWORD) logon(integer) user(NAME, PASSWORD) go Clauses go: - logon(3) write("you are now logged on"0, nl. logon(0): - write("sorry you cannot logon"), nl, fail. logon(-): - getentry(NAME, PASSWORD) user(NAME, PASSWORD) logon(x): - write("illegal entry"), nl xx=x-1 logon(xx) getentry(NAME, PASSWORD):- write("please enter your name:"), nl. readln(PASSWORD), nl user(smith, abc)
  • 11. 10 EXPERIMENT NO.: 08 Aim: Write a program to determine whether the graph is connected or not, if connected then whether it unidirectional or bidirectional. Objective: To study kinds of graphs using PROLOG. Theory: Graph G= (V, E) is a set of vertices and edges. A normal graph in which the edges are undirected is said to be unidirectional. Otherwise if arrow may be placed on one or both end point of the edge of a to indicate directedness. The graph is said to be directed. A directed graph in which each edge is given a unique direction (i.e. the edges may not be bidirectional and point on both directions at once) is called an oriented graph. An undirected graph is said to be connected if for any pair of nodes of graph, the two nodes reachable from each other. This definition cannot be applied for directed graphs without some further modifications. Because in directed graph if node u is reachable from another node v, the node v may not be reachable from u hence we call digraph weakly connected. If for any pairs of the node of the graph both the nodes are reachable from each other then it is called strongly connected graph. If the direction of graph is omitted, then graph is connected. LOGIC: Domains x, y, z = symbol Predicates edge(string, string) pathuni(string, string) pathbi(string, string) pathpresent(string, string) Clauses pathpresent(x, y): - pathuni(x, y)
  • 12. 11 pathbi(x, y) pathuni(x, y): - edge(x, y)ni write("path is unidirectional"), n! write("path is present from "x" "to" y), edge(x, z) edge(z, y), n! write(path is present from "x" to "z" and from "z" to "y"), x<>y pathbi(x, y): - edge (x, y), edge(y, x), n! write("path is bidirectional"), n! write("path is present from "x" "to" y and vice versa), x<>y edge(a, b) edge(a, c) edge(b, a) edge(a, b) edge(c, a) edge(d, b) edge(b, c) edge(d, a) edge(d, e) edge(d, f) CONCLUSION:Graph has been studied and implemented.
  • 13. 12 EXPERIMENT NO.:09 AIM: Write to see all element are present in the list or not. OBJECTIVE:To study the conceptof list using PROLOG. THEORY: Link list is a sequence of the nodes. Each node has two part viz. node data and pointer field. Pointer field points to the next node in the list. The last node's pointer field contains NULL indicating that pointing to nothing. If first node pointer consist field consist NULL it means that the link list consists of a single node. LOGIC: Domains List=symbol* Predicates list(symbol, list) Clauses list(x, [H|-]): - x=H write("Element “, x," is present in the list"), nl list(x, [-|T]) list(x, T), list(x, T) list(x, |]): write(x, "is not in the list"), fail. CONCLUSION:Goal is successfulfor above mentioned aim.
  • 14. 13 EXPERIMENT NO.:10 AIM: Mini project on expert system. EXPERT SYSTEM: Expert system is set of program which manipulates encoded knowledge to solve the problems in a specialized domain that normally require human expertise. An expert system's knowledge is obtained from expert sources and coded in a form suitable for the system to use in its inference or reasoning process. Expert knowledge require much training and experience in some specialized field such as machine. CHARACTERISTICS: 1) Expert system uses the knowledge rather than data to control solution of process. 2) The knowledge is encoded and maintained as an entity separate from the control program. 3) Expert systems are capable of explaining how a particular conclusion was reached why requested information is need during consultation. 4) These are the symbolic representations for knowledge and perform their inferences through symbolic computation. 5) These often reasons with meta knowledge. Meta knowledge is knowledge about data. APPLICATION: 1) Different type medical diagnosis. 2) Diagnosis of complex electronic and electromechanical systems. 3) Diagnosis of diesel electric locomotion systems. 4) Diagnosis of software development projects. 5) Forecasting the crop damage. 6) Identification of chemical compound structures. 7) Location of fault in the computer and communication systems. 8) Evaluation of loan application for lending institutions. 9) Assessment of geological structure from dip meter logs. 10) Estate planning for minimal tax. 11) Design of VLNI system. 12) Spaceplanning.