Jumat, 13 November 2009

operators and arithmatics 01

Kali ini kita diperintahkan untuk mengubah program awal (pada soal) menjadi standar operator form.
Yang mulanya seperti di bawah ini:












Menjadi seperti ini:












Setelah itu, Consult di Prolog lalu ketik chases(X,Y). Dan jangan lupa mengetik ; sampai "no"



 Program yang seperti pada contoh soal:




Jadi bisa kita lihat bahwa program yang dihasilkan pada soal dan program form adalah sama.

operators and arithmatics 02

Operator Operator adalah simbol khusus yang melakukan operasi tertentu pada satu , dua, atau tiga Operand, dan kemudian mengembalikan hasilnya. Seperti +, -, /, *, dll.


Dalam FP kali ini, kita diperintahkan untuk mempelajari tentang pembuatan operasi hitungan.
Yang pertama yaitu mencari nilai rata-rata suatu hitungan. misalnya:

Yang kedua adalah menghitung akar rata-rata, misalnya:


Yang ketiga adalah menentukan nilai max dari dua penghitungan sebelumnya.
Maka kita mencari Q dengan max(Z,P), misal:






Kamis, 22 Oktober 2009

Fact, Rules, Predicate, and Variable in Prolog

Type the following program into a file

1. buat databasenya terlebih dahulu












2. lalu tambahkan rules : -person(X,male),person(Y,female).












3. lalu, sekarang kita periksa rules yang telah kita buat dengan mengetik: -couple(X,Y).
jika berhasil, maka akan muncul:













itulah mengapa sangat penting mengatur logika dalam pemprograman....

Fact, Rules, Predicate, and Variable in Prolog

practical exercise 2:

pertama buat database animal:













berikutnya buka prolog, lalu file >> consult













ketiga, untuk mengetahui mana binatang mamalia kita cukup mengetik :-animal(mammal,X,Y,Z). dan untuk mengetahui kemungkinan yang lain cukup ketik ; (semicolon).Dan bila tidak ada kemungkinan lain maka akan muncul "no".














lalu berikutnya untuk mengetahui hewan mamalia yang karnivora kita ketik: -animal(mamalia,X,carnivore,Y). dan jangan lupa tanda ;













lalu, untuk mengetahui hewan mamalia dengan garis ketik: -animal (mamalia,X,Y,stripes). jangan lupa ;













untuk mengetahui reptile yang memiliki rambut di tengkuk, kita ketik:-animal(reptile,X,Y,mane).













jawabannya hanya "no", karena tidak ada reptile yang memiliki rambut di tengkuk.
expert system is sofware that attempts to provide an answer to a problem or clarify uncertaintainties were normally one or more human expert would need to be consule. Expert systems are most common in a specific problem domain, and is a traditional application or subfield of artificial intellegence. A wide variety of methods can be used to simulate the performance of the expert however common to most or all are 1) the creation of a so-called "knowledgebase" which uses some knowledge representation formalism to capture the Subject Matter Expert's (SME) knowledge and 2) a process of gathering that knowledge from the SME and codifying it according to the formalism, which is called knowledge engineering. Expert systems may or may not have learning components but a third common element is that once the system is developed it is proven by being placed in the same real world problem solving situation as the human SME, typically as an aid to human workers or a supplement to some information system.

rule-based expert system is an expert system based on a set of rules that a human expert would follow in diagnosing a problem. Conventional rule-based expert systems, use human
expert knowledge to solve real-world problems that normally would require human intelligence. Expert knowledge is often represented in the form of rules or as data within the computer.Depending upon the problem requirement, these rules and data can be recalled to solve problems. Rule-based expert systems have played an important role in modern intelligent
systems and their applications in strategic goal setting, planning, design, scheduling, fault monitoring, diagnosis and so on.

Kamis, 15 Oktober 2009

How to list all possible combination of two sets????


1. the first step, open the SWI-Prolog program

2. the second step, creating new file











3. give name the file of program "tutorial"

4. Declaring the facts that consists of predicate and fact as below :












5. and than save it

6. open the click the SWIT-prolog and than click file > consult > choose tutorial file
















7. Write rule code firstsets(X),secondsets(Y) as below :











8. press enter on your keyboard, and then it will show you combination of two set, type ";" after a combination. It will continue until the word "No" appear.

Kamis, 01 Oktober 2009