From ab460f065f26b7b341dbc63f36f4d1febf4bc6ec Mon Sep 17 00:00:00 2001 From: oblonski Date: Thu, 22 Jan 2015 09:20:50 +0100 Subject: [PATCH] remove deprecated SolutionPrinter --- .../analysis/toolbox/SolutionPrinter.java | 159 ------------------ 1 file changed, 159 deletions(-) delete mode 100644 jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java diff --git a/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java b/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java deleted file mode 100644 index ef6b8fb6..00000000 --- a/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2014 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package jsprit.analysis.toolbox; - -import jsprit.core.problem.VehicleRoutingProblem; -import jsprit.core.problem.job.Job; -import jsprit.core.problem.job.Service; -import jsprit.core.problem.job.Shipment; -import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.solution.route.VehicleRoute; -import jsprit.core.problem.solution.route.activity.TourActivity; -import jsprit.core.problem.solution.route.activity.TourActivity.JobActivity; -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 { - - /** - * Enum to indicate verbose-level. - * - *

Print.CONCISE and Print.VERBOSE are available. - * - * @author stefan schroeder - * - */ - public enum Print { - - CONCISE,VERBOSE - } - - /** - * Prints costs and #vehicles to stdout (System.out.println). - * - * @param solution - */ - public static void print(VehicleRoutingProblemSolution solution){ - System.out.println("[costs="+solution.getCost() + "]"); - System.out.println("[#vehicles="+solution.getRoutes().size() + "]"); - - } - - private static class Jobs { - int nServices; - int nShipments; - public Jobs(int nServices, int nShipments) { - super(); - this.nServices = nServices; - this.nShipments = nShipments; - } - } - - public static void print(VehicleRoutingProblem problem, VehicleRoutingProblemSolution solution, Print print){ - String leftAlign = "| %-13s | %-8s | %n"; - - System.out.format("+--------------------------+%n"); - System.out.printf("| problem |%n"); - System.out.format("+---------------+----------+%n"); - System.out.printf("| indicator | value |%n"); - System.out.format("+---------------+----------+%n"); - - System.out.format(leftAlign, "nJobs", 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, "fleetsize",problem.getFleetSize().toString()); - System.out.format("+--------------------------+%n"); - - - String leftAlignSolution = "| %-13s | %-40s | %n"; - System.out.format("+----------------------------------------------------------+%n"); - System.out.printf("| solution |%n"); - System.out.format("+---------------+------------------------------------------+%n"); - 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, "unassignedJobs", solution.getUnassignedJobs().size()); - System.out.format("+----------------------------------------------------------+%n"); - - if(print.equals(Print.VERBOSE)){ - printVerbose(problem,solution); - } - } - - private static void printVerbose(VehicleRoutingProblem problem, VehicleRoutingProblemSolution solution) { - String leftAlgin = "| %-7s | %-20s | %-21s | %-15s | %-15s | %-15s | %-15s |%n"; - System.out.format("+--------------------------------------------------------------------------------------------------------------------------------+%n"); - System.out.printf("| detailed solution |%n"); - System.out.format("+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+%n"); - System.out.printf("| route | vehicle | activity | job | arrTime | endTime | costs |%n"); - int routeNu = 1; - for(VehicleRoute route : solution.getRoutes()){ - System.out.format("+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+%n"); - double costs = 0; - System.out.format(leftAlgin, routeNu, getVehicleString(route), route.getStart().getName(), "-", "undef", Math.round(route.getStart().getEndTime()),Math.round(costs)); - TourActivity prevAct = route.getStart(); - for(TourActivity act : route.getActivities()){ - String jobId; - if(act instanceof JobActivity) jobId = ((JobActivity)act).getJob().getId(); - else jobId = "-"; - double c = problem.getTransportCosts().getTransportCost(prevAct.getLocation(), act.getLocation(), prevAct.getEndTime(), route.getDriver(), route.getVehicle()); - c+= problem.getActivityCosts().getActivityCost(act, act.getArrTime(), route.getDriver(), route.getVehicle()); - costs+=c; - System.out.format(leftAlgin, routeNu, getVehicleString(route), act.getName(), jobId, Math.round(act.getArrTime()), Math.round(act.getEndTime()),Math.round(costs)); - prevAct=act; - } - double c = problem.getTransportCosts().getTransportCost(prevAct.getLocation(), route.getEnd().getLocation(), prevAct.getEndTime(), route.getDriver(), route.getVehicle()); - c+= problem.getActivityCosts().getActivityCost(route.getEnd(), route.getEnd().getArrTime(), route.getDriver(), route.getVehicle()); - costs+=c; - System.out.format(leftAlgin, routeNu, getVehicleString(route), route.getEnd().getName(), "-", Math.round(route.getEnd().getArrTime()), "undef", Math.round(costs)); - routeNu++; - } - System.out.format("+*:=PenaltyVehicle+%n"); - System.out.format("+--------------------------------------------------------------------------------------------------------------------------------+%n"); - System.out.format("+*:=badJobs+%n"); - for(Job j : solution.getUnassignedJobs()){ - System.out.println(j.getId()); - } - } - - private static String getVehicleString(VehicleRoute route) { - if(route.getVehicle().getType() instanceof PenaltyVehicleType){ - return route.getVehicle().getId()+"*"; - } - return route.getVehicle().getId(); - } - - private static Jobs getNuOfJobs(VehicleRoutingProblem problem) { - int nShipments = 0; - int nServices = 0; - for(Job j : problem.getJobs().values()){ - if(j instanceof Shipment) nShipments++; - if(j instanceof Service) nServices++; - } - return new Jobs(nServices,nShipments); - } - -}