문제

I can set the minimalAcceptedSelection editing SampleDroolsConfig.xml

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

Is it possibile to set this parameter at runtime?

도움이 되었습니까?

해결책

Yes:

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

See the Drools Planner manual section about configuration by Java (instead of XML).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top