我已为OptaPlanner配置了时间窗口(PDPTW)的收货和送货问题。我的配置使用与VRPTW示例非常相似的链式计划变量。 FIRST_FIT_DECREASING构造启发式方法以及大多数本地搜索算法。但是,当我尝试CHEAPEST_INSERTION构造试探法时,出现以下异常:


  线程“主”中的异常java.lang.IllegalArgumentException:具有resolveCacheType(PHASE)和resolveSelectionOrder(SORTED)的valueSelectorConfig(ValueSelectorConfig(previousVisit))必须基于EntityIndependentValueSelector(Initialized(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)。

最佳答案

它已在7.0.0.Beta1中的OptaPlanner中修复。

关于java - 对于PDPTW,在OptaPlanner中插入成本最低?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37727544/

10-12 00:37