1

在修改应用算法时遇到了一些问题:首先,我似乎无法更改后期接受算法配置。这是我的本地搜索配置,当我既没有指定接受者也没有指定觅食者时,它可以很好地工作:

<localSearch>
    <localSearchType>LATE_ACCEPTANCE</localSearchType>
    <acceptor>
            <lateAcceptanceSize>5000</lateAcceptanceSize>
            <entityTabuRatio>0.1</entityTabuRatio>
            <!--valueTabuSize>10000</valueTabuSize-->
    </acceptor>
    <forager>
        <acceptedCountLimit>1</acceptedCountLimit>
    </forager>
    <termination>
              <minutesSpentLimit>10</minutesSpentLimit>
              <bestScoreLimit>[0/11496/11496]hard/[0]soft</bestScoreLimit>
        </termination>
</localSearch>

我收到此错误消息作为输出的一部分

 java.lang.IllegalArgumentException: The localSearchType (... 
java.lang.IllegalArgumentException: The localSearchType (LATE_ACCEPTANCE) must not be configured if the acceptorConfig (AcceptorConfig()) is explicitly configured.
        at org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig.buildAcceptor(LocalSearchPhaseConfig.java:182)
        at org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig.buildDecider(LocalSearchPhaseConfig.java:132) 
        at org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig.buildPhase(LocalSearchPhaseConfig.java:117) 
        at org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig.buildPhase(LocalSearchPhaseConfig.java:54) 
        at org.optaplanner.core.config.solver.SolverConfig.buildPhaseList(SolverConfig.java:364) 
        at org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:270) 
        at org.optaplanner.core.impl.solver.AbstractSolverFactory.buildSolver(AbstractSolverFactory.java:61) 
        at com.gmv.g2gmps.CBand.App.main(App.java:75) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
        at java.lang.reflect.Method.invoke(Method.java:498) 
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282) 
        at java.lang.Thread.run(Thread.java:748) 
4

1 回答 1

1

最后被告知同时配置LATE_ACCEPTANCE和lateAcceptanceSize不兼容。因此,我将延迟接受大小设置为唯一参数(因此延迟接受作为接受者),而不是将其写为本地搜索类型。

<localSearch>
    <acceptor>
        <lateAcceptanceSize>5000</lateAcceptanceSize>
        <entityTabuRatio>0.1</entityTabuRatio>
        <!--valueTabuSize>10000</valueTabuSize-->
    </acceptor>
    <forager>
        <acceptedCountLimit>1</acceptedCountLimit>
    </forager>
    <termination>
        <minutesSpentLimit>10</minutesSpentLimit>
        <bestScoreLimit>[0/11496/11496]hard/[0]soft</bestScoreLimit>
    </termination>
</localSearch>
于 2020-04-24T10:23:37.217 回答