简体   繁体   中英

Construction Heuristics takes long time

Using Optaplanner 7.3.0 with multiple planning variable hence multiple (2) construction heuristics phases. Here is how my CH phase 2 looks like:

<constructionHeuristic>
        <queuedEntityPlacer>
            <entitySelector id="taskChainEntitySelector">
                <entityClass>....Task</entityClass>
            </entitySelector>
            <changeMoveSelector>
                <entitySelector mimicSelectorRef="taskChainEntitySelector"/>
                <valueSelector>
                    <variableName>previousTaskOrEmployee</variableName>
                </valueSelector>
            </changeMoveSelector>
        </queuedEntityPlacer>
    </constructionHeuristic>

I have 814 tasks and previousTaskOrEmployee is a chained planning variable. But this CH phase takes around 7-8 mins or more than that if I don't use any of these:
1. Caching in valueSelector (Cache:PHASE, selectionOrder:SORTED )
2. selectedCountLimit=100

The reason selectedCountLimit works as this CH phase creates a large number of moves as it goes with steps, a simple data without caching/limiting/filtering:

-814init = selectedMovesCOunt:1
..
-621init = selectedMovesCOunt:300
..
-421init = selectedMovesCOunt:500
..
-221init = selectedMovesCOunt:800// increases downwards

In same cases, I've seen moves per step to be more than 50k which is crazy

My questions:
A. Is generating so many steps by changeMove in CH normal?
B. Filtering does not make much sense in CH as variables are not initialised. So, should selectedCountLimit be used ideally?
C. My first CH phase does not take any time just a few 4-5 seconds because it's relatively lesser entities and no chains. What should be the ideal time for my CH phase 2 with 814 chained entities?

See the docs section "Scaling Construction Heuristics". There's am ulti-vars non-cartesian alternative that is much faster. And if that doesn't help enough, there's Partitioned Search (with only CH) . Both have tradeoffs though.

Also check if your score calculation speed isn't too low (it should be above 1000/sec at the very least).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM