سؤال

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