我该如何配置延迟接受算法?

问题描述 投票:1回答:1

我在修改应用算法时遇到一些问题:首先,看来我无法更改延迟接受算法的配置。这是我的本地搜索配置,当我既未指定acceptor也未指定forager时,它会很好地工作:

<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) 
algorithm search configuration solver acceptance
1个回答
0
投票

最后,我被告知,同时配置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>

© www.soinside.com 2019 - 2024. All rights reserved.