Package jsprit.core.analysis

Examples of jsprit.core.analysis.SolutionAnalyser$LoadAndActivityCounter


    Plotter plotter = new Plotter(vrp, solution);
    plotter.setLabel(Label.SIZE);
    plotter.plot("output/pd_solomon_r101_solution.png","pd_r101");

        //some stats
        SolutionAnalyser analyser = new SolutionAnalyser(vrp,solution,new SolutionAnalyser.DistanceCalculator() {

            @Override
            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }

        });

        System.out.println("tp_distance: " + analyser.getDistance());
        System.out.println("tp_time: " + analyser.getTransportTime());
        System.out.println("waiting: " + analyser.getWaitingTime());
        System.out.println("service: " + analyser.getServiceTime());
        System.out.println("#picks: " + analyser.getNumberOfPickups());
        System.out.println("#deliveries: " + analyser.getNumberOfDeliveries());


    }
View Full Code Here


//    SolutionPlotter.plotSolutionAsPNG(vrp, solution, "output/pd_solomon_r101_solution.png","pd_r101");
//    Plotter plotter = new Plotter(vrp, solution);
//    plotter.setLabel(Label.SIZE);
//    plotter.plot("output/vrpwbh_christophides_vrpnc1_solution.png","vrpwbh_vrpnc1");

        SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new SolutionAnalyser.DistanceCalculator() {

            @Override
            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }

        });

        for(VehicleRoute route : solution.getRoutes()){
            System.out.println("------");
            System.out.println("vehicleId: " + route.getVehicle().getId());
            System.out.println("vehicleCapacity: " + route.getVehicle().getType().getCapacityDimensions() + " maxLoad: " + analyser.getMaxLoad(route));
            System.out.println("totalDistance: " + analyser.getDistance(route));
            System.out.println("waitingTime: " + analyser.getWaitingTime(route));
            System.out.println("load@beginning: " + analyser.getLoadAtBeginning(route));
            System.out.println("load@end: " + analyser.getLoadAtEnd(route));
            System.out.println("operationTime: " + analyser.getOperationTime(route));
            System.out.println("serviceTime: " + analyser.getServiceTime(route));
            System.out.println("transportTime: " + analyser.getTransportTime(route));
            System.out.println("transportCosts: " + analyser.getVariableTransportCosts(route));
            System.out.println("fixedCosts: " + analyser.getFixedCosts(route));
            System.out.println("capViolationOnRoute: " + analyser.getCapacityViolation(route));
            System.out.println("capViolation@beginning: " + analyser.getCapacityViolationAtBeginning(route));
            System.out.println("capViolation@end: " + analyser.getCapacityViolationAtEnd(route));
            System.out.println("timeWindowViolationOnRoute: " + analyser.getTimeWindowViolation(route));
            System.out.println("skillConstraintViolatedOnRoute: " + analyser.hasSkillConstraintViolation(route));

            System.out.println("dist@" + route.getStart().getLocationId() + ": " + analyser.getDistanceAtActivity(route.getStart(),route));
            System.out.println("timeWindowViolation@"  + route.getStart().getLocationId() + ": " + analyser.getTimeWindowViolationAtActivity(route.getStart(), route));
            for(TourActivity act : route.getActivities()){
                System.out.println("--");
                System.out.println("actType: " + act.getName() + " demand: " + act.getSize());
                System.out.println("dist@" + act.getLocationId() + ": " + analyser.getDistanceAtActivity(act,route));
                System.out.println("load(before)@" + act.getLocationId() + ": " + analyser.getLoadJustBeforeActivity(act,route));
                System.out.println("load(after)@" + act.getLocationId() + ": " + analyser.getLoadRightAfterActivity(act, route));
                System.out.println("transportCosts@" + act.getLocationId() + ": " + analyser.getVariableTransportCostsAtActivity(act,route));
                System.out.println("capViolation(after)@" + act.getLocationId() + ": " + analyser.getCapacityViolationAfterActivity(act,route));
                System.out.println("timeWindowViolation@"  + act.getLocationId() + ": " + analyser.getTimeWindowViolationAtActivity(act,route));
                System.out.println("skillConstraintViolated@" + act.getLocationId() + ": " + analyser.hasSkillConstraintViolationAtActivity(act, route));
            }
            System.out.println("--");
            System.out.println("dist@" + route.getEnd().getLocationId() + ": " + analyser.getDistanceAtActivity(route.getEnd(),route));
            System.out.println("timeWindowViolation@"  + route.getEnd().getLocationId() + ": " + analyser.getTimeWindowViolationAtActivity(route.getEnd(),route));
        }

        System.out.println("-----");
        System.out.println("aggreate solution stats");
        System.out.println("total freight moved: " + Capacity.addup(analyser.getLoadAtBeginning(),analyser.getLoadPickedUp()));
        System.out.println("total no. picks at beginning: " + analyser.getNumberOfPickupsAtBeginning());
        System.out.println("total no. picks on routes: " + analyser.getNumberOfPickups());
        System.out.println("total picked load at beginnnig: " + analyser.getLoadAtBeginning());
        System.out.println("total picked load on routes: " + analyser.getLoadPickedUp());
        System.out.println("total no. deliveries at end: " + analyser.getNumberOfDeliveriesAtEnd());
        System.out.println("total no. deliveries on routes: " + analyser.getNumberOfDeliveries());
        System.out.println("total delivered load at end: " + analyser.getLoadAtEnd());
        System.out.println("total delivered load on routes: " + analyser.getLoadDelivered());
        System.out.println("total tp_distance: " + analyser.getDistance());
        System.out.println("total tp_time: " + analyser.getTransportTime());
        System.out.println("total waiting_time: " + analyser.getWaitingTime());
        System.out.println("total service_time: " + analyser.getServiceTime());
        System.out.println("total operation_time: " + analyser.getOperationTime());
        System.out.println("total twViolation: " + analyser.getTimeWindowViolation());
        System.out.println("total capViolation: " + analyser.getCapacityViolation());
        System.out.println("total fixedCosts: " + analyser.getFixedCosts());
        System.out.println("total variableCosts: " + analyser.getVariableTransportCosts());
        System.out.println("total costs: " + analyser.getTotalCosts());

    }
View Full Code Here

    }

    public VrpJsonWriter(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, SolutionAnalyser.DistanceCalculator distanceCalculator){
        this.vrp = vrp;
        this.solution = solution;
        this.solutionAnalyzer = new SolutionAnalyser(vrp,solution,distanceCalculator);
    }
View Full Code Here

TOP

Related Classes of jsprit.core.analysis.SolutionAnalyser$LoadAndActivityCounter

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.