MODUL PRAKTIKUM 12.pdf

Embed Size (px)

Citation preview

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    1/12

    qwertyuiopasdfghjklzxcvbnmqwe

    rtyuiopasdfghjklzxcvbnmqwertyu

    opasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfg

    hjklzxcvbnmqwertyuiopasdfghjkl

    zxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbn

    mqwertyuiopasdfghjklzxcvbnmq

    wertyuiopasdfghjklzxcvbnmqwer

    yuiopasdfghjklzxcvbnmqwertyui

    opasdfghjklzxcvbnmqwertyuiopa

    sdfghjklzxcvbnmqwertyuiopasdfg

    hjklzxcvbnmqwertyuiopasdfghjkl

    zxcvbnmqwertyuiopasdfghjklzxcvbnm wert uio asdf h klzxcvbn

    MODUL PRAKTIKUMSISTEM PAKAR

    PRAKTIKUM 12

    TEKNIK INFOMATIKA

    UPRI - MAKASSAR

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    2/12

    PRAKTIKUM 12

    Sistem Pakar

    TEKNIK INFORMATIKAFAKULTAS TEKNIKUPRI MAKASSAR

    Penggunaan file .clp

    Agar pengetahuan tersimpan di dalam secondarystorage, maka harus disimpan dalam suatu file

    Dalam CLIPS, format filetersebut berekstensi .clp Tahapan penggunaan file .clp

    file.clp

    Load (file->Load)

    Reset (Execution --> Reset)

    CLIPS>(Agenda)

    Run (Execution --> Run)

    1

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    3/12

    DEFFACTS COMMAND

    Use for Initializing fatcs.Called as initial knowledge.Functionally Like assert.

    CONT

    General Format

    (deffacts [] )

    E.g

    (deffacts mahasiswa (person (name sofuyyah)(age 17)

    (eye-color blue)(hair-color brown)))

    2

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    4/12

    CONT

    Deffact juga bisa digunakan untuk memasukkan himpunanfakta lebih dari satu

    Contoh

    CLIPS > (deffacts test1 (aliayah indra)

    (indra ayah budi))

    DEFFACT VS ASSERT

    Assert

    ;assert.clp(deftemplate person

    (slot name)(slot age)

    (slot eye-color)(slot hair-color))

    (assert (person (name shofiyyah)

    (age 15) (eye-color brown)

    (hair-color black)))

    3

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    5/12

    Result

    DEFFACT VS ASSERT

    Deffact;deffact.clp(deftemplate person

    (slot name)(slot age)(slot eye-color)(slot hair-color))

    (deffacts siswa (person (name

    shofiyyah) (age 4)(eye-color blue) (hair-color black)) (person

    (name aisyah) (age 2)

    (eye-color brown)(hair-color black)))

    4

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    6/12

    Result

    DEFFACT VS ASSERT

    Deffact load

    5

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    7/12

    Me-load File.clp

    Perintah yang digunakan: (load)Format : (load )

    Contoh: (load "E:/Users/ilkom/Desktop/assert.clp")

    Perintah lain: File => Load atau ctrl + L

    Memasukkan data yang diload keworking memory

    Data yang diload tidak langsung masuk ke working

    memory

    tidak dapat langsung digunakanPerintah: (reset)

    6

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    8/12

    Memasukkan data yang diload keworking memory

    Membersihkan Layar

    Perintah: (clear-window)

    7

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    9/12

    RULE

    Perintah: (defrule)Format of RULE:

    (defrule [] =>)

    Contoh RULE; rule.clp(deftemplate suhu

    (slot kondisi))

    (deftemplate respon(slot

    lajureaksi)) ;Make Rule(defrule tinggi-suhu

    (suhu (kondisi tinggi))=>

    (assert (respon(lajureaksi naik))))

    (defrule rendah-suhu(suhu (kondisi rendah))

    =>(assert (respon

    (lajureaksi turun))))

    8

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    10/12

    Menjalankan RULE

    Perintah: (run)

    Pastikan fakta dan rule sudah ada di workingmemory

    RUN

    For Running our program.

    Commandd

    (run)

    9

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    11/12

    RUN

    variabel.CLP(deftemplate variabel

    (slot number))

    (deftemplate jumlah

    (slot total))

    (deffacts nilai

    (variabel (number 4))

    (variabel (number 6)))

    (defrule addup(variabel (number ?x))

    (variabel (number ?y))

    =>

    (bind ?total (+ ?x ?y))

    (printout t ?x " + " ?y " = " ?total crlf)

    (assert (jumlah (total ?total))))

    10

  • 7/23/2019 MODUL PRAKTIKUM 12.pdf

    12/12

    Latihan1.Buatlah sebuah file . clp yang berisikan

    a. template untuk fakta mahasiswa

    (slot nama, nrp, nilai) *nilai berupa integer dari 0-10b.template mutu (slot nilai-mutu)

    c.5 buah inisialisasi fakta mahasiswa yangmemiliki nilai dari 3-7

    d.rule yang berisikan

    nilai-mutu A untuk nilai 9-10

    nilai-mutu B untuk nilai 7-8nilai-mutu C untuk nilai 5-6

    2. Tambahkan 3 fakta berdasarkan template mahasiswa

    yang memiliki nilai 8-10!3. Run program dan tuliskan fakta akhirnya!

    Terima Kasih

    11