我为项目创建了一个模糊的规则库。我正在测试规则是否有效。我试图从下面给出的规则中明确地测试规则7(尽管模糊控制器具有写在其中的所有规则)。
RULE 7 : IF hotelClass IS aboveAverage AND travellerType IS familyMan AND room IS poor THEN trustWeight IS medium;
我打算保持“hotelClass”,“travllerType”不变,同时只更改“room”值以检查输出的行为方式。代码是:
for (double room = 0.0; room <= 10; room += 0.1) {
fis.getVariable("room").setValue(room);
fis.getVariable("hotelClass").setValue(5);
fis.getVariable("travellerType").setValue(travellerType);
fis.evaluate();
// Print result & update plot
System.out.println(String.format("Room: %2.2f\t=> tweight: %2.2f ", room, fis.getVariable("trustWeight").getValue()));
}
但似乎当我完成所有规则时,规则不会受到影响,输出模糊设置值保持为0.但我没有问题,当我的模糊控制器仅有一条规则。
这些是原始控制器文件中的规则:
RULE 1 : IF hotelClass IS aboveAverage AND travellerType IS businessMan AND room IS poor THEN trustWeight IS high;
RULE 2 : IF hotelClass IS aboveAverage AND travellerType IS businessMan AND service IS poor THEN trustWeight IS high;
RULE 3 : IF hotelClass IS aboveAverage AND travellerType IS businessMan AND room IS excellent THEN trustWeight IS less;
RULE 4 : IF hotelClass IS aboveAverage AND travellerType IS businessMan AND service IS excellent THEN trustWeight IS less;
RULE 5 : IF hotelClass IS aboveAverage AND travellerType IS businessMan AND room IS good THEN trustWeight IS medium;
RULE 6 : IF hotelClass IS aboveAverage AND travellerType IS businessMan AND service IS good THEN trustWeight IS medium;
RULE 7 : IF hotelClass IS aboveAverage AND travellerType IS familyMan AND room IS poor THEN trustWeight IS medium;
RULE 8 : IF hotelClass IS aboveAverage AND travellerType IS familyMan AND service IS poor THEN trustWeight IS medium;
RULE 9 : IF hotelClass IS aboveAverage AND travellerType IS familyMan AND room IS excellent THEN trustWeight IS medium;
RULE 10 : IF hotelClass IS aboveAverage AND travellerType IS familyMan AND service IS excellent THEN trustWeight IS medium;
RULE 11 : IF hotelClass IS aboveAverage AND travellerType IS familyMan AND room IS good THEN trustWeight IS high;
RULE 12 : IF hotelClass IS aboveAverage AND travellerType IS familyMan AND service IS good THEN trustWeight IS high;
其他信息:
谁能告诉我出错的地方或地点?任何评论,指示,解释等都会有所帮助。
答案 0 :(得分:0)
您是否尝试过确保规则中没有矛盾?如果房间很差并且服务很好会怎么样?