Question

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?

Était-ce utile?

La solution

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).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top