diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..d64c606 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1 @@ +/net/ diff --git a/bin/net/sourceforge/jFuzzyLogic/CompileCpp.class b/bin/net/sourceforge/jFuzzyLogic/CompileCpp.class index bc5ef84..4099bda 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/CompileCpp.class and b/bin/net/sourceforge/jFuzzyLogic/CompileCpp.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/FIS.class b/bin/net/sourceforge/jFuzzyLogic/FIS.class index c411bdf..4c712e0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/FIS.class and b/bin/net/sourceforge/jFuzzyLogic/FIS.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/FunctionBlock.class b/bin/net/sourceforge/jFuzzyLogic/FunctionBlock.class index 53b570d..d65e976 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/FunctionBlock.class and b/bin/net/sourceforge/jFuzzyLogic/FunctionBlock.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/Gpr.class b/bin/net/sourceforge/jFuzzyLogic/Gpr.class index 3dfbc1a..e51621e 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/Gpr.class and b/bin/net/sourceforge/jFuzzyLogic/Gpr.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/JFuzzyLogic.class b/bin/net/sourceforge/jFuzzyLogic/JFuzzyLogic.class index a121534..3bb3657 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/JFuzzyLogic.class and b/bin/net/sourceforge/jFuzzyLogic/JFuzzyLogic.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/Pcingola.class b/bin/net/sourceforge/jFuzzyLogic/Pcingola.class index 1c12e3a..39dfba7 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/Pcingola.class and b/bin/net/sourceforge/jFuzzyLogic/Pcingola.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/defuzzifier/Defuzzifier.class b/bin/net/sourceforge/jFuzzyLogic/defuzzifier/Defuzzifier.class index 4599f2d..af8f321 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/defuzzifier/Defuzzifier.class and b/bin/net/sourceforge/jFuzzyLogic/defuzzifier/Defuzzifier.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierCenterOfGravityFunctions.class b/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierCenterOfGravityFunctions.class index ecdd3b5..544d082 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierCenterOfGravityFunctions.class and b/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierCenterOfGravityFunctions.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierContinuous.class b/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierContinuous.class index 7748bd2..3d84fa4 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierContinuous.class and b/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierContinuous.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierDiscrete.class b/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierDiscrete.class index a7a4699..9d17b1e 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierDiscrete.class and b/bin/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierDiscrete.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLFileFilter.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLFileFilter.class index 1e48406..d2f32c0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLFileFilter.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLFileFilter.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLPanel.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLPanel.class index bca0563..6d6c015 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLPanel.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLPanel.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLPanel.form b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLPanel.form deleted file mode 100644 index 663255c..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FCLPanel.form +++ /dev/null @@ -1,37 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/ForceDrivenModel.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/ForceDrivenModel.class index 4e383f8..757e947 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/ForceDrivenModel.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/ForceDrivenModel.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$1.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$1.class index 4d77124..0ca4df8 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$1.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$2.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$2.class index 489c2c5..922b7c3 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$2.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$2.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$3.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$3.class index 7e4b1d5..a9833a0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$3.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp$3.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp.class index 18e192a..39e7fb0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApp.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApplet.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApplet.class index c644b0b..c245958 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApplet.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoApplet.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoLayoutPanel.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoLayoutPanel.class index 051495f..8532302 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoLayoutPanel.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoLayoutPanel.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoLayoutPanel.form b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoLayoutPanel.form deleted file mode 100644 index f6877d6..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/FuzzyDemoLayoutPanel.form +++ /dev/null @@ -1,63 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo$1.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo$1.class index f664909..c939180 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo$1.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo$2.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo$2.class index 5e1d29c..a388c3f 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo$2.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo$2.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo.class index 23b3227..ed50eb1 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPDemo.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPModel.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPModel.class index 9ca82e7..e5abcf5 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPModel.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPModel.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView$1.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView$1.class index 1a05a39..b48bd98 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView$1.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView$2.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView$2.class index c4c2ec3..f5174a7 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView$2.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView$2.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView.class index f1778be..59643ff 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/IPView.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/about.html b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/about.html deleted file mode 100644 index 0ec90d1..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/about.html +++ /dev/null @@ -1,99 +0,0 @@ -

Fuzzy Control Demo

- - - -

This demo simulates a cart with an inverted pendulum. -The challenge is to keep the system stable by varying the force applied to the cart. -This system is just like a unicycle or one of these segway bikes.

-
- -i2.jpg

- -
- - -

User control

- -

-The user (that means you) can apply a force by clicking the mouse on the display. -The force applied is proportional to the distance from the cart -(like an elastic band). See if you can get home without falling over!

- -

Fuzzy Logic

- -

Fuzzy logic can be used for -a wide range of practical applications ranging from what wash to use in your -washing machine to the control of robotic limbs. - In this demo when the fuzzy logic is enabled the program attempts to -control the angle using a set of "fuzzy rules". - -The inputs are: -

- - -The ouput of the system is the requested force value. - - -The fuzzy inference system classifies the -input values into degree of membership of fuzzy sets. -In this case the sets have names like -PB (positive big) PS (positive small) Z (zero) etc. -Unlike classical "crisp" logic -which only uses 2 values; true and false, the -degree of membership of a fuzzy set can be any value between -0 (not in the set e.g. false) and 1 (definately in the set e.g. true).

- -

In this demo the fuzzy controller is define by an FCL (fuzzy control logic) file. -You can examine this in the Fuzzy Control Logic tab. -In practice this file could be compiled into -a program for an embedded micro controller. -

- -

Why fuzzy logic

- -

The big deal with fuzzy logic is that you can define -your control system using rules that mean something to a human and avoid -the complex maths required for some types of classical control. It is common -to create fuzzy controllers by asking experts what rules they use. -

- -

In this demo the rule.

- - - IF phi IS PS AND dphidt IS PB THEN force IS PB ; - - -

says we should apply a positive big force if the - angle is positive small and the rate of change is positive big.

- -

All the rules for the force are combined in a process called defuzzification which -which creates a final real value for the force from the degree of membership functions.

Graphs tab - -

The Graphs tab shows an animation of how the fuzzy system is working. The -coloured sections are the fuzzy sets which map the crisp value -into a degree of membership. The defuzzication of the force is done by taking the -centre of gravity of the force graph. -

- -

The rule set for this demo was created in a hurry -by the author in order to get -the demo working. -The rules can be edited -(and possibly saved but this feature is untested on windows) -using the Fuzzy Control Logic tab. -If you manage to create a better system please let me have -a copy :-) -

- -

PJ.Leonard

diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/credits.html b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/credits.html deleted file mode 100644 index ef6a20a..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/credits.html +++ /dev/null @@ -1,11 +0,0 @@ -

Credits

- -

- This demo was created by -PJ.Leonard (Department of Electrical Engineering. Unversity of Bath).

-The fuzzy logic engine is jFuzzyLogic an open source software maintained by -Pablo Cingolani.

The inverted pendulum dynamic simulation is -by Andrew Kaluzniacki. -

. - -

This program is written in JAVA

\ No newline at end of file diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/house.gif b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/house.gif deleted file mode 100644 index 31cb334..0000000 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/house.gif and /dev/null differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/i2.jpg b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/i2.jpg deleted file mode 100644 index 22f0c70..0000000 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/i2.jpg and /dev/null differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/ip2.fcl b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/ip2.fcl deleted file mode 100644 index 92ac2cf..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/ip2.fcl +++ /dev/null @@ -1,59 +0,0 @@ -FUNCTION_BLOCK IPController // control block for the angle - -VAR_OUTPUT // define output variables - force : REAL; -END_VAR - -VAR_INPUT // inputs - phi : REAL; // the difference between the requested and real angle. We want this to be zero - dphidt : REAL; // rate of change of the real angle. We also want this to be zero. -END_VAR - - -FUZZIFY phi // define the membership functions (see graph tab in the demo) - TERM Z := TRIAN -5 0 5; // zero (ish) - TERM PS := TRIAN 0 5 10; // positive small - TERM NS := TRIAN -10 -5 0; // neg small - TERM PB := (5,0) (10,1) (60,1) (70,0); // pos big - TERM NB := (-70,0) (-60,1) (-10, 1) (-5,0); // neg big - -END_FUZZIFY - -FUZZIFY dphidt - TERM Z := TRIAN -8 0 8; - TERM PS := TRIAN 0 8 200 ; - TERM NS := TRIAN -200 -8 0 ; - TERM PB := (8,0) (200,1) (500,1) ; - TERM NB := (-500,1) (-200,1) (-8,0); -END_FUZZIFY - - -DEFUZZIFY force - TERM Z := 0 ; // TRIAN -20 0 20; - TERM PS := 50 ;// TRIAN 30 50 70; - TERM NS := -50 ;//TRIAN -70 -50 -30; - TERM PB := 200 ;// TRIAN 190 200 210; - TERM NB := -200 ;// TRIAN -210 -200 -190; - - METHOD : COGS; // Use 'Center Of Gravity' defuzzification method - DEFAULT := 0; // Default value is 0 (if no rule activates defuzzifier) -END_DEFUZZIFY - -RULEBLOCK No1 // Rules - AND : MIN; // defines how we combine sets - ACT : MIN; // how we activate outputs which have more than 1 rule - ACCU : MAX; // how we combine the membership functions of the output variables. - -// now the rules . . . - - RULE 1 : IF phi IS PS AND (dphidt IS PS OR dphidt IS Z) THEN force IS PS; - RULE 2 : IF phi IS PS AND dphidt IS PB THEN force IS PB ; - RULE 3 : IF phi IS NS AND (dphidt IS NS OR dphidt IS Z) THEN force IS NS; - RULE 4 : IF phi IS NS AND dphidt IS NB THEN force IS NB ; - RULE 5 : IF phi IS PB AND (dphidt IS NOT NB) AND (dphidt IS NOT NS) THEN force IS PB ; - RULE 6 : IF phi IS NB AND (dphidt IS NOT PB) AND (dphidt IS NOT PS) THEN force IS NB ; - RULE 7 : IF phi IS Z AND dphidt IS Z THEN force IS Z; - -END_RULEBLOCK - -END_FUNCTION_BLOCK diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/left.gif b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/left.gif deleted file mode 100644 index 34dc231..0000000 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/left.gif and /dev/null differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/right.gif b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/right.gif deleted file mode 100644 index 94de6cd..0000000 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/right.gif and /dev/null differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/tree.gif b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/tree.gif deleted file mode 100644 index d20467c..0000000 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/IP/tree.gif and /dev/null differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/Test.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/Test.class index 1e345c2..75d612d 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/Test.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/Test.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/View.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/View.class index 524bd82..ae88c5f 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/View.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/View.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDemo$1.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDemo$1.class index b5356e7..0757a8d 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDemo$1.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDemo$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDemo.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDemo.class index a8231c2..1c38449 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDemo.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDemo.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDynamics.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDynamics.class index 987952c..28d54d0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDynamics.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmDynamics.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmModel.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmModel.class index 1d38a63..a283692 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmModel.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmModel.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmView$1.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmView$1.class index 27dcd9c..a67f6f3 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmView$1.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmView$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmView.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmView.class index 0e6ad24..f4bd5c3 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmView.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/ArmView.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/about.html b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/about.html deleted file mode 100644 index dd226d5..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/about.html +++ /dev/null @@ -1,49 +0,0 @@ -

Fuzzy Control Demo

- - - -

- -This demo simulates a 2 link robot arm. - -

-
- -arm.png

- -
-

- -

Control

- -The user (that is you) can click on the screen to specify the desired location of the "hand". -The controller works out the angles needed to achieve this "target" position and uses the -difference between the actual values and the target as inputs to the fuzzy control system. -The angular velocities are also used in the fuzzy control system to provide damping. - - -The inputs are: - - - -The ouput of the system is the torques for the joints torque1 and torque2 - - -

The rule set for this demo was created in a hurry -by the author in order to get the demo working. -The rules can be edited -(and possibly saved but this feature is untested on windows) -using the Fuzzy Control Logic tab. -If you manage to create a better system please let me have -a copy :-) -

- -

PJ.Leonard

diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/arm.fcl b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/arm.fcl deleted file mode 100644 index 154b54c..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/arm.fcl +++ /dev/null @@ -1,99 +0,0 @@ -FUNCTION_BLOCK arm // Block definition (there may be more than one block per file) - -VAR_OUTPUT // Define input variables - torque1 : REAL; - torque2 : REAL; -END_VAR - -VAR_INPUT // Define output variables - dphi1dt : REAL; - dphi2dt : REAL; - phi1: REAL; - phi2: REAL; -END_VAR - -FUZZIFY phi1 - TERM nb := (-2, 1) (-0.5 ,1) (-0.001,0); - TERM ns := TRIAN -0.5 -0.001 0; - TERM ok := TRIAN -0.001 0 0.001; - TERM ps := TRIAN 0 0.001 0.5; - TERM pb := (0.001,0) (0.5,1) (2, 1); -END_FUZZIFY - -FUZZIFY phi2 - TERM nb := (-2, 1) (-0.5 ,1) (-0.001,0); - TERM ns := TRIAN -0.5 -0.001 0; - TERM ok := TRIAN -0.001 0 0.01; - TERM ps := TRIAN 0 0.001 0.5; - TERM pb := (0.001,0) (0.5,1) (2, 1); -END_FUZZIFY - - -FUZZIFY dphi1dt - TERM nb := (-10, 1) (-1 ,1) (-0.3,0); - TERM ns := TRIAN -1 -0.3 0; - TERM ok := TRIAN -0.3 0 0.3; - TERM ps := TRIAN 0 0.3 1; - TERM pb := (0.3,0) (1,1) (10, 1); -END_FUZZIFY - -FUZZIFY dphi2dt - TERM nb := (-10, 1) (-1 ,1) (-0.3,0); - TERM ns := TRIAN -1 -0.3 0; - TERM ok := TRIAN -0.3 0 0.3; - TERM ps := TRIAN 0 0.3 1; - TERM pb := (0.3,0) (1,1) (10, 1); -END_FUZZIFY - -DEFUZZIFY torque1 - TERM nb := -800 ; - TERM ns := -400 ; - TERM zero := 0 ; - TERM ps := 400 ; - TERM pb := 800 ; - - METHOD : COGS; - DEFAULT := 0; -END_DEFUZZIFY - -DEFUZZIFY torque2 - TERM nb := -500 ; - TERM ns := -200 ; - TERM zero := 0 ; - TERM ps := 200 ; - TERM pb := 500 ; - - METHOD : COGS; - DEFAULT := 0; -END_DEFUZZIFY - - -RULEBLOCK No1 - AND : MIN; - ACCU : MAX; - ACT : MIN; - - RULE 1 : IF phi1 IS nb THEN torque1 IS pb; -/* - RULE 2 : IF phi1 IS ns THEN torque1 IS ps; - RULE 3 : IF phi1 IS ok THEN torque1 IS zero; - RULE 4 : IF phi1 IS ps THEN torque1 IS ns; - RULE 5 : IF phi1 IS pb THEN torque1 IS nb; - RULE 6 : IF dphi1dt IS nb THEN torque1 IS pb; - RULE 7 : IF dphi1dt IS pb THEN torque1 IS nb; - RULE 8 : IF dphi1dt IS ns AND phi1 is ok THEN torque1 IS pb; - RULE 9 : IF dphi1dt IS ps AND phi1 is ok THEN torque1 IS nb; - RULE 11 : IF phi2 IS nb THEN torque2 IS pb; - RULE 12 : IF phi2 IS ns THEN torque2 IS ps; - RULE 13 : IF phi2 IS ok THEN torque2 IS zero; - RULE 14 : IF phi2 IS ps THEN torque2 IS ns; - RULE 15 : IF phi2 IS pb THEN torque2 IS nb; - RULE 16 : IF dphi2dt IS nb THEN torque2 IS pb; - RULE 17 : IF dphi2dt IS pb THEN torque2 IS nb; - RULE 18 : IF dphi2dt IS ns AND phi2 is ok THEN torque2 IS pb; - RULE 19 : IF dphi2dt IS ps AND phi2 is ok THEN torque2 IS nb; -*/ -END_RULEBLOCK - - -END_FUNCTION_BLOCK diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/arm.png b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/arm.png deleted file mode 100644 index 1070341..0000000 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/arm.png and /dev/null differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/credits.html b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/credits.html deleted file mode 100644 index 3c68a68..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/arm/credits.html +++ /dev/null @@ -1,14 +0,0 @@ -

Credits

- -

- This demo was created by -PJ.Leonard (Department of Electrical Engineering. Unversity of Bath).

-

-The fuzzy logic engine is jFuzzyLogic an open source software maintained by -Pablo Cingolani.

- -

-Thanks to Necip and Pejman for helping with the dynamic simulation. -

. - -

This program is written in JAVA

\ No newline at end of file diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$1.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$1.class index bc4059f..d4f8250 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$1.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$2.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$2.class index 5ee1f6c..b696493 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$2.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$2.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$3.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$3.class index 54bff41..7db8a07 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$3.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo$3.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo.class index 701825e..2729b87 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockDemo.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockModel.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockModel.class index affab6f..aa4f6b0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockModel.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockModel.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView$1.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView$1.class index c5de7a8..f20c806 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView$1.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView$2.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView$2.class index b944e0f..8aa8595 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView$2.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView$2.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView.class index 3c2bc91..7deeb73 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/BlockView.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/about.html b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/about.html deleted file mode 100644 index 8546078..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/about.html +++ /dev/null @@ -1,100 +0,0 @@ -

Fuzzy Control Demo

- - - -

- -This demo simulates a 2 link robot arm. - -
- -i2.jpg

- -
- - -

User control

- -

-The user (that means you) can apply a force by clicking the mouse on the display. -The force applied is proportional to the distance from the cart -(like an elastic band). See if you can get home without falling over!

- -

Fuzzy Logic

- -

Fuzzy logic can be used for -a wide range of practical applications ranging from what wash to use in your -washing machine to the control of robotic limbs. - In this demo when the fuzzy logic is enabled the program attempts to -control the angle using a set of "fuzzy rules". - -The inputs are: -

- - -The ouput of the system is the requested force value. - - -The fuzzy inference system classifies the -input values into degree of membership of fuzzy sets. -In this case the sets have names like -PB (positive big) PS (positive small) Z (zero) etc. -Unlike classical "crisp" logic -which only uses 2 values; true and false, the -degree of membership of a fuzzy set can be any value between -0 (not in the set e.g. false) and 1 (definately in the set e.g. true).

- -

In this demo the fuzzy controller is define by an FCL (fuzzy control logic) file. -You can examine this in the Fuzzy Control Logic tab. -In practice this file could be compiled into -a program for an embedded micro controller. -

- -

Why fuzzy logic

- -

The big deal with fuzzy logic is that you can define -your control system using rules that mean something to a human and avoid -the complex maths required for some types of classical control. It is common -to create fuzzy controllers by asking experts what rules they use. -

- -

In this demo the rule.

- - - IF phi IS PS AND dphidt IS PB THEN force IS PB ; - - -

says we should apply a positive big force if the - angle is positive small and the rate of change is positive big.

- -

All the rules for the force are combined in a process called defuzzification which -which creates a final real value for the force from the degree of membership functions.

Graphs tab - -

The Graphs tab shows an animation of how the fuzzy system is working. The -coloured sections are the fuzzy sets which map the crisp value -into a degree of membership. The defuzzication of the force is done by taking the -centre of gravity of the force graph. -

- -

The rule set for this demo was created in a hurry -by the author in order to get -the demo working. -The rules can be edited -(and possibly saved but this feature is untested on windows) -using the Fuzzy Control Logic tab. -If you manage to create a better system please let me have -a copy :-) -

- -

PJ.Leonard

diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/block.fcl b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/block.fcl deleted file mode 100644 index b3d8711..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/block.fcl +++ /dev/null @@ -1,50 +0,0 @@ -FUNCTION_BLOCK ip // Block definition (there may be more than one block per file) - -VAR_OUTPUT // Define input variables - force : REAL; -END_VAR - -VAR_INPUT // Define output variable - x : REAL; - dxdt : REAL; -END_VAR - -FUZZIFY x - TERM ok := (-0.1,0) (0,1) (0.1,0) ; - TERM left := (-2,1) (0,0); - TERM right := ( 0, 0) (2,1) ; -END_FUZZIFY - -FUZZIFY dxdt - TERM ok := TRIAN -1 0 1 ; - TERM left := (-1,1) (0,0); - TERM right := (0,0) (1,1) ; - TERM tooRight := (3,0) (4,1); - TERM tooLeft := (-4,1) (-3,0); - -END_FUZZIFY - - -DEFUZZIFY force - TERM zero := TRIAN -1 0 1 ; - TERM left := (-101,0) (-100,1) (-99,0); - TERM right := (99,0) (100,1) (101,0); - - METHOD : COG; // Use 'Center Of Gravity' defuzzification method - DEFAULT := 0; // Default value is 0 (if no rule activates defuzzifier) -END_DEFUZZIFY - -RULEBLOCK No1 - AND : MIN; // Use 'min' for 'and' (also implicit use 'max' for 'or' to fulfill DeMorgan's Law) - ACT : MIN; // Use 'min' activation method - ACCU : MAX; // Use 'max' accumulation method - - RULE 1 : IF x IS right AND dxdt IS NOT tooLeft THEN force IS left ; - RULE 2 : IF x IS left AND dxdt IS NOT tooRight THEN force IS right ; - RULE 3 : IF x IS ok AND dxdt IS right THEN force IS left ; - RULE 4 : IF x IS ok AND dxdt IS left THEN force IS right ; - RULE 5 : IF x IS ok AND dxdt IS ok THEN force IS zero ; - -END_RULEBLOCK - -END_FUNCTION_BLOCK diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/credits.html b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/credits.html deleted file mode 100644 index ef6a20a..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/block/credits.html +++ /dev/null @@ -1,11 +0,0 @@ -

Credits

- -

- This demo was created by -PJ.Leonard (Department of Electrical Engineering. Unversity of Bath).

-The fuzzy logic engine is jFuzzyLogic an open source software maintained by -Pablo Cingolani.

The inverted pendulum dynamic simulation is -by Andrew Kaluzniacki. -

. - -

This program is written in JAVA

