1 回答
TA贡献1804条经验 获得超3个赞
我终于找到了一种编写规则的方法,该规则允许我避免在时间段上进行迭代。这个想法是在作业开始时计算使用情况
rule "Maximum usage of a resource"
when
$r : Resource()
$p : TaskAssignment($id1 : id, $ts : timeSlot != null,
resourceUsage!.ressource==$r,
$usage : resourceUsage!.usagePercent);
accumulate(TaskAssignment(timeSlot != null, timeSlot <= $ts,
endingSlot > $ts, id != $id1,
resourceUsage!.ressource==$r,
$rate : resourceUsage!.usagePercent);
$s:sum($rate);
$s + $usage > 100)
then
scoreHolder.addHardConstraintMatch(kcontext, 100-($s + $usage));
end
添加回答
举报