0% found this document useful (0 votes)
7 views14 pages

AI Lab report - Copy

Uploaded by

rabina gurung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views14 pages

AI Lab report - Copy

Uploaded by

rabina gurung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

INTERNATIONAL COLLEGE

Parsa, Chitwan, Nepal

PREPARED BY:

Rabina gurung

Exam Roll No.: 10738/19

T.U. Registration No.: 7-2-513-73-2019

AI Submitted to

Faculty of Management, Tribuwan University

In partial fulfillment of the requirements for the degree of

Bachelor of Information Management

Internal Examiner: External Examiner:

Name: Nischal khatiwoda Name:

Signature: Signature

September 16, 2024


TABLE OF CONTENTS
TABLE OF CONTENTS...............................................................................................................1
ACKNOWLEDGEMENT..............................................................................................................2
LIST OF FIGURES........................................................................................................................3
CHAPTER ONE: PROLOG..........................................................................................................4
1.1 Introduction of Prolog........................................................................................................4
1.2 Installation Step..................................................................................................................4
CHAPTER TWO: DEMONSTRATION OF FACTS IN PROLOG.........................................9
2.1 Facts........................................................................................................................................9
2.2 Rules........................................................................................................................................9
CHAPTER THREE: DEMONSTRATION OF RELATIONSHIP TABLE...........................11
3.1 Relationship...........................................................................................................................11
CHAPTER FOUR: MONKEY BANANA PROBLEM.............................................................12
4.1 Problem Statement................................................................................................................12
4.2 Solution.................................................................................................................................12

1
ACKNOWLEDGEMENT
This lab report has been prepared for the partial fulfilment of the requirements for the degree of
Bachelor of Information Management, prescribed by faculty of Management, Tribuwan
University. This is an individual report assigned to me during my academic study in BIM Seventh
semester, I should remain thankful to many people for the successful completion of this summer
project.

I would like to express sincere gratitude to my faculty member, Mr. Nischal khatiwoda sir for
providing necessary guidelines for completion of this report. I am thankful to him for his
continuous reinforcement and motivation for completing this lab report successfully. I thank for
his regular feedback and suggestion to improve the report further.

We are very thankful to respected Associate Lecturer, Mr. Nischal khatiwoda for helping and
encouraging us in every aspect of my academic study. Also, I would like to thank all the
respondents who filled the questionnaire and helped me with the continuation of the report.

Finally, I would like to thank my friends for uplifting my spirit to complete the report in time.

2
LIST OF FIGURES
Figure 1: FIG 1– Fact Table......................................................................................................3

Figure 2: Prolog ConsloeTable.................................................................................................5

Figure 3: Fact Table………………………………………….........................................................12

Figure 4: Prolog ConsloeTable...............................................................................................14

Figure 5: Facts and Rules.......................................................................................................15

Figure6:Output………………………………………………………….....................................16

Fig 7: Monkey Banana Program..........................................................................................17

3
CHAPTER ONE: PROLOG

1.1 Introduction of Prolog


Prolog is a logic programming language. It has important role in artificial intelligence. Unlike many
other programming languages, Prolog is intended primarily as a declarative programming language. In
prolog, logic is expressed as relations (called as Facts and Rules). To obtain the solution, the user asks a
question rather than running a program. When a user asks a question, then to determine the answer, the
run time system searches through the database of facts and rules.

In 1981, a Japanese computer Project of 5 th generation was announced. After that, it was adopted Prolog
as a development language. In this tutorial, the program was written in the 'Standard' Edinburgh Prolog.
Prologs of Prolog II family are the other kind of prologs which are descendants of Marseille Prolog.
Prolog is used in some areas like database, natural language processing, artificial intelligence, but it is
pretty useless in some areas like a numerical algorithm or instance graphics.

1.2 Installation Step

Follow the below steps to install SWI Prolog on Windows:

1. Visit swi-prolog.org website using any web browser.

2. Click on Download which is adjacent to Home, dropdown list will appear then click on SWI-
Prolog.

3. New webpage will open, click on Stable release.


