2016-06-09 69 views
1

我已配置OptaPlanner與時間窗口(PDPTW)的拾取和交付問題。我的配置使用與VRPTW示例非常相似的鏈式計劃變量。 FIRST_FIT_DECREASING構建啓發式作品,以及大多數本地搜索算法。然而,當我嘗試CHEAPEST_INSERTION建設啓發式,我得到以下異常:線程 「主」 java.lang.IllegalArgumentException異常最便宜的插入OptaPlanner的PDPTW?

例外:valueSelectorConfig(ValueSelectorConfig(previousVisit))與resolvedCacheType(相位)和resolvedSelectionOrder( SORTED)需要基於EntityIndependentValueSelector(初始化(FromSolutionPropertyValueSelector(previousVisit)))。檢查您的@ValueRangeProvider註釋。

問題是我真的不明白錯誤消息。我檢查了我的@ValueRangeProvider註釋,並且一切看起來都是正確的。 This question似乎提出了類似的問題,在這裏,建議工作周圍手動排序每個實體的值範圍列表。對我而言,這種解決方法是否也適用於我的案例或如何應用它尚不清楚。

我使用OptaPlanner 6.3.0.Final。

實例化規劃者我使用了以下配置:

<?xml version="1.0" encoding="UTF-8"?> 
<solver> 
    <environmentMode>REPRODUCIBLE</environmentMode> 
    <randomType>MERSENNE_TWISTER</randomType> 
    <solutionClass>com.github.rinde.logistics.pdptw.solver.optaplanner.PDPSolution</solutionClass> 
    <entityClass>com.github.rinde.logistics.pdptw.solver.optaplanner.ParcelVisit</entityClass> 
    <entityClass>com.github.rinde.logistics.pdptw.solver.optaplanner.Visit</entityClass> 

    <scoreDirectorFactory> 
     <scoreDefinitionType>HARD_SOFT_LONG</scoreDefinitionType> 
     <incrementalScoreCalculatorClass>com.github.rinde.logistics.pdptw.solver.optaplanner.ScoreCalculator</incrementalScoreCalculatorClass> 
     <initializingScoreTrend>ONLY_DOWN</initializingScoreTrend> 
    </scoreDirectorFactory> 

    <termination> 
     <unimprovedMillisecondsSpentLimit>180000</unimprovedMillisecondsSpentLimit> 
    </termination> 

    <constructionHeuristic> 
     <constructionHeuristicType>CHEAPEST_INSERTION</constructionHeuristicType> 
    </constructionHeuristic> 

    <localSearch> 
     <unionMoveSelector> 
      <moveIteratorFactory> 
       <moveIteratorFactoryClass>com.github.rinde.logistics.pdptw.solver.optaplanner.MoveItFactory</moveIteratorFactoryClass> 
      </moveIteratorFactory> 
      <changeMoveSelector> 
       <filterClass>com.github.rinde.logistics.pdptw.solver.optaplanner.ChangeFilter</filterClass> 
      </changeMoveSelector> 
      <changeMoveSelector> 
       <entitySelector> 
        <filterClass>com.github.rinde.logistics.pdptw.solver.optaplanner.EntityFilter</filterClass> 
       </entitySelector> 
      </changeMoveSelector> 
     </unionMoveSelector> 
    </localSearch> 
</solver> 

的類定義如下:https://github.com/rinde/RinLog/tree/develop/src/main/java/com/github/rinde/logistics/pdptw/solver/optaplanner

的原因,我想嘗試CHEAPEST_INSERTION的是,我發現,我自己實施最便宜的插入優於FIRST_FIT_DECREASING連同Simulated Annealing,我發現它非常可疑。我想比較自己最便宜的插入與OptaPlanner的插入,以驗證我對OptaPlanner的使用是否正確。

更新:我只是OptaPlanner 7.0.0-SNAPSHOT試了一下,這個問題似乎是固定的(我不得不改變因API改變代碼的某些部分,而不得不改變我的項目中使用Java 8)。

+0

看起來像一個錯誤。我[創建了一個jira](https://issues.jboss.org/browse/PLANNER-597)。 –

+0

請注意,最便宜的插入不會使用太多,因爲它的縮放比First Fit更差。 –

+0

**我無法用optaplanner-example VRPTW重現最便宜的插入**。檢查您是否可以使用6.4.0.Final重現它,並將解算器配置添加到問題中。如果它是一個有效的配置,請重新打開PLANNER-597。 –

回答

0

它在OptaPlanner 6.4.0.Final中(因此也在OptaPlanner 7.X中)中修復。

事實證明,在我的配置中有一個錯誤,我使用6.3.0.Final與6.4.0.Final相反。

0

它在7.0.0.Beta1中的OptaPlanner中得到修復。