0% found this document useful (0 votes)
12 views21 pages

Expert System Lab Report Guide

The document is a laboratory report for the Expert System Lab at Geeta Engineering College, detailing guidelines for writing laboratory reports, evaluation criteria for practical work, and good laboratory practices. It includes a list of experiments focusing on Prolog programming, such as solving the Monkey Banana problem and implementing factorial and Fibonacci functions. The report emphasizes the importance of individual work, proper documentation, and adherence to laboratory rules.
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)
12 views21 pages

Expert System Lab Report Guide

The document is a laboratory report for the Expert System Lab at Geeta Engineering College, detailing guidelines for writing laboratory reports, evaluation criteria for practical work, and good laboratory practices. It includes a list of experiments focusing on Prolog programming, such as solving the Monkey Banana problem and implementing factorial and Fibonacci functions. The report emphasizes the importance of individual work, proper documentation, and adherence to laboratory rules.
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

GEETA ENGINEERING COLLEGE

(Approved by AICTE & Affiliated to Kurukshetra University, Kurukshetra)

COMPUTER SCIENCE & ENGINEERING


DEPARTMENT

LABORATORY REPORT
(EXPERT SYSTEM LAB)

NAME OF STUDENT RITIK BHAT

ROLL No. 4918154

SEMESTER 7th

SESSION 2018-2022

STUDENT SIGNATURE: FACULTY SIGNATURE:


This Guide is designed for helping the students to perform better in various
practical courses. It describes the structure of a good laboratory report,
outlines the different sections of the report and explains the need for each of
them. It also introduces some standard conventions and rules for writing
reports of professional quality. The quality of your written report will strongly
affect your grade for the course.

EVALUATION OF PRACTICAL WORK


• Each student will be required to perform the experiment individually.
• Student will be required to write theory, algorithm, program, outputs etc.
during practical session itself.
• Each experiment will be marked by the teacher on the basis of experiment
performed and write up on the same day. These marks will account for 40%
of the sessional marks.
• Sessional marks will also include VIVA and Attendance marks as per rules.

GOOD LABORATORY PRACTICES


• You must develop good laboratory habits by keeping complete
laboratory notebooks.
• Keep all your notes about the laboratory procedures and data in this
notebook in pen.
• It is always better to read experiment in advance.
• The expectation is that you will work individually on separate computers.
Each of you will write a separate report.
• Please bring your laboratory manual to the laboratory on every turn.
THINGS TO DO AND DON’T DO IN THE LABORATORY

DO’S
• Remember this is a practice laboratory & Keep silence.
• Sit down in proper manner.
• Laboratory instructor can help you to access software and printer.
• If you require more in depth help you can ask concern lecturer
• Proper shut down the computer system before leaving the laboratory.
• Exit laboratory quickly, if short circuit or any emergency occurs.
• You must entry when you enter and leave the laboratory.

DON’T
• Write anything on the furniture.
• Delete or change other student’s file.
• Uninstall the any Software.
• Inter change any Hardware.
• Create, Change or remove any password.
• Exhibit disruptive behavior.
• Chatting and other banned sites.
• Play computer games.
• Eat and drink in Laboratory
GEETA ENGINEERING COLLEGE, FILE TITLE : LABORATORY
NAULTHA,PANIPAT MANUAL

SUBJECT CODE: PE-CS-D415AL LAB NAME: ES LAB


COURSE: B. TECH CSE SEM: 7th

LIST OF EXPERIMENT

EXPERIMENT EXPERIMENTS PAGE


REV. NO. REV .DATE
NO. DESCRIPTION NO.
EXP No.1 Study of PROLOG.

EXP No.2 Write simple fact for the


statements using PROLOG.

EXP No.3 Write predicates one


converts centigrade
temperatures Fahrenheit,
the other checks if a
temperature is below
freezing.
EXP No.4 Write a program to solve the
Monkey Banana problem.

EXP No.5 Write a program to implement


factorial, Fibonacci of a given
number.
EXP No.6 Write a program to solve
4-Queen problem.
EXP No.7 Write a program to solve
travelling salesman problem.

EXP No.8 Write a program to solve


water jug program using
LISP.
EXP No.9 Solve any problem using
depth first search and best
first search.
EXP No.10

PREPARED APPROVED
BY: BY:
GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY
PANIPAT MANUAL

EXPERIMENT NO: 1
EXPERIMENT TITLE: Study of Prolog

ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7th
&ENGINEERING

AIM: Study of Prolog.

APPRATUS/SOFTWARE USED:
SWI-PRO

PROLOG-PROGRAMMING IN LOGIC:
PROLOG stands for Programming, In Logic- an idea that emerged in the early 1970's to use logic as
programming language. The early developers of this idea included Robert Kowaiski at Edinburgh (on
the theoretical side), Marrten van Emden at Edinburgh (experimental demonstration) and Alian
Colmerauer at Marseilles (implementation). David D.H. Warren's efficient implementation at
Edinburgh in the mid-1970's greatly contributed to the popularity of PROLOG. PROLOG is a
programming language centred around a small set of basic mechanisms, including pattern matching,
tree-based data structuring and automatic backtracking. This Small set constitutes a surprisingly
powerful and flexible programming framework. PROLOG is especially well suited for problems that
involve objects- in particular, structured objects- and relations between them.

SYMBOLIC LANGUAGE:
PROLOG is a programming language for symbolic, non-numeric computation. It is especially well
suited for solving problems that involve objects and relations between objects. For example, it is an
easy exercise in prolog to express spatial relationship between objects, such as the blue sphere is
behind the green one. It is also easy to state a more general rule: if object X is closer to the observer
than object Y. and object Y is closer than Z, then X must be closer than Z. PROLOG can reason
about the spatial relationships and their consistency with respect to the general rule. Features like this
make PROLOG a powerful language for ArtJlcial Language A1,) and non- numerical programming.
There are well-known examples of symbolic computation whose implementation in other standard
languages took tens of pages of indigestible code, when the same algorithms were implemented in
PROLOG, the result was a crystal-clear program easily fitting on one page.

FACTS, RULES AND QUERIES:


Programming in PROLOG is accomplished by creating a database of facts and rules about objects,
their properties, and their relationships to other objects. Queries then can be posed about the objects
and valid conclusions will be determined and returned by the program. Responses to user queries are
determined through a form of inference control known as resolution.

FOR EXAMPLE:
a) FACTS:
Some facts about family relationships could be written as:
sister(sue,bill).
parent([Link]).
male(joe).
female(riya).

b) RULES:
grandfather(X2).
parent(X,Y).
parent(Y,Z).
male(X).

c) QUERIES:
Given a database of facts and rules such as that above, we may make queries by typing after a
query a symbol ‘?’ statements such as:
?-parent(X,sam)
X=ann
?-grandfather(X,Y).
X=joe , Y=sam

PROLOG IN DISGINING EXPERT SYSTEMS:

An expert system is a set of programs that manipulates encoded knowledge to solve problems in a
specialized domain that normally requires human expertise. An expert system's knowledge is
obtained from expert sources such as texts, journal articles, databases etc and encoded in a form
suitable for the system to use in its inference or reasoning processes. Once a sufficient body of expert
knowledge has been acquired, it must be encoded in some form, loaded into knowledge base, then
tested, and refined continually throughout the life of the system PROLOG serves as a powerful
language in designing expert systems because of its following features. Use of knowledge rather than
data Modification of the knowledge base without recompilation of the control programs. Capable of
explaining conclusion. Symbolic computations resembling manipulations of natural language.
Reason with meta knowledge. META PROGRAMMING A meta-program is a program that takes
other programs as data.
Interpreters and compilers are examples of meta-programs. Meta-interpreter is a particular kind of
meta program: an interpreter for a language written in that language. So a PROLOG interpreter is an
interpreter for PROLOG, itself written in PROLOG. Due to its symbol- manipulation capabilities,
PROLOG is a powerful language for meta-programming. Therefore, it is often used as an
implementation language for other languages. PROLOG is particularly suitable as a language for
rapid prototyping where we are interested in implementing new ideas quickly. New ideas are rapidly
implemented and experimented with.

PREPARED APPROVED
BY: BY:
GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY
PANIPAT MANUAL

EXPERIMENT TITLE: Write simple fact for the statements using


PROLOG. EXPERIMENT NO: 2

ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7TH
&ENGINEERING

AIM: Write simple facts for the following:


a. Ram likes mango.
b. Seema is a girl.
c. Bill likes candy.
d. Rose is red.
e. John owns gold.

PROGRAM:

RULES:
likes(ram,mango).
girl(seema).
red(rose).
likes(bill,candy).
owns(john,gold).

OUTPUT:
PREPARED APPROVED
BY: BY:
GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY
PANIPAT MANUAL

EXPERIMENT TITLE: Write predicates one converts centigrade


EXPERIMENT NO: 3
temperatures Fahrenheit, the other checks if a temperature is below
freezing.
ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7th
&ENGINEERING

AIM: Write predicates one converts centigrade temperatures Fahrenheit, the other checks if a
temperature is below freezing.

PROGRAM:

c_to_f(C,F) :-F is C * 9 / 5 + 32.


% here freezing point is less than 32 Fahrenheit
freezing(F):-F =<32.

OUTPUT:

PREPARED APPROVED
BY: BY:

GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY


PANIPAT MANUAL
EXPERIMENT TITLE: Write a program to solve the Monkey Banana EXPERIMENT NO: 4
problem.

ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7th
&ENGINEERING

AIM: Write a program to solve the Monkey Banana problem.

PROGRAM:

on(floor,monkey).
on(floor,chair).
in(room,monkey).
in(room,chair).
in(room,banana).
at(ceiling,banana).

strong(monkey).
grasp(monkey).
climb(monkey,chair).

push(monkey,chair).
strong(monkey).

under(banana,chair).
push(monkey,chair).

canreach(banana,monkey).
at(floor,banana).
at(ceiling,banana).
under(banana,chair).
climb(monkey,chair).

