gpt4 book ai didi

java - 流口水返回最低显着性规则

转载 作者:行者123 更新时间:2023-12-01 21:08:30 26 4
gpt4 key购买 nike

我遇到了匹配多个规则并获取显着性最低的规则的问题。这是源文件。

package HotelAnalyticsLuxuryPromotions 
#generated from Decision Table
import com.mmt.analytics.hotel.promotions.drools.HotelPromotionsDroolsPojo;
import com.mmt.analytics.hotel.promotions.drools.HotelPromotionsDroolRules;
#From row number: 11
rule "for Luxury Hotel Promotions_11"
salience 9
when
fact: HotelPromotionsDroolsPojo(
eval(HotelPromotionsDroolRules.checkHotelId(fact,"12345")),
eval(HotelPromotionsDroolRules.checkRsq(fact,"*")),
eval(HotelPromotionsDroolRules.checkValidCheckInCheckOut(fact,"*")),
eval(HotelPromotionsDroolRules.checkLoggedStatus(fact,"*")))
eval(HotelPromotionsDroolRules.checkActiveStatus(fact,"1"))
then
fact.setPackageName("Pack 2");
fact.setRatePlanCode("ABC 2");
fact.setTariffUrl("TariffUrl");
fact.setClickUrl("ClickUrl");
fact.setInclusionText("InclusionText");
end

#From row number: 12
rule "for Luxury Hotel Promotions_12"
salience 10
when
fact: HotelPromotionsDroolsPojo(
eval(HotelPromotionsDroolRules.checkHotelId(fact,"12345")),
eval(HotelPromotionsDroolRules.checkRsq(fact,"*")),
eval(HotelPromotionsDroolRules.checkValidCheckInCheckOut(fact,"*")),
eval(HotelPromotionsDroolRules.checkLoggedStatus(fact,"*")))
eval(HotelPromotionsDroolRules.checkActiveStatus(fact,"1"))
then
fact.setPackageName("Pack 1");
fact.setRatePlanCode("ABC 1");
fact.setTariffUrl("TariffUrl");
fact.setClickUrl("ClickUrl");
fact.setInclusionText("InclusionText");
end

#From row number: 14
rule "for Luxury Hotel Promotions_14"
salience 5
when
fact:HotelPromotionsDroolsPojo(
eval(HotelPromotionsDroolRules.checkHotelId(fact,"12345")),
eval(HotelPromotionsDroolRules.checkRsq(fact,"*")),
eval(HotelPromotionsDroolRules.checkValidCheckInCheckOut(fact,"*")),
eval(HotelPromotionsDroolRules.checkLoggedStatus(fact,"*")))
eval(HotelPromotionsDroolRules.checkActiveStatus(fact,"1"))
then
fact.setPackageName("Pack 3");
fact.setRatePlanCode("ABC 3");
fact.setTariffUrl("TariffUrl");
fact.setClickUrl("ClickUrl");
fact.setInclusionText("InclusionText");
end

我认为必须返回具有最高优先级的规则,但我得到的恰恰相反。

下面是规则引擎的代码

   StatelessKnowledgeSession kSession = promotionsDroolManager.getStatelessSession();
kSession.execute(droolsPojo);

我正在使用这些 Drool 配置属性

promotions.drools.agent.scan.resources=true
promotions.drools.agent.scan.directories=true
promotions.drools.resource.scanner.interval=1800
promotions.drools.agent.monitor.change.set.events=true
promotions.drools.knowledge.agent.name=Promotions_Knowledge_agent
promotions.drools.base.knowledge.agent.change.set.path=promotions.xml

请。建议

最佳答案

如果您使用 kie workbench 进行规则建模,则可以添加显着性属性列,如下所示。这将确保表中的最后一条规则具有最高优先级。

salience column

关于java - 流口水返回最低显着性规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41751835/

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