// TERM poor := (0, 1) (4, 0) ;
// TERM good := (1, 0) (4,1) (6,1) (9,0);
// TERM excellent := (6, 0) (9, 1);
// END_FUZZIFY
Value poorX[] = { new Value(0), new Value(4) };
Value poorY[] = { new Value(1), new Value(0) };
MembershipFunction poor = new MembershipFunctionPieceWiseLinear(poorX, poorY);
MembershipFunction good = new MembershipFunctionTrapetzoidal(new Value(1), new Value(4), new Value(6), new Value(9));
Value exX[] = { new Value(6), new Value(9), new Value(10) };
Value exY[] = { new Value(0), new Value(1), new Value(1) };
MembershipFunction excellent = new MembershipFunctionPieceWiseLinear(exX, exY);
LinguisticTerm ltPoor = new LinguisticTerm("poor", poor);
LinguisticTerm ltGood = new LinguisticTerm("good", good);
LinguisticTerm ltExcellent = new LinguisticTerm("excellent", excellent);
service.add(ltPoor);
service.add(ltGood);
service.add(ltExcellent);
// FUZZIFY food
// TERM rancid := (0, 1) (1, 1) (3,0) ;
// TERM delicious := (7,0) (9,1) (10,1);
// END_FUZZIFY
Value ranX[] = { new Value(0), new Value(1), new Value(3) };
Value ranY[] = { new Value(1), new Value(1), new Value(0) };
MembershipFunction rancid = new MembershipFunctionPieceWiseLinear(ranX, ranY);
Value delX[] = { new Value(7), new Value(9), new Value(10) };
Value delY[] = { new Value(0), new Value(1), new Value(1) };
MembershipFunction delicious = new MembershipFunctionPieceWiseLinear(delX, delY);
LinguisticTerm ltRancid = new LinguisticTerm("rancid", rancid);
LinguisticTerm ltDelicious = new LinguisticTerm("delicious", delicious);
food.add(ltRancid);
food.add(ltDelicious);
// DEFUZZIFY tip
// 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;
// DEFAULT := 0;
// END_DEFUZZIFY
MembershipFunction cheap = new MembershipFunctionTriangular(new Value(0), new Value(5), new Value(10));
MembershipFunction average = new MembershipFunctionTriangular(new Value(10), new Value(15), new Value(20));
MembershipFunction generous = new MembershipFunctionTriangular(new Value(20), new Value(25), new Value(30));
LinguisticTerm ltCheap = new LinguisticTerm("cheap", cheap);
LinguisticTerm ltAverage = new LinguisticTerm("average", average);
LinguisticTerm ltGenerous = new LinguisticTerm("generous", generous);