canget(banana,monkey).
canreach(banana,monkey),grasp(monkey).
OUTPUT:
PREPARED APPROVED
BY: BY:
GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY
PANIPAT MANUAL

EXPERIMENT TITLE: Write a program to implement factorial, Fibonacci EXPERIMENT NO: 5


of a given number.

ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7th
&ENGINEERING

AIM: Write a program to implement factorial, Fibonacci of a given number.

PROGRAM:

factorial(N,F). N>0.

factorial(0,1). q1 is N-1 factorial(N1,F1), F is N^ * F1.

OUTPUT:

PREPARED APPROVED
BY: BY:
GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY
PANIPAT MANUAL

EXPERIMENT NO: 6
EXPERIMENT TITLE: Write a program to solve 4-Queen problem.

ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7th
&ENGINEERING

AIM: Write a program to solve 4-Queen problem.

PROGRAM: In the 4 Queens problem the object is to place 4 queens on a chessboard in such a way
that no queens can capture a piece. This means that no two queens may be placed on the same row,
column, or diagonal.

:- use_rendering(chess).
queens(N, Queens) :-
length(Queens, N),
board(Queens, Board, 0, N, _, _),
queens(Board, 0, Queens).

board([], [], N, N, _, _).


board([|Queens], [Col-Vars|Board], Col0, N, [|VR], VC) :-
Col is Col0+1,
functor(Vars, f, N),
constraints(N, Vars, VR, VC),
board(Queens, Board, Col, N, VR, [_|VC]).

constraints(0, _, _, _) :- !.
constraints(N, Row, [R|Rs], [C|Cs]) :-
arg(N, Row, R-C),
M is N-1,
constraints(M, Row, Rs, Cs).

queens([], _, []).
queens([C|Cs], Row0, [Col|Solution]) :-
Row is Row0+1,
select(Col-Vars, [C|Cs], Board),
arg(Row, Vars, Row-Row),
queens(Board, Row, Solution).
OUTPUT:

PREPARED APPROVED
BY: BY:

GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY


PANIPAT MANUAL

EXPERIMENT TITLE: Write a program to solve travelling salesman EXPERIMENT NO: 7


problem.

ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7th
&ENGINEERING
AIM: Write a program to solve travelling salesman problem.

PROGRAM:

route(Town1,Town2, Distance).
road(Town1,Town2, Distance).
route(Town1,Town2,Distance).
road(Town1,X, Dist1).

OUTPUT:
PREPARED APPROVED
BY: BY:
GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY
PANIPAT MANUAL

EXPERIMENT TITLE: Write a program to solve water jug program using EXPERIMENT NO: 8
LISP.

ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7th
&ENGINEERING

AIM: Write a program to solve water jug program using LISP.

PROGRAM:

initial_state( [initial, [a,3,0], [b,5,0], [c,8,8]]).

goal_state( [, [a,,4], [b,,], [c,,]]).


goal_state( [, [a,,], [b,,4], [c,,]]).
goal_state( [, [a,,], [b,,], [c,,4]]).

transition( [_, A1,B1,C], [pour_a_to_b, A2,B2,C] ) :- pour(A1,B1,A2,B2).


transition( [_, A1,B,C1], [pour_a_to_c, A2,B,C2] ) :- pour(A1,C1,A2,C2).
transition( [_, A1,B1,C], [pour_b_to_a, A2,B2,C] ) :- pour(B1,A1,B2,A2).
transition( [_, A,B1,C1], [pour_b_to_c, A,B2,C2] ) :- pour(B1,C1,B2,C2).
transition( [_, A1,B,C1], [pour_c_to_a, A2,B,C2] ) :- pour(C1,A1,C2,A2).
transition( [_, A,B1,C1], [pour_c_to_b, A,B2,C2] ) :- pour(C1,B1,C2,B2).

pour( [Jug1, Capacity1, Initial1], [Jug2, Capacity2, Initial2], % initial jug states
[Jug1 ,Capacity1, 0], [Jug2, Capacity2, Final2] % final jug states
):-
Initial1 =< (Capacity2 - Initial2),
Final2 is Initial1 + Initial2.

pour( [Jug1, Capacity1, Initial1], [Jug2, Capacity2, Initial2], % initial jug states
[Jug1 ,Capacity1, Final1], [Jug2, Capacity2, Capacity2] % final jug states
):-
Initial1 > (Capacity2 - Initial2),
Final1 is Initial1 - (Capacity2 - Initial2).

legal_state( _ ).
equivalent_states( X, X ).
loopcheck(on).
OUTPUT:

PREPARED APPROVED
BY: BY:
GEETA ENGINEERING COLLEGE, NAULTHA, LABORATORY
PANIPAT MANUAL

EXPERIMENT TITLE: Solve any problem using depth first search and best EXPERIMENT NO: 9
first search.

ISSUE NO: 001 ISSUE DATE REV NO: 001 REV DATE
COMPUTER
DEPARTMENT: SCIENCE LABORATORY: ES SEMESTER: 7th
&ENGINEERING

AIM: Solve any problem using depth first search and best first search.

PROGRAM:

OUTPUT:
PREPARED APPROVED
BY: BY:

You might also like