我有一个Planning Solution类,其中包含一个getProblemFacts()方法,用于在工作内存中加载事实。 但是我无法在DRL文件中获得事实。
部分代码段如下:
@Override
public Collection<? extends Object> getProblemFacts() {
List<Object> facts = new ArrayList<Object>();
facts.add(users);
facts.add(resources);
facts.add(availabilityList);
facts.add(fromDate);
facts.add(toDate);
return facts
}
DRL档案:
rule Rule4
when
$users : org.volcare.brms.event.User(userName == "User10")
//$value : org.volcare.brms.event.User() from $users
then
System.out.println("Test");
end
配置文件是:
<?xml version="1.0" encoding="UTF-8"?>
<solver>
<solutionClass>org.volcare.brms.event.EventSolution</solutionClass>
<planningEntityClass>com.volcare.brms.EventPlanning</planningEntityClass>
<scoreDirectorFactory>
<scoreDefinitionType>HARD_SOFT</scoreDefinitionType>
<scoreDrl>/eventrule.drl</scoreDrl>
</scoreDirectorFactory>
<termination>
<maximumSecondsSpend>90</maximumSecondsSpend>
</termination>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
<changeMoveSelector>
<valueSelector>
<variableName>eventDate</variableName>
</valueSelector>
</changeMoveSelector>
</unionMoveSelector>
<acceptor>
<entityTabuRatio>0.2</entityTabuRatio>
<lateAcceptanceSize>500</lateAcceptanceSize>
</acceptor>
<forager>
<acceptedCountLimit>4</acceptedCountLimit>
</forager>
</localSearch>
</solver>
可在DRL文件中访问规划实体。 如果我错过了什么,请告诉我。