1

我试图在 Optaplanner 中将请求公平地分配给员工(基于请求的复杂性)。所以我想要一个规则来最小化分配给员工的请求复杂性的标准偏差。我尝试根据 Optaplanner 文档编写规则,

rule "fairAssignment"
salience 1
    when
        $employee : Employee($possType: possibleProblemTypes, $availableTime: availableTime)
        $complexityTotal: Number() from accumulate
                            (Request(employee==$employee,problemType memberOf $possType,$Complexity :     complexity),sum(complexity))
    then
        scoreHolder.addSoftConstraintMatch(kcontext, -($complexityTotal.intValue()*     $complexityTotal.intValue()));

end

但我更喜欢标准偏差最小化的解决方案。那么你能帮我写一个“方差”的内联累积函数吗?

4

0 回答 0