我仍在使用OptaPlanner
来优化与VehicleRoutingExample
类似的链式规划问题。我的计划实体有一个计划变量,它是另一个计划实体。得分为HardSoftScores
,使用IncrementalScore
计算得出。
目前我遇到的问题是求解器所需的时间仍然太长,无法找到可接受的解决方案。
我想用固定数量的工人来优化问题,他们必须处理具有多个时间窗的固定数量的订单。
订单是我的链式实体,工人用作链条的锚点。 我正在计算听众对订单的开始和结束时间点。另一个监听器是在每个实体中保存每个链的锚点(因为它需要很长时间才能通过一个可能超过1000个实体的链......)
我的目标是在解算器需要超过2小时才能获得可接受的解决方案时解决大约3000个实体的问题。对于400个实体的较小问题,它需要将近5分钟,这也太长了。对于更大的问题10分钟10分钟就可以了,对于小的1分钟。
我已经与基准测试人员一起找到了最好的求解器配置...
有没有人看到让我的求解器更快的一些可能性?
P.S。:是否有机会使用多线程?,或者optaplanner是否已经使用它?
答案 0 :(得分:0)
查看6.2.0.CR2中的附近选择(以及CR1)。
它只是部分记录了......而不是所有的移动类型(只是改变和交换动作)......要耐心等待。但是一旦你到达2K实体以及更多实体,它就会变得非常好。没有它,它甚至比这张图中最差的更糟糕:
这是我本地基准测试之一的快速而脏的复制和粘贴:
<#list [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 5000] as linearDistributionSizeMaximum>
<solverBenchmark>
<name>LA Nearby LinDist max${linearDistributionSizeMaximum}</name>
<solver>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
<changeMoveSelector>
<entitySelector id="entitySelector1"/>
<valueSelector>
<nearbySelection>
<originEntitySelector mimicSelectorRef="entitySelector1"/>
<nearbyDistanceMeterClass>org.optaplanner.examples.vehiclerouting.domain.solver.nearby.CustomerNearbyDistanceMeter</nearbyDistanceMeterClass>
<linearDistributionSizeMaximum>${linearDistributionSizeMaximum}</linearDistributionSizeMaximum>
</nearbySelection>
</valueSelector>
</changeMoveSelector>
<swapMoveSelector>
<entitySelector id="entitySelector2"/>
<secondaryEntitySelector>
<nearbySelection>
<originEntitySelector mimicSelectorRef="entitySelector2"/>
<nearbyDistanceMeterClass>org.optaplanner.examples.vehiclerouting.domain.solver.nearby.CustomerNearbyDistanceMeter</nearbyDistanceMeterClass>
<linearDistributionSizeMaximum>${linearDistributionSizeMaximum}</linearDistributionSizeMaximum>
</nearbySelection>
</secondaryEntitySelector>
</swapMoveSelector>
</unionMoveSelector>
<acceptor>
<lateAcceptanceSize>200</lateAcceptanceSize>
</acceptor>
<forager>
<acceptedCountLimit>1</acceptedCountLimit>
</forager>
</localSearch>
</solver>
</solverBenchmark>
</#list>
<#list [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 5000] as parabolicDistributionSizeMaximum>
<solverBenchmark>
<name>LA Nearby ParDist max${parabolicDistributionSizeMaximum}</name>
<solver>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
<changeMoveSelector>
<entitySelector id="entitySelector1"/>
<valueSelector>
<nearbySelection>
<originEntitySelector mimicSelectorRef="entitySelector1"/>
<nearbyDistanceMeterClass>org.optaplanner.examples.vehiclerouting.domain.solver.nearby.CustomerNearbyDistanceMeter</nearbyDistanceMeterClass>
<parabolicDistributionSizeMaximum>${parabolicDistributionSizeMaximum}</parabolicDistributionSizeMaximum>
</nearbySelection>
</valueSelector>
</changeMoveSelector>
<swapMoveSelector>
<entitySelector id="entitySelector2"/>
<secondaryEntitySelector>
<nearbySelection>
<originEntitySelector mimicSelectorRef="entitySelector2"/>
<nearbyDistanceMeterClass>org.optaplanner.examples.vehiclerouting.domain.solver.nearby.CustomerNearbyDistanceMeter</nearbyDistanceMeterClass>
<parabolicDistributionSizeMaximum>${parabolicDistributionSizeMaximum}</parabolicDistributionSizeMaximum>
</nearbySelection>
</secondaryEntitySelector>
</swapMoveSelector>
</unionMoveSelector>
<acceptor>
<lateAcceptanceSize>200</lateAcceptanceSize>
</acceptor>
<forager>
<acceptedCountLimit>1</acceptedCountLimit>
</forager>
</localSearch>
</solver>
</solverBenchmark>
</#list>