diff --git a/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java b/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java index b44821f6..741e3f79 100644 --- a/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java +++ b/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java @@ -30,8 +30,10 @@ import jsprit.core.problem.vehicle.PenaltyVehicleType; * Printer to print the details of a vehicle-routing-problem solution. * * @author stefan schroeder + * @deprecated use jsprit.core.reporting.SolutionPrinter instead * */ +@Deprecated public class SolutionPrinter { /** @@ -93,7 +95,7 @@ public class SolutionPrinter { System.out.format("+---------------+------------------------------------------+%n"); System.out.format(leftAlignSolution, "costs",solution.getCost()); System.out.format(leftAlignSolution, "nVehicles",solution.getRoutes().size()); - System.out.format(leftAlignSolution, "badJobs", solution.getUnassignedJobs().size()); + System.out.format(leftAlignSolution, "unassignedJobs", solution.getUnassignedJobs().size()); System.out.format("+----------------------------------------------------------+%n"); if(print.equals(Print.VERBOSE)){ diff --git a/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java b/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java index 22abcc1b..6efd27a2 100644 --- a/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java +++ b/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java @@ -77,10 +77,10 @@ public class SolutionPrinter { System.out.printf("| indicator | value |%n"); System.out.format("+---------------+----------+%n"); - System.out.format(leftAlign, "nJobs", problem.getJobs().values().size()); + System.out.format(leftAlign, "noJobs", problem.getJobs().values().size()); Jobs jobs = getNuOfJobs(problem); - System.out.format(leftAlign, "nServices",jobs.nServices); - System.out.format(leftAlign, "nShipments",jobs.nShipments); + System.out.format(leftAlign, "noServices",jobs.nServices); + System.out.format(leftAlign, "noShipments",jobs.nShipments); System.out.format(leftAlign, "fleetsize",problem.getFleetSize().toString()); System.out.format("+--------------------------+%n"); @@ -92,7 +92,8 @@ public class SolutionPrinter { System.out.printf("| indicator | value |%n"); System.out.format("+---------------+------------------------------------------+%n"); System.out.format(leftAlignSolution, "costs",solution.getCost()); - System.out.format(leftAlignSolution, "nVehicles",solution.getRoutes().size()); + System.out.format(leftAlignSolution, "noVehicles",solution.getRoutes().size()); + System.out.format(leftAlignSolution, "unassgndJobs", solution.getUnassignedJobs().size()); System.out.format("+----------------------------------------------------------+%n"); if(print.equals(Print.VERBOSE)){ @@ -130,6 +131,14 @@ public class SolutionPrinter { } System.out.format("+*:=PenaltyVehicle+%n"); System.out.format("+--------------------------------------------------------------------------------------------------------------------------------+%n"); + System.out.format("+----------------+%n"); + System.out.format("| unassignedJobs |%n"); + System.out.format("+----------------+%n"); + String unassignedJobAlgin = "| %-14s |%n"; + for(Job j : solution.getUnassignedJobs()){ + System.out.format(unassignedJobAlgin,j.getId()); + } + System.out.format("+----------------+%n"); } private static String getVehicleString(VehicleRoute route) { diff --git a/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java b/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java index 6aa3d626..633825a0 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java +++ b/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java @@ -16,8 +16,9 @@ ******************************************************************************/ package jsprit.examples; -import jsprit.analysis.toolbox.*; -import jsprit.analysis.toolbox.SolutionPrinter.Print; +import jsprit.analysis.toolbox.GraphStreamViewer; +import jsprit.analysis.toolbox.Plotter; +import jsprit.analysis.toolbox.StopWatch; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority; @@ -28,6 +29,7 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; @@ -105,12 +107,12 @@ public class MultipleDepotExampleWithPenaltyVehicles { * solve the problem */ VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml"); - vra.setMaxIterations(5000); + vra.setMaxIterations(1); vra.getAlgorithmListeners().addListener(new StopWatch(),Priority.HIGH); - vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png")); +// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png")); Collection solutions = vra.searchSolutions(); - SolutionPrinter.print(vrp,Solutions.bestOf(solutions),Print.VERBOSE); + SolutionPrinter.print(vrp, Solutions.bestOf(solutions), jsprit.core.reporting.SolutionPrinter.Print.VERBOSE); new Plotter(vrp, Solutions.bestOf(solutions)).plot("output/p08_solution.png", "p08");