diff --git a/jsprit-analysis/src/main/java/analysis/Benchmarker.java b/jsprit-analysis/src/main/java/analysis/Benchmarker.java deleted file mode 100644 index 0b8d8f43..00000000 --- a/jsprit-analysis/src/main/java/analysis/Benchmarker.java +++ /dev/null @@ -1,93 +0,0 @@ -package analysis; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import util.Solutions; -import algorithms.VehicleRoutingAlgorithms; -import basics.VehicleRoutingAlgorithm; -import basics.VehicleRoutingProblem; -import basics.VehicleRoutingProblemSolution; -import basics.algo.VehicleRoutingAlgorithmListeners.Priority; - -public class Benchmarker { - - static class Problem { - public final String name; - public final VehicleRoutingProblem vrp; - public final Double bestKnown; - public Problem(String name, VehicleRoutingProblem vrp, Double bestKnown) { - super(); - this.name = name; - this.vrp = vrp; - this.bestKnown = bestKnown; - } - } - - static class Result { - public final double result; - public final double time; - public final Problem problem; - public Double delta = null; - public Result(Problem p, double result, double time) { - super(); - this.result = result; - this.time = time; - this.problem = p; - } - void setBestKnownDelta(double delta){ - this.delta = delta; - } - } - - private String algorithmConfig; - - private List problems = new ArrayList(); - - public Benchmarker(String algorithmConfig) { - super(); - this.algorithmConfig = algorithmConfig; - } - - public void addProblem(String name, VehicleRoutingProblem problem){ - problems.add(new Problem(name,problem,null)); - } - - public void addProblem(String name, VehicleRoutingProblem problem, double bestKnown){ - problems.add(new Problem(name,problem,bestKnown)); - } - - public void run(){ - List results = new ArrayList(); - for(Problem p : problems){ - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(p.vrp, algorithmConfig); - StopWatch stopwatch = new StopWatch(); - vra.getAlgorithmListeners().addListener(stopwatch,Priority.HIGH); - Collection solutions = vra.searchSolutions(); - VehicleRoutingProblemSolution best = Solutions.getBest(solutions); - Result result = new Result(p,best.getCost(),stopwatch.getCompTimeInSeconds()); - if(p.bestKnown != null) result.setBestKnownDelta((best.getCost()/p.bestKnown-1)); - results.add(result); - } - print(results); - } - - private void print(List results) { - System.out.println("instance,time [in sec],result,delta [in percent to bestKnown]"); - double sumTime=0.0; - double sumResult=0.0; - for(Result r : results){ - sumTime+=r.time; - sumResult+=r.result; - System.out.println("[instance="+r.problem.name+"][time="+round(r.time,2)+"][result="+round(r.result,2)+"][delta="+round(r.delta,3)+"]"); - } - System.out.println("[avgTime="+round(sumTime/(double)results.size(),2)+"][avgResult="+round(sumResult/(double)results.size(),2)+"]"); - } - - private double round(Double delta, int i) { - long roundedVal = Math.round(delta*Math.pow(10, i)); - return (double)roundedVal/(double)(Math.pow(10, i)); - } - -} diff --git a/jsprit-analysis/src/main/java/analysis/ConcurrentBenchmarker.java b/jsprit-analysis/src/main/java/analysis/ConcurrentBenchmarker.java index bcaa0380..6d3a9817 100644 --- a/jsprit-analysis/src/main/java/analysis/ConcurrentBenchmarker.java +++ b/jsprit-analysis/src/main/java/analysis/ConcurrentBenchmarker.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * Stefan Schroeder - initial API and implementation + ******************************************************************************/ + package analysis; import java.util.ArrayList; diff --git a/jsprit-analysis/src/main/java/util/BenchmarkWriter.java b/jsprit-analysis/src/main/java/util/BenchmarkWriter.java index 6ca10b3d..97a03e6f 100644 --- a/jsprit-analysis/src/main/java/util/BenchmarkWriter.java +++ b/jsprit-analysis/src/main/java/util/BenchmarkWriter.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * Stefan Schroeder - initial API and implementation + ******************************************************************************/ + package util; import java.util.Collection; diff --git a/jsprit-analysis/src/main/java/util/HtmlBenchmarkTableWriter.java b/jsprit-analysis/src/main/java/util/HtmlBenchmarkTableWriter.java index b69ac67d..b25437c3 100644 --- a/jsprit-analysis/src/main/java/util/HtmlBenchmarkTableWriter.java +++ b/jsprit-analysis/src/main/java/util/HtmlBenchmarkTableWriter.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * Stefan Schroeder - initial API and implementation + ******************************************************************************/ + package util; import java.io.BufferedWriter; diff --git a/jsprit-core/src/main/java/basics/algo/IterationWithoutImprovementBreaker.java b/jsprit-core/src/main/java/basics/algo/IterationWithoutImprovementBreaker.java index cdcfc7e4..a8f5cf44 100644 --- a/jsprit-core/src/main/java/basics/algo/IterationWithoutImprovementBreaker.java +++ b/jsprit-core/src/main/java/basics/algo/IterationWithoutImprovementBreaker.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * Stefan Schroeder - initial API and implementation + ******************************************************************************/ + package basics.algo; import org.apache.log4j.Logger; diff --git a/jsprit-core/src/main/java/basics/algo/PrematureAlgorithmBreaker.java b/jsprit-core/src/main/java/basics/algo/PrematureAlgorithmBreaker.java index 2b437872..7984924d 100644 --- a/jsprit-core/src/main/java/basics/algo/PrematureAlgorithmBreaker.java +++ b/jsprit-core/src/main/java/basics/algo/PrematureAlgorithmBreaker.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * Stefan Schroeder - initial API and implementation + ******************************************************************************/ + package basics.algo; import basics.algo.SearchStrategy.DiscoveredSolution; diff --git a/jsprit-core/src/main/java/basics/algo/TimeBreaker.java b/jsprit-core/src/main/java/basics/algo/TimeBreaker.java index ac7f4be1..806758ac 100644 --- a/jsprit-core/src/main/java/basics/algo/TimeBreaker.java +++ b/jsprit-core/src/main/java/basics/algo/TimeBreaker.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * Stefan Schroeder - initial API and implementation + ******************************************************************************/ + package basics.algo; import java.util.Collection; diff --git a/jsprit-core/src/main/java/basics/algo/VariationCoefficientBreaker.java b/jsprit-core/src/main/java/basics/algo/VariationCoefficientBreaker.java index 2629b5cf..1df0bb51 100644 --- a/jsprit-core/src/main/java/basics/algo/VariationCoefficientBreaker.java +++ b/jsprit-core/src/main/java/basics/algo/VariationCoefficientBreaker.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * Stefan Schroeder - initial API and implementation + ******************************************************************************/ + package basics.algo; import java.util.Collection;