Package net.sf.cpsolver.ifs.solution

Examples of net.sf.cpsolver.ifs.solution.Solution


        if (solver.lastSolution().getBestInfo() == null)
            logger.severe("No solution found :-(");

        logger.info("Last solution:" + solver.lastSolution().getInfo());
        logger.info("Best solution:" + solver.lastSolution().getBestInfo());
        Solution best = solver.lastSolution();
        best.restoreBest();
        int value = 0;
        for (Enumeration iv = best.getModel().assignedVariables().elements(); iv.hasMoreElements();) {
            value += (int) ((Variable) iv.nextElement()).getAssignment().toDouble();
        }

        logger.info("Last solution:" + best.getInfo());
        logger.info(doubleFormat.format(properties.getPropertyDouble("Generator.FillFactor", 0.0)) + ";"
                + doubleFormat.format(properties.getPropertyInt("Generator.NrRooms", 0)) + ";");
        logger.info(doubleFormat.format(best.getTime()) + ";" + best.getIteration() + ";"
                + doubleFormat.format(((double) best.getIteration()) / best.getTime()) + ";");
        logger.info(best.getModel().assignedVariables().size() + ";"
                + doubleFormat.format(100.0 * best.getModel().assignedVariables().size()
                / best.getModel().variables().size()) + ";" + value);
        logger.info("    time:         " + doubleFormat.format(best.getTime()) + " s");
        logger.info("    iteration:    " + best.getIteration());
        logger.info("    speed:        " + doubleFormat.format(((double) best.getIteration())
                / best.getTime()) + " it/s");
        logger.info("    assigned:     " + best.getModel().assignedVariables().size()
                + " (" + doubleFormat.format(100.0 * best.getModel().assignedVariables().size()
                / best.getModel().variables().size()) + "%)");
        logger.info("    value:        " + value);

        // remove previous assignments
        for (Location loc : locToRoom.keySet()) {
            for (Event ev : loc.getEvents()) {
View Full Code Here

TOP

Related Classes of net.sf.cpsolver.ifs.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.