Make your own free website on Tripod.com
  1. Implement the "RuleApp" java application. The java source code is documented in chapter 4 of the text and source code provided on a CD-ROM that comes with the book. Demonstrate the running of the program with sample outputs showing how it performed for the given inputs and rules. Make a few small changes to the rules and show the results.

Answer:

a). The following data were initially loaded into the working memory, and the rule base is “forward chain” with the final goal is “vehicle”.

    1. num_wheel=4.
    2. motor=yes.
    3. num_door=4.
    4. size=medium.

 

Program result = Mini Van

--- Starting Inferencing Cycle ---

 

vehicleType value = null

size value = medium

num_wheels value = 4

num_doors value = 3

motor value = yes

vehicle value = null

Testing rule bicycle

Testing rule tricycle

Testing rule motorcycle

Testing rule sportsCar

Testing rule sedan

Testing rule miniVan

Testing rule SUV

Testing rule Cycle

Testing rule Automobile

 -- Rules in conflict set:

Automobile(2),

Firing rule Automobile

Testing rule bicycle

Testing rule tricycle

Testing rule motorcycle

Testing rule sportsCar

Testing rule sedan

Testing rule miniVan

Testing rule SUV

Testing rule Cycle

Testing rule Automobile

 -- Rules in conflict set:

miniVan(3),

Firing rule miniVan

Testing rule bicycle

Testing rule tricycle

Testing rule motorcycle

Testing rule sportsCar

Testing rule sedan

Testing rule miniVan

Testing rule SUV

 -- Rules in conflict set:

 

vehicleType value = automobile

size value = medium

num_wheels value = 4

num_doors value = 3

motor value = yes

vehicle value = MiniVan

 --- Ending Inferencing Cycle ---

 

b) Running the RuleApp the second time. The following data were initially loaded into the working memory, and the rule base is “backward chain” with the final goal is “Vehicle”.

1.       num_wheel=2.

2.       motor=yes.

3.       num_door=null.

4.       size=null.

5.       Vehicle type=null.

Program result=Motorcycle.

--- Starting Inferencing Cycle ---

 

vehicleType value = null

size value = null

num_wheels value = 2

num_doors value = null

motor value = yes

vehicle value = null

Evaluating rule bicycle

Evaluating rule Cycle

Rule Cycle is true, setting vehicleType: = cycle

Evaluating rule Automobile

Rule Automobile is false, can't set vehicleType

Rule bicycle is false, can't set vehicle

Evaluating rule tricycle

Rule tricycle is false, can't set vehicle

Evaluating rule motorcycle

Rule motorcycle is true, setting vehicle: = Motorcycle

 +++ Found Solution for goal: vehicle

vehicleType value = cycle

size value = null

num_wheels value = 2

num_doors value = null

motor value = yes

vehicle value = Motorcycle

 --- Ending Inferencing Cycle ---

 

Code modifying: Added:

a)       New Label for Unicycle.

b)   New rule for “Unicycle” num_wheel=1 in the RuleFrame.java file

 

vehicle.setLabels("Unicycle Bicycle Tricycle MotorCycle Sports_Car Sedan MiniVan Sports_Utility_Vehicle");

………………………

 

 Rule Unicycle = new Rule(rb, "Unicycle", new Clause[]{ new Clause(vehicleType, cEquals, "cycle"),

                                                         new Clause(num_wheels, cEquals, "1"),

                                                         new Clause(motor, cEquals, "no") },

                                                         new Clause(vehicle, cEquals, "Unicycle"));

  1. Problem # 4: Early expert system used confident factors with Boolean rules to reason about uncertainty. How do fuzzy rule systems overcome this issue, or do they? What is the different between a probability and a fuzzy number?

The fuzzy rule systems deal with the degree of something that will happen for the uncertainty event. The fuzzy rule system deals with truth values ranging from 0.0, 0.5, …, 0.9, 1.0 which are the knowledge (facts) and are mapped naturally to concepts we use in everyday language.

The initial data values are converted into fuzzy values using the membership function. All rules are evaluated and the clause truth values are combined using fuzzy logic operators.  Then a logic AND operation takes the minimum values of the two fuzzy clauses. The result is an output fuzzy set, which is obtained by using one of the fuzzy compositional rules of inference.  This combines the fuzzy sets specified in the consequent clauses of all rules.

A fuzzy number is a degree to which an event occurs. I.e. 0.0 not true, 0.5: half true, 0.9: very likely true, 1.0. While a probability is a chance of something will happen.

  1. Problem # 5: The motor fuzzy rule uses four rules to convert the input space of temperature and humidity. Use RuleApp to enter the values over the entire range 0 – 100 for these variables and plot the motor output value. Does the output change smoothly or jump abruptly as the input values change? Add more rules to the motor rule base and check the effect on the motor variable. Would adding more fuzzy sets or using linguistic hedges help to smooth the output response? 

Answer: The output as shown on the graph jumps abruptly as opposed to smoothly.  There is a sharp rise from 0 to 30, which then plateaus off from 30 to 70 where there is another sharp rise.  There is then a dramatic from after 80.  Adding more fuzzy sets or using linguistic hedges would help smooth the output response because they map more realistically to daily languages.  There are many more variables and degrees of accurateness, therefore maps more naturally.

 

Temp / Humidity

Output

0

0.00

10

0.00

20

8.59

30

49.60

40

49.60

50

49.60

60

49.60

70

49.60

80

91.01

90

0.00

100

0.00

  1. Problem # 6: You have created the system to diagnose problem with an engine. A mechanic is available to act as an expert. Your job is to take his knowledge and turn it into rules. The application must take a best guess diagnosis based on the available data. As more information is available, the diagnosis is more accurate. Would you choose the Boolean or fuzzy rules for this application? Why?

Answer: The Boolean is more suitable for this application because the Boolean logic represents the knowledge in a way with more certainty: True or false. Also the Boolean is more powerful and faster when processing a high volume of data. While the fuzzy system is dealing with the degree of something that will happen i.e. 0.0 is no chance and 1.0 is certainty.