0

問題のファクト クラスはスコアの制約によって使用されますが、計画中に変更されない (問題が同じままである限り) というステートメントに関する明確化が必要です。

Optaplanner は、問題のプロパティが Fact Values に依存するシナリオを処理 (および最適化されたソリューションを返す) できますか?

例: 配車ルートの問題で、optaplanner エンジンは、Location_A から Location_B に移動するのに Vehicle_0 よりも Vehicle_1 の方が時間がかかる (たとえば 1.2 倍) という事実に基づいて、最適化されたソリューションを返すことができます。

同様に、Project Job Scheduling の例では、Resource_X はタスクを完了するのに 1.2 日かかりますが、Resource_Y は同じタスクを完了するのに 0.9 日かかります。

4

1 に答える 1

0

はい、できます。いくつかの例が実際にそれを行っています。それを設計/実装するにはいくつかの方法があります。これが私が好むものです:

@PlanningEntity class TaskAssignment {
     Task task;
     @PlanningVariable Employee employee;

     public int getDuration() {
         // Warning: If affinity's or task types would change during planning (except during real-time planning ProblemFactChange of course),
         // we would need to do this through DRL or break incremental score calculation.
         return employee.getAffinityTo(task.getType()).getDuration();
     }

}


rule affinityBasedDuration
when
   TaskAssignment(employee != null, $d : duration)
then
   // addSoft(-$d)
end

引数を渡すこともできます:

when
    $a : TaskAssignment($id : id)
    $b : TaskAssignment($id < id, $d: calculateOverlap($a))
then
   // addSoft(-$d)
end


@PlanningEntity class TaskAssignment {
     ...

     public int calculateOverlap(TaskAssignment other) {
         // calculate overlap with this.startTimestamp vs other.startTimestamp
         // and this.endTimestamp vs other.endTimestamp
     }

}
于 2016-02-24T10:32:38.330 に答える