Jumat, 20 November 2009

RESUME CHAPTER 4

1. Arithmetic
Prolog menyediakan fasilitas untuk melakukan penghitungan aritmatik menggunakan notasi-notasi yang mirip dengan aljabar dasar. Pada perhitungan aritmatika menggunakan built in perdikat ,dimana argumen 1 terikat pada argumen 2 sedangkan argumen 2 berupa angka atau tanda aritmatik lainnya.

2. Operators
Ada bentuk lain untuk menulis suatu predikat selain bentuk standar yang sudah dipelajari pada bab sebelumnya.

a. Operator Aritmatika
Adalah operator yang biasanya digunakan dalam pemrgograman menggunakan prolog. Berikut adalah operator-operatornya:
1. X+Y (penjumlahan dari X ditambah Y)
2. X-Y (selisih dari X dikurangi Y)
3. X*Y (hasil perkalian dari X dan Y)
4. X/Y (hasil pembagian dari X dibagi oleh Y)
5. X//Y the 'integer quotient' of X and Y (the result is truncated to the nearest integer between it and zero)
6. X^Y (nilai dari X pangkat Y)
7. -X (nilai negatif dari X)

b. Fungsi Aritmatika
Adalah fungsi yang biasanya digunakan dalam proses aritmarika dengan menggunakan prolog. Berikut contoh penggunaan dari masing-masing fungsi:
contoh penggunaan dari masing-masing fungsi :
sin(X) (nilai sinus dari X untuk X dalam derajat)
cos(X) (nilai cosinus dari X untuk X dalam derajat)
abs(X) (nilai absolut dari X)
max(X,Y) (menentukan mana yang lebih besar antara X dan Y)
sqrt(X) (nilai dari X akar pangkat dua)

c. Pengutamaan Operator Dalam Ekspresi Aritmatika
Dalam prolog, proses aritmatika juga menggunakan konsep aljabar.
Contoh:
a-b*c+d
proses di atas akan dibaca sebagai berikut, b dikali c kemudian dikurang a dan ditambah d. Hal ini sesuai dengan konsep aljabar yang selama ini kita telah pelajari. Di sini juga berlaku proses pengkhususan menggunakan dalam kurung.
Contoh:
(a+b)*(c+d)
proses di atas akan dibaca sebagai berikut, a ditambah b, c ditambah d dan kemudian kedua hasil akan dikalikan.

d. Relational Operators
Operator seperti =, !=, >,>=, <, =<, dapat digunakan di Prolog. Digunakan untuk membandingkan dua variabel. Contoh: a != b artinya a tidak sama dengan b a<= b artinya a lebih kecil sama dengan b 3. Operator Pembanding Berikut merupakan daftar dari equality operators yang digunakan dalam prolog beserta fungsi dari masing-masing operator. --> Arithmetic Expression Inequality =\=
--> Arithmetic Expression Equality =:=
--> Terms Not Identical \==
--> Terms Identical ==
--> Terms Identical With Unification =
--> Non-Unification Between Two Terms \=

4. Operator Logika
a. Operator Not
Operator not dapat ditempatkan sebelum predikat untuk memberikan negasi. Predikat yang dinegasikan bernilai benar jika predikat yang asli salah dan bernilai salah jika predikat yang asli benar. Berikut contoh penggunaan operator not :
dog(fido).
?- not dog(fido).
no
?- dog(fred).
no
?- not dog(fred).
yes
?- X=0,X is 0.
X = 0
?- X=0,not X is 0.
no

b. Operator Disjungsi
Operator disjungsi (;) digunakan sebagai operator ‘atau’. Contoh :
?- 6<3;7>
yes

?- 6*6=:=36;10=8+3.
yes

Kamis, 19 November 2009

OPERATOR AND ARITHMETIC

Jawaban Exercise 4 no 1

1. Langkah pertama, copy dulu rulenya dalam notepad dan simpan dalam format .pl seperti pada contoh gambar di bawah


2. Kemudian melalui prolog buka file tersebut
3. Untuk menjalankan prolognya ketik contoh(5,6).atau pred(5,6). kemudian enter
4. Dan hasilnya dapat dilihat pada gambar di bawah ini.

Jawaban Exercise 4 no 2

1. Langkah pertama sama seperti di atas, kita copy dahulu rulenya di notepad kemudian save dalam format .pl seperti gambar di bawah


