Droolsは言うまでもなく、プログラミングの経験はあまりありませんが、配車ルートと同様のプロジェクトを行っています。ランダムシードに応じて、一部の動きを除いて、ほとんどすべてが正常に機能します。
問題は、ヒューリスティックフェーズが完了すると、ローカル検索フェーズが次のような奇妙な動きをすることがあるということです。
ヒューリスティックフェーズソリューション:
1日目:場所1->場所2->場所3->場所4->場所5->場所6日2:場所7->場所8->場所9->場所10
ローカル検索の移動:場所5を2日目に移動しました解決策:
1日目:場所1->場所2->場所3->場所4日2:場所5->場所6
残りの場所は日がなく(例では車両になります)、固定されていないチェーンとして残されます。
場所7->場所8->場所9->場所10->場所7->など
したがって、プログラムがそれらのいずれかの日を探すとき、それは無限ループに入ります。明らかに、問題はそのループから抜け出す方法ではなく(私はその初心者ではありません)、それらの動きを回避する方法です。
例と同じソルバー構成(ソルバークラスの変更など)を使用しているので、なぜそれらの動きをするのかわかりません。自分のMoveクラスをコーディングする必要があると思いますが、コーディング方法の例もMoveFactoryも見つかりません。私はsolver.xmlをコードブロックに残します。
MoveクラスとMoveFactoryクラスのコーディングを学ぶのに役立つリンクやヒント、およびそれを回避するための構成のヒント(ある場合)が役立ちます。
とにかく、時間と労力をありがとうございました。
<?xml version="1.0" encoding="UTF-8"?>
<solver>
<!--<environmentMode>DEBUG</environmentMode>-->
<environmentMode>PRODUCTION</environmentMode>
<solutionClass>org.tourgune.planificador.bean.Turista</solutionClass>
<planningEntityClass>org.tourgune.planificador.bean.PuntoInteres</planningEntityClass>
<scoreDirectorFactory>
<scoreDefinitionType>HARD_AND_SOFT</scoreDefinitionType>
<scoreDrl>/org/tourgune/planificador/core/planificadorScoreRules.drl</scoreDrl>
</scoreDirectorFactory>
<termination>
<maximumMinutesSpend>4</maximumMinutesSpend>
</termination>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
<selector>
<selector>
<moveFactoryClass>org.drools.planner.core.move.generic.GenericChainedChangeMoveFactory</moveFactoryClass>
</selector>
<selector>
<moveFactoryClass>org.drools.planner.core.move.generic.GenericChainedChangePartMoveFactory</moveFactoryClass>
</selector>
<!-- TODO needs a GenericChainedSwapMoveFactory and probably even a GenericChainedSwapPartMoveFactory -->
</selector>
<acceptor>
<planningEntityTabuSize>10</planningEntityTabuSize>
</acceptor>
<forager>
<minimalAcceptedSelection>0</minimalAcceptedSelection>
</forager>
</localSearch>
<!--<localSearch>-->
<!--<selector>-->
<!--<selector>-->
<!--<moveFactoryClass>org.drools.planner.core.move.generic.GenericChainedChangeMoveFactory</moveFactoryClass>-->
<!--</selector>-->
<!--<selector>-->
<!--<moveFactoryClass>org.drools.planner.core.move.generic.GenericChainedChangePartMoveFactory</moveFactoryClass>-->
<!--</selector>-->
<!--</selector>-->
<!--<acceptor>-->
<!--<simulatedAnnealingStartingTemperature>10</simulatedAnnealingStartingTemperature>-->
<!--</acceptor>-->
<!--<forager>-->
<!--<minimalAcceptedSelection>4</minimalAcceptedSelection>-->
<!--</forager>-->
<!--</localSearch>-->
</solver>