1

我可以设置 minimumAcceptedSelection 编辑 SampleDroolsConfig.xml

        ...
        <acceptor>
            <solutionTabuSize>1000</solutionTabuSize>
            <planningEntityTabuSize>7</planningEntityTabuSize>
        </acceptor>
        <forager>
            <minimalAcceptedSelection>200</minimalAcceptedSelection>
        </forager>
    </localSearch>   
</solver>

是否可以在运行时设置此参数?

4

1 回答 1

1

是的:

XmlSolverFactory solverFactory = new XmlSolverFactory(SOLVER_CONFIG);
LocalSearchSolverPhaseConfig localSearchSolverPhaseConfig = (LocalSearchSolverPhaseConfig) solverFactory.getSolverConfig().getSolverPhaseConfigList().get(1);
localSearchSolverPhaseConfig.getForagerConfig().setMinimalAcceptedSelection(200);

请参阅 Drools Planner 手册中有关通过 Java(而不是 XML)进行配置的部分。

于 2012-07-31T07:05:37.010 回答