2. Kemudian melalui prolog buka file tersebut
3. Untuk menjalankan prolog ini ketikan X chase Y. sehingga tampilan prolog seperti pada gambar di bawah ini

EXPERT SYSTEM

An expert system is software that attempts to provide an answer to a problem, or clarify uncertainties where normally one or more human experts would need to be consulted. Expert systems are most common in a specific problem domain, and is a traditional application and/or subfield of artificial intelligence. 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.

The following general points about expert systems and their architecture have been illustrated.

1. The sequence of steps taken to reach a conclusion is dynamically synthesized with each new case. It is not explicitly programmed when the system is built.

2. Expert systems can process multiple values for any problem parameter. This permits more than one line of reasoning to be pursued and the results of incomplete (not fully determined) reasoning to be presented.

3. Problem solving is accomplished by applying specific knowledge rather than specific technique. This is a key idea in expert systems technology. It reflects the belief that human experts do not process their knowledge differently from others, but they do possess different knowledge. With this philosophy, when one finds that their expert system does not produce the desired results, work begins to expand the knowledge base, not to re-program the procedures.

There are various expert systems in which a rulebase and an inference engine cooperate to simulate the reasoning process that a human expert pursues in analyzing a problem and arriving at a conclusion. In these systems, in order to simulate the human reasoning process, a vast amount of knowledge needed to be stored in the knowledge base. Generally, the knowledge base of such an expert system consisted of a relatively large number of "if then" type of statements that were interrelated in a manner that, in theory at least, resembled the sequence of mental steps that were involved in the human reasoning process.

Because of the need for large storage capacities and related programs to store the rulebase, most expert systems have, in the past, been run only on large information handling systems. Recently, the storage capacity of personal computers has increased to a point where it is becoming possible to consider running some types of simple expert systems on personal computers.

In some applications of expert systems, the nature of the application and the amount of stored information necessary to simulate the human reasoning process for that application is just too vast to store in the active memory of a computer. In other applications of expert systems, the nature of the application is such that not all of the information is always needed in the reasoning process. An example of this latter type application would be the use of an expert system to diagnose a data processing system comprising many separate components, some of which are optional. When that type of expert system employs a single integrated rulebase to diagnose the minimum system configuration of the data processing system, much of the rulebase is not required since many of the components which are optional units of the system will not be present in the system. Nevertheless, earlier expert systems require the entire rulebase to be stored since all the rules were, in effect, chained or linked together by the structure of the rulebase.

When the rulebase is segmented, preferably into contextual segments or units, it is then possible to eliminate portions of the Rulebase containing data or knowledge that is not needed in a particular application. The segmenting of the rulebase also allows the expert system to be run with systems or on systems having much smaller memory capacities than was possible with earlier arrangements since each segment of the rulebase can be paged into and out of the system as needed. The segmenting of the rulebase into contextual segments requires that the expert system manage various intersegment relationships as segments are paged into and out of memory during execution of the program. Since the system permits a rulebase segment to be called and executed at any time during the processing of the first rulebase, provision must be made to store the data that has been accumulated up to that point so that at some time later in the process, when the system returns to the first segment, it can proceed from the last point or rule node that was processed. Also, provision must be made so that data that has been collected by the system up to that point can be passed to the second segment of the rulebase after it has been paged into the system and data collected during the processing of the second segment can be passed to the first segment when the system returns to complete processing that segment.

The user interface and the procedure interface are two important functions in the information collection process.

Another major distinction between expert systems and traditional systems is illustrated by the following answer given by the system when the user answers a question with another question, "Why", as occurred in the above example. The answer is:

A. I am trying to determine the type of restaurant to suggest. So far Chinese is not a likely choice. It is possible that French is a likely choice. I know that if the diner is a wine drinker, and the preferred wine is French, then there is strong evidence that the restaurant choice should include French.

It is very difficult to implement a general explanation system (answering questions like "Why" and "How") in a traditional computer program. An expert system can generate an explanation by retracing the steps of its reasoning. The response of the expert system to the question WHY is an exposure of the underlying knowledge structure. It is a rule; a set of antecedent conditions which, if true, allow the assertion of a consequent. The rule references values, and tests them against various constraints or asserts constraints onto them. This, in fact, is a significant part of the knowledge structure. There are values, which may be associated with some organizing entity. For example, the individual diner is an entity with various attributes (values) including whether they drink wine and the kind of wine. There are also rules, which associate the currently known values of some attributes with assertions that can be made about other attributes. It is the orderly processing of these rules that dictates the dialog itself.