Selasa, 22 Desember 2009

8th task

finally the FP is over..and this is our report..
the file is in pdf format and we also have the tutorial for FP 7 in video(i'll post it later)..
here is the link:
Discrete Math report


Minggu, 20 Desember 2009

7th Task

hi friends!!! xD
after long time, finally we've did our 7th task...
this task is about expert system in prolog..
you already read our idea for expert sysytem, didn't you?

our idea for expert system is type of haircut and glasses for some shape of  our face, such as oval, square, oblong, triangular and round...

these are the tutorial....
  • first make a notepad then write down the formula for expert system..this is our formula








  • then write down the shape  of  your face(oval,square,oblong,triangular or round)..
  • give a full stop(.) after you write down the type of your face. Then 'ENTER'
  • you will get the result..and this is the example of the result...





Rabu, 09 Desember 2009

6th task

We’ll find who’s the professor from people who listed here and have another job. We will find the professor using looping function of prolog programme
  • Make a new notepad and then write down the input and formula(look at the first picture). 
  • Saving file under the name prof.pl 
  • Consult the file on plwin then write find then ‘ENTER’. 
  • Look at the result at second picture! 




6th task

The second excerise is the looping function that made the programme loop every word we typed.
  • Make a new notepad and write the formula(look at the first picture).
  • Save as under the name go.pl 
  • Then consult go.pl in plwin then write go. Then ‘ENTER’.
  • Now write a word give full stop behind the word (.), then ‘ENTER’. 



6th task



Loops in prolog programme

  • We will make a looping to get know about the square of some number
  • Make a new notepad file then write the formula(look at the first picture).
  • Save file under the name loop1.pl
  • Now open loop1.pl, then write down outsquare(4,9)* then ‘ENTER’. You’ll see the result like this. We’ll see the result of squared from number 3until number 10 (we just need to write the command once and then the result will be looping if the condition is true )

























P.S
(4,9) : Actually you may write another number, but make sure that the first number is lower than second number.^^


    Selasa, 08 Desember 2009

    Resume bab 6


    RESUME
    6.1 LOOPING A FIXED NUMBER OF TIMES
    Loops enable a set of instructions to be executed a fixed number of times. In prolog, looping can be obtained using recursion. In this case, looping function on PROLOG is similiar to another programming language. We can see in the example given below:
    loop(0).
    loop(N):-N>0,write('The value is: '),write(N),nl,
    M is N-1,loop(M).
    Those clauses means that ‘the terminating condition of the recurtion is 0. To loop from N, first determine the value of N, then substract it to having M, then loop from M, until the value is 0. If the value is 0, the looping process is stopped there’
    6.2 LOOPING UNTIL A CONDITION IS SATISFIED
    No facility on PROLOG that directly enable a set of instructions to be executed repeatedly until a given condition is met. But there are two way to obtained the similiar effect :

    -          Recursion
    Recursion read the input from keyboard, and output it to the screen, until the ‘end’ instruction is endountered.
    Example of the form :

    go:-loop(start). /* start is a dummy value used to get
    the looping process started.*/
    loop(end).
    loop(X):-X\=end,write('Type end to end'),read(Word),
    write('Input was '),write(Word),nl,loop(Word).

    The last clauses mean: The looping of X will be stopped if the ‘end’ is encountered. Saat looping berlangsung (before ‘end’ had encountered), PROLOG will always ask the user to enter the input by the sentence ‘Type end to end’ .

    -          Using the ‘repeat’ Predicate
    The goal repeat doesn’t repeat anything, it will be succeeds whenever it’s being called. If user enter another term but yes or no, PROLOG will always repeat the instruction until the user enter the term ‘yes’ or ‘no’. This is the example of the form :
    get_answer(Ans):-
    write('Enter answer to question'),nl,
    repeat,write('answer yes or no'),read(Ans),
    valid(Ans),write('Answer is '),write(Ans),nl.
    valid(yes). valid(no).

    In the case of looping, the two goals write(‘answer yes or no’) and read(Ans) will always repeat until the condition valid(Ans) had satisfied.

    Repeat predicate can also processing the sequence of terms from a specified file an outputs them until the term ‘end’ is encountered.
    The example of the form :
    readterms(Infile):-
    seeing(S),see(Infile),
    repeat,read(X),write(X),nl,X=end,
    seen,see(user).

    Then, the file that will being outputted containing (for example, the file ‘myfile.txt’ :
    'first term'. 'second term'.
    'third term'. 'fourth term'.
    'fifth term'. 'sixth term'.
    'seventh term'.
    'eighth term'.
    end.

    Then, call the goal readterms will produced a result :

    ?- readterms('myfile.txt').
    first term
    second term
    third term
    fourth term
    fifth term
    sixth term
    seventh term
    eighth term
    end
    yes

    If ‘end’ hasn’t been encountered, there will be a looping process between the goals repeat and X=end.

    6.3 BACKTRACKING WITH FAILURE
    This chapter describes how a set of goals can be evaluated repeatedly in Prolog,
    either a fixed number of times or until a specified condition is met, and how
    multiple solutions can be arrived at using the technique of 'backtracking with
    failure'.



    Rabu, 25 November 2009

    resume bab 5


    Bab 5
    Input dan Output

    Pendahuluan :
    Prolog memiliki fasilitas untuk mengaktifkan input dan output baik dari istilah atau karakter.
    Menggunakan istilah lebih sederhana dan akan dijelaskan terlebih dahulu.

    5,1 Outputing
        fungsinya untuk mencetak write/1 dan writeq/1
        perbedaan write/1 : saat mencetak outputnya dibutuhkan tanda petik, baik di awal dan di akhir
        sedangkan writeq/1 : ketika mengeluarkan outputnya tidak memrlukan tanda petik baik di awal atau di akhir
        built-in predicate nl/0 akan membuat baris baru pada hasil outputnya
                contoh :
                untuk write/1
                ?- write('a string of characters'),nl.
                a string of characters
                yes

                untuk writeq/1
                ?- writeq('a string of characters'),nl.
                'a string of characters'
                Yes
    5.2 Inputing terms
        Predikat read/1 dibutuhkan dalam penginputan yang membutuhkan sebuah argument dan berupa variabel.
        dalam penginputannya juga dibutuhkan tanda titik (.)
        istilah input disatukan dengan argumen
        variabel. Jika variabel tidak terikat (yang biasanya terjadi) itu adalah terikat pada
        masukan nilai.
                contoh :
                ?- read(Y).
                : 'a string of characters'.
                Y = 'a string of characters'
               
                atau

                ?- read(X).
                : 26.
                X = 26
                Jika variabel argumen sudah terikat (sebagian kesalahan terjadi karena kelasalahan [engguna itu sendiri), berhasil jika dan hanya jika
                masukan istilah adalah identik dengan nilai terikat sebelumnya.
                contoh :
                ?- X=fred,read(X).
                : jim.
                no ==> disini "no" maksudnya kata jim tidak ada dalam variabel x
               
    5.3  Input and Output Using Characters
                Menggunakan syarat-syarat yaitu penggunaan tanda kutip dan penuh
    berhenti dapat menjadi rumit dan tidak selalu sesuai.


    94 : ^
    95 :_
    96 :`
    97:-
    122 :a to z
    123 :{
    124 |:
    125 :}
    126 :~



    59: ;
    60 :<
    61 :=
    62 :>
    63 :?
    64: @
    65:-
    90 : A to Z
    91 : [
    92 : \
    93 :]



    40: (
    41 :)
    42 :*
    43 :+
    44 :,
    45 :-
    46 :.
    47 :/
    48-57: 0 to 9
    58 ::



    9   : tab
    10 : end of record
    32 :space
    33 :!
    34 :"
    35 :#
    36 :$
    37 :%
    38 :&
    39 :'


    Contoh :






    Nilai ASCII karakter yang kurang dari atau sama dengan 32 yang dikenal sebagai putih
    ruang karakter.

    5.4 Outputting Characters
    Karakter output menggunakan built-in predicate put/1..
    Karakter put akn menyebabkan satu karakter di outputnya . Ini adalah karakter yang sesuai dengan nilai numerik (ASCII nilai) dari argumen, misalnya :
                ?- put(97),nl.
    a
    yes
    5.5 Inputting Characters
    Predikat Two built-in untuk memasukan inputan satu karakter get0/1 and get/1.
    Maksud dari get0/1 adalah untuk satu karakter 
    Contoh :
    ?- get0(N).
    : a
    N = 97
    ?- M is 41,get0(M).
    : )
    M = 41
    ?- M=dog,get0(M).
    : )
    No
    ?- get(X).
    : Z
    X = 90

    5.6 Using Characters: Examples
    Contoh pertama menunjukan bagaimana cara karakter dari keyboard. Variabel
    kemudian disatukan dengan nilai ASCII karakter ini.
    Contoh :
    readin:-get0(X),process(X).
    process(42).
    process(X):-X=\=42,write(X),nl,readin.
    ?- readin.
    : Prolog Example*
    80
    114
    111
    108
    111
    103
    32
    69
    120
    97
    109
    112
    108
    101
    yes

    Kali ini ASCII nilai-nilai input adalah karakter yang tidak output, tetapi jumlah karakter
    (termasuk *) adalah output.
    go(Total):-count(0,Total).
    count(Oldcount,Result):-
    get0(X),process(X,Oldcount,Result).
    process(42,Oldcount,Oldcount).
    process(X,Oldcount,Result):-
    X=\=42,New is Oldcount+1,count(New,Result).
    ?- go(T).
    : The time has come the walrus said*
    T = 33
    ?- go(T).
    : *
    T = 0
    Predikat vokal tes untuk salah satu dari 10 kemungkinan vokal (lima huruf besar dan lima huruf kecil), menggunakan nilai-nilai ASCII.

    go(Vowels):-count(0,Vowels).
    count(Oldvowels,Totvowels):-
    get0(X),process(X,Oldvowels,Totvowels).
    process(42,Oldvowels,Oldvowels).
    process(X,Oldvowels,Totalvowels):-
    X=\=42,processChar(X,Oldvowels,New),
    count(New,Totalvowels).
    processChar(X,Oldvowels,New):-vowel(X),
    New is Oldvowels+1.
    processChar(X,Oldvowels,Oldvowels).
    vowel(65). /* A */
    vowel(69). /* E */
    vowel(73). /* I */
    vowel(79). /* O */
    vowel(85). /* U */
    vowel(97). /* a */
    vowel(101). /* e */
    vowel(105). /* i */
    vowel(111). /* o */
    vowel(117). /* u */
    ?- go(Vowels).
    : In the beginning was the word*
    Vowels = 8
    ?- go(Vowels).
    : pqrst*
    Vowels = 0

    5.7 Input dan Output Menggunakan File
    Prolog melakukan input dan output dalam stream. Pengguna mungkin melakukan (membuka dan menutup) di  stream dengan menggunakan huruf dari nama filenya .
    File 5,8 Output: Mengubah Current Output Stream
    Aliran arus output dapat diubah menggunakan tell / 1 predikat. Nilai ini dapat dikembalikan baik dengan menggunakan kata / 0 predikat atau dengan kirim (pengguna).


    File 5,9 Input: Mengubah Input Current Stream
    Input stream yang aktif dapat diubah dengan menggunakan melihat / 1 predikat yang mewakili nama file, misalnya
    lihat ( 'myfile.txt'). Nilai ini dapat dikembalikan baik dengan menggunakan dilihat predikat atau dengan melihat (pengguna).
    1.
    Membaca dari File: End of File
    Jika akhir file ditemukan ketika mengevaluasi tujuan read (X), variabel X akan terikat pada atom end_of_file. Jika akhir file ditemukan saat mengevaluasi tujuan mendapatkan (X) atau get0 (X), variabel X akan terikat kepada seorang 'khusus' nilai numerik.
    2.
    Membaca dari File: End of Record
    Biasanya akhir baris dari input pada terminal pengguna akan ditunjukkan oleh karakter dengan nilai ASCII 13. Akhir sebuah catatan dalam sebuah file pada umumnya akan ditandai dengan dua nilai ASCII: 13 diikuti oleh 10.
    Readline:-get0 (X), proses (X).
    proses (13).
    proses (X):-X = \ = 13, memakai (X), nl, Readline.
    ? - Readline.
    : Prolog test
    P
    r
    o
    l
    o
    g
    t
    e
    s
    t
    ya


    Selasa, 24 November 2009

    Expert System for Fixing the type of hair style and face shape glasses fit

     
    Expert System for Fixing the type of hair style and face shape glasses fit


    Background of problem are...

    most people are confused about hair style, when, they went to the salon they are confused what to do with their hair?, especially for women (for women haircuts model is like the crown that must always be on guard and in-patient) cut hair style must also comply with face shape...especially for those who wear glasses.... for example on my group there is have oval faces (since covered so the haircut was not observed), he likely will use the lens frame or round box...Because of that, with this expert system, we hope people not difficult in deciding type of hair style and face shape glasses fit Detail Explanation of Idea.
    Expert System that we make consist of facts that is many kind of face shape, hairstyle and glasses are suitable.

    We categories kind face shape's facts to many groups, such as :
    1 WAJAH OVAL ( bulat telur )
    2.WAJAH SQUARE ( kotak persegi / bujursangkar )
    3.WAJAH OBLONG ( lonjong )
    4.WAJAH TRIANGULAR ( segitiga )
    5. WAJAH ROUND ( bulat bundar )

    The possibilities of hair styles and models glasses suitable for their face shape :
    1. WAJAH OVAL ( bulat telur ) Hair styles are suitable: for your face all in balance or in balance (the perfect face shape) so whatever haircut okay, from bald to short, medium, long and even no problems ^^
     
    Type of glasses that fit: shape eyeglasses frames and lenses matches anything except a round (circle).

    2.WAJAH SQUARE ( kotak persegi / bujursangkar )
    Hair styles that match: remember that your face is a box of hair on the edge of the head (the side of the head) slightly curved piece of shaving to reduce the sharpness angle and soften the appearance.Can choose models with short to medium curly variation (curly), layer (curtain), or wavy (wavy).

    Type of glasses that fit: choose the form of frames and lenses are oval (ellipse) and for the frame (frame) that does not matter a bit thick.

    3.WAJAH OBLONG ( lonjong )
    Hair styles are suitable: for your face-like oval impressed choose wide variations such as bangs hair (widen laterally), layered hair (curtain), and curls (curling). Short and medium hair okay but not rising to the top with the hair side of the third part ditipisi head. Do not choose long hair straight up over my neck, it can make your face look longer and more narrow.

    Type of glasses that fit: choose frames and lenses tend to form a widened laterally box.

    4. WAJAH TRIANGULAR ( segitiga ) You can choose layered hairstyle (curtain), side swept bangs, and shaggy. Type triangular face does not fit with the military haircut (crew cut) and the mohawk

    Type of glasses that fit: choose frames and lenses that stretch to the top

    5. WAJAH ROUND ( bulat bundar )
    Hair styles that match: round face, including the width so choose hair styles tend to rise upward or downward lengthwise (optional long hair). Demen alternative short hair can select the style spikes, mohawk, and Bross

    Type of glasses that fit: choose frames and lenses are shaped and narrow box.

    Examples :
    - if "curls hairs"... "frame glasses is box" ..,.. means oval face shape
    - if "shaggy hairs"... "frames and lenses that stretch to the top" .... so WAJAH TRIANGULAR ( segitiga )

    Beneficial The benefit that that can be gotten of this Expert System are :
    1. helping customers salon "hair cut" to make it easier to find the hair model
    2. help store glasses optical to choose their models frame
    3. help people to select the models of the hair in accordance with the shape of her face

    Jumat, 13 November 2009

    4th task

    Operators and Arithmetic




    Operator terdapat berebagai macam jenis

    Ada operator sisipan contoh predikat : john likes mary.

    Ada operator awalan contoh predikat : isa_dog fred.

    Ada operator akhiran contoh predikat : fred isa_dog.

    Ini jelas berbeda dari predikat yang sering digunakan yaitu : likes(john,mary).

    Terdapat keistimewaan dalam operator yaitu pengunaan op predikat contohnya : ?-op(150,xfy,likes).

    xfy menunjukan bahwa predikat merupakan operator sisipan,

    xf menunjukan bahwa predikat merupakan operator awalan,

    fy menunjukan bahwa predikat merupakan operator akhiran,

    (akan lebih jelas jika nanti dilihat di soal).

    Dalam prolog juga terdapat angka-angka yaitu didalam aritmatika tetapi di sini aritmatika yang terdapat di dalam prolog tidak dapat berdiri sendiri jadi harus terdapat keterangan(predikat lain yang mendukung).

    Sebagai contoh : ?-X is 6*Y+Z-3.2+P-Q/4.

    (prolog tidak dapat menjalankan ini karena prolog tidak mengetahui berapa itu Y,Z,P,dan Q)





    tetapi jika kita mengunakan ini :

    ?- X is 10.5+4.7*2.

    X = 19.9 (maka prolog bisa menjalankannya)

    Berikut adalah table operator dalam aritmatika

    X+Y penjumlahan X and Y

    X-Y pengurangan X and Y

    X*Y perkalian X and Y

    X/Y pembagian X and Y

    X^Y X pangkat Y

    abs(X) nilai absolute X

    sin(X) sinus X

    cos(X) cosines X

    max(X,Y) nilai terbesar dari X dan Y

    sqrt(X) akar dari X

    Selain dari itu didalam prolog juga terdapat operasi relasi yaitu :

    =:= , =\= , > , >= , < , =< .

    Contoh operasi relasi :

    ?- 88+15-3=:=110-5*2.

    Yes

    ?- 100=\=99.

    yes

    jenis -jenis samadengan di dalam prolog yaitu :





    1. Arithmetic Expression Equality =:=

    Contoh :

    ?- 6+4=:=6*3-8.

    Yes

    2. Arithmetic Expression Inequality =\=

    Contoh :

    ?- 10=\=8+3.

    yes

    3. Terms Identical ==

    Contoh :

    ?- X is 10,pred1(X)==pred1(10).

    X = 10

    4. Terms Identical With Unification =

    Contoh :

    ?- 6+X=6+3.

    X = 3

    5. Non-Unification Between Two Terms \=

    Contoh :

    ?- 6+4\=3+7.

    Yes







    Logika Operator

    1. The not Operator

    Contoh : dog(fido).

    ?- not dog(fido).

    no

    2. The Disjunction Operator

    Contoh :

    ?- 6<3;7>

    yes




    4th task

    4th task finally coming..
    we are so tired this weel..-,-!!
    and here it is question number one from task 4th :



















    then we have to find animal that is large cat, small cat. large dog & small dog.
    1. firt we have to arrange the database . ex : dog (Fido),dog (rover),cat (marry), then type that on a enotepad and save it as 'pl
    2. then consult it on prolog.. type the formulas, ex : large_dog(X).
    3. then push enter and semi colon until "no " shows up!



















    then task number two,we have to make some condition with math operator (such as : average,square,product and larger than) and calculate it based on our algorithm..
    the process are :

    1. we made it directly on prolog
    2. then inizialitation for integer X & Y
    3. then type the formula beside the inizialitation of X & Y (divided by coma).
    4. then push enter so the result must be gien gift..then push semi colon until "no" shows up..^^




    Rabu, 11 November 2009

    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.
    Expert systems were introduced by Edward Feigenbaum, the first truly successful form of AI software. The topic of expert systems has many points of contact with general systems theory, operations research, business process reengineering and various topics in applied mathematics and management science.
    Expert systems topics
    Chaining
    Two methods of reasoning when using inference rules are backward chaining and forward chaining.
    Forward chaining starts with the data available and uses the inference rules to conclude more data until a desired goal is reached. An inference engine using forward chaining searches the inference rules until it finds one in which the if clause is known to be true. It then concludes the then clause and adds this information to its data. It would continue to do this until a goal is reached. Because the data available determines which inference rules are used, this method is also called data driven.
    Backward chaining starts with a list of goals and works backwards to see if there is data which will allow it to conclude any of these goals. An inference engine using backward chaining would search the inference rules until it finds one which has a then clause that matches a desired goal. If the if clause of that inference rule is not known to be true, then it is added to the list of goals. For example, suppose a rule base contains
    1. If Fritz is green then Fritz is a frog.
    2. If Fritz is a frog then Fritz hops.
    Suppose a goal is to conclude that Fritz hops. The rule base would be searched and rule (2) would be selected because its conclusion (the then clause) matches the goal. It is not known that Fritz is a frog, so this "if" statement is added to the goal list. The rule base is again searched and this time rule (1) is selected because its then clause matches the new as certainty factors. A human, when reasoning, does not always conclude things with 100% confidence: he might venture, "If Fritz is green, then he is probably a frog" (after all, he might be a chameleon). This type of reasoning can be imitated by using numeric values called confidences. For example, if it is known that Fritz is green, it might be concluded with 0.85 confidence that he is a frog; or, if it is known that he is a frog, it might be concluded with 0.95 confidence that he hops. These numbers are probabilities in a Bayesian sense, in that they quantify uncertainty.
    Expert system architecture
    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.
    End user
    The end-user usually sees an expert system through an interactive dialog, an example of which follows:
    Q. Do you know which restaurant you want to go to?
    A. No
    Q. Is there any kind of food you would particularly like?
    A. No
    Q. Do you like spicy food?
    A. No
    Q. Do you usually drink wine with meals?
    A. Yes
    Q. When you drink wine, is it French wine?
    A. Yes
    As can be seen from this dialog, the system is leading the user through a set of questions, the purpose of which is to determine a suitable set of restaurants to recommend. This dialog begins with the system asking if the user already knows the restaurant choice (a common feature of expert systems) and immediately illustrates a characteristic of expert systems; users may choose not to respond to any question. In expert systems, dialogs are not pre-planned. There is no fixed control structure. Dialogs are synthesized from the current information and the contents of the knowledge base. Because of this, not being able to supply the answer to a particular question does not stop the consultation.
    Explanation system
    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.
    Expert systems versus problem-solving systems
    The principal distinction between expert systems and traditional problem solving programs is the way in which the problem related expertise is coded. In traditional applications, problem expertise is encoded in both program and data structures. In the expert system approach all of the problem related expertise is encoded in data structures only; no problem-specific information is encoded in the program structure. This organization has several benefits.
    An example may help contrast the traditional problem solving program with the expert system approach. The example is the problem of tax advice. In the traditional approach data structures describe the taxpayer and tax tables, and a program in which there are statements representing an expert tax consultant's knowledge, such as statements which relate information about the taxpayer to tax table choices. It is this representation of the tax expert's knowledge that is difficult for the tax expert to understand or modify.
    In the expert system approach, the information about taxpayers and tax computations is again found in data structures, but now the knowledge describing the relationships between them is encoded in data structures as well. The programs of an expert system are independent of the problem domain (taxes) and serve to process the data structures without regard to the nature of the problem area they describe. For example, there are programs to acquire the described data values through user interaction, programs to represent and process special organizations of description, and programs to process the declarations that represent semantic relationships within the problem domain and an algorithm to control the processing sequence and focus.
    The general architecture of an expert system involves two principal components: a problem dependent set of data declarations called the knowledge base or rule base, and a problem independent (although highly data structure dependent) program which is called the inference engine.
    Individuals involved with expert systems
    There are generally three individuals having an interaction with expert systems. Primary among these is the end-user; the individual who uses the system for its problem solving assistance. In the building and maintenance of the system there are two other roles: the problem domain expert who builds and supplies the knowledge base providing the domain expertise, and a knowledge engineer who assists the experts in determining the representation of their knowledge, enters this knowledge into an explanation module and who defines the inference technique required to obtain useful problem solving activity. Usually, the knowledge engineer will represent the problem solving activity in the form of rules which is referred to as a rule-based expert system. When these rules are created from the domain expertise, the knowledge base stores the rules of the expert system.
    Inference rule
    An understanding of the "inference rule" concept is important to understand expert systems. An inference rule is a statement that has two parts, an if clause and a then clause. This rule is what gives expert systems the ability to find solutions to diagnostic and prescriptive problems. An example of an inference rule is:
    If the restaurant choice includes French, and the occasion is romantic,
    Then the restaurant choice is definitely Paul Bocuse.
    An expert system's rulebase is made up of many such inference rules. They are entered as separate rules and it is the inference engine that uses them together to draw conclusions. Because each rule is a unit, rules may be deleted or added without affecting other rules (though it should affect which conclusions are reached). One advantage of inference rules over traditional programming is that inference rules use reasoning which more closely resemble human reasoning.
    Thus, when a conclusion is drawn, it is possible to understand how this conclusion was reached. Furthermore, because the expert system uses knowledge in a form similar to the expert, it may be easier to retrieve this information from the expert.
    Procedure node interface
    The function of the procedure node interface is to receive information from the procedures coordinator and create the appropriate procedure call. The ability to call a procedure and receive information from that procedure can be viewed as simply a generalization of input from the external world. While in some earlier expert systems external information has been obtained, that information was obtained only in a predetermined manner so only certain information could actually be acquired. This expert system, disclosed in the cross-referenced application, through the knowledge base, is permitted to invoke any procedure allowed on its host system. This makes the expert system useful in a much wider class of knowledge domains than if it had no external access or only limited external access.
    In the area of machine diagnostics using expert systems, particularly self-diagnostic applications, it is not possible to conclude the current state of "health" of a machine without some information. The best source of information is the machine itself, for it contains much detailed information that could not reasonably be provided by the operator.
    The knowledge that is represented in the system appears in the rulebase. In the rulebase described in the cross-referenced applications, there are basically four different types of objects, with associated information present.
    1. Classes—these are questions asked to the user.
    2. Parameters—a parameter is a place holder for a character string which may be a variable that can be inserted into a class question at the point in the question where the parameter is positioned.
    3. Procedures—these are definitions of calls to external procedures.
    4. Rule Nodes—The inferencing in the system is done by a tree structure which indicates the rules or logic which mimics human reasoning. The nodes of these trees are called rule nodes. There are several different types of rule nodes.
    The rulebase comprises a forest of many trees. The top node of the tree is called the goal node, in that it contains the conclusion. Each tree in the forest has a different goal node. The leaves of the tree are also referred to as rule nodes, or one of the types of rule nodes. A leaf may be an evidence node, an external node, or a reference node.
    An evidence node functions to obtain information from the operator by asking a specific question. In responding to a question presented by an evidence node, the operator is generally instructed to answer "yes" or "no" represented by numeric values 1 and 0 or provide a value of between 0 and 1, represented by a "maybe."
    Questions which require a response from the operator other than yes or no or a value between 0 and 1 are handled in a different manner.
    A leaf that is an external node indicates that data will be used which was obtained from a procedure call.
    A reference node functions to refer to another tree or subtree.
    A tree may also contain intermediate or minor nodes between the goal node and the leaf node. An intermediate node can represent logical operations like And or Or.
    The inference logic has two functions. It selects a tree to trace and then it traces that tree. Once a tree has been selected, that tree is traced, depth-first, left to right.
    The word "tracing" refers to the action the system takes as it traverses the tree, asking classes (questions), calling procedures, and calculating confidences as it proceeds.
    As explained in the cross-referenced applications, the selection of a tree depends on the ordering of the trees. The original ordering of the trees is the order in which they appear in the rulebase. This order can be changed, however, by assigning an evidence node an attribute "initial" which is described in detail in these applications. The first action taken is to obtain values for all evidence nodes which have been assigned an "initial" attribute. Using only the answers to these initial evidences, the rules are ordered so that the most likely to succeed is evaluated first. The trees can be further re-ordered since they are constantly being updated as a selected tree is being traced.
    It has been found that the type of information that is solicited by the system from the user by means of questions or classes should be tailored to the level of knowledge of the user. In many applications, the group of prospective uses is nicely defined and the knowledge level can be estimated so that the questions can be presented at a level which corresponds generally to the average user. However, in other applications, knowledge of the specific domain of the expert system might vary considerably among the group of prospective users.
    One application where this is particularly true involves the use of an expert system, operating in a self-diagnostic mode on a personal computer to assist the operator of the personal computer to diagnose the cause of a fault or error in either the hardware or software. In general, asking the operator for information is the most straightforward way for the expert system to gather information assuming, of course, that the information is or should be within the operator's understanding. For example, in diagnosing a personal computer, the expert system must know the major functional components of the system. It could ask the operator, for instance, if the display is a monochrome or color display. The operator should, in all probability, be able to provide the correct answer 100% of the time. The expert system could, on the other hand, cause a test unit to be run to determine the type of display. The accuracy of the data collected by either approach in this instance probably would not be that different so the knowledge engineer could employ either approach without affecting the accuracy of the diagnosis. However, in many instances, because of the nature of the information being solicited, it is better to obtain the information from the system rather than asking the operator, because the accuracy of the data supplied by the operator is so low that the system could not effectively process it to a meaningful conclusion.
    In many situations the information is already in the system, in a form of which permits the correct answer to a question to be obtained through a process of inductive or deductive reasoning. The data previously collected by the system could be answers provided by the user to less complex questions that were asked for a different reason or results returned from test units that were previously run.
    User interface
    The function of the user interface is to present questions and information to the user and supply the user's responses to the inference engine.
    Any values entered by the user must be received and interpreted by the user interface. Some responses are restricted to a set of possible legal answers, others are not. The user interface checks all responses to insure that they are of the correct data type. Any responses that are restricted to a legal set of answers are compared against these legal answers. Whenever the user enters an illegal answer, the user interface informs the user that his answer was invalid and prompts him to correct it.
    Application of expert systems
    Expert systems are designed and created to facilitate tasks in the fields of accounting, medicine, process control, financial service, production, human resources etc. Indeed, the foundation of a successful expert system depends on a series of technical procedures and development that may be designed by certain technicians and related experts.
    A good example of application of expert systems in banking area is expert systems for mortgages. Loan departments are interested in expert systems for mortgages because of the growing cost of labour which makes the handling and acceptance of relatively small loans less profitable. They also see in the application of expert systems a possibility for standardised, efficient handling of mortgage loan, and appreciate that for the acceptance of mortgages there are hard and fast rules which do not always exist with other types of loans.
    While expert systems have distinguished themselves in AI research in finding practical application, their application has been limited. Expert systems are notoriously narrow in their domain of knowledge—as an amusing example, a researcher used the "skin disease" expert system to diagnose his rustbucket car as likely to have developed measles—and the systems were thus prone to making errors that humans would easily spot. Additionally, once some of the mystique had worn off, most programmers realized that simple expert systems were essentially just slightly more elaborate versions of the decision logic they had already been using. Therefore, some of the techniques of expert systems can now be found in most complex programs without any fuss about them.
    An example, and a good demonstration of the limitations of, an expert system used by many people is the Microsoft Windows operating system troubleshooting software located in the "help" section in the taskbar menu. Obtaining expert/technical operating system support is often difficult for individuals not closely involved with the development of the operating system. Microsoft has designed their expert system to provide solutions, advice, and suggestions to common errors encountered throughout using the operating systems.
    Another 1970s and 1980s application of expert systems — which we today would simply call AI — was in computer games. For example, the computer baseball games Earl Weaver Baseball and Tony La Russa Baseball each had highly detailed simulations of the game strategies of those two baseball managers. When a human played the game against the computer, the computer queried the Earl Weaver or Tony La Russa Expert System for a decision on what strategy to follow. Even those choices where some randomness was part of the natural system (such as when to throw a surprise pitch-out to try to trick a runner trying to steal a base) were decided based on probabilities supplied by Weaver or La Russa. Today we would simply say that "the game's AI provided the opposing manager's strategy."
    Advantages and disadvantages
    Advantages:
    • Provides consistent answers for repetitive decisions, processes and tasks
    • Holds and maintains significant levels of information
    • Encourages organizations to clarify the logic of their decision-making
    • Always asks a question, that a human might forget to ask
    • Can work continuously (no human needs)
    • Can be used by the user more frequently
    • A multi-user expert system can serve more users at a time
    Disadvantages:
    • Lacks common sense needed in some decision making
    • Cannot respond creatively like a human expert would in unusual circumstances
    • Domain experts not always able to explain their logic and reasoning
    • Errors may occur in the knowledge base, and lead to wrong decisions
    • Cannot adapt to changing environments, unless knowledge base is changed
    Types of problems solved by expert systems
    Expert systems are most valuable to organizations that have a high-level of know-how experience and expertise that cannot be easily transferred to other members. They are designed to carry the intelligence and information found in the intellect of experts and provide this knowledge to other members of the organization for problem-solving purposes.
    Typically, the problems to be solved are of the sort that would normally be tackled by a medical or other professional. Real experts in the problem domain (which will typically be very narrow, for instance "diagnosing skin conditions in human teenagers") are asked to provide "rules of thumb" on how they evaluate the problems, either explicitly with the aid of experienced systems developers, or sometimes implicitly, by getting such experts to evaluate test cases and using computer programs to examine the test data and (in a strictly limited manner) derive rules from that. Generally, expert systems are used for problems for which there is no single "correct" solution which can be encoded in a conventional algorithm — one would not write an expert system to find shortest paths through graphs, or sort data, as there are simply easier ways to do these tasks.
    Simple systems use simple true/false logic to evaluate data. More sophisticated systems are capable of performing at least some evaluation, taking into account real-world uncertainties, using such methods as fuzzy logic. Such sophistication is difficult to develop and still highly imperfect.
    Expert Systems Shells or Inference Engine
    A shell is a complete development environment for building and maintaining knowledge-based applications. It provides a step-by-step methodology, and ideally a user-friendly interface such as a graphical interface, for a knowledge engineer that allows the domain experts themselves to be directly involved in structuring and encoding the knowledge. Many commercial shells are available, one example being eGanges which aims to remove the need for a knowledge engineer.