gpt4 book ai didi

java - 在模糊逻辑中,如何添加不同视角的隶属函数?

转载 作者:行者123 更新时间:2023-12-01 11:57:56 26 4
gpt4 key购买 nike

我正在将 jFuzzyLogic 库用于 FL 项目。

我创建了一个包含三个变量的 FCL 文件:服务、房间和食物。

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)时,输出不应该相同我需要能够制定如下规则:

  • 如果是家庭成员,而且房间很糟糕,那么信任权重就会较小
  • 如果是商人,而且房间很差,那么信任权重就很高

根据人的类型(和其他固定因素),我应该能够得到不同的 TrustWeight 结果。

这可以做到吗?如果可以,我该怎么做?

最佳答案

我会添加另一个输入者:

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;

关于java - 在模糊逻辑中,如何添加不同视角的隶属函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28213739/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com