Package org.drools.planner.core.phase.custom

Examples of org.drools.planner.core.phase.custom.DefaultCustomSolverPhase


    // Builder methods
    // ************************************************************************

    public CustomSolverPhase buildSolverPhase(EnvironmentMode environmentMode,
            SolutionDescriptor solutionDescriptor, ScoreDefinition scoreDefinition, Termination solverTermination) {
        DefaultCustomSolverPhase customSolverPhase = new DefaultCustomSolverPhase();
        configureSolverPhase(customSolverPhase, environmentMode, scoreDefinition, solverTermination);
        if (CollectionUtils.isEmpty(customSolverPhaseCommandClassList)) {
            throw new IllegalArgumentException(
                    "Configure at least 1 <customSolverPhaseCommandClass> in the <customSolverPhase> configuration.");
        }
        List<CustomSolverPhaseCommand> customSolverPhaseCommandList
                = new ArrayList<CustomSolverPhaseCommand>(customSolverPhaseCommandClassList.size());
        for (Class<CustomSolverPhaseCommand> customSolverPhaseCommandClass : customSolverPhaseCommandClassList) {
            CustomSolverPhaseCommand customSolverPhaseCommand = ConfigUtils.newInstance(this,
                    "customSolverPhaseCommandClass", customSolverPhaseCommandClass);
            customSolverPhaseCommandList.add(customSolverPhaseCommand);
        }
        customSolverPhase.setCustomSolverPhaseCommandList(customSolverPhaseCommandList);
        customSolverPhase.setForceUpdateBestSolution(forceUpdateBestSolution == null ? false : forceUpdateBestSolution);
        return customSolverPhase;
    }
View Full Code Here


    // Builder methods
    // ************************************************************************

    public CustomSolverPhase buildSolverPhase(EnvironmentMode environmentMode,
            SolutionDescriptor solutionDescriptor, ScoreDefinition scoreDefinition, Termination solverTermination) {
        DefaultCustomSolverPhase customSolverPhase = new DefaultCustomSolverPhase();
        configureSolverPhase(customSolverPhase, environmentMode, scoreDefinition, solverTermination);
        if (customSolverPhaseCommandClassList == null || customSolverPhaseCommandClassList.isEmpty()) {
            throw new IllegalArgumentException(
                    "Configure at least 1 <customSolverPhaseCommandClass> in the <customSolverPhase> configuration.");
        }
        List<CustomSolverPhaseCommand> customSolverPhaseCommandList
                = new ArrayList<CustomSolverPhaseCommand>(customSolverPhaseCommandClassList.size());
        for (Class<CustomSolverPhaseCommand> customSolverPhaseCommandClass : customSolverPhaseCommandClassList) {
            try {
                customSolverPhaseCommandList.add(customSolverPhaseCommandClass.newInstance());
            } catch (InstantiationException e) {
                throw new IllegalArgumentException("customSolverPhaseCommandClass ("
                        + customSolverPhaseCommandClass.getName() + ") does not have a public no-arg constructor", e);
            } catch (IllegalAccessException e) {
                throw new IllegalArgumentException("customSolverPhaseCommandClass ("
                        + customSolverPhaseCommandClass.getName() + ") does not have a public no-arg constructor", e);
            }
        }
        customSolverPhase.setCustomSolverPhaseCommandList(customSolverPhaseCommandList);
        return customSolverPhase;
    }
View Full Code Here

    // Builder methods
    // ************************************************************************

    public CustomSolverPhase buildSolverPhase(EnvironmentMode environmentMode,
            SolutionDescriptor solutionDescriptor, ScoreDefinition scoreDefinition, Termination solverTermination) {
        DefaultCustomSolverPhase customSolverPhase = new DefaultCustomSolverPhase();
        configureSolverPhase(customSolverPhase, environmentMode, scoreDefinition, solverTermination);
        if (customSolverPhaseCommandClassList == null || customSolverPhaseCommandClassList.isEmpty()) {
            throw new IllegalArgumentException(
                    "Configure at least 1 <customSolverPhaseCommandClass> in the <customSolverPhase> configuration.");
        }
        List<CustomSolverPhaseCommand> customSolverPhaseCommandList
                = new ArrayList<CustomSolverPhaseCommand>(customSolverPhaseCommandClassList.size());
        for (Class<CustomSolverPhaseCommand> customSolverPhaseCommandClass : customSolverPhaseCommandClassList) {
            try {
                customSolverPhaseCommandList.add(customSolverPhaseCommandClass.newInstance());
            } catch (InstantiationException e) {
                throw new IllegalArgumentException("customSolverPhaseCommandClass ("
                        + customSolverPhaseCommandClass.getName() + ") does not have a public no-arg constructor", e);
            } catch (IllegalAccessException e) {
                throw new IllegalArgumentException("customSolverPhaseCommandClass ("
                        + customSolverPhaseCommandClass.getName() + ") does not have a public no-arg constructor", e);
            }
        }
        customSolverPhase.setCustomSolverPhaseCommandList(customSolverPhaseCommandList);
        return customSolverPhase;
    }
View Full Code Here

TOP

Related Classes of org.drools.planner.core.phase.custom.DefaultCustomSolverPhase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.