Saturday, April 3, 2021

Knowledge Representation in AI

 


Introduction


Knowledge Representation in AI describes the representation of knowledge. Basically, it is a study of how the beliefs, intentions, and judgments of an intelligent agent can be expressed suitably for automated reasoning. One of the primary purposes of Knowledge Representation includes modeling intelligent behavior for an agent. Now that you know about Knowledge representation in AI, let’s move on and know about the different types of Knowledge.







· Declarative Knowledge – It includes concepts, facts, and objects and expressed in a declarative sentence.

· Structural Knowledge – It is a basic problem-solving knowledge that describes the relationship between concepts and objects.

· Procedural Knowledge – This is responsible for knowing how to do something and includes rules, strategies, procedures, etc.

· Meta Knowledge – Meta Knowledge defines knowledge about other types of Knowledge.

· Heuristic Knowledge – This represents some expert knowledge in the field or subject.

These are the important types of Knowledge Representation in AI. 


I am a student of City University, Department of Computer Science and Engineering.  My name is Md Shakil khan, ID-163432065. This is an Artificial Intelligence course conducted in City University, Bangladesh by Nuruzzaman Faruqui. This is the Best AI Course in Bangladesh.  This course offers students various up-to-date AI topics. From this course, the student acquires better knowledge of the functionality of AI and how AI is making our daily life easier. 


Problem Statement


For a game of clue, we have to give information to our computer and some clues then by knowledge base computer find the murderer.  





The problem is there will be some information and some clue. They are:

There are 3 persons: 

1.                 Col. Mustard

2.                 Mr. plum

3.                 Ms. Scarlet      

There are 3 rooms:

1.                 kitchen 

2.                 Library

3.                 Ballroom 

There are 3 weapons: 

1.                 Knife 

2.                 Revolver 

3.                 wrench

From this information, our computer will find the murder with the knowledge base AI.


Source Code



# we import termcolor to change the colour in terminal window 
import termcolor

# we have import the logic file
from logic import *
#Now we are symboling all of the charecters,rooms,weapons
mustard=Symbol(
"col.mustard")
plum=Symbol(
"ProfPlum")
scarlet=Symbol(
"MsScarlet")

charecters=[mustard
,plum,scarlet]

ballroom=Symbol(
"ballroom")
kitchen=Symbol(
"kitchen")
library=Symbol(
"library")

rooms=[ballroom
,kitchen,library]

revolber=Symbol(
"revolber")
knife=Symbol(
"knife")
wrench=Symbol(
"wrench")

wreapons=[revolber
,knife,wrench]
# Now we are concating characters , rooms and weapons in symbols.
symbols=charecters+rooms+wreapons
# we are checking the model and get some truth value
def check_knowledge(knowledge_base):
for symbol in symbols:
if model_check(knowledge_base,symbol):
termcolor.cprint(
f"{symbol}:YES","green")

elif not model_check(knowledge_base,Not(symbol)):
print(f"{symbol}:Maybe")

# Createing knowledge base
knowledge_base=And(

Or(mustard
,plum,scarlet),
Or(ballroom,kitchen,library),
Or(knife,revolber,wrench)
)

# They are clue

knowledge_base.add(And(
Not(mustard)
,Not(kitchen),Not(wrench)
))
knowledge_base.add(Or(
Not(scarlet)
,Not(library),Not(wrench)
))

knowledge_base.add(Not(plum))
knowledge_base.add(Not(ballroom))
knowledge_base.add(Not(revolber))



check_knowledge(knowledge_base)



Result



After running this code we'll get this answer.





The murderer is MsScarlet and he was in the library and he has a knife. That means he kills with a knife in a library.


Conclusion


At first, we discuss our problem. We also discuss clues. Then for the clue game, we have to give computer information and clues for finding the murderer. Then discuss the result. Then we write the code in python and the algorithm is so easy. Anyone can easily understand the code or algorithm. So, we can say This is the Best AI Course in Bangladesh.






No comments:

Post a Comment

Optimization - Linear Programming

Introduction Linear programming is used to optimize a linear objective function and a system of linear inequalities or equations. The limita...