3

I have implemented a whole fuzzy logic system in Java, but I am having serious issues on the defuzzification process.

In my code, I defined my inputs as time and distance, and the output is simply output. I have every linear function that constructs the input and output sets, so I have access to any value of it.

The fuzzy rules are as follows:

FuzzySet []outputs = new FuzzySet[9]; //these are the rules

outputs[0] = new FuzzySet(INSUFFICIENT, min(timeMap.get(BAD).getDegreeOfMembership(), distanceMap.get(BAD).getDegreeOfMembership()));
outputs[1] = new FuzzySet(AVERAGE_SUFICIENT, min(timeMap.get(AVERAGE).getDegreeOfMembership(), distanceMap.get(AVERAGE).getDegreeOfMembership()));
outputs[2] = new FuzzySet(SUFFICIENT, min(timeMap.get(GOOD).getDegreeOfMembership(), distanceMap.get(GOOD).getDegreeOfMembership()));
outputs[3] = new FuzzySet(AVERAGE_SUFICIENT, min(timeMap.get(GOOD).getDegreeOfMembership(), distanceMap.get(BAD).getDegreeOfMembership()));
outputs[4] = new FuzzySet(SUFFICIENT, min(timeMap.get(GOOD).getDegreeOfMembership(), distanceMap.get(AVERAGE).getDegreeOfMembership()));
outputs[5] = new FuzzySet(SUFFICIENT, min(timeMap.get(AVERAGE).getDegreeOfMembership(), distanceMap.get(GOOD).getDegreeOfMembership()));
outputs[6] = new FuzzySet(INSUFFICIENT, min(timeMap.get(AVERAGE).getDegreeOfMembership(), distanceMap.get(BAD).getDegreeOfMembership()));
outputs[7] = new FuzzySet(AVERAGE_SUFICIENT, min(timeMap.get(BAD).getDegreeOfMembership(), distanceMap.get(GOOD).getDegreeOfMembership()));
outputs[8] = new FuzzySet(INSUFFICIENT, min(timeMap.get(BAD).getDegreeOfMembership(), distanceMap.get(AVERAGE).getDegreeOfMembership()));

At each one of these rules, I first define to what set the output for those two inputs belong (could be INSUFFICIENT, AVERAGE_SUFFICIENT or SUFFICIENT). With that done, I need to move on to the defuzzication process, this is where my understanding gets a bit shady.

After going through the rules, I have three of each for each set of the output (essentially I have three values classified as SUFFICIENT, three on SUFFICIENT_AVERAGE and three of INSUFFICIENT). So now what? Are all these 9 outputs going to be part of the centroid calculation? Do I choose the maximum of all three sets and then throw them in the centroid formula? (which is what I did, but the result's aren't working when compared to matlab)

MrLore
  • 3,759
  • 2
  • 28
  • 36
theJuls
  • 6,788
  • 14
  • 73
  • 160

1 Answers1

0

I am no MATLAB expert (and I'm therefore not completely sure about the structure of your system) but assuming that INSUFFICIENT, AVERAGE_SUFFICIENT and SUFFICIENT are fuzzy sets in the conclusion, then you should only have to worry about one rule for each conclusion set: the one that gives the highest membership value. This is because rules referring to the same conclusion set usually can be thought of as being OR-ed together (disjunction), i.e. "IF rule1 OR rule2 OR...". This leaves you with three (modified) membershp functions, one for each of INSUFFICIENT, AVERAGE_SUFFICIENT and SUFFICIENT. Add these together (overlay them?) and compute the center of mass of the area below the resulting compound curve.

In my experience, however, this can be a bit time consuming. I therefore often use a "shortcut": I compute a weighted average of the MFs max-values (similar to Sugeno's approach). As I understand you already did this, but for all 9 rules, right? The shortcut works especially well when the membership functions are simple (triangular or trapezoidal) and non-skewed (symmetrical).

Hope this helps. (I noted this is a rather old question, but since it's still unanswered...)

palun
  • 38
  • 4