\ No newline at end of file diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/generic/GenericDemo.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/generic/GenericDemo.class index 0549cc0..7cb186c 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/generic/GenericDemo.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/generic/GenericDemo.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/DynamicModel.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/DynamicModel.class index bd89b96..ec6aacb 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/DynamicModel.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/DynamicModel.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/RungeKutta.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/RungeKutta.class index c217363..591c45b 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/RungeKutta.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/RungeKutta.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/TestOsc$1.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/TestOsc$1.class index 3ba815a..149331e 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/TestOsc$1.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/TestOsc$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/TestOsc.class b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/TestOsc.class index 942e446..2433d4d 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/TestOsc.class and b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/timestep/TestOsc.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/tipper.fcl b/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/tipper.fcl deleted file mode 100644 index 02f476f..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/demo/dynamics/tipper.fcl +++ /dev/null @@ -1,54 +0,0 @@ -/* - Example: A tip calculation FIS (fuzzy inference system) - Calculates tip based on 'servie' and 'food' - - If you want to about thIS example (and fuzzy logic), please - read Matlab's tutorial on fuzzy logic toolbox - http://www.mathworks.com/access/helpdesk/help/pdf_doc/fuzzy/fuzzy.pdf - - Pablo Cingolani - pcingola@users.sourceforge.net -*/ - -FUNCTION_BLOCK tipper // Block definition (there may be more than one block per file) - -VAR_INPUT // Define input variables - service : REAL; - food : REAL; -END_VAR - -VAR_OUTPUT // Define output variable - tip : REAL; -END_VAR - -FUZZIFY service // Fuzzify input variable 'service': {'poor', 'good' , 'excellent'} - TERM poor := (0, 1) (4, 0) ; - TERM good := (1, 0) (4,1) (6,1) (9,0); - TERM excellent := (6, 0) (9, 1); -END_FUZZIFY - -FUZZIFY food // Fuzzify input variable 'food': { 'rancid', 'delicious' } - TERM rancid := (0, 1) (1, 1) (3,0) ; - TERM delicious := (7,0) (9,1); -END_FUZZIFY - -DEFUZZIFY tip // Defzzzify output variable 'tip' : {'cheap', 'average', 'generous' } - TERM cheap := (0,0) (5,1) (10,0); - TERM average := (10,0) (15,1) (20,0); - TERM generous := (20,0) (25,1) (30,0); - METHOD : COG; // Use 'Center Of Gravity' defuzzification method - DEFAULT := 0; // Default value IS 0 (if no rule activates defuzzifier) -END_DEFUZZIFY - -RULEBLOCK No1 - AND : MIN; // Use 'min' for 'and' (also implicit use 'max' for 'or' to fulfill DeMorgan's Law) - ACT : MIN; // Use 'min' activation method - ACCU : MAX; // Use 'max' accumulation method - - RULE 1 : IF service IS poor OR food IS rancid THEN tip IS cheap; - RULE 2 : IF service IS good THEN tip IS average; - RULE 3 : IF service IS excellent AND food IS delicious THEN tip IS generous; -END_RULEBLOCK - -END_FUNCTION_BLOCK - diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/qualifyDemo/ParameterOptimizationDemo.class b/bin/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/qualifyDemo/ParameterOptimizationDemo.class index 2bf8993..beda82c 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/qualifyDemo/ParameterOptimizationDemo.class and b/bin/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/qualifyDemo/ParameterOptimizationDemo.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/robotDemo/ParameterOptimizationRobot.class b/bin/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/robotDemo/ParameterOptimizationRobot.class index 59b0f62..15ab58f 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/robotDemo/ParameterOptimizationRobot.class and b/bin/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/robotDemo/ParameterOptimizationRobot.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/Fcl.tokens b/bin/net/sourceforge/jFuzzyLogic/fcl/Fcl.tokens deleted file mode 100644 index f2d35f4..0000000 --- a/bin/net/sourceforge/jFuzzyLogic/fcl/Fcl.tokens +++ /dev/null @@ -1,99 +0,0 @@ -FUNCTION=34 -SIGM=61 -STAR=91 -LN=43 -LETTER=96 -LM=42 -LOG=44 -EINSTEIN=26 -COG=17 -NOT=52 -COA=15 -HAT=81 -SIN=62 -EXP=32 -MM=50 -COS=20 -TAN=65 -LEFT_PARENTHESIS=83 -COMMENT=99 -GAUSS2=36 -NC=51 -END_RULEBLOCK=30 -VAR_OUTPUT=72 -ACT=10 -END_DEFUZZIFY=27 -RULE=59 -NUMBER=93 -GBELL=37 -SEMICOLON=89 -DMIN=24 -VALUE_REAL=6 -ALPHANUM=97 -TYPE_REAL=70 -ABS=8 -REAL=98 -WS=74 -NSUM=53 -LEFT_CURLY=82 -OR=54 -LOWER=94 -END_FUZZIFY=29 -UPPER=95 -TERM=66 -COGF=19 -PROBOR=55 -RIGHT_CURLY=87 -NIPMIN=48 -POINT=4 -RM=58 -MAX=45 -DOTS=80 -COGS=18 -ID=102 -AND=11 -SUM=64 -VALUE_ID=7 -DSIGM=25 -IF=40 -SLASH=90 -THEN=67 -RIGHT_PARENTHESIS=88 -COMMA=78 -IS=41 -DMAX=23 -TRAPE=68 -BDIF=13 -PROD=56 -COSINE=16 -PLUS=86 -DIGIT=92 -DOT=79 -FUNCTION_BLOCK=38 -WITH=73 -END_VAR=31 -ACCU=9 -ASUM=12 -PERCENT=85 -SINGLETONS=63 -NIPMAX=49 -ASSIGN_OPERATOR=76 -TRIAN=69 -DEFAULT=21 -HAMACHER=33 -COMMENT_C=100 -FCL=5 -RANGE=57 -MIN=47 -MINUS=84 -DEFUZZIFY=22 -COLON=77 -NEWLINE=75 -COMMENT_SL=101 -VAR_INPUT=71 -BSUM=14 -RULEBLOCK=60 -FUZZIFY=39 -END_FUNCTION_BLOCK=28 -METHOD=46 -GAUSS=35 diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclLexer$DFA15.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclLexer$DFA15.class index 14ac780..91ad3b0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclLexer$DFA15.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclLexer$DFA15.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclLexer.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclLexer.class index 1efcb90..0baddf4 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclLexer.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclLexer.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclObject.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclObject.class index 801e6b3..f7100d3 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclObject.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclObject.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$accumulation_method_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$accumulation_method_return.class index 8b47408..c76cd74 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$accumulation_method_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$accumulation_method_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$activation_method_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$activation_method_return.class index 50c8e63..983222c 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$activation_method_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$activation_method_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$atom_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$atom_return.class index e898600..84e851f 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$atom_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$atom_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$conclusion_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$conclusion_return.class index 7c92dc8..9b54d8d 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$conclusion_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$conclusion_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$condition_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$condition_return.class index e9bc1fe..f333ba1 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$condition_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$condition_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$cosine_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$cosine_return.class index 2db18c6..0a2f3d5 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$cosine_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$cosine_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$data_type_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$data_type_return.class index df5e7ce..f2555d7 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$data_type_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$data_type_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$declaration_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$declaration_return.class index 162ff03..78bff25 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$declaration_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$declaration_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$default_value_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$default_value_return.class index 1b4ba4d..e109a91 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$default_value_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$default_value_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzification_method_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzification_method_return.class index 29a5d3d..6210173 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzification_method_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzification_method_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzify_block_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzify_block_return.class index f051d42..a45c952 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzify_block_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzify_block_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzify_item_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzify_item_return.class index 8c824a1..8403460 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzify_item_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$defuzzify_item_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$dsigm_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$dsigm_return.class index b61b6c7..e5709f4 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$dsigm_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$dsigm_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fcl_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fcl_return.class index 1296c84..0e426c9 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fcl_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fcl_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_atom_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_atom_return.class index 32edc7d..8678915 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_atom_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_atom_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_md_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_md_return.class index f9155ab..8fe78ce 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_md_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_md_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_mp_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_mp_return.class index 5ace5df..93d44ee 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_mp_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_mp_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_pm_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_pm_return.class index dbe9543..9c3052d 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_pm_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fun_pm_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$function_block_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$function_block_return.class index 4619873..dc00933 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$function_block_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$function_block_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$function_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$function_return.class index 01d8917..334c19e 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$function_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$function_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fuzzify_block_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fuzzify_block_return.class index ca06270..68188fd 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fuzzify_block_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$fuzzify_block_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gauss2_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gauss2_return.class index 649ad11..61b53af 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gauss2_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gauss2_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gauss_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gauss_return.class index 6ae3a62..a0251ed 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gauss_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gauss_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gbell_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gbell_return.class index 09c913d..1aea0ae 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gbell_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$gbell_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$id_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$id_return.class index 0b72d06..a119837 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$id_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$id_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$if_clause_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$if_clause_return.class index d4fe1ec..3ddf218 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$if_clause_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$if_clause_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$linguistic_term_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$linguistic_term_return.class index 17b0431..77a8a83 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$linguistic_term_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$linguistic_term_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$main_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$main_return.class index 3f170bf..3ea40b8 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$main_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$main_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$membership_function_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$membership_function_return.class index 26d5248..8da4df8 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$membership_function_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$membership_function_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_and_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_and_return.class index 27bf0a1..e2c7479 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_and_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_and_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_or_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_or_return.class index 1b08c64..9a1289a 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_or_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_or_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_return.class index 146685f..cc6a6ce 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$operator_definition_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$piece_wise_linear_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$piece_wise_linear_return.class index f7bbc4e..512dd63 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$piece_wise_linear_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$piece_wise_linear_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$points_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$points_return.class index 30f9c53..842ac31 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$points_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$points_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$range_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$range_return.class index d3e1f3e..9aed7fc 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$range_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$range_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$real_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$real_return.class index 0196901..ec312e1 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$real_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$real_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_block_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_block_return.class index e5fe346..414b08d 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_block_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_block_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_item_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_item_return.class index 7c9da51..3a551ef 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_item_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_item_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_name_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_name_return.class index 83b787c..de40aa6 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_name_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_name_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_return.class index 6e48ac3..4d6f4e1 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$rule_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$sigm_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$sigm_return.class index 27c4c4c..5cd02d0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$sigm_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$sigm_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$singleton_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$singleton_return.class index 0cb1916..8627afb 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$singleton_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$singleton_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$singletons_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$singletons_return.class index 29b42d1..a9d6d31 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$singletons_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$singletons_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$sub_conclusion_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$sub_conclusion_return.class index c128361..2bdab37 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$sub_conclusion_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$sub_conclusion_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_bare_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_bare_return.class index 7db2d70..14a6908 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_bare_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_bare_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_paren_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_paren_return.class index 0159d78..036c814 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_paren_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_paren_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_return.class index aee5366..8407aec 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$subcondition_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$then_clause_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$then_clause_return.class index 1c1cc46..05b65b3 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$then_clause_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$then_clause_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$trape_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$trape_return.class index debd474..7c2343f 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$trape_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$trape_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$trian_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$trian_return.class index 29ce455..39a6092 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$trian_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$trian_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_def_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_def_return.class index 4455293..8ff8107 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_def_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_def_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_input_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_input_return.class index 301b802..67338fc 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_input_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_input_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_output_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_output_return.class index a169a57..794c724 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_output_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$var_output_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$with_return.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$with_return.class index 50c72d9..5eb5253 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$with_return.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser$with_return.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser.class b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser.class index 0e994f9..016e2d9 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser.class and b/bin/net/sourceforge/jFuzzyLogic/fcl/FclParser.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunction.class b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunction.class index f37c6fa..6609f73 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunction.class and b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunction.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion$1.class b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion$1.class index 1587319..699ee30 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion$1.class and b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion.class b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion.class index 78a9b9e..4e86177 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion.class and b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton$1.class b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton$1.class index c9008d1..ee979ac 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton$1.class and b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton$1.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton.class b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton.class index 68416c9..190031e 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton.class and b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionPieceWiseLinear.class b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionPieceWiseLinear.class index 2aa7292..901071d 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionPieceWiseLinear.class and b/bin/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionPieceWiseLinear.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/membership/Value.class b/bin/net/sourceforge/jFuzzyLogic/membership/Value.class index 67a74b9..8a9ce13 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/membership/Value.class and b/bin/net/sourceforge/jFuzzyLogic/membership/Value.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/membership/functions/MffFunction.class b/bin/net/sourceforge/jFuzzyLogic/membership/functions/MffFunction.class index f7d5e3f..e41b628 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/membership/functions/MffFunction.class and b/bin/net/sourceforge/jFuzzyLogic/membership/functions/MffFunction.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/optimization/ErrorFunction.class b/bin/net/sourceforge/jFuzzyLogic/optimization/ErrorFunction.class index 316eda3..b2b762f 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/optimization/ErrorFunction.class and b/bin/net/sourceforge/jFuzzyLogic/optimization/ErrorFunction.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationGradient.class b/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationGradient.class index 1ae54bb..4c4e878 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationGradient.class and b/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationGradient.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationMethod.class b/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationMethod.class index 6456882..3d594b4 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationMethod.class and b/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationMethod.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationPartialDerivate.class b/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationPartialDerivate.class index 0bc1cad..67e937a 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationPartialDerivate.class and b/bin/net/sourceforge/jFuzzyLogic/optimization/OptimizationPartialDerivate.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/optimization/ParameterRuleWeight.class b/bin/net/sourceforge/jFuzzyLogic/optimization/ParameterRuleWeight.class index df7b8c9..13edad0 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/optimization/ParameterRuleWeight.class and b/bin/net/sourceforge/jFuzzyLogic/optimization/ParameterRuleWeight.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/plot/DialogGraph.class b/bin/net/sourceforge/jFuzzyLogic/plot/DialogGraph.class index 00bdc77..7a77036 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/plot/DialogGraph.class and b/bin/net/sourceforge/jFuzzyLogic/plot/DialogGraph.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/plot/JDialogFis.class b/bin/net/sourceforge/jFuzzyLogic/plot/JDialogFis.class index 5bb5670..beebccf 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/plot/JDialogFis.class and b/bin/net/sourceforge/jFuzzyLogic/plot/JDialogFis.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/plot/JFuzzyChartImpl.class b/bin/net/sourceforge/jFuzzyLogic/plot/JFuzzyChartImpl.class index ed5e6f6..23ee4a7 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/plot/JFuzzyChartImpl.class and b/bin/net/sourceforge/jFuzzyLogic/plot/JFuzzyChartImpl.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/plot/PanelPaintGraph.class b/bin/net/sourceforge/jFuzzyLogic/plot/PanelPaintGraph.class index d5a309e..e48da01 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/plot/PanelPaintGraph.class and b/bin/net/sourceforge/jFuzzyLogic/plot/PanelPaintGraph.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/plot/PlotWindow.class b/bin/net/sourceforge/jFuzzyLogic/plot/PlotWindow.class index d2e2c34..e81ea30 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/plot/PlotWindow.class and b/bin/net/sourceforge/jFuzzyLogic/plot/PlotWindow.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/rule/LinguisticTerm.class b/bin/net/sourceforge/jFuzzyLogic/rule/LinguisticTerm.class index 2b9efcb..8647928 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/rule/LinguisticTerm.class and b/bin/net/sourceforge/jFuzzyLogic/rule/LinguisticTerm.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/rule/RuleBlock.class b/bin/net/sourceforge/jFuzzyLogic/rule/RuleBlock.class index 5330c03..dc62d39 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/rule/RuleBlock.class and b/bin/net/sourceforge/jFuzzyLogic/rule/RuleBlock.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/rule/Variable.class b/bin/net/sourceforge/jFuzzyLogic/rule/Variable.class index b26626f..cc97147 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/rule/Variable.class and b/bin/net/sourceforge/jFuzzyLogic/rule/Variable.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethod.class b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethod.class index a54d626..f86a7e8 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethod.class and b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethod.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodBoundedSum.class b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodBoundedSum.class index c380737..b0eb0a5 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodBoundedSum.class and b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodBoundedSum.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodMax.class b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodMax.class index 7b9fa75..0ddcc95 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodMax.class and b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodMax.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodNormedSum.class b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodNormedSum.class index e7b9a25..0e14a87 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodNormedSum.class and b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodNormedSum.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodProbOr.class b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodProbOr.class index 54bdc13..5aba910 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodProbOr.class and b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodProbOr.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodSum.class b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodSum.class index 50966d9..65e1bec 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodSum.class and b/bin/net/sourceforge/jFuzzyLogic/ruleAccumulationMethod/RuleAccumulationMethodSum.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleActivationMethod/RuleActivationMethodMin.class b/bin/net/sourceforge/jFuzzyLogic/ruleActivationMethod/RuleActivationMethodMin.class index 7bb2bce..c77e7b9 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleActivationMethod/RuleActivationMethodMin.class and b/bin/net/sourceforge/jFuzzyLogic/ruleActivationMethod/RuleActivationMethodMin.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleActivationMethod/RuleActivationMethodProduct.class b/bin/net/sourceforge/jFuzzyLogic/ruleActivationMethod/RuleActivationMethodProduct.class index ff77b1f..4d377bc 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleActivationMethod/RuleActivationMethodProduct.class and b/bin/net/sourceforge/jFuzzyLogic/ruleActivationMethod/RuleActivationMethodProduct.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethod.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethod.class index 5dc1985..2b06754 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethod.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethod.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndBoundedDif.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndBoundedDif.class index f92ce45..ff6cda8 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndBoundedDif.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndBoundedDif.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndDrastic.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndDrastic.class index c853e01..10634b3 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndDrastic.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndDrastic.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndHamacher.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndHamacher.class index 16aedf9..a2b1b96 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndHamacher.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndHamacher.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndMin.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndMin.class index 95067ea..55e5c61 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndMin.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndMin.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndNilpotent.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndNilpotent.class index 7b0f22c..e58ca62 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndNilpotent.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndNilpotent.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndProduct.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndProduct.class index d590fc5..ec5992b 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndProduct.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodAndProduct.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrBoundedSum.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrBoundedSum.class index 082e8e5..4bea640 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrBoundedSum.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrBoundedSum.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrDrastic.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrDrastic.class index ac0612f..a2902e4 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrDrastic.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrDrastic.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrEinstein.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrEinstein.class index 0d5d345..028358d 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrEinstein.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrEinstein.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrMax.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrMax.class index b13a398..53989a1 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrMax.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrMax.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrNilpotent.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrNilpotent.class index e091ea1..651a5c6 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrNilpotent.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrNilpotent.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrProbOr.class b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrProbOr.class index 42cd21f..a13656b 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrProbOr.class and b/bin/net/sourceforge/jFuzzyLogic/ruleConnectionMethod/RuleConnectionMethodOrProbOr.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/test/performance/PerformanceChart.class b/bin/net/sourceforge/jFuzzyLogic/test/performance/PerformanceChart.class index 6d0dd52..81ca237 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/test/performance/PerformanceChart.class and b/bin/net/sourceforge/jFuzzyLogic/test/performance/PerformanceChart.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/test/performance/PerformanceTester.class b/bin/net/sourceforge/jFuzzyLogic/test/performance/PerformanceTester.class index 6265268..3a0dc8a 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/test/performance/PerformanceTester.class and b/bin/net/sourceforge/jFuzzyLogic/test/performance/PerformanceTester.class differ diff --git a/bin/net/sourceforge/jFuzzyLogic/testCases/TestCaseJfuzzy.class b/bin/net/sourceforge/jFuzzyLogic/testCases/TestCaseJfuzzy.class index 5c96fde..2e80ca6 100644 Binary files a/bin/net/sourceforge/jFuzzyLogic/testCases/TestCaseJfuzzy.class and b/bin/net/sourceforge/jFuzzyLogic/testCases/TestCaseJfuzzy.class differ diff --git a/src/net/sourceforge/jFuzzyLogic/FunctionBlock.java b/src/net/sourceforge/jFuzzyLogic/FunctionBlock.java index 6fcdd0d..d6f4d98 100644 --- a/src/net/sourceforge/jFuzzyLogic/FunctionBlock.java +++ b/src/net/sourceforge/jFuzzyLogic/FunctionBlock.java @@ -42,10 +42,10 @@ import org.antlr.runtime.tree.Tree; * A complete inference system contains: * - input / output variables * - rule blocks - * + * * Reference: See IEC 1131 - Part 7 - Fuzzy Control Programming - * - * + * + * * @author pcingola@users.sourceforge.net * */ @@ -53,10 +53,10 @@ public class FunctionBlock extends FclObject implements Iterable, Com public static boolean debug = FIS.debug; - FIS fis; // Which FIS does this FunctionBlock belong to? - String name; // Function block name - HashMap ruleBlocks; // Several RuleBlocks indexed by name - HashMap variablesByName; // Every variable is here (key: VariableName) + FIS fis; // Which FIS does this FunctionBlock belong to? + String name; // Function block name + HashMap ruleBlocks; // Several RuleBlocks indexed by name + HashMap variablesByName; // Every variable is here (key: VariableName) public FunctionBlock(FIS fis) { this.fis = fis; @@ -70,7 +70,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Create a defuzzifier based on defuziffier's name and a variable + * Create a defuzzifier based on defuziffier's name and a variable */ protected Defuzzifier createDefuzzifier(String defuzzificationMethodType, Variable variable) { Defuzzifier defuzzifier; @@ -86,9 +86,12 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Evaluate fuzzy rules in this function block + * Evaluate fuzzy rules in this function block */ public void evaluate() { + // reset(true); // Reset variables + reset(); // Reset variables + // First: Reset defuzzifiers, variables, etc. for (RuleBlock ruleBlock : this) ruleBlock.reset(); @@ -103,7 +106,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Builds rule set based on FCL tree (parsed from an FCL file) + * Builds rule set based on FCL tree (parsed from an FCL file) * @param tree : Tree to use * @return : RuleSet's name (or "" if no name) */ @@ -145,7 +148,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for "Defuzzify" item + * Parse a tree for "Defuzzify" item * @param tree : Tree to parse * @return Variable (old or created) */ @@ -178,10 +181,10 @@ public class FunctionBlock extends FclObject implements Iterable, Com LinguisticTerm linguisticTerm = fclTreeFuzzifyTerm(child, variable); variable.add(linguisticTerm); } else if (leaveName.equalsIgnoreCase("ACCU")) // Accumulation method - throw new RuntimeException("Accumulation method (ACCU) must be defined at RULE_BLOCK"); + throw new RuntimeException("Accumulation method (ACCU) must be defined at RULE_BLOCK"); // ruleAccumulationMethodType = child.getChild(0).getText(); else if (leaveName.equalsIgnoreCase("METHOD")) // Defuzzification method - defuzzificationMethodType = child.getChild(0).getText(); + defuzzificationMethodType = child.getChild(0).getText(); else if (leaveName.equalsIgnoreCase("DEFAULT")) { // Default value String defaultValueStr = child.getChild(0).getText(); @@ -205,7 +208,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for "Fuzzify" item + * Parse a tree for "Fuzzify" item * @param tree : Tree to parse * @return Variable (old or created) */ @@ -239,7 +242,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for "Term" item + * Parse a tree for "Term" item * @param tree : Tree to parse * @return A new LinguisticTerm */ @@ -301,7 +304,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for trapetzoidal membership function + * Parse a tree for trapetzoidal membership function * @param tree : Tree to parse * @return A new membership function */ @@ -311,7 +314,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for gaussian membership function + * Parse a tree for gaussian membership function * @param tree : Tree to parse * @return A new membership function */ @@ -325,7 +328,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for gaussian2 membership function + * Parse a tree for gaussian2 membership function * @param tree : Tree to parse * @return A new membership function */ @@ -341,7 +344,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for generilized bell membership function + * Parse a tree for generilized bell membership function * @param tree : Tree to parse * @return A new membership function */ @@ -356,7 +359,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for piece-wice linear membership function + * Parse a tree for piece-wice linear membership function * @param tree : Tree to parse * @return A new membership function */ @@ -384,7 +387,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for sigmoidal membership function + * Parse a tree for sigmoidal membership function * @param tree : Tree to parse * @return A new membership function */ @@ -397,7 +400,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for piece-wice linear membership function item + * Parse a tree for piece-wice linear membership function item * @param tree : Tree to parse * @return A new membership function */ @@ -409,7 +412,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for singletons membership function + * Parse a tree for singletons membership function * @param tree : Tree to parse * @return A new membership function */ @@ -431,7 +434,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for singletons membership function series of points + * Parse a tree for singletons membership function series of points * @param tree : Tree to parse * @param numberOfPoints : Number of points in this function * @return A new membership function @@ -460,7 +463,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for trapetzoidal membership function + * Parse a tree for trapetzoidal membership function * @param tree : Tree to parse * @return A new membership function */ @@ -475,7 +478,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for triangular membership function + * Parse a tree for triangular membership function * @param tree : Tree to parse * @return A new membership function */ @@ -489,7 +492,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Parse a tree for "Variable" item (either input or output variables) + * Parse a tree for "Variable" item (either input or output variables) * @param tree */ private void fclTreeVariables(Tree tree) { @@ -520,7 +523,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com } /** - * Get a RuleBlock + * Get a RuleBlock * @param ruleBlockName : Rule block's name (can be null to retrieve first available one) * @return Fuzzy rule block (or null if not found) */ @@ -550,12 +553,20 @@ public class FunctionBlock extends FclObject implements Iterable, Com return ruleBlocks.values().iterator(); } + // /** + // * Reset all variables + // */ + // public void reset(boolean useDefault) { + // for (Variable var : variables()) + // var.reset(useDefault); + // } + /** - * Reset all variables + * Reset all variables */ - public void reset(boolean useDefault) { + public void reset() { for (Variable var : variables()) - var.reset(useDefault); + var.reset(); } public List ruleBlocksSorted() { @@ -619,13 +630,13 @@ public class FunctionBlock extends FclObject implements Iterable, Com membershipMethods.append("// Membership functions \n"); methodsDecl.append( // "\tpublic:\n" // - + "\t" + className + "();\n" // - + "\tvoid calc();\n" // - + "\tvoid print();\n" // - + "\n\tprivate:\n" // - + "\tvoid defuzzify();\n" // - + "\tvoid fuzzify();\n" // - + "\tvoid reset();\n" // + + "\t" + className + "();\n" // + + "\tvoid calc();\n" // + + "\tvoid print();\n" // + + "\n\tprivate:\n" // + + "\tvoid defuzzify();\n" // + + "\tvoid fuzzify();\n" // + + "\tvoid reset();\n" // ); printMethod.append("// Print \nvoid " + className + "::print() {\n\tprintf(\"Function block " + name + ":\\n\");\n"); resetMethod.append("// Reset output\nvoid " + className + "::reset() {\n"); @@ -726,7 +737,7 @@ public class FunctionBlock extends FclObject implements Iterable, Com + membershipMethods + "\n" // + printMethod + "\n" // + resetMethod + "\n" // - ; // + ; // } @Override diff --git a/src/net/sourceforge/jFuzzyLogic/JFuzzyLogic.java b/src/net/sourceforge/jFuzzyLogic/JFuzzyLogic.java index 4fc6687..766d430 100644 --- a/src/net/sourceforge/jFuzzyLogic/JFuzzyLogic.java +++ b/src/net/sourceforge/jFuzzyLogic/JFuzzyLogic.java @@ -19,9 +19,9 @@ public class JFuzzyLogic { // Version info public static final String SOFTWARE_NAME = "JFuzzyLogic"; - public static final String REVISION = "j"; - public static final String BUILD = "2013-12-13"; - public static final String VERSION_MAJOR = "3.2"; + public static final String REVISION = ""; + public static final String BUILD = "2015-04-09"; + public static final String VERSION_MAJOR = "3.3"; public static final String VERSION_SHORT = VERSION_MAJOR + REVISION; public static final String VERSION_NO_NAME = VERSION_SHORT + " (build " + BUILD + "), by " + Pcingola.BY; public static final String VERSION = SOFTWARE_NAME + " " + VERSION_NO_NAME; @@ -130,8 +130,6 @@ public class JFuzzyLogic { /** * Load FIS form an FCL file - * @param fclFileName - * @return */ FIS load(String fclFileName) { try { diff --git a/src/net/sourceforge/jFuzzyLogic/defuzzifier/Defuzzifier.java b/src/net/sourceforge/jFuzzyLogic/defuzzifier/Defuzzifier.java index 3833a62..71f81e4 100644 --- a/src/net/sourceforge/jFuzzyLogic/defuzzifier/Defuzzifier.java +++ b/src/net/sourceforge/jFuzzyLogic/defuzzifier/Defuzzifier.java @@ -18,9 +18,9 @@ public abstract class Defuzzifier extends FclObject { this.variable = variable; } - /** - * Deffuzification function - * Note: Has to return Double.NaN if no rule inferred this variable + /** + * Deffuzification function + * Note: Has to return Double.NaN if no rule inferred this variable */ public abstract double defuzzify(); @@ -36,12 +36,24 @@ public abstract class Defuzzifier extends FclObject { return str; } + protected abstract void init(); + public boolean isDiscrete() { return discrete; } - /** Reset defuzzifier values, this method is invoked on every RuleSet.evaluate() */ - public abstract void reset(); + /** + * Do we need to re-initialize? + * E.g. Defuzzified depends on an input variable that changed value + */ + public abstract boolean needsInit(); + + /** + * Reset defuzzifier values, this method is invoked on every RuleSet.evaluate() + */ + public void reset() { + if (needsInit()) init(); + } public void setDiscrete(boolean discrete) { this.discrete = discrete; diff --git a/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierCenterOfGravityFunctions.java b/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierCenterOfGravityFunctions.java index 19372cd..bd41172 100644 --- a/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierCenterOfGravityFunctions.java +++ b/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierCenterOfGravityFunctions.java @@ -1,12 +1,10 @@ package net.sourceforge.jFuzzyLogic.defuzzifier; -import java.util.HashMap; - import net.sourceforge.jFuzzyLogic.rule.Variable; /** * Center of gravity for functions defuzzyfier - * + * * @author pcingola@users.sourceforge.net */ public class DefuzzifierCenterOfGravityFunctions extends DefuzzifierDiscrete { @@ -19,23 +17,17 @@ public class DefuzzifierCenterOfGravityFunctions extends DefuzzifierDiscrete { @Override public double defuzzify() { double x, y, sum = 0, sumWeight = 0; - for( Double xD : this ) { + for (Double xD : this) { y = getDiscreteValue(xD); x = xD; sumWeight += x * y; sum += y; } - if( sum != 0 ) return sumWeight / sum; + if (sum != 0) return sumWeight / sum; return Double.NaN; } - /** Reset values */ - @Override - public void reset() { - discreteValues = new HashMap(); - } - @Override public String toStringFcl() { return "METHOD : COGF;"; diff --git a/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierContinuous.java b/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierContinuous.java index 9711bb3..3f2ad64 100644 --- a/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierContinuous.java +++ b/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierContinuous.java @@ -11,19 +11,21 @@ public abstract class DefuzzifierContinuous extends Defuzzifier { /** Default number of points for 'values[]' */ public static int DEFAULT_NUMBER_OF_POINTS = 1000; - protected double max; // Where function ends + protected double max; // Where function ends protected double min; // Where function begins - /** + + /** * Step size between each element in 'values[]' - * stepSize = (max - min) / values.length + * stepSize = (max - min) / values.length */ protected double stepSize; - /** + + /** * Funcion values: A generic continuous function * y = f(x) - * where x : [min, max] + * where x : [min, max] * Values are stored in 'values[]' array. - * Array's index is calculated as: + * Array's index is calculated as: * index = (x - min) / (max - min) * (values.length) */ protected double values[]; @@ -31,8 +33,7 @@ public abstract class DefuzzifierContinuous extends Defuzzifier { public DefuzzifierContinuous(Variable variable) { super(variable); discrete = false; - variable.estimateUniverse(); - init(variable.getUniverseMin(), variable.getUniverseMax(), DEFAULT_NUMBER_OF_POINTS); + init(); } public void addValue(int index, double value) { @@ -89,22 +90,28 @@ public abstract class DefuzzifierContinuous extends Defuzzifier { /** * Initialize - * @param min : Minimum - * @param max : Maximum - * @param numberOfPoints */ - private void init(double min, double max, int numberOfPoints) { - values = new double[numberOfPoints]; + @Override + protected void init() { + variable.estimateUniverse(); + double umin = variable.getUniverseMin(); + double umax = variable.getUniverseMax(); + int numberOfPoints = DEFAULT_NUMBER_OF_POINTS; + + if (values == null || values.length != numberOfPoints) values = new double[numberOfPoints]; // Go on only if min & max are set - if (Double.isNaN(min) || Double.isNaN(max)) return; + if (Double.isNaN(umin) || Double.isNaN(umax)) { + min = max = Double.NaN; + return; + } // Check parameters - if (min > max) throw new RuntimeException("Parameter max is out of range (should satisfy: min < max). min: " + min + "\tmax: " + max); + if (umin > umax) throw new RuntimeException("Parameter max is out of range (should satisfy: min < max). min: " + umin + "\tmax: " + umax); // Initialize - this.min = min; - this.max = max; + min = umin; + max = umax; stepSize = (max - min) / numberOfPoints; reset(); } @@ -114,9 +121,19 @@ public abstract class DefuzzifierContinuous extends Defuzzifier { return discrete; } + /** + * Do we need to re-initialize? + */ + @Override + public boolean needsInit() { + return Double.isNaN(max) || Double.isNaN(min); + } + /** Reset values (in 'values[] array) */ @Override public void reset() { + super.reset(); + if (values != null) { for (int i = 0; i < values.length; i++) values[i] = 0; diff --git a/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierDiscrete.java b/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierDiscrete.java index 485cb5e..0c81796 100644 --- a/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierDiscrete.java +++ b/src/net/sourceforge/jFuzzyLogic/defuzzifier/DefuzzifierDiscrete.java @@ -11,8 +11,8 @@ import net.sourceforge.jFuzzyLogic.rule.Variable; */ public abstract class DefuzzifierDiscrete extends Defuzzifier implements Iterable { - /** - * Funcion values: A generic discrete function + /** + * Funcion values: A generic discrete function * x = [x_1, x_2, .... , x_n] * y = [y_1, y_2, .... , y_n] * y_i = f[x_i] @@ -23,7 +23,7 @@ public abstract class DefuzzifierDiscrete extends Defuzzifier implements Iterabl public DefuzzifierDiscrete(Variable variable) { super(variable); discrete = true; - discreteValues = new HashMap(); + init(); } /** Deffuzification function */ @@ -37,16 +37,32 @@ public abstract class DefuzzifierDiscrete extends Defuzzifier implements Iterabl return y; } + @Override + protected void init() { + discreteValues = new HashMap(); + } + /** Get an iterator (on discreteValues' keys) */ @Override public Iterator iterator() { return discreteValues.keySet().iterator(); } + /** + * Do we need to re-initialize? + */ + @Override + public boolean needsInit() { + return false; + } + /** Reset values */ @Override public void reset() { - if (discreteValues != null) { // Set all values to 0 + super.reset(); + + if (discreteValues != null) { + // Set all values to 0 for (Double key : this) discreteValues.put(key, 0.0); } diff --git a/src/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/qualifyDemo/ParameterOptimizationDemo.java b/src/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/qualifyDemo/ParameterOptimizationDemo.java index 6daf90d..8a5884b 100644 --- a/src/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/qualifyDemo/ParameterOptimizationDemo.java +++ b/src/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/qualifyDemo/ParameterOptimizationDemo.java @@ -64,7 +64,8 @@ public class ParameterOptimizationDemo { Gpr.toFile("fcl/qualify_optimized.fcl", functionBlock.toString()); // Show - functionBlock.reset(false); + // functionBlock.reset(false); + functionBlock.reset(); JFuzzyChart.get().chart(functionBlock); System.out.println("ParameterOptimizationDemo: End"); diff --git a/src/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/robotDemo/ParameterOptimizationRobot.java b/src/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/robotDemo/ParameterOptimizationRobot.java index df94369..50f0e40 100644 --- a/src/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/robotDemo/ParameterOptimizationRobot.java +++ b/src/net/sourceforge/jFuzzyLogic/demo/parameterOptimization/robotDemo/ParameterOptimizationRobot.java @@ -68,7 +68,8 @@ public class ParameterOptimizationRobot { Gpr.toFile("fcl/robot_optimized.fcl", functionBlock.toString()); // Show - functionBlock.reset(false); + // functionBlock.reset(false); + functionBlock.reset(); JFuzzyChart.get().chart(functionBlock); System.out.println("ParameterOptimizationDemo: End"); diff --git a/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunction.java b/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunction.java index 819ce5f..651fee1 100644 --- a/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunction.java +++ b/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunction.java @@ -1,7 +1,11 @@ package net.sourceforge.jFuzzyLogic.membership; +import java.util.HashSet; +import java.util.Set; + import net.sourceforge.jFuzzyLogic.FIS; import net.sourceforge.jFuzzyLogic.fcl.FclObject; +import net.sourceforge.jFuzzyLogic.rule.Variable; /** * Base membership function @@ -13,12 +17,9 @@ public abstract class MembershipFunction extends FclObject { public static boolean debug = FIS.debug; boolean discrete; - /** Function's parameters */ - Value parameters[]; - /** Universe max (range max) */ - double universeMax; - /** Universe min (range min) */ - double universeMin; + Value parameters[]; // Function's parameters + double universeMax; // Universe max (range max) + double universeMin; // Universe min (range min) /** Default Constructor */ MembershipFunction() { @@ -30,6 +31,25 @@ public abstract class MembershipFunction extends FclObject { /** Try to guess the universe (if not set) */ public abstract void estimateUniverse(); + public void estimateUniverseForce() { + universeMin = universeMax = Double.NaN; + estimateUniverse(); + } + + /** + * Find variables used by this function + */ + public Set findVariables() { + HashSet vars = new HashSet<>(); + + if (parameters != null) { + for (Value val : parameters) + if (val.getType() == Value.Type.VAR_REFERENCE && val.getVarRef() != null) vars.add(val.getVarRef()); + } + + return vars; + } + /** Short name */ public String getName() { String str = this.getClass().getName(); @@ -62,10 +82,10 @@ public abstract class MembershipFunction extends FclObject { return discrete; } - /** + /** * Get membership function's value. * @param in : Variable's 'x' value - * Note: Output mu be in range [0,1] + * Note: Output mu be in range [0,1] */ public abstract double membership(double in); diff --git a/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion.java b/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion.java index 4121d65..1852508 100644 --- a/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion.java +++ b/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionFuncion.java @@ -1,6 +1,7 @@ package net.sourceforge.jFuzzyLogic.membership; import java.util.Iterator; +import java.util.Set; import net.sourceforge.jFuzzyLogic.FunctionBlock; import net.sourceforge.jFuzzyLogic.Gpr; @@ -20,12 +21,13 @@ import net.sourceforge.jFuzzyLogic.membership.functions.MffSubstract; import net.sourceforge.jFuzzyLogic.membership.functions.MffSum; import net.sourceforge.jFuzzyLogic.membership.functions.MffTan; import net.sourceforge.jFuzzyLogic.membership.functions.MffTimes; +import net.sourceforge.jFuzzyLogic.rule.Variable; import org.antlr.runtime.tree.Tree; /** * Membership function that is a (simple) mathematical funcion (the result is a singleton) - * + * * @author pcingola@users.sourceforge.net */ public class MembershipFunctionFuncion extends MembershipFunctionDiscrete { @@ -128,6 +130,11 @@ public class MembershipFunctionFuncion extends MembershipFunctionDiscrete { universeMin = universeMax = val; } + @Override + public Set findVariables() { + return function.findVariables(); + } + /** * @see net.sourceforge.jFuzzyLogic.membership.MembershipFunctionDiscrete#iterator() */ @@ -173,8 +180,8 @@ public class MembershipFunctionFuncion extends MembershipFunctionDiscrete { } /** - * Parse each term (from tree) creating appropriate functions. - * + * Parse each term (from tree) creating appropriate functions. + * * @param ruleBlock Fuzzy Set for this function * @param tree : AST (tree) to parse * @return An array of objects (terms[]) diff --git a/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton.java b/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton.java index b52a29b..fdf3762 100644 --- a/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton.java +++ b/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionGenericSingleton.java @@ -1,6 +1,10 @@ package net.sourceforge.jFuzzyLogic.membership; +import java.util.HashSet; import java.util.Iterator; +import java.util.Set; + +import net.sourceforge.jFuzzyLogic.rule.Variable; /** * Generic singleton membership function: Allows 'n' singletons (generic discrete membership function) @@ -14,7 +18,7 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre Value y[]; /** - * Constructor for generin (N-values) + * Constructor for generin (N-values) * @param x : x[] values array * @param y : y[] values array */ @@ -22,10 +26,10 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre discrete = true; // Check parameters - if( x == null ) throw new RuntimeException("Parameter x[] can't be null"); - if( y == null ) throw new RuntimeException("Parameter x[] can't be null"); - if( x.length > y.length ) throw new RuntimeException("Array size differ"); - if( x.length < 1 ) throw new RuntimeException("Array size is 0"); + if (x == null) throw new RuntimeException("Parameter x[] can't be null"); + if (y == null) throw new RuntimeException("Parameter x[] can't be null"); + if (x.length > y.length) throw new RuntimeException("Array size differ"); + if (x.length < 1) throw new RuntimeException("Array size is 0"); // Initialize this.x = x; @@ -33,22 +37,22 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre // Check parameters StringBuffer errors = new StringBuffer(); - if( !checkParamters(errors) ) throw new RuntimeException(errors.toString()); + if (!checkParamters(errors)) throw new RuntimeException(errors.toString()); } @Override public boolean checkParamters(StringBuffer errors) { boolean ok = true; - if( x.length > 1 ) for( int i = 0; i < x.length; i++ ) { - if( (i > 0) && (x[i - 1].getValue() > x[i].getValue()) ) { + if (x.length > 1) for (int i = 0; i < x.length; i++) { + if ((i > 0) && (x[i - 1].getValue() > x[i].getValue())) { ok = false; - if( errors != null ) errors.append("Array not sorted: x[" + (i - 1) + "] = " + x[i - 1] + " , x[" + i + "] = " + x[i] + "\n"); + if (errors != null) errors.append("Array not sorted: x[" + (i - 1) + "] = " + x[i - 1] + " , x[" + i + "] = " + x[i] + "\n"); } - if( (y[i].getValue() < 0) || (y[i].getValue() > 1) ) { + if ((y[i].getValue() < 0) || (y[i].getValue() > 1)) { ok = false; - if( errors != null ) errors.append("Membership funcion out of range: y[" + i + "] = " + y[i] + " (should be in range [0,1]\n"); + if (errors != null) errors.append("Membership funcion out of range: y[" + i + "] = " + y[i] + " (should be in range [0,1]\n"); } } @@ -58,16 +62,36 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre @Override public void estimateUniverse() { // Are universeMin and universeMax already set? => nothing to do - if( (!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax)) ) return; + if ((!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax))) return; universeMin = x[0].getValue(); universeMax = x[x.length - 1].getValue(); } + /** + * Find variables used by this function + */ + @Override + public Set findVariables() { + HashSet vars = new HashSet<>(); + + if (x != null) { + for (Value val : x) + if (val.getType() == Value.Type.VAR_REFERENCE && val.getVarRef() != null) vars.add(val.getVarRef()); + } + + if (y != null) { + for (Value val : y) + if (val.getType() == Value.Type.VAR_REFERENCE && val.getVarRef() != null) vars.add(val.getVarRef()); + } + + return vars; + } + /** Need to override this method (we store parameters differently in this function) */ @Override public double getParameter(int i) { int j = i / 2; - if( (i % 2) == 0 ) return x[j].getValue(); + if ((i % 2) == 0) return x[j].getValue(); return y[j].getValue(); } @@ -87,15 +111,19 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre int i = 0; + @Override public boolean hasNext() { return (i < x.length); } + @Override public Double next() { return x[i].getValue(); } - public void remove() {} + @Override + public void remove() { + } }; } @@ -105,10 +133,10 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre @Override public double membership(double in) { int i, len = x.length; - if( in <= x[0].getValue() ) return y[0].getValue(); - if( in > x[len - 1].getValue() ) return y[len - 1].getValue(); - for( i = 1; i < len; i++ ) - if( in == x[i].getValue() ) return y[i].getValue(); + if (in <= x[0].getValue()) return y[0].getValue(); + if (in > x[len - 1].getValue()) return y[len - 1].getValue(); + for (i = 1; i < len; i++) + if (in == x[i].getValue()) return y[i].getValue(); return 0; } @@ -117,7 +145,7 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre */ @Override public double membership(int index) { - if( (index < 0) || (index > x.length) ) return 0; + if ((index < 0) || (index > x.length)) return 0; return y[index].getValue(); } @@ -125,7 +153,7 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre @Override public void setParameter(int i, double value) { int j = i / 2; - if( (i % 2) == 0 ) x[j].setValue(value); + if ((i % 2) == 0) x[j].setValue(value); else y[j].setValue(value); } @@ -143,9 +171,9 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre @Override public String toString() { StringBuffer str = new StringBuffer(getName() + " : "); - for( int i = 0; i < x.length; i++ ) { + for (int i = 0; i < x.length; i++) { str.append("[" + x[i] + ", " + y[i] + "] "); - if( i < (x.length - 1) ) str.append(", "); + if (i < (x.length - 1)) str.append(", "); } str.append(";"); return str.toString(); @@ -155,7 +183,7 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre @Override public String toStringFcl() { String str = "SINGLETONS "; - for( int i = 0; i < x.length; i++ ) + for (int i = 0; i < x.length; i++) str += "(" + x[i] + ", " + y[i] + ") "; return str; } diff --git a/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionPieceWiseLinear.java b/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionPieceWiseLinear.java index ffca52c..a65f38c 100644 --- a/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionPieceWiseLinear.java +++ b/src/net/sourceforge/jFuzzyLogic/membership/MembershipFunctionPieceWiseLinear.java @@ -1,5 +1,10 @@ package net.sourceforge.jFuzzyLogic.membership; +import java.util.HashSet; +import java.util.Set; + +import net.sourceforge.jFuzzyLogic.rule.Variable; + /** * Piece-wise linear membership function * @author pcingola@users.sourceforge.net @@ -12,7 +17,7 @@ public class MembershipFunctionPieceWiseLinear extends MembershipFunctionContinu Value y[]; /** - * Default constructor + * Default constructor * @param x [] : x points array * @param y [] : y points array * A piecewise linear function is defined by 'n' points: @@ -65,6 +70,26 @@ public class MembershipFunctionPieceWiseLinear extends MembershipFunctionContinu universeMax = x[x.length - 1].getValue(); } + /** + * Find variables used by this function + */ + @Override + public Set findVariables() { + HashSet vars = new HashSet<>(); + + if (x != null) { + for (Value val : x) + if (val.getType() == Value.Type.VAR_REFERENCE && val.getVarRef() != null) vars.add(val.getVarRef()); + } + + if (y != null) { + for (Value val : y) + if (val.getType() == Value.Type.VAR_REFERENCE && val.getVarRef() != null) vars.add(val.getVarRef()); + } + + return vars; + } + /** Need to override this method (we store parameters differently in this function) */ @Override public double getParameter(int i) { @@ -85,7 +110,7 @@ public class MembershipFunctionPieceWiseLinear extends MembershipFunctionContinu * membership(x) = y[0] if x <= x[0] * membership(x) = y[n] if x >= x[n] (where n = x.length) * membership(x) = y[i - 1] + (y[i] - y[i - 1]) / (in - x[i]) if x[i-1] < x <= x[i] - * + * * @see net.sourceforge.jFuzzyLogic.membership.MembershipFunction#membership(double) */ @Override diff --git a/src/net/sourceforge/jFuzzyLogic/membership/Value.java b/src/net/sourceforge/jFuzzyLogic/membership/Value.java index 3f2f46e..12af9da 100644 --- a/src/net/sourceforge/jFuzzyLogic/membership/Value.java +++ b/src/net/sourceforge/jFuzzyLogic/membership/Value.java @@ -10,7 +10,7 @@ import org.antlr.runtime.tree.Tree; /** * A value can be either REAL, INT, BOOL or a reference to variable - * + * * @author pcingola@users.sourceforge.net */ public class Value extends FclObject { @@ -22,18 +22,10 @@ public class Value extends FclObject { public static final Value ONE = new Value(1.0); public static final Value ZERO = new Value(0.0); - //------------------------------------------------------------------------- - // Variables - //------------------------------------------------------------------------- - Type type; double valReal; Variable varRef; - //------------------------------------------------------------------------- - // Methods - //------------------------------------------------------------------------- - public Value() { type = Type.REAL; valReal = 0.0; @@ -44,19 +36,15 @@ public class Value extends FclObject { this.valReal = valReal; } - /** - * Default constructor - * @param name : Value - */ public Value(Tree tree, FunctionBlock fb) { - if( tree.getType() == FclLexer.VALUE_REAL ) { + if (tree.getType() == FclLexer.VALUE_REAL) { type = Type.REAL; valReal = Gpr.parseDouble(tree.getChild(0)); - } else if( tree.getType() == FclLexer.VALUE_ID ) { + } else if (tree.getType() == FclLexer.VALUE_ID) { type = Type.VAR_REFERENCE; String varName = tree.getChild(0).getText(); varRef = fb.getVariable(varName); - if( varRef == null ) throw new RuntimeException("Cannot find variable: '" + varName + "'"); + if (varRef == null) throw new RuntimeException("Cannot find variable: '" + varName + "'"); } else throw new RuntimeException("Unimplemented 'Value' for node type: " + tree.getType() + "\ttree: " + tree.toStringTree()); } @@ -70,25 +58,24 @@ public class Value extends FclObject { /** * Get value (not really a getter) - * @return */ public double getValue() { - if( type == null ) { + if (type == null) { Gpr.debug("WARNING: Value type not defined!"); return 0; } - switch(type) { - case REAL: - return valReal; - case VAR_REFERENCE: - if( varRef == null ) { - Gpr.debug("WARNING: Undefined variable reference!"); - return 0; - } - return varRef.getValue(); - default: - throw new RuntimeException("Value type '" + type + "' not implemented!"); + switch (type) { + case REAL: + return valReal; + case VAR_REFERENCE: + if (varRef == null) { + Gpr.debug("WARNING: Undefined variable reference!"); + return 0; + } + return varRef.getValue(); + default: + throw new RuntimeException("Value type '" + type + "' not implemented!"); } } @@ -106,18 +93,17 @@ public class Value extends FclObject { /** * Set value (not really a setter) - * @param valReal */ public void setValue(double valReal) { - switch(type) { - case REAL: - this.valReal = valReal; - return; - case VAR_REFERENCE: - varRef.setValue(valReal); - return; - default: - throw new RuntimeException("Value type '" + type + "' not implemented!"); + switch (type) { + case REAL: + this.valReal = valReal; + return; + case VAR_REFERENCE: + varRef.setValue(valReal); + return; + default: + throw new RuntimeException("Value type '" + type + "' not implemented!"); } } @@ -127,8 +113,8 @@ public class Value extends FclObject { @Override public String toStringFcl() { - if( type == Type.REAL ) return "" + getValue(); - if( type == Type.VAR_REFERENCE ) return varRef.toStringFcl(); + if (type == Type.REAL) return "" + getValue(); + if (type == Type.VAR_REFERENCE) return varRef.toStringFcl(); throw new RuntimeException("Unimplemented type '" + type + "'"); } } diff --git a/src/net/sourceforge/jFuzzyLogic/membership/functions/MffFunction.java b/src/net/sourceforge/jFuzzyLogic/membership/functions/MffFunction.java index c17679c..8460335 100644 --- a/src/net/sourceforge/jFuzzyLogic/membership/functions/MffFunction.java +++ b/src/net/sourceforge/jFuzzyLogic/membership/functions/MffFunction.java @@ -1,5 +1,8 @@ package net.sourceforge.jFuzzyLogic.membership.functions; +import java.util.HashSet; +import java.util.Set; + import net.sourceforge.jFuzzyLogic.FunctionBlock; import net.sourceforge.jFuzzyLogic.Gpr; import net.sourceforge.jFuzzyLogic.fcl.FclObject; @@ -9,10 +12,10 @@ import net.sourceforge.jFuzzyLogic.rule.Variable; /** * Membership function that is a (simple) mathematical function * (Mff stands for 'Membership Function type Function'). - * - * Implements a mathematical function that depends on variables (should - * be input variables only, to avoid some sort of 'race conditions'). - * + * + * Implements a mathematical function that depends on variables (should + * be input variables only, to avoid some sort of 'race conditions'). + * * @author pcingola@users.sourceforge.net */ public abstract class MffFunction extends FclObject { @@ -49,7 +52,7 @@ public abstract class MffFunction extends FclObject { } /** - * Evaluate this function + * Evaluate this function * @return double */ protected abstract double evaluateFunction(); @@ -61,7 +64,7 @@ public abstract class MffFunction extends FclObject { // Evaluate each term for (int i = 0; i < terms.length; i++) { if (terms[i] == null) // Null function => Nothing to do - values[i] = Double.NaN; + values[i] = Double.NaN; else if (terms[i] instanceof Variable) { // Variable's value Variable var = ((Variable) terms[i]); @@ -74,13 +77,33 @@ public abstract class MffFunction extends FclObject { // Function's value MffFunction mff = (MffFunction) terms[i]; // Get function mff.evaluateTerms(); // Evaluate function's terms (recurse into tree) - values[i] = mff.evaluateFunction(); // Evaluate function + values[i] = mff.evaluateFunction(); // Evaluate function if (debug) Gpr.debug("Evaluated: " + mff + " = " + values[i]); } if (debug) Gpr.debug("Term[" + i + "]: " + terms[i] + "\tClass:" + terms[i].getClass().getSimpleName() + "\tValue: " + values[i]); } } + public Set findVariables() { + HashSet vars = new HashSet<>(); + + if (terms != null) { + for (FclObject fco : terms) { + if (fco instanceof Variable) { + vars.add((Variable) fco); + } else if (fco instanceof Value) { + Value val = (Value) fco; + if (val.getType() == Value.Type.VAR_REFERENCE && val.getVarRef() != null) vars.add(val.getVarRef()); + } else if (fco instanceof MffFunction) { + vars.addAll(((MffFunction) fco).findVariables()); + } + } + } + + return vars; + + } + @Override public String toStringCpp() { if (terms == null) return ""; diff --git a/src/net/sourceforge/jFuzzyLogic/plot/JFuzzyChartImpl.java b/src/net/sourceforge/jFuzzyLogic/plot/JFuzzyChartImpl.java index 633d41e..8c91a85 100644 --- a/src/net/sourceforge/jFuzzyLogic/plot/JFuzzyChartImpl.java +++ b/src/net/sourceforge/jFuzzyLogic/plot/JFuzzyChartImpl.java @@ -116,7 +116,7 @@ public class JFuzzyChartImpl extends JFuzzyChart { boolean plotDefuzz = false; // Sanity check - if (Double.isNaN(var.getUniverseMin()) || Double.isInfinite(var.getUniverseMax())) var.estimateUniverse(); + var.estimateUniverse(); int numberOfPoints = PlotWindow.DEFAULT_CHART_NUMBER_OF_POINTS; double step = (var.getUniverseMax() - var.getUniverseMin()) / (numberOfPoints); @@ -143,12 +143,18 @@ public class JFuzzyChartImpl extends JFuzzyChart { Defuzzifier defuzzifier = var.getDefuzzifier(); if ((defuzzifier != null) && (defuzzifier instanceof DefuzzifierContinuous)) { DefuzzifierContinuous def = (DefuzzifierContinuous) defuzzifier; + + // Title String title = String.format("%s:%2.2f (%s)", var.getName(), var.getLatestDefuzzifiedValue(), defuzzifier.getName()); + + // Data points XYSeries series = new XYSeries(title); double values[] = def.getValues(); numberOfPoints = values.length; double xx = def.getMin(); step = (def.getMax() - def.getMin()) / (numberOfPoints); + + // Calculate values for (int i = 0; i < numberOfPoints; i++, xx += step) series.add(xx, values[i]); diff --git a/src/net/sourceforge/jFuzzyLogic/rule/LinguisticTerm.java b/src/net/sourceforge/jFuzzyLogic/rule/LinguisticTerm.java index a965819..00f87a5 100644 --- a/src/net/sourceforge/jFuzzyLogic/rule/LinguisticTerm.java +++ b/src/net/sourceforge/jFuzzyLogic/rule/LinguisticTerm.java @@ -12,6 +12,7 @@ public class LinguisticTerm extends FclObject implements Comparable, Comparable, CompileCpp { @@ -49,11 +49,11 @@ public class RuleBlock extends FclObject implements Iterable, Comparable rules; // All the rules + RuleAccumulationMethod ruleAccumulationMethod; // Rule accumulation method: How results of the rules are combined to obtain an overall result (e.g. MAX: maximum, BSUM: bounded sum, etc.) + RuleActivationMethod ruleActivationMethod; // Rule activation (implication) method: How the 'if' activates the 'then' (e.g. MIN: minimum, PROD: product) + ArrayList rules; // All the rules public static boolean isDebug() { return debug; @@ -87,7 +87,7 @@ public class RuleBlock extends FclObject implements Iterable, Comparable, Comparable, Comparable, Comparable, Iterable, CompileCpp { - double defaultValue; // Default value, when no change - double latestDefuzzifiedValue; // Latest defuzzified value - double universeMax; // Universe max (range max) - double universeMin; // Universe minimum (range minimum) - double value; // Variable's value - String name; // Variable name - HashMap linguisticTerms; // Terms for this variable - Defuzzifier defuzzifier; // Defuzzifier class + public static final double EPSILON = 1e-6; + + double defaultValue; // Default value, when no change + double latestDefuzzifiedValue; // Latest defuzzified value + double universeMax; // Universe max (range max) + double universeMin; // Universe minimum (range minimum) + double value; // Variable's value + String name; // Variable name + HashMap linguisticTerms; // Terms for this variable + Defuzzifier defuzzifier; // Defuzzifier class + HashMap variableValues; // Terms may use variables, we need to keep track of values to know when universe needs to be updated /** - * Default constructor + * Default constructor * @param name : Variable's name */ public Variable(String name) { @@ -39,41 +45,21 @@ public class Variable extends FclObject implements Comparable, Iterabl universeMin = Double.NaN; universeMax = Double.NaN; value = Double.NaN; - reset(true); // Reset values - } - /** - * Constructor - */ - public Variable(String name, double universeMin, double universeMax) { - if (name == null) throw new RuntimeException("Variable's name can't be null"); - if (universeMax < universeMin) throw new RuntimeException("Parameter error in variable \'" + name + "\' universeMax < universeMin"); - this.name = name; - linguisticTerms = new HashMap(); - this.universeMin = universeMin; - this.universeMax = universeMax; - value = Double.NaN; - reset(true); // Reset values + variableValues = null; + + // reset(true); // Reset values + reset(); // Reset values } /** * Adds a termName to this variable - * @param linguisticTerm : Linguistic term to add + * @param linguisticTerm : Linguistic term to add * @return this variable */ public Variable add(LinguisticTerm linguisticTerm) { linguisticTerms.put(linguisticTerm.getTermName(), linguisticTerm); - return this; - } - - /** - * Adds a termName to this variable - * @param termName : RuleTerm name - * @param membershipFunction : membershipFunction for this termName - * @return this variable - */ - public Variable add(String termName, MembershipFunction membershipFunction) { - this.add(new LinguisticTerm(termName, membershipFunction)); + variableValues = null; // Reset cache return this; } @@ -84,7 +70,7 @@ public class Variable extends FclObject implements Comparable, Iterabl return name.compareTo(var.getName()); } - /** + /** * Defuzzify this (output) variable * Set defuzzufied values to 'value' and 'latestDefuzzifiedValue' */ @@ -109,7 +95,7 @@ public class Variable extends FclObject implements Comparable, Iterabl if (linguisticTerms.size() > 0) { for (LinguisticTerm lt : this) { MembershipFunction membershipFunction = lt.getMembershipFunction(); - membershipFunction.estimateUniverse(); + membershipFunction.estimateUniverseForce(); umin = Math.min(membershipFunction.getUniverseMin(), umin); umax = Math.max(membershipFunction.getUniverseMax(), umax); @@ -120,9 +106,21 @@ public class Variable extends FclObject implements Comparable, Iterabl else umin = umax = 0; } - // Set parameters (if not set) - if (Double.isNaN(universeMin)) universeMin = umin; - if (Double.isNaN(universeMax)) universeMax = umax; + // Set parameters + universeMin = umin; + universeMax = umax; + } + + /** + * Find all variables used in linguistic terms + */ + protected Set findVariables() { + Set vars = new HashSet(); + + for (LinguisticTerm lt : this) + vars.addAll(lt.getMembershipFunction().findVariables()); + + return vars; } public double getDefaultValue() { @@ -193,6 +191,21 @@ public class Variable extends FclObject implements Comparable, Iterabl return linguisticTerms.values().iterator(); } + // /** Reset defuzzifier (if any) */ + // public void reset(boolean onlyDefuzzifier) { + // if (onlyDefuzzifier) { + // // Only reset variables that have a defuzzifier + // if (defuzzifier != null) { + // defuzzifier.reset(); + // // Set default value for output variables (if any default value was defined) + // if (!Double.isNaN(defaultValue)) value = defaultValue; + // latestDefuzzifiedValue = defaultValue; + // } + // } else { + // latestDefuzzifiedValue = value = defaultValue; + // } + // } + /** Get a 'linguisticTerms sorted by name */ public List linguisticTermsSorted() { ArrayList al = new ArrayList(linguisticTerms.values()); @@ -200,17 +213,58 @@ public class Variable extends FclObject implements Comparable, Iterabl return al; } - /** Reset defuzzifier (if any) */ - public void reset(boolean onlyDefuzzifier) { - if (onlyDefuzzifier) { - // Only reset variables that have a defuzzifier - if (defuzzifier != null) { - defuzzifier.reset(); - // Set default value for output variables (if any default value was defined) - if (!Double.isNaN(defaultValue)) value = defaultValue; - latestDefuzzifiedValue = defaultValue; + /** + * Do we need to estimate universe? + * (e.g. when a variable referred by a linguistic term changed) + */ + protected boolean needEstimateUniverse() { + //--- + // Find all dependent variables + //--- + if (variableValues == null) { + Set vars = findVariables(); + + // Add all variables + variableValues = new HashMap(); + for (Variable var : vars) + variableValues.put(var, var.getValue()); + } + + //--- + // Any dependent variables changed? + //--- + LinkedList change = null; + for (Variable var : variableValues.keySet()) { + double value = variableValues.get(var); + if (Math.abs(value - var.getValue()) > EPSILON) { + if (change == null) change = new LinkedList(); + change.add(var); } - } else value = Double.NaN; + } + + //--- + // Do we need to update any value? + //--- + if (change != null) { + for (Variable var : change) + variableValues.put(var, var.getValue()); + } + + return change != null; + } + + /** Reset defuzzifier (if any) */ + public void reset() { + if (needEstimateUniverse()) { + universeMin = universeMax = Double.NaN; // Force + estimateUniverse(); + } + + // Only reset variables that have a defuzzifier + if (defuzzifier != null) defuzzifier.reset(); + + // Set default value for output variables (if any default value was defined) + if (!Double.isNaN(defaultValue)) latestDefuzzifiedValue = value = defaultValue; } public void setDefaultValue(double defualtValue) { @@ -246,10 +300,6 @@ public class Variable extends FclObject implements Comparable, Iterabl this.value = value; } - /** - * Printable string - * @see java.lang.Object#toString() - */ @Override public String toString() { String str = name + " : \n"; diff --git a/src/net/sourceforge/jFuzzyLogic/testCases/TestCaseJfuzzy.java b/src/net/sourceforge/jFuzzyLogic/testCases/TestCaseJfuzzy.java index bd79cda..1626dfd 100644 --- a/src/net/sourceforge/jFuzzyLogic/testCases/TestCaseJfuzzy.java +++ b/src/net/sourceforge/jFuzzyLogic/testCases/TestCaseJfuzzy.java @@ -15,7 +15,9 @@ import net.sourceforge.jFuzzyLogic.FunctionBlock; import net.sourceforge.jFuzzyLogic.Gpr; import net.sourceforge.jFuzzyLogic.rule.Rule; import net.sourceforge.jFuzzyLogic.rule.RuleBlock; +import net.sourceforge.jFuzzyLogic.rule.Variable; +import org.junit.Assert; import org.junit.Test; /** @@ -77,7 +79,7 @@ public class TestCaseJfuzzy extends TestCase { FunctionBlock fb = fis.getFunctionBlock(null); for (int ind = 1; ind < mem.length; ind++) { - double value = int100ToDOuble(mem[ind][0]); + double value = int100ToDouble(mem[ind][0]); fb.setVariable("inVar", value); @@ -85,9 +87,9 @@ public class TestCaseJfuzzy extends TestCase { int good = doubleToInt100(fb.getVariable("inVar").getMembership("good")); int excellent = doubleToInt100(fb.getVariable("inVar").getMembership("excellent")); - if (poor != mem[ind][1]) fail("Membership function " + title + ", poor(" + value + ") should be " + int100ToDOuble(mem[ind][1]) + ", but it is " + int100ToDOuble(poor)); - if (good != mem[ind][2]) fail("Membership function " + title + ", good(" + value + ") should be " + int100ToDOuble(mem[ind][2]) + ", but it is " + int100ToDOuble(good)); - if (excellent != mem[ind][3]) fail("Membership function " + title + ", excellent(" + value + ") should be " + int100ToDOuble(mem[ind][3]) + ", but it is " + int100ToDOuble(excellent)); + if (poor != mem[ind][1]) fail("Membership function " + title + ", poor(" + value + ") should be " + int100ToDouble(mem[ind][1]) + ", but it is " + int100ToDouble(poor)); + if (good != mem[ind][2]) fail("Membership function " + title + ", good(" + value + ") should be " + int100ToDouble(mem[ind][2]) + ", but it is " + int100ToDouble(good)); + if (excellent != mem[ind][3]) fail("Membership function " + title + ", excellent(" + value + ") should be " + int100ToDouble(mem[ind][3]) + ", but it is " + int100ToDouble(excellent)); } } @@ -102,7 +104,7 @@ public class TestCaseJfuzzy extends TestCase { FunctionBlock fb = fis.getFunctionBlock(null); for (int ind = 1; ind < mem.length; ind++) { - double value = int100ToDOuble(mem[ind][0]); + double value = int100ToDouble(mem[ind][0]); fb.setVariable("inVar", value); @@ -110,9 +112,9 @@ public class TestCaseJfuzzy extends TestCase { int good = doubleToInt100(fb.getVariable("inVar").getMembership("good")); int excellent = doubleToInt100(fb.getVariable("inVar").getMembership("excellent")); - if (poor != mem[ind][1]) fail("Membership function " + title + ", poor(" + value + ") should be " + int100ToDOuble(mem[ind][1]) + ", but it is " + int100ToDOuble(poor)); - if (good != mem[ind][2]) fail("Membership function " + title + ", good(" + value + ") should be " + int100ToDOuble(mem[ind][2]) + ", but it is " + int100ToDOuble(good)); - if (excellent != mem[ind][3]) fail("Membership function " + title + ", excellent(" + value + ") should be " + int100ToDOuble(mem[ind][3]) + ", but it is " + int100ToDOuble(excellent)); + if (poor != mem[ind][1]) fail("Membership function " + title + ", poor(" + value + ") should be " + int100ToDouble(mem[ind][1]) + ", but it is " + int100ToDouble(poor)); + if (good != mem[ind][2]) fail("Membership function " + title + ", good(" + value + ") should be " + int100ToDouble(mem[ind][2]) + ", but it is " + int100ToDouble(good)); + if (excellent != mem[ind][3]) fail("Membership function " + title + ", excellent(" + value + ") should be " + int100ToDouble(mem[ind][3]) + ", but it is " + int100ToDouble(excellent)); } } @@ -123,7 +125,7 @@ public class TestCaseJfuzzy extends TestCase { return ((int) Math.round(d * 100)); } - double int100ToDOuble(int i) { + double int100ToDouble(int i) { return (i) / 100.0; } @@ -258,7 +260,7 @@ public class TestCaseJfuzzy extends TestCase { // Compare running the system vs. stored results for (int ind = 0; ind < mem.length; ind++) { // Get input variables from stores results - double inVar = int100ToDOuble(mem[ind][0]); + double inVar = int100ToDouble(mem[ind][0]); // Set variables and run the system fb.setVariable("inVar", inVar); @@ -268,7 +270,7 @@ public class TestCaseJfuzzy extends TestCase { double outVar = fb.getVariable("outVar").getLatestDefuzzifiedValue(); // Compare output variable to stored result - if (doubleToInt100(outVar) != mem[ind][4]) fail("Tipper output outVar(inVar=" + inVar + ") should be " + int100ToDOuble(mem[ind][4]) + ", but it is " + outVar); + if (doubleToInt100(outVar) != mem[ind][4]) fail("Output outVar(inVar=" + inVar + ") should be " + int100ToDouble(mem[ind][4]) + ", but it is " + outVar); } } @@ -413,6 +415,54 @@ public class TestCaseJfuzzy extends TestCase { checkMembershipFunction("Triangular", "./tests/junit_triang.fcl", "./tests/junit_triang.txt"); } + @Test + public void testMembershipWithVariables() { + Gpr.debug("Test"); + + // FCL.debug = true; + FIS fis = FIS.load("./tests/membershipWithVariables.fcl", true); + + Variable var = fis.getVariable("out"); + if (verbose) { + System.out.println(var); + System.out.println("Universe:\t[" + var.getUniverseMin() + " , " + var.getUniverseMax() + "]: " + var.getValue()); + } + + //--- + // Part 1 + //--- + double low = 1, mid = 2, high = 3; + fis.setVariable("low", low); + fis.setVariable("mid", mid); + fis.setVariable("high", high); + fis.evaluate(); + + if (verbose) { + System.out.println(var); + System.out.println("Universe:\t[" + var.getUniverseMin() + " , " + var.getUniverseMax() + "]: " + var.getValue()); + } + Assert.assertTrue(Math.abs(0.0 - var.getUniverseMin()) < EPSILON); + Assert.assertTrue(Math.abs(3.0 - var.getUniverseMax()) < EPSILON); + + //--- + // Part 2:Re-assign variables and make sure that the 'universe' is properly recalculated + //--- + low = 2; + mid = 4; + high = 6; + fis.setVariable("low", low); + fis.setVariable("mid", mid); + fis.setVariable("high", high); + fis.evaluate(); + + if (verbose) { + System.out.println(var); + System.out.println("Universe:\t[" + var.getUniverseMin() + " , " + var.getUniverseMax() + "]: " + var.getValue()); + } + Assert.assertTrue(Math.abs(0.0 - var.getUniverseMin()) < EPSILON); + Assert.assertTrue(Math.abs(6.0 - var.getUniverseMax()) < EPSILON); + } + /** * Test method a fuzzy system that showed NA values due to 'Triangle' membership function bug * Bug report and FCL code by Shashankrao Wankhede @@ -445,4 +495,5 @@ public class TestCaseJfuzzy extends TestCase { FIS fis = FIS.load("tests/noRules.fcl", true); if (verbose) System.out.println(fis); } + } diff --git a/src/net/sourceforge/jFuzzyLogic/testCases/TestCaseZzz.java b/src/net/sourceforge/jFuzzyLogic/testCases/TestCaseZzz.java new file mode 100644 index 0000000..37021c8 --- /dev/null +++ b/src/net/sourceforge/jFuzzyLogic/testCases/TestCaseZzz.java @@ -0,0 +1,109 @@ +/** + * + * JUnit test for jFuzzyLogic + * + * + * @author pcingola@users.sourceforge.net + */ +package net.sourceforge.jFuzzyLogic.testCases; + +import junit.framework.TestCase; +import net.sourceforge.jFuzzyLogic.FIS; +import net.sourceforge.jFuzzyLogic.Gpr; +import net.sourceforge.jFuzzyLogic.rule.Variable; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Main testing class + * + * @author pcingola@users.sourceforge.net + * + */ +public class TestCaseZzz extends TestCase { + + static double EPSILON = 0.000001; // A small number + static boolean verbose = true; // Verbose? + + /** + * Read a table of numbers as an array of integers + */ + int[][] loadMembershipFile(String fileName) { + String file = Gpr.readFile(fileName); + String lines[] = file.split(System.getProperty("line.separator")); + int numCols = lines[0].split("\t").length; + int vals[][] = new int[lines.length - 1][numCols]; + + // Parse all lines + // Skip first line (title) + for (int lineNum = 1; lineNum < lines.length; lineNum++) { + String valStr[] = lines[lineNum].split("\t"); + // Parse each line + for (int col = 0; col < numCols; col++) + vals[lineNum - 1][col] = Integer.parseInt(valStr[col]); + } + + return vals; + } + + /** + * Round a double to an integer (time 100) + */ + int doubleToInt100(double d) { + return ((int) Math.round(d * 100)); + } + + double int100ToDouble(int i) { + return (i) / 100.0; + } + + @Test + public void testMembershipWithVariables() { + Gpr.debug("Test"); + + // FCL.debug = true; + FIS fis = FIS.load("./tests/membershipWithVariables.fcl", true); + + System.out.println(fis); + Variable var = fis.getVariable("out"); + if (verbose) { + System.out.println(var); + System.out.println("Universe:\t[" + var.getUniverseMin() + " , " + var.getUniverseMax() + "]: " + var.getValue()); + } + + //--- + // Part 1 + //--- + double low = 1, mid = 2, high = 3; + fis.setVariable("low", low); + fis.setVariable("mid", mid); + fis.setVariable("high", high); + fis.evaluate(); + + if (verbose) { + System.out.println(var); + System.out.println("Universe:\t[" + var.getUniverseMin() + " , " + var.getUniverseMax() + "]: " + var.getValue()); + } + Assert.assertTrue(Math.abs(0.0 - var.getUniverseMin()) < EPSILON); + Assert.assertTrue(Math.abs(3.0 - var.getUniverseMax()) < EPSILON); + + //--- + // Part 2:Re-assign variables and make sure that the 'universe' is properly recalculated + //--- + low = 2; + mid = 4; + high = 6; + fis.setVariable("low", low); + fis.setVariable("mid", mid); + fis.setVariable("high", high); + fis.evaluate(); + + if (verbose) { + System.out.println(var); + System.out.println("Universe:\t[" + var.getUniverseMin() + " , " + var.getUniverseMax() + "]: " + var.getValue()); + } + Assert.assertTrue(Math.abs(0.0 - var.getUniverseMin()) < EPSILON); + Assert.assertTrue(Math.abs(6.0 - var.getUniverseMax()) < EPSILON); + } +} diff --git a/tests/junit_functions.fcl b/tests/junit_functions.fcl index 76a2cb6..2f25bfb 100644 --- a/tests/junit_functions.fcl +++ b/tests/junit_functions.fcl @@ -23,6 +23,7 @@ FUZZIFY inVar END_FUZZIFY DEFUZZIFY outVar + DEFAULT = 0 TERM low := FUNCTION (inVar * 1.0); TERM mid := FUNCTION (inVar * 2.0) + 1; TERM high := FUNCTION (inVar * 3.0) + 5 * SIN(inVar); diff --git a/tests/membershipWithVariables.fcl b/tests/membershipWithVariables.fcl new file mode 100644 index 0000000..6ba3b8a --- /dev/null +++ b/tests/membershipWithVariables.fcl @@ -0,0 +1,25 @@ + +FUNCTION_BLOCK MembershipWithVariables + +VAR_INPUT + mid : REAL; + high : REAL; + low : REAL; +END_VAR + +VAR_OUTPUT + out : REAL; +END_VAR + +DEFUZZIFY out + METHOD : COG; + DEFAULT := 4; + + TERM low := (0, 0) (low, 1) (mid, 0) ; + TERM middle := (low, 0) (mid, 1) (high, 0); + TERM high := (mid, 0) (high, 1) ; + +END_DEFUZZIFY + +END_FUNCTION_BLOCK +