Package org.drools.planner.core.solution

Examples of org.drools.planner.core.solution.Solution


    public Solution readSolution(File file) {
        Reader reader = null;
        try {
            // xStream.fromXml(InputStream) does not use UTF-8
            reader = new InputStreamReader(new FileInputStream(file), "UTF-8");
            Solution solution = (Solution) xStream.fromXML(reader);
            logger.info("Loaded: {}", file);
            return solution;
        } catch (IOException e) {
            throw new IllegalArgumentException("Could not read file: " + file, e);
        } finally {
View Full Code Here


    public Solution readSolution(InputStream in) {
        Reader reader = null;
        try {
            // xStream.fromXml(InputStream) does not use UTF-8
            reader = new InputStreamReader(in, "UTF-8");
            Solution solution = (Solution) xStream.fromXML(reader);
            return solution;
        } catch (IOException e) {
            throw new IllegalArgumentException("Could not read from InputStream: " + in, e);
        } finally {
            if (reader != null) {
View Full Code Here

        }
        Arrays.sort(inputFiles);
        for (File inputFile : inputFiles) {
            String inputFileName = inputFile.getName();
            if (inputFileName.endsWith(getInputFileSuffix())) {
                Solution solution = readSolution(inputFile);
                String outputFileName = inputFileName.substring(0,
                        inputFileName.length() - getInputFileSuffix().length())
                        + getOutputFileSuffix();
                File outputFile = new File(outputDir, outputFileName);
                solutionDao.writeSolution(solution, outputFile);
View Full Code Here

                    "Your working dir should be drools-planner-examples and contain: " + inputDir);
        }
        for (File inputFile : inputFiles) {
            String inputFileName = inputFile.getName();
            if (inputFileName.endsWith(getInputFileSuffix())) {
                Solution solution = solutionDao.readSolution(inputFile);
                String outputFileName = inputFileName.substring(0,
                        inputFileName.length() - getInputFileSuffix().length())
                        + getOutputFileSuffix();
                File outputFile = new File(outputDir, outputFileName);
                writeSolution(solution, outputFile);
View Full Code Here

        Collections.sort(scoreDetailList);
        return scoreDetailList;
    }

    public void importSolution(File file) {
        Solution solution = importer.readSolution(file);
        solver.setStartingSolution(solution);
    }
View Full Code Here

        Solution solution = importer.readSolution(file);
        solver.setStartingSolution(solution);
    }

    public void openSolution(File file) {
        Solution solution = solutionDao.readSolution(file);
        solver.setStartingSolution(solution);
    }
View Full Code Here

        Solution solution = solutionDao.readSolution(file);
        solver.setStartingSolution(solution);
    }

    public void saveSolution(File file) {
        Solution solution = abstractSolverScope.getWorkingSolution();
        solutionDao.writeSolution(solution, file);
    }
View Full Code Here

        Solution solution = abstractSolverScope.getWorkingSolution();
        solutionDao.writeSolution(solution, file);
    }

    public void exportSolution(File file) {
        Solution solution = abstractSolverScope.getWorkingSolution();
        exporter.writeSolution(solution, file);
    }
View Full Code Here

        move.doMove(abstractSolverScope.getWorkingMemory());
    }

    public void solve() {
        solver.solve();
        Solution solution = solver.getBestSolution();
        solver.setStartingSolution(solution);
    }
View Full Code Here

    // ************************************************************************

    public void solvingStarted(DefaultSolverScope solverScope) {
        boolean workingSolutionInitialized = solverScope.isWorkingSolutionInitialized();
        Score startingInitializedScore;
        Solution bestSolution;
        if (workingSolutionInitialized) {
            startingInitializedScore = solverScope.calculateScoreFromWorkingMemory();
            bestSolution = solverScope.getWorkingSolution().cloneSolution();
        } else {
            startingInitializedScore = null;
View Full Code Here

TOP

Related Classes of org.drools.planner.core.solution.Solution

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.