Header Ads

Write the program in CLIPS IDE that will save the facts about information of enrolled AI courses like course id (CS607, CS607P) and name (Artificial Intelligence, Artificial Intelligence Practical). You are required to make templates for enrolled courses. After loading the facts in working memory use the facts command to see the index of courses facts. After that remove any one of the course fact and again list the total index of courses facts.

Write the program in CLIPS IDE that will save the
facts about information of enrolled AI courses like course id (CS607, CS607P)
and name (Artificial Intelligence, Artificial Intelligence Practical). You are
required to make templates for enrolled courses. After loading the facts in
working memory use the facts command to see the index of courses facts. After
that remove any one of the course fact and again list the total index of
courses facts.

Solution:


(deftemplate enrolled-courses

    (slot course-id)

    (slot course-name))

(assert (enrolled-courses (course-id "CS607") (course-name "Artificial Intelligence")))

(assert (enrolled-courses (course-id "CS607P") (course-name "Artificial Intelligence Practical")))

(facts)

(retract (enrolled-courses (course-id "CS607P") (course-name "Artificial Intelligence Practical")))

(facts)


Or 


CLIPS> (defclass course (is-a USER) (slot id) (slot name))

CLIPS> (make-instance [CS607 Artificial Intelligence] of COURSE)

CLIPS> (make-instance [CS607P Artificial Intelligence Practical] of COURSE)

CLIPS> (facts)

f-0 (course (id CS607) (name Artificial Intelligence))

f-1 (course (id CS607P) (name Artificial Intelligence Practical))

CLIPS> (retract 1)

CLIPS> (facts)

f-0 (course (id CS607) (name Artificial Intelligence))


No comments

Powered by Blogger.