diff --git a/jsprit-instances/instances/.DS_Store b/jsprit-instances/instances/.DS_Store deleted file mode 100644 index eb2fd83b..00000000 Binary files a/jsprit-instances/instances/.DS_Store and /dev/null differ diff --git a/jsprit-instances/src/main/java/readers/SolomonReader.java b/jsprit-instances/src/main/java/readers/SolomonReader.java index 936d4f62..c8ce1f4b 100644 --- a/jsprit-instances/src/main/java/readers/SolomonReader.java +++ b/jsprit-instances/src/main/java/readers/SolomonReader.java @@ -68,11 +68,19 @@ public class SolomonReader { private double variableCostProjectionFactor = 1; + private double fixedCostPerVehicle = 0.0; + public SolomonReader(VehicleRoutingProblem.Builder vrpBuilder) { super(); this.vrpBuilder = vrpBuilder; } + public SolomonReader(VehicleRoutingProblem.Builder vrpBuilder, double fixedCostPerVehicle) { + super(); + this.vrpBuilder = vrpBuilder; + this.fixedCostPerVehicle=fixedCostPerVehicle; + } + public void read(String solomonFile){ vrpBuilder.setFleetSize(FleetSize.INFINITE); BufferedReader reader = getReader(solomonFile); @@ -98,7 +106,7 @@ public class SolomonReader { double serviceTime = Double.parseDouble(tokens[6])*timeProjectionFactor; if(counter == 10){ VehicleTypeImpl.Builder typeBuilder = VehicleTypeImpl.Builder.newInstance("solomonType", vehicleCapacity); - typeBuilder.setCostPerDistance(1.0*variableCostProjectionFactor).setFixedCost(100); + typeBuilder.setCostPerDistance(1.0*variableCostProjectionFactor).setFixedCost(fixedCostPerVehicle); VehicleTypeImpl vehicleType = typeBuilder.build(); diff --git a/jsprit-instances/src/main/java/util/Instances.java b/jsprit-instances/src/main/java/util/Instances.java index f9f57d60..57c91364 100644 --- a/jsprit-instances/src/main/java/util/Instances.java +++ b/jsprit-instances/src/main/java/util/Instances.java @@ -104,6 +104,7 @@ public class Instances { /** * Returns a collection of {@link BenchmarkInstance} which are Solomon instances. *

Note that this assumes that within the folder 'inputFolder' 9 C1-instances are located with their original name, i.e. C101.txt,C102.txt,...,C109.txt. + *

Note that unlike the original problems, a fixed-cost value of 1000 is set for each employed vehicle. * @param inputFolder where solomon C1 instances are located. It must end without '/' such as instances/solomon. * * @return a collection of {@link BenchmarkInstance} @@ -115,7 +116,7 @@ public class Instances { for(int i=0;i<9;i++){ VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); String file = inputFolder + "/C1"+ getInstanceNu(i+1) + ".txt"; - new SolomonReader(builder).read(file); + new SolomonReader(builder,1000).read(file); VehicleRoutingProblem p = builder.build(); instances.add(new BenchmarkInstance("C1" + getInstanceNu(i+1), p, bestKnown.get(i).doubleValue(), bestKnowVehicles.get(i).doubleValue())); } @@ -125,6 +126,7 @@ public class Instances { /** * Returns a collection of {@link BenchmarkInstance} which are Solomon instances. *

Note that this assumes that within the folder 'inputFolder' 8 C2-instances are located with their original name, i.e. C201.txt,C202.txt,...,C208.txt. + *

Note that unlike the original problems, a fixed-cost value of 1000 is set for each employed vehicle. * @param inputFolder where solomon C2 instances are located. It must end without '/' such as instances/solomon. * @return a collection of {@link BenchmarkInstance} */ @@ -135,7 +137,7 @@ public class Instances { for(int i=0;i<8;i++){ VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); String file = inputFolder + "/C2"+ getInstanceNu(i+1) + ".txt"; - new SolomonReader(builder).read(file); + new SolomonReader(builder,1000).read(file); VehicleRoutingProblem p = builder.build(); instances.add(new BenchmarkInstance("C2" + getInstanceNu(i+1), p, bestKnown.get(i).doubleValue(), bestKnowVehicles.get(i).doubleValue())); } @@ -145,6 +147,7 @@ public class Instances { /** * Returns a collection of {@link BenchmarkInstance} which are Solomon instances. *

Note that this assumes that within the folder 'inputFolder' 12 R1-instances are located with their original name, i.e. R101.txt,R102.txt,...,R112.txt. + *

Note that unlike the original problems, a fixed-cost value of 1000 is set for each employed vehicle. * @param inputFolder where solomon R1 instances are located. It must end without '/' such as instances/solomon. * @return a collection of {@link BenchmarkInstance} */ @@ -155,7 +158,7 @@ public class Instances { for(int i=0;i<12;i++){ VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); String file = inputFolder + "/R1"+ getInstanceNu(i+1) + ".txt"; - new SolomonReader(builder).read(file); + new SolomonReader(builder,1000).read(file); VehicleRoutingProblem p = builder.build(); instances.add(new BenchmarkInstance("R1" + getInstanceNu(i+1), p, bestKnown.get(i).doubleValue(), bestKnowVehicles.get(i).doubleValue())); } @@ -165,6 +168,7 @@ public class Instances { /** * Returns a collection of {@link BenchmarkInstance} which are Solomon instances. *

Note that this assumes that within the folder 'inputFolder' 11 R1-instances are located with their original name, i.e. R201.txt,R202.txt,...,R111.txt. + *

Note that unlike the original problems, a fixed-cost value of 1000 is set for each employed vehicle. * @param inputFolder TODO * @param inputFolder where solomon R2 instances are located. It must end without '/' such as instances/solomon. * @return a collection of {@link BenchmarkInstance} @@ -176,7 +180,7 @@ public class Instances { for(int i=0;i<11;i++){ VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); String file = inputFolder + "/R2"+ getInstanceNu(i+1) + ".txt"; - new SolomonReader(builder).read(file); + new SolomonReader(builder,1000).read(file); VehicleRoutingProblem p = builder.build(); instances.add(new BenchmarkInstance("R2" + getInstanceNu(i+1), p, bestKnown.get(i).doubleValue(), bestKnowVehicles.get(i).doubleValue())); } @@ -186,6 +190,7 @@ public class Instances { /** * Returns a collection of {@link BenchmarkInstance} which are Solomon instances. *

Note that this assumes that within the folder 'inputFolder' 8 RC1-instances are located with their original name, i.e. RC101.txt,RC102.txt,...,RC108.txt. + *

Note that unlike the original problems, a fixed-cost value of 1000 is set for each employed vehicle. * @param inputFolder where solomon RC1 instances are located. It must end without '/' such as instances/solomon. * @return a collection of {@link BenchmarkInstance} */ @@ -196,7 +201,7 @@ public class Instances { for(int i=0;i<8;i++){ VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); String file = inputFolder + "/RC1"+ getInstanceNu(i+1) + ".txt"; - new SolomonReader(builder).read(file); + new SolomonReader(builder,1000).read(file); VehicleRoutingProblem p = builder.build(); instances.add(new BenchmarkInstance("RC1" + getInstanceNu(i+1), p, bestKnown.get(i).doubleValue(), bestKnowVehicles.get(i).doubleValue())); } @@ -206,6 +211,7 @@ public class Instances { /** * Returns a collection of {@link BenchmarkInstance} which are Solomon instances. *

Note that this assumes that within the folder 'inputFolder' 8 RC2-instances are located with their original name, i.e. RC201.txt,RC202.txt,...,RC208.txt. + *

Note that unlike the original problems, a fixed-cost value of 1000 is set for each employed vehicle. * @param inputFolder TODO * @param inputFolder where solomon RC2 instances are located. It must end without '/' such as instances/solomon. * @return a collection of {@link BenchmarkInstance} @@ -217,7 +223,7 @@ public class Instances { for(int i=0;i<8;i++){ VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); String file = inputFolder + "/RC2"+ getInstanceNu(i+1) + ".txt"; - new SolomonReader(builder).read(file); + new SolomonReader(builder,1000).read(file); VehicleRoutingProblem p = builder.build(); instances.add(new BenchmarkInstance("RC2" + getInstanceNu(i+1), p, bestKnown.get(i).doubleValue(), bestKnowVehicles.get(i).doubleValue())); }