Package jsprit.analysis.toolbox

Examples of jsprit.analysis.toolbox.XYLineChartBuilder


    computationalLab.setNuOfRuns(5);
       
    /*
     * plot search progress of different algorithms
     */
    final XYLineChartBuilder chartBuilder = XYLineChartBuilder.newInstance("random variations", "iterations", "costs");
    computationalLab.addListener(new CalculationListener() {
     
      @Override
      public void calculationStarts(BenchmarkInstance p, final String algorithmName,VehicleRoutingAlgorithm algorithm, final int run) {
        algorithm.addListener(new IterationStartsListener() {
         
          @Override
          public void informIterationStarts(int i, VehicleRoutingProblem problem,Collection<VehicleRoutingProblemSolution> solutions) {
            /*
             * since there will be more than 1 run and we want to plot each run, we need to specify an apropriate
             * XYSeries-name. Thus we add run to algorithmName.
             */
            chartBuilder.addData(algorithmName+"_"+run, i, Solutions.bestOf(solutions).getCost());
          }
         
        });
       
      }
     
      @Override
      public void calculationEnds(BenchmarkInstance p, String algorithmName,VehicleRoutingAlgorithm algorithm, int run,Collection<VehicleRoutingProblemSolution> solutions) {}
     
    });
   
    computationalLab.setThreads(2);
    /*
     * run the experiments
     */
    computationalLab.run();
   
    /*
     * plot the lineChart
     */
    XYLineChartBuilder.saveChartAsPNG(chartBuilder.build(), "output/computationalStudies_randomVariations.png");
   
  }
View Full Code Here


    computationalLab.run();
   
    /*
     * plot min, avg and max
     */
    XYLineChartBuilder chartBuilder = XYLineChartBuilder.newInstance("variations with iterations", "iterations", "costs");
    for(String algorithmName : computationalLab.getAlgorithmNames()){
      String[] nameTokens = algorithmName.split("_");
      int iteration = Integer.parseInt(nameTokens[1]);
      chartBuilder.addData("min", iteration, min(dataCollector.getData("R101", algorithmName, "costs")));
      chartBuilder.addData("max", iteration, max(dataCollector.getData("R101", algorithmName, "costs")));
      chartBuilder.addData("avg", iteration, avg(dataCollector.getData("R101", algorithmName, "costs")));
    }
   
    XYLineChartBuilder.saveChartAsPNG(chartBuilder.build(), "output/computationalStudies_min_max_avg.png");
   
   
  }
View Full Code Here

    });
       
    /*
     * plot search progress of different algorithms
     */
    final XYLineChartBuilder chartBuilder = XYLineChartBuilder.newInstance("schrimpf vs greedy", "iterations", "costs");
    computationalLab.addListener(new CalculationListener() {
     
      @Override
      public void calculationStarts(BenchmarkInstance p, final String algorithmName,VehicleRoutingAlgorithm algorithm, int run) {
        algorithm.addListener(new IterationStartsListener() {
         
          @Override
          public void informIterationStarts(int i, VehicleRoutingProblem problem,Collection<VehicleRoutingProblemSolution> solutions) {
            chartBuilder.addData(algorithmName, i, Solutions.bestOf(solutions).getCost());
          }
         
        });
       
      }
     
      @Override
      public void calculationEnds(BenchmarkInstance p, String algorithmName,VehicleRoutingAlgorithm algorithm, int run,Collection<VehicleRoutingProblemSolution> solutions) {}
     
    });
   
    computationalLab.setThreads(2);
    /*
     * run the experiments
     */
    computationalLab.run();
   
    /*
     * plot the lineChart
     */
    XYLineChartBuilder.saveChartAsPNG(chartBuilder.build(), "output/computationalStudies_schrimpf_vs_greedy.png");
   
  }
View Full Code Here

    }
       
    /*
     * plot search progress of different algorithms
     */
    final XYLineChartBuilder chartBuilder = XYLineChartBuilder.newInstance("alpha-sensitivity", "iterations", "costs");
    computationalLab.addListener(new CalculationListener() {
     
      @Override
      public void calculationStarts(BenchmarkInstance p, final String algorithmName,VehicleRoutingAlgorithm algorithm, int run) {
        algorithm.addListener(new IterationStartsListener() {
         
          @Override
          public void informIterationStarts(int i, VehicleRoutingProblem problem,Collection<VehicleRoutingProblemSolution> solutions) {
            /*
             * plot only distance-costs, i.e. without fixed costs
             */
            VehicleRoutingProblemSolution bestOf = Solutions.bestOf(solutions);
            chartBuilder.addData(algorithmName, i, bestOf.getCost()-bestOf.getRoutes().size()*100.);
          }
         
        });
       
      }
     
      @Override
      public void calculationEnds(BenchmarkInstance p, String algorithmName,VehicleRoutingAlgorithm algorithm, int run,Collection<VehicleRoutingProblemSolution> solutions) {}
     
    });
    /*
     * define dataCollector to collect an arbitrary number of indicators as well as solutions
     */
    final DataCollector dataCollector = new DataCollector();
    computationalLab.addListener(new CalculationListener() {
     
      @Override
      public void calculationStarts(BenchmarkInstance p, String algorithmName,VehicleRoutingAlgorithm algorithm, int run) {}
     
      @Override
      public void calculationEnds(BenchmarkInstance p, String algorithmName,VehicleRoutingAlgorithm algorithm, int run,Collection<VehicleRoutingProblemSolution> solutions) {
        //memorize solution
        dataCollector.addSolution(p.name, algorithmName, run, Solutions.bestOf(solutions));
      }
     
    });
    /*
     * determine number of threads to be used
     */
    computationalLab.setThreads(2);
    /*
     * run the experiments
     */
    computationalLab.run();
   
    /*
     * plot the lineChart
     */
    XYLineChartBuilder.saveChartAsPNG(chartBuilder.build(), "output/computationalStudies_alphaSensitivity.png");
   
    /*
     * print best solution
     */
    SolutionPrinter.print(vrp, Solutions.bestOf(dataCollector.getSolutions()), Print.VERBOSE);
View Full Code Here

TOP

Related Classes of jsprit.analysis.toolbox.XYLineChartBuilder

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.