Friday, October 23, 2009

Fact, Rules, Predicate, and Variable in Prolog

Now, We will show another tutorial about Prolog.

This is a program about searching anything which have same identify. We will use this source :

/* Animals Database */
animal(mammal,tiger,carnivore,stripes).
animal(mammal,hyena,carnivore,ugly).
animal(mammal,lion,carnivore,mane).
animal(mammal,zebra,herbivore,stripes).
animal(bird,eagle,carnivore,large).
animal(bird,sparrow,scavenger,small).
animal(reptile,snake,carnivore,long).
animal(reptile,lizard,scavenger,small).

Step 1

Type the source to text editor (ex. notepad).

See this image :








(Click the image if you can't see well)


Step 2

Save in My Documents\Prolog\ and give name "animal.pl" or "animal.pro".

See this image :










(Click the image if you can't see well)



Step 3

Open it with command consult.

See this image :










(Click the image if you can't see well)


Step 4

Now, if We want to search all mammal animal, use this command : animal(mammal,A,_,_). "A" is variable. Can change another variable, but must in Upper Case.

Note : "_" mean DON'T SHOW anything from source in the line which can possibility show.

See this image :
















(Click the image if you can't see well)


Step 5

Now, if We want to search all the carnivores that are mammals, use this command : animal(mammal,A,carnivore,_).

See this image :
















(Click the image if you can't see well)


Step 6

Now, if We want to search all mammals with stripes, use this command : animal(mammal,A,_,stripe).

See this image :
















(Click the image if you can't see well)


Step 7

Now, if We want to search a reptile that has a mane, use this command : animal(_,A,_,_mane).

See this image :
















(Click the image if you can't see well)

Read more...

Rule – Based Expert System

Expert System

First, What is 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.

As a premiere application of computing and artificial intelligence, 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 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.

Rule – Based Expert System

A rule-based expert system is an expert system which works as a production system in which rules encode expert knowledge.

Most expert systems are rule-based. Alternatives are :

1. frame-based - knowledge is associated with the objects of interest and reasoning consists of confirming expectations for slot values. Such systems often include rules too. 

2. model-based, where the entire system models the real world, and this deep knowledge is used to e.g. diagnose equipment malfunctions, by comparing model predicted outcomes with actual observed outcomes

3. case-based - previous examples (cases) of the task and its solution are stored. To solve a new problem the closest matching case is retrieved, and its solution or an adaptation of it is proposed as the solution to the new problem.

Data-driven Rule-based Expert Systems

Use Forward Chaining:

Given a certain set of facts in WM, use the rules to generate new facts until the desired goal is reached.

To forward chain the inference engine must:

1. Match the condition patterns of rules against facts in working memory.

2. If there is more than one rule that could be used (that could "fire"), select which one to apply (this is called conflict resolution)

3. Apply the rule, maybe causing new facts to be added to working memory

4. Halt when some useful (or goal) conclusion is added to WM (or until all possible conclusions have been drawn.)

Sources :

Wikipedia (http://en.wikipedia.org/wiki/Expert_system)

cs.tcd.ie (https://www.cs.tcd.ie/Lucy.Hederman/DipHI/RuleBasedExpSys.doc)

Read more...

Tuesday, October 13, 2009

Final Project Prolog

This the final project prolog. We will show about all possible combination of a set. Okay, let's begin..

Step 1

Make a set. In here, We call it "himpunan s" and "himpunan h". The member of "himpunan s" are Fahrireza, Izzat, Chandra, and Catur. And the member of "himpunan h" are Probolinggo, Nganjuk, Surabaya, and Sidoarjo. Make the set in notepad by typing :
himpunans(fahrireza).
himpunans(izzat).
himpunans(chandra).
himpunans(catur).
himpunanh(probolinggo).
himpunanh(nganjuk).
himpunanh(surabaya).
himpunanh(sidoarjo).

note : In Prolog, the letters must be typed in Lower Case and Without Space. Also must type dot "." or stop mark in the last declaration.

See this image :
















(Click the image if you can't see well)


Step 2

Save with format prolog. In our computer, Extension Prolog is ".pro". So We save it with extension ".pro". Prolog can be ".pro" or ".pl" extension. We name the file with "prolog".

note : Must save in My Documents\Prolog\

See this image :
















(Click the image if you can't see well)


Step 3

Open the Prolog and open the file. Command in prolog to open the file is consult. The sintax is consult('file.pro').

note : Remember to give stop mark or dot "." in last command and declaration.

See this image :
















(Click the image if you can't see well)


Step 4

If file is correct and prolog can open it, prolog will show if the file is compiled successfully. Now, to check the file really has been compiled with prolog, We can try it with type : himpunans(X). With this command prolog will show the member of himpunans.

See this image :
















(Click the image if you can't see well)

Step 5

Now, prolog show an output "X = fahrireza". In this output show that X possible or can be replace with fahrireza. If you feel fahrireza who are not you find, you can type ";". Prolog will show another possibility. If you type ";" rapidly, if the last possibility, prolog will show output "No". Because prolog conclude that the member what you want is nothing.

See this image :










































































(Click the image if you can't see well)


Step 6

Okay let's check the possibility can prolog show if We want to know how many possibility combination of "himpunans" and "himpunanh". Command in prolog to check it is : himpunans(X),himpunanh(Y).

It mean that prolog must show how many possibility of "himpunans" and "himpunanh" by make output the member of himpunans and himpunanh.

See this image :






























(Click the image if you can't see well)

The possibility is sixteen. So we can conclude that how many possibility can be calculate with "the count of himpunans multiply with the count of himpunanh". So if himpunans have 4 members and himpunanh also have 4 members, the possibility is 4 x 4 = 16.

Read more...

Biography member of team

  1. Fahri Reza was born in Probolinggo. 8 apil 1991. He is first child from three children in his family. He also so have spirit to reach success. He start his study from Sukabumi 2 elementary school, and after he pass from it, he drawn out to junior High school 1 in probolinggo, and then he drawn out to Senior High School 1 Probolinggo. And Now He was studying in Information System Department Faculty of Information Technology INSTITUT TEKNOLOGI SEPULUH NOPEMBER (ITS) Surabaya. He also interesting about everything in computer such as software or webdesign therefore He enter to Information System Department. Not only he interested in computer but also he like swim and play badminton. His motto is try something which do you never do it before. If you want more to know me please show in Facebook and Friendster at de_shiki@yahoo.com and if you want to chat with me please add my contact in your addres at de_shiki@yahoo.com. And my telephone number is 085258488558 and 08993314239. Please give comment or feedback if there is mistake.


  2. Izzat Aulia Akbar was born in Kediri, 7 April 1991. A student at Information System Department Faculty of Information Technology INSTITUT TEKNOLOGI SEPULUH NOPEMBER (ITS) Surabaya. Born in a simple family. The second child of five brothers. Interested about technology, especially computer, software, and web design. Enjoy spending time by reading books and listening music. Izzat Aulia Akbar is founder site masizzat.co.cc. For more information can be obtained through : email : zuver_lassig07@yahoo.co.id


  3. Chandra Posma Rachmawan was born in Surabaya at 21 October 1990 .he is second child from five children in his family. He also interesting about everything in computer such as software or web design therefore He enter to Information System Department (ITS). Not only he interested in computer but also he like playing football and music. He have a motto .his motto is “Don’t ever give up whatever a event”. If you want more to know me please show in Facebook at stolenofmusic@yahoo.co.id. And my telephone number is 08563201546. Please give comment or feedback if there is mistake.



  4. Catur Agus Setiawan was born in Surabaya, 17 August 1990. The fourth son of three brothers. He lives in North Medayu No. 69 Surabaya. He is a student in ITS Surabaya at Information System Department. He also interesting about everything in computer such as software or web design. Not only interested about computer but also playing football and karate. If you want more to know me please send email to : catur09@mhs.is.its.ac.id.

Read more...

Thursday, October 1, 2009

Launching Blog

This is the first posting from us (the permutation team). The member of this team are :
1. Fahri Reza
2. Izzat Aulia A.
3. Chandra Posma R.
4. Catur Agus

We are from Institut Teknologi Sepuluh November (ITS) in Information System Department. We make this Blog to complete the assigment from our be lovely teacher Mr. "Cak Shon". We will show him and all people in the world that we can do the best and more in each seconds !!

No Worries Sir !!
^_^

Read more...

About This Blog

This Blog created to complete Discrete Math Assignment. This Blog contain all about discrete math subject especially Prolog programming. The member of team are Fahri Reza, Izzat, Chandra and Catur. We are from Discrete Math class A at Information System Department faculty of Information Technology INSTITUT TEKNOLOGI SEPULUH NOPEMBER (ITS) Surabaya. We hope all existing posts on this blog will be useful for all people. And thanks for visiting our Blog..

Followers

  © Blogger template PingooIgloo by Ourblogtemplates.com 2009 | The Permutation Team's Blog 2009

Back to TOP