Optaplanner 使用 pillarmove 和 filterClass 抛出异常

Optaplanner throws exception with pillarmove with filterClass

我在我的应用程序中将 pillarMove 配置为:

<pillarChangeMoveSelector>
                <pillarSelector>
                    <entitySelector>
                        <entityClass>com.X.Y.Z.MyEntity</entityClass>
                        <cacheType>STEP</cacheType>
                    </entitySelector>
                    <subPillarEnabled>true</subPillarEnabled>
                    <minimumSubPillarSize>1</minimumSubPillarSize>
                    <maximumSubPillarSize>40</maximumSubPillarSize>
                </pillarSelector>
                <valueSelector variableName="variable">
                </valueSelector>
                <filterClass>com.X.Y.Z.MyEntityPillarMoveFilter</filterClass>
            </pillarChangeMoveSelector>

但它抛出异常

java.lang.UnsupportedOperationException: The selector (DefaultPillarSelector(FromSolutionEntitySelector(MyEntity))) with randomSelection (true) and subPillarEnabled (true) does not support getSize() because the number of sub pillars scales exponentially. at org.optaplanner.core.impl.heuristic.selector.entity.pillar.DefaultPillarSelector.getSize(DefaultPillarSelector.java:180) at org.optaplanner.core.impl.heuristic.selector.move.generic.PillarChangeMoveSelector.getSize(PillarChangeMoveSelector.java:73) at org.optaplanner.core.impl.heuristic.selector.move.decorator.FilteringMoveSelector.determineBailOutSize(FilteringMoveSelector.java:119) at org.optaplanner.core.impl.heuristic.selector.move.decorator.FilteringMoveSelector.iterator(FilteringMoveSelector.java:78) at org.optaplanner.core.impl.heuristic.selector.move.composite.UnionMoveSelector$RandomUnionMoveIterator.(UnionMoveSelector.java:144) at org.optaplanner.core.impl.heuristic.selector.move.composite.UnionMoveSelector.iterator(UnionMoveSelector.java:129)

PillarMove 在没有过滤器的情况下用处不大,因为它会 select 所有实体。相比之下,启用没有过滤器的 subPillar 在我的用例中也没有太大帮助。

optaplanner 是否支持带 filterClass 的 pillarMove?

目前不支持。

这是由于至少在 7.6 之前出现了一个更普遍的问题。0.Final:选择过滤的 bailOut 计算使用了并不总是受支持的 getSize()(不可能支持支柱移动).