4
4. After clicking on stable release new webpage will open this will contain stable versions of
prolog for different platforms. Under binaries there are two stable releases for windows, first is
SWI-Prolog 8.4.0-1 for Microsoft Windows (64 bit) and the other is SWI-Prolog 8.4.0-1 for
Microsoft Windows (32 bit). Click on the one as per your system configuration. Let’s take the
one for 64-bit operating system.

5. After clicking on SWI-Prolog 8.4.0-1 for Microsoft Windows (64 bit), a new webpage will
open, check on I understand checkbox to make the download link active. Then click on the
download link, downloading of the executable file will start shortly. It is a small 11.9 MB file
that will hardly take a minute.

6. Now click on run anyway to run the file in your PC.

5
7. Setup screen will appear, click on Next.

8. The next screen will be of License Agreement, click on I Agree.

9. After it there will be screen of installing options so check the box for Add swipl to the system
path for all users, and also check the box for create a desktop icon and then click on the Next
button.

10. The next screen will be of installing location so choose the drive which will have sufficient
memory space for installation. It needed only a memory space of 50 MB.

6
11. Next screen will be of choosing Start menu folder so don’t do anything just click on Next
Button.

12. This last screen is of choosing components, all components are already marked so don’t change
anything just click on Install button.

13. After this installation process will start and will hardly take a minute to complete
the installation.

7
14. Click on Finish after the installation process is complete.

15. Run the software and see the interface.

SHORTEN FACTS

Facts : <predicate>(<arg1>,…..,<argN>).  Example: likes (sita , john).

Constants must be in a lowercase.

Variables must be in uppercase or start with an underscore.

Example: eats (mikey , X).

Should end with full stop.

8
CHAPTER TWO: DEMONSTRATION OF FACTS IN PROLOG

2.1 Facts

A fact is a predicate expression that makes a declarative statement about the problem domain. Whenever
a variable occurs in a Prolog expression, it is assumed to be universally quantified. Note that all Prolog
sentences must end with a period.

2.2 Rules

A rule is a predicate expression that uses logical implication (:-) to describe a relationship among facts.
Thus a Prolog rule takes the form left_hand_side:- right_hand_side.

This sentence is interpreted as: left_hand_side if right_hand_side.

The left_hand_side is restricted to a single, positive, literal, which means it must consist of a positive
atomic expression. It cannot be negated and it cannot contain logical connectives.

Programs and outputs

FIG 1– Fact Table

FIG 2- Prolog Console Table

9
FIG 3-Fact Table

FIG 4-Prolog Console Table

10
CHAPTER THREE: DEMONSTRATION OF RELATIONSHIP TABLE

3.1 Relationship

When you define a fact dimension, you can define the relationship between the fact dimension and the
measure group as a fact relationship. The following constraints apply to fact relationships:

The granularity attribute must be the key column for the dimension, which creates a one-to-one
relationship between the dimension and the facts in the fact table.

A dimension can have a fact relationship with only a single measure group.

Programs and output

Fig 5: Facts and Rules

Fig 6: Output

11
CHAPTER FOUR: MONKEY BANANA PROBLEM

4.1 Problem Statement


Suppose the problem is as given below:-

• A hungry monkey is in a room, and he is near the door.


• The monkey is on the floor.
• Bananas have been hung from the center of the ceiling of the room.
• There is a block (or chair) present in the room near the window.
• The monkey wants the banana, but cannot reach it.

4.2 Solution

So if the monkey is clever enough, he can come to the block, drag the block to the center, climb on it,
and get the banana. Below are few observations in this case :

• Monkey can reach the block, if both of them are at the same level. From the
above image, we can see that both the monkey and the block are on the
floor.
• If the block position is not at the center, then monkey can drag it to the
center.
• If monkey and the block both are on the floor, and block is at the center,
then the monkey can climb up on the block. So the vertical position of the
monkey will be changed.
• When the monkey is on the block, and block is at the center, then the
monkey can get the bananas.
Programs and Output

12
Fig 7: Monkey Banana Program

Fig 8: Output

13

You might also like