我正在为FL项目使用jFuzzyLogic库。
我创建了一个包含三个变量的FCL文件:service,room和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
我还有两条规则(这些并非详尽无遗):
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
最终输出如下:
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
我的逻辑是,根据不同类型人的输入,应分配不同的权重。例如,当一个商人评价一个房间(5/10)并且一个家庭成员评价房间(5/10)时,输出不应该是相同的 我需要能够制定如下规则:
根据人的类型(以及其他固定因素),我应该能够获得不同的信任量结果。
这可能吗?如果是这样,我该怎么做?
答案 0 :(得分:1)
我会添加另一个输入人:
FUZZIFY person
TERM family := 1;
TERM business := 2;
END_FUZZIFY
和必要的规则:
RULE 3 : IF person IS business THEN trustWeight IS high;
RULE 4 : IF person IS family THEN trustWeight IS less;