Reputation: 891
I am using jFuzzyLogic library for a FL project.
I have created a FCL file that has three variables, service, room and food.
FUZZIFY food
TERM bad := (0, 1) (4, 0) ;
TERM good := (1, 0) (4,1) (6,1) (9,0);
TERM excellent := (6, 0) (9, 1);
END_FUZZIFY
FUZZIFY service
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 room
TERM poor := (0, 1) (4, 0) ;
TERM good := (1, 0) (4,1) (6,1) (9,0);
TERM excellent := (6, 0) (9, 1);
END_FUZZIFY
I also have two rules (these are not exhaustive) that are :
RULEBLOCK rules
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 food IS bad OR service IS poor OR room IS poor THEN trustWeight IS less;
RULE 2 : IF food IS excellent OR service IS excellent OR room IS excellent THEN trustWeight IS high;
END_RULEBLOCK
The final output is of the following set:
DEFUZZIFY trustWeight
TERM less := (0,0) (0.25,1) (0.5,0);
TERM high := (0.5,0) (0.75,1) (1,0);
METHOD : COG; // Use 'Center Of Gravity' defuzzification method
DEFAULT := 0; // Default value is 0 (if no rule activates defuzzifier)
END_DEFUZZIFY
My logic is that based on the input from different types of people, different weights should be allocated. For example when a businessman rates a room(5/10) and a familyman rates a room(5/10), the output shouldn't be the same I need to be able to have rules that's like the following:
Based on the type of person (and other fixed factors) I should be able to get differentTrustWeight results.
Is this possible to be done? If so, how can I do it?
Upvotes: 0
Views: 506
Reputation: 55
I would add another input person:
FUZZIFY person
TERM family := 1;
TERM business := 2;
END_FUZZIFY
and the necessary rules:
RULE 3 : IF person IS business THEN trustWeight IS high;
RULE 4 : IF person IS family THEN trustWeight IS less;
Upvotes: 1