mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
remove penalty-veh constructor in jsprit-instances.reader.CordeauReader
This commit is contained in:
parent
005517ffa9
commit
305b5e5cab
2 changed files with 23 additions and 24 deletions
|
|
@ -1,16 +1,16 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (C) 2013 Stefan Schroeder
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 3.0 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -62,7 +62,8 @@ public class CordeauReader {
|
||||||
super();
|
super();
|
||||||
this.vrpBuilder = vrpBuilder;
|
this.vrpBuilder = vrpBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public CordeauReader(VehicleRoutingProblem.Builder vrpBuilder, boolean penaltyVehicles) {
|
public CordeauReader(VehicleRoutingProblem.Builder vrpBuilder, boolean penaltyVehicles) {
|
||||||
super();
|
super();
|
||||||
this.vrpBuilder = vrpBuilder;
|
this.vrpBuilder = vrpBuilder;
|
||||||
|
|
@ -78,7 +79,7 @@ public class CordeauReader {
|
||||||
int nOfVehiclesAtEachDepot = 0;
|
int nOfVehiclesAtEachDepot = 0;
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
String line = null;
|
String line;
|
||||||
List<List<Builder>> vehiclesAtDepot = new ArrayList<List<Builder>>();
|
List<List<Builder>> vehiclesAtDepot = new ArrayList<List<Builder>>();
|
||||||
int depotCounter = 0;
|
int depotCounter = 0;
|
||||||
while((line = readLine(reader)) != null){
|
while((line = readLine(reader)) != null){
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,33 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (C) 2013 Stefan Schroeder
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 3.0 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.instance.util;
|
package jsprit.instance.util;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.util.BenchmarkInstance;
|
import jsprit.core.util.BenchmarkInstance;
|
||||||
import jsprit.instance.reader.ChristofidesReader;
|
import jsprit.instance.reader.ChristofidesReader;
|
||||||
import jsprit.instance.reader.CordeauReader;
|
import jsprit.instance.reader.CordeauReader;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class Instances {
|
public class Instances {
|
||||||
|
|
||||||
|
|
@ -48,12 +44,14 @@ public class Instances {
|
||||||
for(int i=0;i<12;i++){
|
for(int i=0;i<12;i++){
|
||||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
String file = inputFolder + "/p"+ getInstanceNu(i+1);
|
String file = inputFolder + "/p"+ getInstanceNu(i+1);
|
||||||
new CordeauReader(builder,true).read(file);
|
new CordeauReader(builder).read(file);
|
||||||
VehicleRoutingProblem p = builder.build();
|
VehicleRoutingProblem p = builder.build();
|
||||||
instances.add(new BenchmarkInstance("p" + getInstanceNu(i+1), p, getBestKnown(file), null));
|
instances.add(new BenchmarkInstance("p" + getInstanceNu(i+1), p, getBestKnown(file), null));
|
||||||
}
|
}
|
||||||
return instances;
|
return instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static double getBestKnown(String file) {
|
private static double getBestKnown(String file) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -91,7 +89,7 @@ public class Instances {
|
||||||
for(int i=0;i<10;i++){
|
for(int i=0;i<10;i++){
|
||||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
String file = inputFolder + "/pr"+ getInstanceNu(i+1);
|
String file = inputFolder + "/pr"+ getInstanceNu(i+1);
|
||||||
new CordeauReader(builder,true).read(file);
|
new CordeauReader(builder).read(file);
|
||||||
VehicleRoutingProblem p = builder.build();
|
VehicleRoutingProblem p = builder.build();
|
||||||
instances.add(new BenchmarkInstance("pr" + getInstanceNu(i+1), p, getBestKnown(file),null));
|
instances.add(new BenchmarkInstance("pr" + getInstanceNu(i+1), p, getBestKnown(file),null));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue