mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
ini
This commit is contained in:
commit
3581d6e097
435 changed files with 46952 additions and 0 deletions
156
jsprit-instances/src/main/java/readers/ChristophidesReader.java
Normal file
156
jsprit-instances/src/main/java/readers/ChristophidesReader.java
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import readers.ChristophidesReader;
|
||||
import util.Coordinate;
|
||||
|
||||
import basics.route.Vehicle;
|
||||
import basics.route.VehicleImpl;
|
||||
import basics.route.VehicleImpl.VehicleType;
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
|
||||
/**
|
||||
* Reader that reads Christophides, Mingozzi and Toth instances.
|
||||
*
|
||||
* <p>Files and file-description can be found <a href="http://neo.lcc.uma.es/vrp/vrp-instances/capacitated-vrp-instances/">here</a>.
|
||||
*
|
||||
* @author stefan schroeder
|
||||
*
|
||||
*/
|
||||
public class ChristophidesReader {
|
||||
|
||||
private static Logger logger = Logger.getLogger(ChristophidesReader.class);
|
||||
|
||||
private final VehicleRoutingProblem.Builder vrpBuilder;
|
||||
|
||||
private double coordProjectionFactor = 1;
|
||||
|
||||
private int customerCounter = 1;
|
||||
|
||||
/**
|
||||
* Constructs the reader.
|
||||
*
|
||||
* @param vrpBuilder
|
||||
*/
|
||||
public ChristophidesReader(VehicleRoutingProblem.Builder vrpBuilder) {
|
||||
super();
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads instance-file and memorizes vehicles, customers and so forth in
|
||||
* {@link VehicleRoutingProblem.Builder}.
|
||||
*
|
||||
* @param fileName
|
||||
*/
|
||||
public void read(String fileName){
|
||||
vrpBuilder.setFleetSize(FleetSize.INFINITE);
|
||||
BufferedReader reader = getReader(fileName);
|
||||
int vehicleCapacity = 0;
|
||||
double serviceTime = 0.0;
|
||||
double endTime = Double.MAX_VALUE;
|
||||
int counter = 0;
|
||||
String line = null;
|
||||
while((line = readLine(reader)) != null){
|
||||
line = line.replace("\r", "");
|
||||
line = line.trim();
|
||||
String[] tokens = line.split(" ");
|
||||
if(counter == 0){
|
||||
vehicleCapacity = Integer.parseInt(tokens[1].trim());
|
||||
endTime = Double.parseDouble(tokens[2].trim());
|
||||
serviceTime = Double.parseDouble(tokens[3].trim());
|
||||
}
|
||||
else if(counter == 1){
|
||||
String id = Integer.valueOf(counter).toString();
|
||||
Coordinate depotCoord = makeCoord(tokens[0].trim(),tokens[1].trim());
|
||||
VehicleType vehicleType = VehicleImpl.VehicleType.Builder.newInstance("christophidesType", vehicleCapacity).
|
||||
setCostPerDistance(1.0).setFixedCost(100).build();
|
||||
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("christophidesVehicle").setLatestArrival(endTime).setLocationId(id).setLocationCoord(depotCoord).
|
||||
setType(vehicleType).build();
|
||||
vrpBuilder.addVehicle(vehicle);
|
||||
}
|
||||
else{
|
||||
Coordinate customerCoord = makeCoord(tokens[0].trim(),tokens[1].trim());
|
||||
int demand = Integer.parseInt(tokens[2].trim());
|
||||
String customer = Integer.valueOf(customerCounter).toString();
|
||||
Service service = Service.Builder.newInstance(customer, demand).setServiceTime(serviceTime).setLocationId(customer).setCoord(customerCoord).build();
|
||||
vrpBuilder.addService(service);
|
||||
customerCounter++;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
close(reader);
|
||||
}
|
||||
|
||||
public void setCoordProjectionFactor(double coordProjectionFactor) {
|
||||
this.coordProjectionFactor = coordProjectionFactor;
|
||||
}
|
||||
|
||||
private void close(BufferedReader reader) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private String readLine(BufferedReader reader) {
|
||||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Coordinate makeCoord(String xString, String yString) {
|
||||
double x = Double.parseDouble(xString);
|
||||
double y = Double.parseDouble(yString);
|
||||
return new Coordinate(x*coordProjectionFactor,y*coordProjectionFactor);
|
||||
}
|
||||
|
||||
private BufferedReader getReader(String solomonFile) {
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error(e1);
|
||||
System.exit(1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
}
|
||||
172
jsprit-instances/src/main/java/readers/CordeauReader.java
Normal file
172
jsprit-instances/src/main/java/readers/CordeauReader.java
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import readers.CordeauReader;
|
||||
import util.Coordinate;
|
||||
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.VehicleImpl;
|
||||
import basics.route.VehicleImpl.VehicleBuilder;
|
||||
import basics.route.VehicleImpl.VehicleType;
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
|
||||
/**
|
||||
* Reader that reads instances developed by:
|
||||
*
|
||||
* <p>Cordeau, J.-F., Gendreau, M. and Laporte, G. (1997), A tabu search heuristic for periodic and multi-depot vehicle routing problems.
|
||||
* Networks, 30: 105–119. doi: 10.1002/(SICI)1097-0037(199709)30:2<105::AID-NET5>3.0.CO;2-G
|
||||
*
|
||||
* <p>Files and file-description can be found <a href="http://neo.lcc.uma.es/vrp/vrp-instances/multiple-depot-vrp-instances/">here</a>.
|
||||
*
|
||||
* @author stefan schroeder
|
||||
*
|
||||
*/
|
||||
public class CordeauReader {
|
||||
|
||||
private static Logger logger = Logger.getLogger(CordeauReader.class);
|
||||
|
||||
private final VehicleRoutingProblem.Builder vrpBuilder;
|
||||
|
||||
private double coordProjectionFactor = 1;
|
||||
|
||||
public CordeauReader(VehicleRoutingProblem.Builder vrpBuilder) {
|
||||
super();
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
}
|
||||
|
||||
public void read(String fileName){
|
||||
vrpBuilder.setFleetSize(FleetSize.FINITE);
|
||||
BufferedReader reader = getReader(fileName);
|
||||
int vrpType;
|
||||
int nOfDepots = 0;
|
||||
int nOfCustomers = 0;
|
||||
int nOfVehiclesAtEachDepot = 0;
|
||||
|
||||
int counter = 0;
|
||||
String line = null;
|
||||
List<List<VehicleBuilder>> vehiclesAtDepot = new ArrayList<List<VehicleBuilder>>();
|
||||
int depotCounter = 0;
|
||||
while((line = readLine(reader)) != null){
|
||||
line = line.replace("\r", "");
|
||||
line = line.trim();
|
||||
String[] tokens = line.split("\\s+");
|
||||
if(counter == 0){
|
||||
vrpType = Integer.parseInt(tokens[0].trim());
|
||||
if(vrpType != 2) throw new IllegalStateException("expect vrpType to be equal to 2 and thus to be MDVRP");
|
||||
nOfVehiclesAtEachDepot = Integer.parseInt(tokens[1].trim());
|
||||
nOfCustomers = Integer.parseInt(tokens[2].trim());
|
||||
nOfDepots = Integer.parseInt(tokens[3].trim());
|
||||
}
|
||||
else if(counter <= nOfDepots){
|
||||
String depot = Integer.valueOf(counter).toString();
|
||||
int duration = Integer.parseInt(tokens[0].trim());
|
||||
if(duration == 0) duration = 999999;
|
||||
int capacity = Integer.parseInt(tokens[1].trim());
|
||||
VehicleType vehicleType = VehicleImpl.VehicleType.Builder.newInstance(counter + "_cordeauType", capacity).setCostPerDistance(1.0).setFixedCost(100).build();
|
||||
List<VehicleBuilder> builders = new ArrayList<VehicleImpl.VehicleBuilder>();
|
||||
for(int vehicleCounter=0;vehicleCounter<nOfVehiclesAtEachDepot;vehicleCounter++){
|
||||
VehicleBuilder vBuilder = VehicleImpl.VehicleBuilder.newInstance(depot+"_"+(vehicleCounter+1) + "_cordeauVehicle");
|
||||
vBuilder.setLatestArrival(duration).setType(vehicleType);
|
||||
builders.add(vBuilder);
|
||||
}
|
||||
vehiclesAtDepot.add(builders);
|
||||
}
|
||||
else if(counter <= (nOfCustomers+nOfDepots)){
|
||||
String id = tokens[0].trim();
|
||||
Coordinate customerCoord = makeCoord(tokens[1].trim(),tokens[2].trim());
|
||||
double serviceTime = Double.parseDouble(tokens[3].trim());
|
||||
int demand = Integer.parseInt(tokens[4].trim());
|
||||
Service service = Service.Builder.newInstance(id, demand).setServiceTime(serviceTime).setLocationId(id).setCoord(customerCoord).build();
|
||||
vrpBuilder.addService(service);
|
||||
}
|
||||
else if(counter <= (nOfCustomers+nOfDepots+nOfDepots)){
|
||||
Coordinate depotCoord = makeCoord(tokens[1].trim(),tokens[2].trim());
|
||||
List<VehicleBuilder> vBuilders = vehiclesAtDepot.get(depotCounter);
|
||||
for(VehicleBuilder vBuilder : vBuilders){
|
||||
vBuilder.setLocationCoord(depotCoord);
|
||||
VehicleImpl vehicle = vBuilder.build();
|
||||
vrpBuilder.addVehicle(vehicle);
|
||||
}
|
||||
depotCounter++;
|
||||
}
|
||||
else{
|
||||
throw new IllegalStateException("there are more lines than expected in file.");
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
close(reader);
|
||||
}
|
||||
|
||||
public void setCoordProjectionFactor(double coordProjectionFactor) {
|
||||
this.coordProjectionFactor = coordProjectionFactor;
|
||||
}
|
||||
|
||||
private void close(BufferedReader reader) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private String readLine(BufferedReader reader) {
|
||||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Coordinate makeCoord(String xString, String yString) {
|
||||
double x = Double.parseDouble(xString);
|
||||
double y = Double.parseDouble(yString);
|
||||
return new Coordinate(x*coordProjectionFactor,y*coordProjectionFactor);
|
||||
}
|
||||
|
||||
private BufferedReader getReader(String solomonFile) {
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error(e1);
|
||||
System.exit(1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
}
|
||||
148
jsprit-instances/src/main/java/readers/FigliozziReader.java
Normal file
148
jsprit-instances/src/main/java/readers/FigliozziReader.java
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import util.CrowFlyCosts;
|
||||
import util.Locations;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.Builder;
|
||||
import basics.costs.VehicleRoutingTransportCosts;
|
||||
import basics.route.Driver;
|
||||
import basics.route.Vehicle;
|
||||
|
||||
public class FigliozziReader {
|
||||
|
||||
public static class TDCosts implements VehicleRoutingTransportCosts {
|
||||
|
||||
private static Logger log = Logger.getLogger(TDCosts.class);
|
||||
|
||||
private List<Double> timeBins;
|
||||
|
||||
private List<Double> speed;
|
||||
|
||||
private CrowFlyCosts crowFly;
|
||||
|
||||
public TDCosts(Locations locations, List<Double> timeBins, List<Double> speedValues) {
|
||||
super();
|
||||
speed = speedValues;
|
||||
this.timeBins = timeBins;
|
||||
crowFly = new CrowFlyCosts(locations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTransportCost(String fromId, String toId, double departureTime, Driver driver, Vehicle vehicle) {
|
||||
return 1.0*crowFly.getTransportCost(fromId, toId, departureTime, null, null) +
|
||||
1.0*getTransportTime(fromId,toId,departureTime, null, null);
|
||||
// return getTransportTime(fromId, toId, departureTime, driver, vehicle);
|
||||
// return crowFly.getTransportCost(fromId, toId, departureTime, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBackwardTransportCost(String fromId, String toId,double arrivalTime, Driver driver, Vehicle vehicle) {
|
||||
// return crowFly.getTransportCost(fromId, toId, arrivalTime, null,null) + getBackwardTransportTime(fromId, toId, arrivalTime,null,null);
|
||||
return getBackwardTransportTime(fromId, toId, arrivalTime, driver, vehicle);
|
||||
// return crowFly.getTransportCost(fromId, toId, arrivalTime, null, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getTransportTime(String fromId, String toId, double departureTime, Driver driver, Vehicle vehicle) {
|
||||
if(fromId.equals(toId)){
|
||||
return 0.0;
|
||||
}
|
||||
double totalTravelTime = 0.0;
|
||||
double distanceToTravel = crowFly.getTransportCost(fromId, toId, departureTime, null, null);
|
||||
double currentTime = departureTime;
|
||||
for(int i=0;i<timeBins.size();i++){
|
||||
double timeThreshold = timeBins.get(i);
|
||||
if(currentTime < timeThreshold){
|
||||
double maxReachableDistance = (timeThreshold-currentTime)*speed.get(i);
|
||||
if(distanceToTravel > maxReachableDistance){
|
||||
distanceToTravel = distanceToTravel - maxReachableDistance;
|
||||
totalTravelTime += (timeThreshold-currentTime);
|
||||
currentTime = timeThreshold;
|
||||
continue;
|
||||
}
|
||||
else{ //<= maxReachableDistance
|
||||
totalTravelTime += distanceToTravel/speed.get(i);
|
||||
return totalTravelTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getBackwardTransportTime(String fromId, String toId,double arrivalTime, Driver driver, Vehicle vehicle) {
|
||||
if(fromId.equals(toId)){
|
||||
return 0.0;
|
||||
}
|
||||
double totalTravelTime = 0.0;
|
||||
double distanceToTravel = crowFly.getTransportCost(fromId, toId, arrivalTime, null, null);
|
||||
double currentTime = arrivalTime;
|
||||
for(int i=timeBins.size()-1;i>=0;i--){
|
||||
double nextLowerTimeThreshold;
|
||||
if(i>0){
|
||||
nextLowerTimeThreshold = timeBins.get(i-1);
|
||||
}
|
||||
else{
|
||||
nextLowerTimeThreshold = 0;
|
||||
}
|
||||
if(currentTime > nextLowerTimeThreshold){
|
||||
double maxReachableDistance = (currentTime - nextLowerTimeThreshold)*speed.get(i);
|
||||
if(distanceToTravel > maxReachableDistance){
|
||||
distanceToTravel = distanceToTravel - maxReachableDistance;
|
||||
totalTravelTime += (currentTime-nextLowerTimeThreshold);
|
||||
currentTime = nextLowerTimeThreshold;
|
||||
continue;
|
||||
}
|
||||
else{ //<= maxReachableDistance
|
||||
totalTravelTime += distanceToTravel/speed.get(i);
|
||||
return totalTravelTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private VehicleRoutingProblem.Builder builder;
|
||||
|
||||
public FigliozziReader(Builder builder) {
|
||||
super();
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
public void read(String instanceFile, String speedScenarioFile, String speedScenario){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
223
jsprit-instances/src/main/java/readers/LiLim.java
Normal file
223
jsprit-instances/src/main/java/readers/LiLim.java
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
//package instances;
|
||||
//
|
||||
//import java.io.BufferedReader;
|
||||
//import java.io.IOException;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Collection;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//import org.apache.log4j.Level;
|
||||
//import org.apache.log4j.Logger;
|
||||
//import org.matsim.contrib.freight.vrp.algorithms.rr.RuinAndRecreate;
|
||||
//import org.matsim.contrib.freight.vrp.basics.Job;
|
||||
//import org.matsim.contrib.freight.vrp.basics.Shipment;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleRoutingProblem;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VrpBuilder;
|
||||
//import org.matsim.contrib.freight.vrp.utils.Coordinate;
|
||||
//import org.matsim.contrib.freight.vrp.utils.CrowFlyCosts;
|
||||
//import org.matsim.contrib.freight.vrp.utils.Locations;
|
||||
//import org.matsim.core.utils.io.IOUtils;
|
||||
//
|
||||
///**
|
||||
// * test instances for the capacitated vrp with pickup and deliveries and time windows.
|
||||
// * instances are from li and lim and can be found at:
|
||||
// * http://www.top.sintef.no/vrp/benchmarks.html
|
||||
// * @author stefan schroeder
|
||||
// *
|
||||
// */
|
||||
//
|
||||
//
|
||||
//public class LiLim {
|
||||
//
|
||||
// static class MyLocations implements Locations{
|
||||
//
|
||||
// private Map<String,Coordinate> locations = new HashMap<String, Coordinate>();
|
||||
//
|
||||
// public void addLocation(String id, Coordinate coord){
|
||||
// locations.put(id, coord);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Coordinate getCoord(String id) {
|
||||
// return locations.get(id);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// static class CustomerData{
|
||||
// public double start;
|
||||
// public double end;
|
||||
// public double serviceTime;
|
||||
// public CustomerData(double start, double end, double serviceTime) {
|
||||
// super();
|
||||
// this.start = start;
|
||||
// this.end = end;
|
||||
// this.serviceTime = serviceTime;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// static class Relation{
|
||||
// public String from;
|
||||
// public String to;
|
||||
// public int demand;
|
||||
// public Relation(String from, String to, int demand) {
|
||||
// super();
|
||||
// this.from = from;
|
||||
// this.to = to;
|
||||
// this.demand = demand;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private static Logger logger = Logger.getLogger(Christophides.class);
|
||||
//
|
||||
// private VrpBuilder vrpBuilder;
|
||||
//
|
||||
//// private Locations locations;
|
||||
//
|
||||
// private String fileNameOfInstance;
|
||||
//
|
||||
// private int vehicleCapacity;
|
||||
//
|
||||
// private String depotId;
|
||||
//
|
||||
// private Map<String,CustomerData> data;
|
||||
//
|
||||
// private Collection<Relation> relations;
|
||||
//
|
||||
// private String instanceName;
|
||||
// public LiLim(String fileNameOfInstance, String instanceName) {
|
||||
// this.fileNameOfInstance = fileNameOfInstance;
|
||||
// this.instanceName = instanceName;
|
||||
// data = new HashMap<String, LiLim.CustomerData>();
|
||||
// relations = new ArrayList<LiLim.Relation>();
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// Logger.getRootLogger().setLevel(Level.INFO);
|
||||
// LiLim liLim = new LiLim("/Users/stefan/Documents/workspace/VehicleRouting/instances/cvrppdtw_lilim/pdp100/lc205.txt", "lc205");
|
||||
// liLim.run();
|
||||
// }
|
||||
//
|
||||
// public void run(){
|
||||
// MyLocations myLocations = new MyLocations();
|
||||
// Collection<Job> jobs = new ArrayList<Job>();
|
||||
// readLocationsAndJobs(myLocations);
|
||||
// buildJobs(jobs);
|
||||
// VrpBuilder vrpBuilder = new VrpBuilder(new CrowFlyCosts(myLocations));
|
||||
// for(Job j : jobs){
|
||||
// vrpBuilder.addJob(j);
|
||||
// }
|
||||
// for(int i=0;i<20;i++){
|
||||
// vrpBuilder.addVehicle(VrpUtils.createVehicle("" + (i+1), depotId, vehicleCapacity, "standard",100.0,1.0,1.0));
|
||||
// }
|
||||
// RuinAndRecreate algo = createAlgo(vrpBuilder.build());
|
||||
// algo.run();
|
||||
// }
|
||||
//
|
||||
// private void buildJobs(Collection<Job> jobs) {
|
||||
// Integer counter = 0;
|
||||
// for(Relation rel : relations){
|
||||
// counter++;
|
||||
// String from = rel.from;
|
||||
// String to = rel.to;
|
||||
// Shipment s = VrpUtils.createShipment(counter.toString(), from, to, rel.demand,
|
||||
// VrpUtils.createTimeWindow(data.get(from).start, data.get(from).end),
|
||||
// VrpUtils.createTimeWindow(data.get(to).start, data.get(to).end));
|
||||
// s.setPickupServiceTime(data.get(from).serviceTime);
|
||||
// s.setDeliveryServiceTime(data.get(to).serviceTime);
|
||||
// jobs.add(s);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private RuinAndRecreate createAlgo(VehicleRoutingProblem vrp) {
|
||||
//// PickupAndDeliveryTourWithTimeWindowsAlgoFactory factory = new PickupAndDeliveryTourWithTimeWindowsAlgoFactory();
|
||||
//// factory.setIterations(100);
|
||||
//// factory.setWarmUp(10);
|
||||
//// RuinAndRecreateChartListener chartListener = new RuinAndRecreateChartListener();
|
||||
//// chartListener.setFilename("vrp/liLim/"+instanceName+".png");
|
||||
//// RuinAndRecreateReport report = new RuinAndRecreateReport();
|
||||
//// factory.addRuinAndRecreateListener(chartListener);
|
||||
//// factory.addRuinAndRecreateListener(report);
|
||||
//// return factory.createAlgorithm(vrp);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private void readLocationsAndJobs(MyLocations locs) {
|
||||
// BufferedReader reader = IOUtils.getBufferedReader(fileNameOfInstance);
|
||||
// String line = null;
|
||||
// boolean firstLine = true;
|
||||
// try {
|
||||
// while((line = reader.readLine()) != null){
|
||||
// line = line.replace("\r", "");
|
||||
// line = line.trim();
|
||||
// String[] tokens = line.split("\t");
|
||||
// if(firstLine){
|
||||
// int vehicleCapacity = getInt(tokens[1]);
|
||||
// this.vehicleCapacity = vehicleCapacity;
|
||||
// firstLine = false;
|
||||
// continue;
|
||||
// }
|
||||
// else{
|
||||
// String customerId = tokens[0];
|
||||
// Coordinate coord = makeCoord(tokens[1], tokens[2]);
|
||||
// if(customerId.equals("0")){
|
||||
// depotId = customerId;
|
||||
// }
|
||||
// int demand = getInt(tokens[3]);
|
||||
// double startTimeWindow = getDouble(tokens[4]);
|
||||
// double endTimeWindow = getDouble(tokens[5]);
|
||||
// double serviceTime = getDouble(tokens[6]);
|
||||
// locs.addLocation(customerId, coord);
|
||||
// data.put(customerId, new CustomerData(startTimeWindow,endTimeWindow,serviceTime));
|
||||
// if(demand > 0){
|
||||
// relations.add(new Relation(customerId,tokens[8],demand));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// reader.close();
|
||||
// } catch (IOException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private Coordinate makeCoord(String xString, String yString) {
|
||||
// double x = Double.parseDouble(xString);
|
||||
// double y = Double.parseDouble(yString);
|
||||
// return new Coordinate(x,y);
|
||||
// }
|
||||
//
|
||||
// private double getDouble(String string) {
|
||||
// return Double.parseDouble(string);
|
||||
// }
|
||||
//
|
||||
// private int getInt(String string) {
|
||||
// return Integer.parseInt(string);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
194
jsprit-instances/src/main/java/readers/LuiShenReader.java
Normal file
194
jsprit-instances/src/main/java/readers/LuiShenReader.java
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import readers.LuiShenReader;
|
||||
import util.Coordinate;
|
||||
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetComposition;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.TimeWindow;
|
||||
import basics.route.Vehicle;
|
||||
import basics.route.VehicleImpl;
|
||||
import basics.route.VehicleImpl.VehicleType;
|
||||
|
||||
public class LuiShenReader {
|
||||
|
||||
private static Logger logger = Logger.getLogger(LuiShenReader.class);
|
||||
|
||||
private final VehicleRoutingProblem.Builder vrpBuilder;
|
||||
|
||||
private double coordProjectionFactor = 1;
|
||||
|
||||
public LuiShenReader(VehicleRoutingProblem.Builder vrpBuilder) {
|
||||
super();
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
this.vrpBuilder.setFleetComposition(FleetComposition.HETEROGENEOUS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads input files to build luiShen problem.
|
||||
*
|
||||
* <p>The instance-file is a solomon file. The vehicle-file is a
|
||||
* txt-file that has the following columns:
|
||||
* <p>Vehicle;Capacity;Cost_a;Cost_b;Cost_c
|
||||
* <p>Concrete vehicleType:
|
||||
* <p>A;100;300;60;30
|
||||
*
|
||||
* <p>In the example above, the vehicle-type with typeId A has
|
||||
* a capacity of 100, and fixed costs of 100 in cost scenario "a",
|
||||
* 300 in "b" and 30 in "c".
|
||||
|
||||
* @param instanceFile is a solomon-instance-file
|
||||
* @param vehicleFile
|
||||
* @param costScenario is either "a", "b" or "c"
|
||||
*/
|
||||
public void read(String instanceFile, String vehicleFile, String costScenario){
|
||||
vrpBuilder.setFleetSize(FleetSize.INFINITE);
|
||||
BufferedReader reader = getReader(instanceFile);
|
||||
int counter = 0;
|
||||
String line = null;
|
||||
while((line = readLine(reader)) != null){
|
||||
line = line.replace("\r", "");
|
||||
line = line.trim();
|
||||
String[] tokens = line.split(" +");
|
||||
counter++;
|
||||
if(counter > 9){
|
||||
Coordinate coord = makeCoord(tokens[1],tokens[2]);
|
||||
String customerId = tokens[0];
|
||||
int demand = Integer.parseInt(tokens[3]);
|
||||
double start = Double.parseDouble(tokens[4])*coordProjectionFactor ;
|
||||
double end = Double.parseDouble(tokens[5])*coordProjectionFactor;
|
||||
double serviceTime = Double.parseDouble(tokens[6])*coordProjectionFactor;
|
||||
if(counter == 10){
|
||||
createVehicles(vehicleFile,costScenario,customerId,coord,start,end);
|
||||
}
|
||||
else{
|
||||
Service service = Service.Builder.newInstance("" + counter, demand).setCoord(coord).setLocationId(customerId).setServiceTime(serviceTime)
|
||||
.setTimeWindow(TimeWindow.newInstance(start, end)).build();
|
||||
vrpBuilder.addService(service);
|
||||
}
|
||||
}
|
||||
}
|
||||
close(reader);
|
||||
}
|
||||
|
||||
private void createVehicles(String vehicleFileName, String costScenario, String locationId, Coordinate coord, double start, double end) {
|
||||
BufferedReader reader = getReader(vehicleFileName);
|
||||
|
||||
int costScenarioColumn = getCostScenarioColumn(costScenario);
|
||||
int vehicleIdColumn = 0;
|
||||
int capacityColumn = 1;
|
||||
|
||||
|
||||
|
||||
boolean firstLine = true;
|
||||
String line = null;
|
||||
while((line = readLine(reader)) != null){
|
||||
if(firstLine){
|
||||
firstLine = false;
|
||||
continue;
|
||||
}
|
||||
String[] tokens = line.split(";");
|
||||
String vehicleId = tokens[vehicleIdColumn];
|
||||
int capacity = Integer.parseInt(tokens[capacityColumn]);
|
||||
int fixCost = Integer.parseInt(tokens[costScenarioColumn]);
|
||||
|
||||
VehicleType.Builder typeBuilder = VehicleImpl.VehicleType.Builder.newInstance(vehicleId, capacity);
|
||||
typeBuilder.setFixedCost(fixCost).setCostPerDistance(1.0);
|
||||
|
||||
VehicleType type = typeBuilder.build();
|
||||
|
||||
Vehicle reprVehicle = VehicleImpl.VehicleBuilder.newInstance(vehicleId).setEarliestStart(start).setLatestArrival(end).
|
||||
setLocationId(locationId).setLocationCoord(coord).setType(type).build();
|
||||
|
||||
vrpBuilder.addVehicle(reprVehicle);
|
||||
|
||||
}
|
||||
close(reader);
|
||||
}
|
||||
|
||||
private int getCostScenarioColumn(String costScenario) {
|
||||
if(costScenario.equals("a")){
|
||||
return 2;
|
||||
}
|
||||
else if(costScenario.equals("b")){
|
||||
return 3;
|
||||
}
|
||||
else if(costScenario.equals("c")){
|
||||
return 4;
|
||||
}
|
||||
throw new IllegalStateException("costScenario " + costScenario + " not known");
|
||||
}
|
||||
|
||||
public void setCoordProjectionFactor(double coordProjectionFactor) {
|
||||
this.coordProjectionFactor = coordProjectionFactor;
|
||||
}
|
||||
|
||||
private void close(BufferedReader reader) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private String readLine(BufferedReader reader) {
|
||||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Coordinate makeCoord(String xString, String yString) {
|
||||
double x = Double.parseDouble(xString);
|
||||
double y = Double.parseDouble(yString);
|
||||
return new Coordinate(x*coordProjectionFactor,y*coordProjectionFactor);
|
||||
}
|
||||
|
||||
private BufferedReader getReader(String solomonFile) {
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error(e1);
|
||||
System.exit(1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
}
|
||||
168
jsprit-instances/src/main/java/readers/SolomonReader.java
Normal file
168
jsprit-instances/src/main/java/readers/SolomonReader.java
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import readers.SolomonReader;
|
||||
import util.Coordinate;
|
||||
|
||||
import basics.route.TimeWindow;
|
||||
import basics.route.Vehicle;
|
||||
import basics.route.VehicleImpl;
|
||||
import basics.route.VehicleImpl.VehicleType;
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
|
||||
/**
|
||||
* Reader that reads the well-known solomon-instances.
|
||||
*
|
||||
* <p>See: <a href="http://neo.lcc.uma.es/vrp/vrp-instances/capacitated-vrp-with-time-windows-instances/">neo.org</a>
|
||||
*
|
||||
* @author stefan
|
||||
*
|
||||
*/
|
||||
|
||||
public class SolomonReader {
|
||||
|
||||
/**
|
||||
* @param costProjectionFactor the costProjectionFactor to set
|
||||
*/
|
||||
public void setVariableCostProjectionFactor(double costProjectionFactor) {
|
||||
this.variableCostProjectionFactor = costProjectionFactor;
|
||||
}
|
||||
|
||||
private static Logger logger = Logger.getLogger(SolomonReader.class);
|
||||
|
||||
private final VehicleRoutingProblem.Builder vrpBuilder;
|
||||
|
||||
private double coordProjectionFactor = 1;
|
||||
|
||||
private double timeProjectionFactor = 1;
|
||||
|
||||
private double variableCostProjectionFactor = 1;
|
||||
|
||||
public SolomonReader(VehicleRoutingProblem.Builder vrpBuilder) {
|
||||
super();
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
}
|
||||
|
||||
public void read(String solomonFile){
|
||||
vrpBuilder.setFleetSize(FleetSize.INFINITE);
|
||||
BufferedReader reader = getReader(solomonFile);
|
||||
int vehicleCapacity = 0;
|
||||
|
||||
int counter = 0;
|
||||
String line = null;
|
||||
while((line = readLine(reader)) != null){
|
||||
line = line.replace("\r", "");
|
||||
line = line.trim();
|
||||
String[] tokens = line.split(" +");
|
||||
counter++;
|
||||
if(counter == 5){
|
||||
vehicleCapacity = Integer.parseInt(tokens[1]);
|
||||
continue;
|
||||
}
|
||||
if(counter > 9){
|
||||
Coordinate coord = makeCoord(tokens[1],tokens[2]);
|
||||
String customerId = tokens[0];
|
||||
int demand = Integer.parseInt(tokens[3]);
|
||||
double start = Double.parseDouble(tokens[4])*timeProjectionFactor;
|
||||
double end = Double.parseDouble(tokens[5])*timeProjectionFactor;
|
||||
double serviceTime = Double.parseDouble(tokens[6])*timeProjectionFactor;
|
||||
if(counter == 10){
|
||||
VehicleType.Builder typeBuilder = VehicleImpl.VehicleType.Builder.newInstance("solomonType", vehicleCapacity);
|
||||
typeBuilder.setCostPerDistance(1.0*variableCostProjectionFactor).setFixedCost(100);
|
||||
|
||||
VehicleType vehicleType = typeBuilder.build();
|
||||
|
||||
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("solomonVehicle").setEarliestStart(start).setLatestArrival(end)
|
||||
.setLocationId(customerId).setLocationCoord(coord).setType(vehicleType).build();
|
||||
|
||||
// vrpBuilder.addVehicleType(vehicleType);
|
||||
vrpBuilder.addVehicle(vehicle);
|
||||
|
||||
}
|
||||
else{
|
||||
Service service = Service.Builder.newInstance(customerId, demand).setCoord(coord).setLocationId(customerId).setServiceTime(serviceTime)
|
||||
.setTimeWindow(TimeWindow.newInstance(start, end)).build();
|
||||
vrpBuilder.addService(service);
|
||||
}
|
||||
}
|
||||
}
|
||||
close(reader);
|
||||
}
|
||||
|
||||
public void setCoordProjectionFactor(double coordProjectionFactor) {
|
||||
this.coordProjectionFactor = coordProjectionFactor;
|
||||
}
|
||||
|
||||
private void close(BufferedReader reader) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private String readLine(BufferedReader reader) {
|
||||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Coordinate makeCoord(String xString, String yString) {
|
||||
double x = Double.parseDouble(xString);
|
||||
double y = Double.parseDouble(yString);
|
||||
return new Coordinate(x*coordProjectionFactor,y*coordProjectionFactor);
|
||||
}
|
||||
|
||||
private BufferedReader getReader(String solomonFile) {
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error(e1);
|
||||
System.exit(1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
||||
public void setTimeProjectionFactor(double timeProjection) {
|
||||
this.timeProjectionFactor=timeProjection;
|
||||
|
||||
}
|
||||
}
|
||||
534
jsprit-instances/src/main/java/readers/Taillard.java
Normal file
534
jsprit-instances/src/main/java/readers/Taillard.java
Normal file
|
|
@ -0,0 +1,534 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
//package instances;
|
||||
//
|
||||
//import java.io.BufferedReader;
|
||||
//import java.io.IOException;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Collection;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//import java.util.concurrent.ExecutorService;
|
||||
//import java.util.concurrent.Executors;
|
||||
//import java.util.concurrent.TimeUnit;
|
||||
//
|
||||
//import org.apache.log4j.Level;
|
||||
//import org.apache.log4j.Logger;
|
||||
//import org.matsim.contrib.freight.vrp.algorithms.rr.costCalculators.JobInsertionCalculator;
|
||||
//import org.matsim.contrib.freight.vrp.algorithms.rr.costCalculators.RouteAgentFactory;
|
||||
//import org.matsim.contrib.freight.vrp.algorithms.rr.listener.RuinAndRecreateReport;
|
||||
//import org.matsim.contrib.freight.vrp.algorithms.rr.ruin.JobDistanceAvgCosts;
|
||||
//import org.matsim.contrib.freight.vrp.algorithms.rr.ruin.RuinRadial;
|
||||
//import org.matsim.contrib.freight.vrp.basics.Driver;
|
||||
//import org.matsim.contrib.freight.vrp.basics.Job;
|
||||
//import org.matsim.contrib.freight.vrp.basics.RouteAlgorithm;
|
||||
//import org.matsim.contrib.freight.vrp.basics.RouteAlgorithm.VehicleSwitchedListener;
|
||||
//import org.matsim.contrib.freight.vrp.basics.Service;
|
||||
//import org.matsim.contrib.freight.vrp.basics.Tour;
|
||||
//import org.matsim.contrib.freight.vrp.basics.TourActivity;
|
||||
//import org.matsim.contrib.freight.vrp.basics.TourStateUpdater;
|
||||
//import org.matsim.contrib.freight.vrp.basics.Vehicle;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleFleetManager;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleFleetManagerImpl;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleImpl;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleImpl.Type;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleImpl.VehicleCostParams;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleRoute;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleRoute.VehicleRouteCostCalculator;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleRouteCostFunction;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleRouteCostFunctionFactory;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleRoutingCosts;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleRoutingProblem;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VehicleRoutingProblemSolution;
|
||||
//import org.matsim.contrib.freight.vrp.basics.VrpBuilder;
|
||||
//import org.matsim.contrib.freight.vrp.utils.Coordinate;
|
||||
//import org.matsim.contrib.freight.vrp.utils.EuclideanDistanceCalculator;
|
||||
//import org.matsim.contrib.freight.vrp.utils.Locations;
|
||||
//import org.matsim.contrib.freight.vrp.utils.RouteUtils;
|
||||
//import org.matsim.core.utils.io.IOUtils;
|
||||
//
|
||||
//import ruinFactories.RadialRuinFactory;
|
||||
//import selectors.SelectBest;
|
||||
//import selectors.SelectRandomly;
|
||||
//import strategies.GendreauPostOpt;
|
||||
//import strategies.RadialAndRandomRemoveBestInsert;
|
||||
//import vrp.SearchStrategy;
|
||||
//import vrp.SearchStrategyManager;
|
||||
//import vrp.SearchStrategyModule;
|
||||
//import vrp.VehicleRoutingMetaAlgorithm;
|
||||
//import acceptors.AcceptNewRemoveWorst;
|
||||
//import basics.VehicleRouteFactoryImpl;
|
||||
//import basics.costcalculators.AuxilliaryCostCalculator;
|
||||
//import basics.costcalculators.CalculatesActivityInsertion;
|
||||
//import basics.costcalculators.CalculatesServiceInsertionConsideringFixCost;
|
||||
//import basics.costcalculators.CalculatesServiceInsertionOnRouteLevel;
|
||||
//import basics.costcalculators.CalculatesVehTypeDepServiceInsertion;
|
||||
//import basics.inisolution.CreateInitialSolution;
|
||||
//import basics.insertion.ConfigureFixCostCalculator;
|
||||
//import basics.insertion.DepotDistance;
|
||||
//import basics.insertion.ParRegretInsertion;
|
||||
//import basics.insertion.RecreationBestInsertion;
|
||||
//
|
||||
///**
|
||||
// * test instances for the capacitated vrp with time windows. instances are from solomon
|
||||
// * and can be found at:
|
||||
// * http://neo.lcc.uma.es/radi-aeb/WebVRP/
|
||||
// * @author stefan schroeder
|
||||
// *
|
||||
// */
|
||||
//
|
||||
//
|
||||
//
|
||||
//public class Taillard {
|
||||
//
|
||||
//
|
||||
// static class MyLocations implements Locations{
|
||||
//
|
||||
// private Map<String,Coordinate> locations = new HashMap<String, Coordinate>();
|
||||
//
|
||||
// public void addLocation(String id, Coordinate coord){
|
||||
// locations.put(id, coord);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Coordinate getCoord(String id) {
|
||||
// return locations.get(id);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static final String VRPHE = "vrphe";
|
||||
//
|
||||
// public static final String VFM = "vfm";
|
||||
//
|
||||
// private static Logger logger = Logger.getLogger(Christophides.class);
|
||||
//
|
||||
// private String fileNameOfInstance;
|
||||
//
|
||||
// private String depotId;
|
||||
//
|
||||
// private String instanceName;
|
||||
//
|
||||
// private String vehicleFile;
|
||||
//
|
||||
// private String vehicleCostScenario;
|
||||
//
|
||||
// private String vrpType;
|
||||
//
|
||||
// private ResultWriter resultWriter;
|
||||
//
|
||||
// private RuinAndRecreateReport report;
|
||||
//
|
||||
//
|
||||
// public Taillard(String fileNameOfInstance, String instanceName, String vehicleFileName, String vehicleCostScenario, String vrpType) {
|
||||
// super();
|
||||
// this.fileNameOfInstance = fileNameOfInstance;
|
||||
// this.instanceName = instanceName;
|
||||
// this.vehicleFile = vehicleFileName;
|
||||
// this.vehicleCostScenario = vehicleCostScenario;
|
||||
// this.vrpType = vrpType;
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) throws IOException {
|
||||
// System.out.println("start " + System.currentTimeMillis());
|
||||
// Logger.getRootLogger().setLevel(Level.INFO);
|
||||
//
|
||||
// int nOfProcessors = Runtime.getRuntime().availableProcessors();
|
||||
// logger.info("nOfProcessors: " + nOfProcessors);
|
||||
// ExecutorService executor = Executors.newFixedThreadPool(nOfProcessors+2);
|
||||
//
|
||||
// ResultWriter resultWriter = new ResultWriter();
|
||||
//// String vrpType = "VFM";
|
||||
// String vrpType = VRPHE;
|
||||
// String pblm_abbr = "R101";
|
||||
// String costScen = "R_19";
|
||||
//
|
||||
// String problem = "100_" + pblm_abbr + "_LuiShen";
|
||||
// String problemFile = pblm_abbr + ".txt";
|
||||
// Taillard luiShen = new Taillard("/Users/stefan/Documents/Schroeder/Dissertation/vrpInstances/cvrptw_solomon/nOfCust100/"+problemFile,
|
||||
// problem, "/Users/stefan/Documents/Schroeder/Dissertation/vrpInstances/vrphe_taillard/"+costScen+".txt", costScen, vrpType);
|
||||
// luiShen.setResultWriter(resultWriter);
|
||||
// luiShen.run(executor);
|
||||
//
|
||||
// System.out.println("finish " + System.currentTimeMillis());
|
||||
// resultWriter.write("output/taillard_"+ pblm_abbr + "_" + costScen + ".txt");
|
||||
// resultWriter.writeSolutions("output/taillard_solution_" + pblm_abbr + "_" + costScen + ".txt");
|
||||
//
|
||||
// executor.shutdown();
|
||||
// try {
|
||||
// executor.awaitTermination(10, TimeUnit.SECONDS);
|
||||
// } catch (InterruptedException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static String getName(int i) {
|
||||
// if(i<10){
|
||||
// return "0" + i;
|
||||
// }
|
||||
// else{
|
||||
// return "" + i;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void setResultWriter(ResultWriter resultWriter) {
|
||||
// this.resultWriter = resultWriter;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void run(ExecutorService executor){
|
||||
//
|
||||
// final MyLocations myLocations = new MyLocations();
|
||||
// Collection<Job> jobs = new ArrayList<Job>();
|
||||
// final Map<String,Service> jobMap = readLocationsAndJobs(myLocations,jobs);
|
||||
//
|
||||
// VehicleRoutingCosts costs = new VehicleRoutingCosts() {
|
||||
//
|
||||
// @Override
|
||||
// public double getBackwardTransportTime(String fromId, String toId, double arrivalTime, Driver driver, Vehicle vehicle) {
|
||||
// return getTransportTime(fromId, toId, arrivalTime, null, null);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getBackwardTransportCost(String fromId, String toId, double arrivalTime, Driver driver, Vehicle vehicle) {
|
||||
// return getTransportCost(fromId, toId, arrivalTime, null, null);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getTransportCost(String fromId, String toId, double departureTime, Driver driver, Vehicle vehicle) {
|
||||
// double variableCost;
|
||||
// if(vehicle == null){
|
||||
// variableCost = 1.0;
|
||||
// }
|
||||
// else{
|
||||
// variableCost = vehicle.getType().vehicleCostParams.perDistanceUnit;
|
||||
// }
|
||||
// return variableCost*EuclideanDistanceCalculator.calculateDistance(myLocations.getCoord(fromId), myLocations.getCoord(toId));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getTransportTime(String fromId, String toId, double departureTime, Driver driver, Vehicle vehicle) {
|
||||
// return getTransportCost(fromId, toId, departureTime, driver, vehicle);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// VrpBuilder vrpBuilder = new VrpBuilder(costs);
|
||||
// for(Job j : jobs){
|
||||
// vrpBuilder.addJob(j);
|
||||
// }
|
||||
// createVehicles(vrpBuilder);
|
||||
// VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
//
|
||||
// VehicleRoutingMetaAlgorithm metaAlgorithm = new VehicleRoutingMetaAlgorithm(vrp);
|
||||
// configure(metaAlgorithm,vrp,executor,myLocations);
|
||||
// metaAlgorithm.run();
|
||||
//
|
||||
// printSolutions(vrp);
|
||||
//
|
||||
// VehicleRoutingProblemSolution bestSolution = new SelectBest().selectSolution(vrp);
|
||||
//
|
||||
// resultWriter.addResult(instanceName+"_"+vehicleCostScenario , instanceName, RouteUtils.getNuOfActiveRoutes(bestSolution.getRoutes()), bestSolution.getCost());
|
||||
// resultWriter.addSolution(bestSolution);
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private void printSolutions(VehicleRoutingProblem vrp) {
|
||||
// for(VehicleRoutingProblemSolution s : vrp.getSolutions()){
|
||||
// System.out.println("total: " + s.getCost());
|
||||
// System.out.println("activeTours: " + RouteUtils.getNuOfActiveRoutes(s.getRoutes()));
|
||||
// System.out.println("");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private void configure(VehicleRoutingMetaAlgorithm metaAlgorithm, final VehicleRoutingProblem vrp, ExecutorService executor, MyLocations myLocations) {
|
||||
// VehicleRoute.VehicleRouteCostCalculator = new VehicleRouteCostCalculator() {
|
||||
//
|
||||
// @Override
|
||||
// public double calculate(Tour tour, Vehicle vehicle, Driver driver) {
|
||||
//// return vehicle.getType().vehicleCostParams.fix + tour.getCost();
|
||||
// return tour.getCost();
|
||||
// }
|
||||
//
|
||||
// };
|
||||
//
|
||||
//// final VehicleFleetManager vehicleFleetManager = new InfiniteVehicles(vrp.getVehicles());
|
||||
// final VehicleFleetManager vehicleFleetManager = new VehicleFleetManagerImpl(vrp.getVehicles());
|
||||
//
|
||||
// final VehicleRouteCostFunctionFactory costFuncFac = getFac();
|
||||
//
|
||||
// AuxilliaryCostCalculator auxilliaryCostCalculator = new AuxilliaryCostCalculator(vrp.getCosts(), costFuncFac);
|
||||
// CalculatesActivityInsertion actInsertion = new CalculatesActivityInsertion(auxilliaryCostCalculator,0,5);
|
||||
//// CalculatesServiceInsertion standardServiceInsertion = new CalculatesServiceInsertion(actInsertion);
|
||||
// CalculatesServiceInsertionOnRouteLevel standardServiceInsertion = new CalculatesServiceInsertionOnRouteLevel(actInsertion,vrp.getCosts(),costFuncFac);
|
||||
// CalculatesServiceInsertionOnRouteLevel.MEMORYSIZE_FORPROMISING_INSERTIONPOSITIONS = 2;
|
||||
// CalculatesServiceInsertionConsideringFixCost withFixCost = new CalculatesServiceInsertionConsideringFixCost(standardServiceInsertion);
|
||||
// withFixCost.setWeightOfFixCost(0.0);
|
||||
//
|
||||
// final JobInsertionCalculator vehicleTypeDepInsertionCost = new CalculatesVehTypeDepServiceInsertion(vehicleFleetManager, standardServiceInsertion);
|
||||
//
|
||||
// final TourStateUpdater tourStateCalculator = new TourStateUpdater(vrp.getCosts(),costFuncFac);
|
||||
// tourStateCalculator.setTimeWindowUpdate(false);
|
||||
//
|
||||
// RouteAgentFactory routeAgentFactory = new RouteAgentFactory(){
|
||||
//
|
||||
// @Override
|
||||
// public RouteAlgorithm createAgent(VehicleRoute route) {
|
||||
// VehicleSwitchedListener switched = new VehicleSwitchedListener() {
|
||||
//
|
||||
// @Override
|
||||
// public void vehicleSwitched(Vehicle oldVehicle, Vehicle newVehicle) {
|
||||
// vehicleFleetManager.unlock(oldVehicle);
|
||||
// vehicleFleetManager.lock(newVehicle);
|
||||
// }
|
||||
//
|
||||
// };
|
||||
// RouteAlgorithmImpl agent = new RouteAlgorithmImpl(vehicleTypeDepInsertionCost, tourStateCalculator);
|
||||
// agent.getListeners().add(switched);
|
||||
// return agent;
|
||||
// }
|
||||
//
|
||||
// };
|
||||
//
|
||||
// ParRegretInsertion regretInsertion = new ParRegretInsertion(executor, routeAgentFactory);
|
||||
// regretInsertion.getListener().add(new ConfigureFixCostCalculator(vrp, withFixCost));
|
||||
// regretInsertion.setJobDistance(new DepotDistance(myLocations, depotId));
|
||||
// regretInsertion.scoreParam_of_timeWindowLegth = 0.5;
|
||||
// regretInsertion.scoreParam_of_distance = 0.2;
|
||||
// regretInsertion.setVehicleRouteFactory(new VehicleRouteFactoryImpl(depotId));
|
||||
//
|
||||
//
|
||||
// RecreationBestInsertion bestInsertion = new RecreationBestInsertion(routeAgentFactory);
|
||||
// bestInsertion.getListener().add(new ConfigureFixCostCalculator(vrp, withFixCost));
|
||||
// bestInsertion.setVehicleRouteFactory(new VehicleRouteFactoryImpl(depotId));
|
||||
//
|
||||
//// for(int i=0;i<3;i++){
|
||||
// VehicleRoutingProblemSolution vrpSol = new CreateInitialSolution(bestInsertion).createInitialSolution(vrp);
|
||||
// vrp.getSolutions().add(vrpSol);
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// RadialAndRandomRemoveBestInsert smallNeighborHoodSearchModule = new RadialAndRandomRemoveBestInsert(vrp, vehicleFleetManager, routeAlgorithm);
|
||||
// smallNeighborHoodSearchModule.setCalcConsideringFix(withFixCost);
|
||||
// smallNeighborHoodSearchModule.setStateCalc(tourStateCalculator);
|
||||
// smallNeighborHoodSearchModule.setInsertionStrategy(bestInsertion);
|
||||
// smallNeighborHoodSearchModule.setAuxilliaryCostCalculator(auxilliaryCostCalculator);
|
||||
//
|
||||
// SearchStrategy smallNeighborHoodSearch = new SearchStrategy(new SelectRandomly(), new AcceptNewRemoveWorst());
|
||||
//
|
||||
// smallNeighborHoodSearch.addModule(smallNeighborHoodSearchModule);
|
||||
//
|
||||
// GendreauPostOpt postOpt = new GendreauPostOpt(vrp, routeAgentFactory,
|
||||
// (RuinRadial) new RadialRuinFactory(0.2, new JobDistanceAvgCosts(vrp.getCosts()), routeAgentFactory).createStrategy(vrp),
|
||||
// bestInsertion);
|
||||
// postOpt.setFleetManager(vehicleFleetManager);
|
||||
// postOpt.setVehicleRouteFactory(new VehicleRouteFactoryImpl(depotId));
|
||||
// postOpt.setNuOfIterations(2000);
|
||||
// postOpt.setShareOfJobsToRuin(0.18);
|
||||
//// smallNeighborHoodSearch.addModule(postOpt);
|
||||
//
|
||||
//
|
||||
//// SearchStrategy strat2 = new SearchStrategy(new SelectBest(), new AcceptNewRemoveWorst());
|
||||
//// GendreauPostOpt postOpt2 = new GendreauPostOpt(vrp, routeAgentFactory,
|
||||
//// (RuinRadial) new RadialRuinFactory(0.2, new JobDistanceAvgCosts(vrp.getCosts()), routeAgentFactory).createStrategy(vrp),
|
||||
//// bestInsertion);
|
||||
//// postOpt2.setFleetManager(vehicleFleetManager);
|
||||
//// postOpt2.setVehicleRouteFactory(new VehicleRouteFactoryImpl(depotId));
|
||||
//// postOpt2.setNuOfIterations(2000);
|
||||
//// postOpt2.setShareOfJobsToRuin(0.1);
|
||||
//// strat2.addModule(postOpt2);
|
||||
//
|
||||
// SearchStrategyModule solutionVerifier = new SearchStrategyModule() {
|
||||
//
|
||||
// @Override
|
||||
// public VehicleRoutingProblemSolution runAndGetSolution(VehicleRoutingProblemSolution vrpSolution) {
|
||||
// logger.info("verify solution");
|
||||
// if(SolutionVerifier.resultOfSolutionEqualsSumOfIndividualRouteCost(vrpSolution, vrp, costFuncFac,false)) return vrpSolution;
|
||||
// throw new IllegalStateException("solution is not valid");
|
||||
// }
|
||||
// };
|
||||
// smallNeighborHoodSearch.addModule(solutionVerifier);
|
||||
//
|
||||
// SearchStrategyManager strategyManager = new SearchStrategyManager();
|
||||
// strategyManager.addStrategy(smallNeighborHoodSearch, 1.0);
|
||||
//// strategyManager.addStrategy(strat2, 0.3);
|
||||
//
|
||||
// metaAlgorithm.setSearchStrategyManager(strategyManager);
|
||||
// metaAlgorithm.setNuOfIterations(20);
|
||||
// VehicleRoutingProblem.SOLUTION_MEMORY = 4;
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private VehicleRouteCostFunctionFactory getFac() {
|
||||
// VehicleRouteCostFunctionFactory fac = new VehicleRouteCostFunctionFactory() {
|
||||
//
|
||||
// @Override
|
||||
// public VehicleRouteCostFunction createCostFunction(Vehicle vehicle, Driver driver) {
|
||||
// return new VehicleRouteCostFunction(){
|
||||
//
|
||||
// double cost = 0.0;
|
||||
//
|
||||
// @Override
|
||||
// public void handleActivity(TourActivity tourAct, double startTime, double endTime) {
|
||||
// if(startTime > tourAct.getLatestOperationStartTime()){
|
||||
// cost += Double.MAX_VALUE;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void handleLeg(TourActivity fromAct, TourActivity toAct, double depTime, double tpCost) {
|
||||
// cost += tpCost;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getCost() {
|
||||
// return cost;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void finish() {
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void reset() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// };
|
||||
// }
|
||||
// };
|
||||
// return fac;
|
||||
// }
|
||||
//
|
||||
// private void createVehicles(VrpBuilder vrpBuilder) {
|
||||
// BufferedReader reader = IOUtils.getBufferedReader(vehicleFile);
|
||||
// String line = null;
|
||||
// int vehicleIdColumn = 0;
|
||||
// int capacityColumn = 1;
|
||||
// int fixColumn = 2;
|
||||
// int varColumn = 3;
|
||||
// int nOfVehiclesColumn = 4;
|
||||
// boolean firstLine = true;
|
||||
// try {
|
||||
// while((line = reader.readLine()) != null){
|
||||
// if(firstLine){
|
||||
// firstLine = false;
|
||||
// continue;
|
||||
// }
|
||||
// String[] tokens = line.split(";");
|
||||
// String vehicleId = tokens[vehicleIdColumn];
|
||||
// int capacity = Integer.parseInt(tokens[capacityColumn]);
|
||||
// int fixCost = Integer.parseInt(tokens[fixColumn]);
|
||||
// double var;
|
||||
// if(vrpType.equals(VRPHE)){
|
||||
// var = Double.parseDouble(tokens[varColumn]);
|
||||
// }
|
||||
// else {
|
||||
// var = 1.0;
|
||||
// }
|
||||
// int nOfVehicles = Integer.parseInt(tokens[nOfVehiclesColumn]);
|
||||
// for(int i=0;i<nOfVehicles;i++){
|
||||
// String vId = vehicleId + "_" + (i+1);
|
||||
// VehicleCostParams costparams = VehicleImpl.getFactory().createVehicleCostParams(fixCost, 0.0, var);
|
||||
// Type type = VehicleImpl.getFactory().createType(vehicleId, capacity, costparams);
|
||||
// VehicleImpl v = VehicleImpl.getFactory().createVehicle(vId, depotId, type);
|
||||
// vrpBuilder.addVehicle(v);
|
||||
// }
|
||||
// }
|
||||
// reader.close();
|
||||
// } catch (IOException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private Map<String,Service> readLocationsAndJobs(MyLocations locations, Collection<Job> jobs){
|
||||
// BufferedReader reader = IOUtils.getBufferedReader(fileNameOfInstance);
|
||||
// String line = null;
|
||||
// int counter = 0;
|
||||
// Map<String,Service> jobMap = new HashMap<String, Service>();
|
||||
// try {
|
||||
// while((line = reader.readLine()) != null){
|
||||
// line = line.replace("\r", "");
|
||||
// line = line.trim();
|
||||
// String[] tokens = line.split(" +");
|
||||
// counter++;
|
||||
// if(counter == 5){
|
||||
// int vehicleCap = Integer.parseInt(tokens[1]);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if(counter > 9){
|
||||
// Coordinate coord = makeCoord(tokens[1],tokens[2]);
|
||||
// double depotStart = 0.0;
|
||||
// double depotEnd = Double.MAX_VALUE;
|
||||
// String customerId = tokens[0];
|
||||
// locations.addLocation(customerId, coord);
|
||||
// int demand = Integer.parseInt(tokens[3]);
|
||||
// double start = Double.parseDouble(tokens[4]);
|
||||
// double end = Double.parseDouble(tokens[5]);
|
||||
// double serviceTime = Double.parseDouble(tokens[6]);
|
||||
// if(counter == 10){
|
||||
// depotStart = start;
|
||||
// depotEnd = end;
|
||||
// depotId = tokens[0];
|
||||
//
|
||||
// }
|
||||
// else{
|
||||
// Service service = VrpUtils.createService("" + counter, customerId, demand, 0.0, 0.0, Double.MAX_VALUE);
|
||||
//// Shipment shipment = VrpUtils.createShipment("" + counter, depotId, customerId, demand,
|
||||
//// VrpUtils.createTimeWindow(depotStart, depotEnd), VrpUtils.createTimeWindow(start, end));
|
||||
//// shipment.setDeliveryServiceTime(serviceTime);
|
||||
// jobs.add(service);
|
||||
// jobMap.put(customerId, service);
|
||||
//// jobs.add(shipment);
|
||||
//// j
|
||||
//// Shipment shipment = VrpUtils.createShipment("" + counter, depotId, customerId, demand,
|
||||
//// VrpUtils.createTimeWindow(depotStart, depotEnd), VrpUtils.createTimeWindow(start, end));
|
||||
//// shipment.setDeliveryServiceTime(serviceTime);
|
||||
//// jobs.add(shipment);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// reader.close();
|
||||
// } catch (NumberFormatException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// } catch (IOException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return jobMap;
|
||||
// }
|
||||
//
|
||||
// private Coordinate makeCoord(String xString, String yString) {
|
||||
// double x = Double.parseDouble(xString);
|
||||
// double y = Double.parseDouble(yString);
|
||||
// return new Coordinate(x,y);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.Vehicle;
|
||||
|
||||
public class ChristophidesReaderTest {
|
||||
|
||||
@Test
|
||||
public void whenReadingInstance_nuOfCustomersIsCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new ChristophidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(50,vrp.getJobs().values().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingInstance_fleetSizeIsInfinite(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new ChristophidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(FleetSize.INFINITE,vrp.getFleetSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingInstance_vehicleCapacitiesAreCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new ChristophidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(160,v.getCapacity());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingInstance_vehicleLocationsAreCorrect_and_correspondToDepotLocation(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new ChristophidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(30.0,v.getCoord().getX(),0.01);
|
||||
assertEquals(40.0,v.getCoord().getY(),0.01);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingInstance_vehicleDurationsAreCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new ChristophidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc13.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(0.0,v.getEarliestDeparture(),0.01);
|
||||
assertEquals(720.0,v.getLatestArrival()-v.getEarliestDeparture(),0.01);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingInstance_demandOfCustomerOneIsCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new ChristophidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(7,vrp.getJobs().get("1").getCapacityDemand());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingInstance_serviceDurationOfCustomerTwoIsCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new ChristophidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc13.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(50.0,((Service)vrp.getJobs().get("2")).getServiceDuration(),0.1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
148
jsprit-instances/src/test/java/readers/CordeauReaderTest.java
Normal file
148
jsprit-instances/src/test/java/readers/CordeauReaderTest.java
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.Vehicle;
|
||||
|
||||
public class CordeauReaderTest {
|
||||
|
||||
@Test
|
||||
public void testCordeauReader(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
vrpBuilder.build();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingInstance_fleetSizeIsFinite(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
assertEquals(FleetSize.FINITE, vrp.getFleetSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNuOfVehicles(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
assertEquals(16,vrp.getVehicles().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingCordeauInstance_vehiclesHaveTheCorrectCapacity(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(80, v.getCapacity());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingCordeauInstance_vehiclesHaveTheCorrectDuration(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p08").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(0.0,v.getEarliestDeparture(),0.1);
|
||||
assertEquals(310.0, v.getLatestArrival()-v.getEarliestDeparture(),0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingCustomersCordeauInstance_customerOneShouldHaveCorrectCoordinates(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Service service = (Service) vrp.getJobs().get("1");
|
||||
assertEquals(37.0, service.getCoord().getX(), 0.1);
|
||||
assertEquals(52.0, service.getCoord().getY(), 0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingCustomersCordeauInstance_customerTwoShouldHaveCorrectServiceDuration(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Service service = (Service) vrp.getJobs().get("2");
|
||||
assertEquals(0.0, service.getServiceDuration(), 0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingCustomersCordeauInstance_customerThreeShouldHaveCorrectDemand(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Service service = (Service) vrp.getJobs().get("3");
|
||||
assertEquals(16.0, service.getCapacityDemand(), 0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingCustomersCordeauInstance_customerFortySevenShouldHaveCorrectDemand(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Service service = (Service) vrp.getJobs().get("47");
|
||||
assertEquals(25.0, service.getCapacityDemand(), 0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocationsAndCapOfVehicles(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
boolean capacityOk = true;
|
||||
boolean loc1ok = false;
|
||||
boolean loc2ok = false;
|
||||
boolean loc3ok = false;
|
||||
boolean loc4ok = false;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getCapacity() != 80) capacityOk = false;
|
||||
if(v.getCoord().getX() == 20.0 && v.getCoord().getY() == 20.0) loc1ok = true;
|
||||
if(v.getCoord().getX() == 30.0 && v.getCoord().getY() == 40.0) loc2ok = true;
|
||||
if(v.getCoord().getX() == 50.0 && v.getCoord().getY() == 30.0) loc3ok = true;
|
||||
if(v.getCoord().getX() == 60.0 && v.getCoord().getY() == 50.0) loc4ok = true;
|
||||
}
|
||||
assertTrue(capacityOk);
|
||||
assertTrue(loc1ok);
|
||||
assertTrue(loc2ok);
|
||||
assertTrue(loc3ok);
|
||||
assertTrue(loc4ok);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNuOfCustomers(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.newBuilderInstance();
|
||||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
assertEquals(50,vrp.getJobs().values().size());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetComposition;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
|
||||
public class LuiShenReaderTest {
|
||||
|
||||
VehicleRoutingProblem vrp;
|
||||
|
||||
|
||||
@Before
|
||||
public void doBefore(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new LuiShenReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath(),
|
||||
this.getClass().getClassLoader().getResource("C1_LuiShenVehicles.txt").getPath(), "a");
|
||||
vrp = builder.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFleetCompostion(){
|
||||
assertEquals(FleetComposition.HETEROGENEOUS,vrp.getFleetComposition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFleetSize(){
|
||||
assertEquals(FleetSize.INFINITE,vrp.getFleetSize());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNuOfTypes(){
|
||||
assertEquals(3, vrp.getTypes().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNuOfRepresentativeVehicles(){
|
||||
assertEquals(3, vrp.getVehicles().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNuOfJobs(){
|
||||
assertEquals(100,vrp.getJobs().values().size());
|
||||
}
|
||||
}
|
||||
104
jsprit-instances/src/test/java/readers/SolomonReaderTest.java
Normal file
104
jsprit-instances/src/test/java/readers/SolomonReaderTest.java
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*******************************************************************************
|
||||
* 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 readers;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.Vehicle;
|
||||
|
||||
public class SolomonReaderTest {
|
||||
|
||||
@Test
|
||||
public void whenReadingSolomonInstance_nuOfCustomersIsCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(100,vrp.getJobs().values().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingSolomonInstance_fleetSizeIsInfinite(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(FleetSize.INFINITE,vrp.getFleetSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingSolomonInstance_vehicleCapacitiesAreCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(200,v.getCapacity());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingSolomonInstance_vehicleLocationsAreCorrect_and_correspondToDepotLocation(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(40.0,v.getCoord().getX(),0.01);
|
||||
assertEquals(50.0,v.getCoord().getY(),0.01);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingSolomonInstance_demandOfCustomerOneIsCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(10,vrp.getJobs().get("1").getCapacityDemand());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingSolomonInstance_serviceDurationOfCustomerTwoIsCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(90,((Service)vrp.getJobs().get("2")).getServiceDuration(),0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingSolomonInstance_earliestServiceStartTimeOfCustomerSixtyTwoIsCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(262.0,((Service)vrp.getJobs().get("62")).getTimeWindow().getStart(),0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingSolomonInstance_latestServiceStartTimeOfCustomerEightySevenIsCorrect(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(144.0,((Service)vrp.getJobs().get("87")).getTimeWindow().getEnd(),0.1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
110
jsprit-instances/src/test/resources/C101_solomon.txt
Normal file
110
jsprit-instances/src/test/resources/C101_solomon.txt
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
C101
|
||||
|
||||
VEHICLE
|
||||
NUMBER CAPACITY
|
||||
25 200
|
||||
|
||||
CUSTOMER
|
||||
CUST NO. XCOORD. YCOORD. DEMAND READY TIME DUE DATE SERVICE TIME
|
||||
|
||||
0 40 50 0 0 1236 0
|
||||
1 45 68 10 912 967 90
|
||||
2 45 70 30 825 870 90
|
||||
3 42 66 10 65 146 90
|
||||
4 42 68 10 727 782 90
|
||||
5 42 65 10 15 67 90
|
||||
6 40 69 20 621 702 90
|
||||
7 40 66 20 170 225 90
|
||||
8 38 68 20 255 324 90
|
||||
9 38 70 10 534 605 90
|
||||
10 35 66 10 357 410 90
|
||||
11 35 69 10 448 505 90
|
||||
12 25 85 20 652 721 90
|
||||
13 22 75 30 30 92 90
|
||||
14 22 85 10 567 620 90
|
||||
15 20 80 40 384 429 90
|
||||
16 20 85 40 475 528 90
|
||||
17 18 75 20 99 148 90
|
||||
18 15 75 20 179 254 90
|
||||
19 15 80 10 278 345 90
|
||||
20 30 50 10 10 73 90
|
||||
21 30 52 20 914 965 90
|
||||
22 28 52 20 812 883 90
|
||||
23 28 55 10 732 777 90
|
||||
24 25 50 10 65 144 90
|
||||
25 25 52 40 169 224 90
|
||||
26 25 55 10 622 701 90
|
||||
27 23 52 10 261 316 90
|
||||
28 23 55 20 546 593 90
|
||||
29 20 50 10 358 405 90
|
||||
30 20 55 10 449 504 90
|
||||
31 10 35 20 200 237 90
|
||||
32 10 40 30 31 100 90
|
||||
33 8 40 40 87 158 90
|
||||
34 8 45 20 751 816 90
|
||||
35 5 35 10 283 344 90
|
||||
36 5 45 10 665 716 90
|
||||
37 2 40 20 383 434 90
|
||||
38 0 40 30 479 522 90
|
||||
39 0 45 20 567 624 90
|
||||
40 35 30 10 264 321 90
|
||||
41 35 32 10 166 235 90
|
||||
42 33 32 20 68 149 90
|
||||
43 33 35 10 16 80 90
|
||||
44 32 30 10 359 412 90
|
||||
45 30 30 10 541 600 90
|
||||
46 30 32 30 448 509 90
|
||||
47 30 35 10 1054 1127 90
|
||||
48 28 30 10 632 693 90
|
||||
49 28 35 10 1001 1066 90
|
||||
50 26 32 10 815 880 90
|
||||
51 25 30 10 725 786 90
|
||||
52 25 35 10 912 969 90
|
||||
53 44 5 20 286 347 90
|
||||
54 42 10 40 186 257 90
|
||||
55 42 15 10 95 158 90
|
||||
56 40 5 30 385 436 90
|
||||
57 40 15 40 35 87 90
|
||||
58 38 5 30 471 534 90
|
||||
59 38 15 10 651 740 90
|
||||
60 35 5 20 562 629 90
|
||||
61 50 30 10 531 610 90
|
||||
62 50 35 20 262 317 90
|
||||
63 50 40 50 171 218 90
|
||||
64 48 30 10 632 693 90
|
||||
65 48 40 10 76 129 90
|
||||
66 47 35 10 826 875 90
|
||||
67 47 40 10 12 77 90
|
||||
68 45 30 10 734 777 90
|
||||
69 45 35 10 916 969 90
|
||||
70 95 30 30 387 456 90
|
||||
71 95 35 20 293 360 90
|
||||
72 53 30 10 450 505 90
|
||||
73 92 30 10 478 551 90
|
||||
74 53 35 50 353 412 90
|
||||
75 45 65 20 997 1068 90
|
||||
76 90 35 10 203 260 90
|
||||
77 88 30 10 574 643 90
|
||||
78 88 35 20 109 170 90
|
||||
79 87 30 10 668 731 90
|
||||
80 85 25 10 769 820 90
|
||||
81 85 35 30 47 124 90
|
||||
82 75 55 20 369 420 90
|
||||
83 72 55 10 265 338 90
|
||||
84 70 58 20 458 523 90
|
||||
85 68 60 30 555 612 90
|
||||
86 66 55 10 173 238 90
|
||||
87 65 55 20 85 144 90
|
||||
88 65 60 30 645 708 90
|
||||
89 63 58 10 737 802 90
|
||||
90 60 55 10 20 84 90
|
||||
91 60 60 10 836 889 90
|
||||
92 67 85 20 368 441 90
|
||||
93 65 85 40 475 518 90
|
||||
94 65 82 10 285 336 90
|
||||
95 62 80 30 196 239 90
|
||||
96 60 80 10 95 156 90
|
||||
97 60 85 30 561 622 90
|
||||
98 58 75 20 30 84 90
|
||||
99 55 80 10 743 820 90
|
||||
100 55 85 20 647 726 90
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Vehicle;Capacity;Cost_a;Cost_b;Cost_c
|
||||
A;100;300;60;30
|
||||
B;200;800;160;80
|
||||
C;300;1350;270;135
|
||||
59
jsprit-instances/src/test/resources/p01
Normal file
59
jsprit-instances/src/test/resources/p01
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
2 4 50 4
|
||||
0 80
|
||||
0 80
|
||||
0 80
|
||||
0 80
|
||||
1 37 52 0 7 1 4 1 2 4 8
|
||||
2 49 49 0 30 1 4 1 2 4 8
|
||||
3 52 64 0 16 1 4 1 2 4 8
|
||||
4 20 26 0 9 1 4 1 2 4 8
|
||||
5 40 30 0 21 1 4 1 2 4 8
|
||||
6 21 47 0 15 1 4 1 2 4 8
|
||||
7 17 63 0 19 1 4 1 2 4 8
|
||||
8 31 62 0 23 1 4 1 2 4 8
|
||||
9 52 33 0 11 1 4 1 2 4 8
|
||||
10 51 21 0 5 1 4 1 2 4 8
|
||||
11 42 41 0 19 1 4 1 2 4 8
|
||||
12 31 32 0 29 1 4 1 2 4 8
|
||||
13 5 25 0 23 1 4 1 2 4 8
|
||||
14 12 42 0 21 1 4 1 2 4 8
|
||||
15 36 16 0 10 1 4 1 2 4 8
|
||||
16 52 41 0 15 1 4 1 2 4 8
|
||||
17 27 23 0 3 1 4 1 2 4 8
|
||||
18 17 33 0 41 1 4 1 2 4 8
|
||||
19 13 13 0 9 1 4 1 2 4 8
|
||||
20 57 58 0 28 1 4 1 2 4 8
|
||||
21 62 42 0 8 1 4 1 2 4 8
|
||||
22 42 57 0 8 1 4 1 2 4 8
|
||||
23 16 57 0 16 1 4 1 2 4 8
|
||||
24 8 52 0 10 1 4 1 2 4 8
|
||||
25 7 38 0 28 1 4 1 2 4 8
|
||||
26 27 68 0 7 1 4 1 2 4 8
|
||||
27 30 48 0 15 1 4 1 2 4 8
|
||||
28 43 67 0 14 1 4 1 2 4 8
|
||||
29 58 48 0 6 1 4 1 2 4 8
|
||||
30 58 27 0 19 1 4 1 2 4 8
|
||||
31 37 69 0 11 1 4 1 2 4 8
|
||||
32 38 46 0 12 1 4 1 2 4 8
|
||||
33 46 10 0 23 1 4 1 2 4 8
|
||||
34 61 33 0 26 1 4 1 2 4 8
|
||||
35 62 63 0 17 1 4 1 2 4 8
|
||||
36 63 69 0 6 1 4 1 2 4 8
|
||||
37 32 22 0 9 1 4 1 2 4 8
|
||||
38 45 35 0 15 1 4 1 2 4 8
|
||||
39 59 15 0 14 1 4 1 2 4 8
|
||||
40 5 6 0 7 1 4 1 2 4 8
|
||||
41 10 17 0 27 1 4 1 2 4 8
|
||||
42 21 10 0 13 1 4 1 2 4 8
|
||||
43 5 64 0 11 1 4 1 2 4 8
|
||||
44 30 15 0 16 1 4 1 2 4 8
|
||||
45 39 10 0 10 1 4 1 2 4 8
|
||||
46 32 39 0 5 1 4 1 2 4 8
|
||||
47 25 32 0 25 1 4 1 2 4 8
|
||||
48 25 55 0 17 1 4 1 2 4 8
|
||||
49 48 28 0 18 1 4 1 2 4 8
|
||||
50 56 37 0 10 1 4 1 2 4 8
|
||||
51 20 20 0 0 0 0
|
||||
52 30 40 0 0 0 0
|
||||
53 50 30 0 0 0 0
|
||||
54 60 50 0 0 0 0
|
||||
254
jsprit-instances/src/test/resources/p08
Normal file
254
jsprit-instances/src/test/resources/p08
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
2 14 249 2
|
||||
310 500
|
||||
310 500
|
||||
1 -99 -97 0 6 1 2 1 2
|
||||
2 -59 50 0 72 1 2 1 2
|
||||
3 0 14 0 93 1 2 1 2
|
||||
4 -17 -66 0 28 1 2 1 2
|
||||
5 -69 -19 0 5 1 2 1 2
|
||||
6 31 12 0 43 1 2 1 2
|
||||
7 5 -41 0 1 1 2 1 2
|
||||
8 -12 10 0 36 1 2 1 2
|
||||
9 -64 70 0 53 1 2 1 2
|
||||
10 -12 85 0 63 1 2 1 2
|
||||
11 -18 64 0 25 1 2 1 2
|
||||
12 -77 -16 0 50 1 2 1 2
|
||||
13 -53 88 0 57 1 2 1 2
|
||||
14 83 -24 0 1 1 2 1 2
|
||||
15 24 41 0 66 1 2 1 2
|
||||
16 17 21 0 37 1 2 1 2
|
||||
17 42 96 0 51 1 2 1 2
|
||||
18 -65 0 0 47 1 2 1 2
|
||||
19 -47 -26 0 88 1 2 1 2
|
||||
20 85 36 0 75 1 2 1 2
|
||||
21 -35 -54 0 48 1 2 1 2
|
||||
22 54 -21 0 40 1 2 1 2
|
||||
23 64 -17 0 8 1 2 1 2
|
||||
24 55 89 0 69 1 2 1 2
|
||||
25 17 -25 0 93 1 2 1 2
|
||||
26 -61 66 0 29 1 2 1 2
|
||||
27 -61 26 0 5 1 2 1 2
|
||||
28 17 -72 0 53 1 2 1 2
|
||||
29 79 38 0 8 1 2 1 2
|
||||
30 -62 -2 0 24 1 2 1 2
|
||||
31 -90 -68 0 53 1 2 1 2
|
||||
32 52 66 0 13 1 2 1 2
|
||||
33 -54 -50 0 47 1 2 1 2
|
||||
34 8 -84 0 57 1 2 1 2
|
||||
35 37 -90 0 9 1 2 1 2
|
||||
36 -83 49 0 74 1 2 1 2
|
||||
37 35 -1 0 83 1 2 1 2
|
||||
38 7 59 0 96 1 2 1 2
|
||||
39 12 48 0 42 1 2 1 2
|
||||
40 57 95 0 80 1 2 1 2
|
||||
41 92 28 0 22 1 2 1 2
|
||||
42 -3 97 0 56 1 2 1 2
|
||||
43 -7 52 0 43 1 2 1 2
|
||||
44 42 -15 0 12 1 2 1 2
|
||||
45 77 -43 0 73 1 2 1 2
|
||||
46 59 -49 0 32 1 2 1 2
|
||||
47 25 91 0 8 1 2 1 2
|
||||
48 69 -19 0 79 1 2 1 2
|
||||
49 -82 -14 0 79 1 2 1 2
|
||||
50 74 -70 0 4 1 2 1 2
|
||||
51 69 59 0 14 1 2 1 2
|
||||
52 29 33 0 17 1 2 1 2
|
||||
53 -97 9 0 19 1 2 1 2
|
||||
54 -58 9 0 44 1 2 1 2
|
||||
55 28 93 0 5 1 2 1 2
|
||||
56 7 73 0 37 1 2 1 2
|
||||
57 -28 73 0 100 1 2 1 2
|
||||
58 -76 55 0 62 1 2 1 2
|
||||
59 41 42 0 90 1 2 1 2
|
||||
60 92 40 0 57 1 2 1 2
|
||||
61 -84 -29 0 44 1 2 1 2
|
||||
62 -12 42 0 37 1 2 1 2
|
||||
63 51 -45 0 80 1 2 1 2
|
||||
64 -37 46 0 60 1 2 1 2
|
||||
65 -97 35 0 95 1 2 1 2
|
||||
66 14 89 0 56 1 2 1 2
|
||||
67 60 58 0 56 1 2 1 2
|
||||
68 -63 -75 0 9 1 2 1 2
|
||||
69 -18 34 0 39 1 2 1 2
|
||||
70 -46 -82 0 15 1 2 1 2
|
||||
71 -86 -79 0 4 1 2 1 2
|
||||
72 -43 -30 0 58 1 2 1 2
|
||||
73 -44 7 0 73 1 2 1 2
|
||||
74 -3 -20 0 5 1 2 1 2
|
||||
75 36 41 0 12 1 2 1 2
|
||||
76 -30 -94 0 3 1 2 1 2
|
||||
77 79 -62 0 8 1 2 1 2
|
||||
78 51 70 0 31 1 2 1 2
|
||||
79 -61 -26 0 48 1 2 1 2
|
||||
80 6 94 0 3 1 2 1 2
|
||||
81 -19 -62 0 52 1 2 1 2
|
||||
82 -20 51 0 99 1 2 1 2
|
||||
83 -81 37 0 29 1 2 1 2
|
||||
84 7 31 0 12 1 2 1 2
|
||||
85 52 12 0 50 1 2 1 2
|
||||
86 83 -91 0 98 1 2 1 2
|
||||
87 -7 -92 0 4 1 2 1 2
|
||||
88 82 -74 0 56 1 2 1 2
|
||||
89 -70 85 0 24 1 2 1 2
|
||||
90 -83 -30 0 33 1 2 1 2
|
||||
91 71 -61 0 45 1 2 1 2
|
||||
92 85 11 0 98 1 2 1 2
|
||||
93 66 -48 0 4 1 2 1 2
|
||||
94 78 -87 0 36 1 2 1 2
|
||||
95 9 -79 0 72 1 2 1 2
|
||||
96 -36 4 0 26 1 2 1 2
|
||||
97 66 39 0 71 1 2 1 2
|
||||
98 92 -17 0 84 1 2 1 2
|
||||
99 -46 -79 0 21 1 2 1 2
|
||||
100 -30 -63 0 99 1 2 1 2
|
||||
101 -42 63 0 33 1 2 1 2
|
||||
102 20 42 0 84 1 2 1 2
|
||||
103 15 98 0 74 1 2 1 2
|
||||
104 1 -17 0 93 1 2 1 2
|
||||
105 64 20 0 25 1 2 1 2
|
||||
106 -96 85 0 39 1 2 1 2
|
||||
107 93 -29 0 42 1 2 1 2
|
||||
108 -40 -84 0 77 1 2 1 2
|
||||
109 86 35 0 68 1 2 1 2
|
||||
110 91 36 0 50 1 2 1 2
|
||||
111 62 -8 0 42 1 2 1 2
|
||||
112 -24 4 0 71 1 2 1 2
|
||||
113 11 96 0 85 1 2 1 2
|
||||
114 -53 62 0 78 1 2 1 2
|
||||
115 -28 -71 0 64 1 2 1 2
|
||||
116 7 -4 0 5 1 2 1 2
|
||||
117 95 -9 0 93 1 2 1 2
|
||||
118 -3 17 0 18 1 2 1 2
|
||||
119 53 -90 0 38 1 2 1 2
|
||||
120 58 -19 0 29 1 2 1 2
|
||||
121 -83 84 0 81 1 2 1 2
|
||||
122 -1 49 0 4 1 2 1 2
|
||||
123 -4 17 0 23 1 2 1 2
|
||||
124 -82 -3 0 11 1 2 1 2
|
||||
125 -43 47 0 86 1 2 1 2
|
||||
126 6 -6 0 2 1 2 1 2
|
||||
127 70 99 0 31 1 2 1 2
|
||||
128 68 -29 0 54 1 2 1 2
|
||||
129 -94 -30 0 87 1 2 1 2
|
||||
130 -94 -20 0 17 1 2 1 2
|
||||
131 -21 77 0 81 1 2 1 2
|
||||
132 64 37 0 72 1 2 1 2
|
||||
133 -70 -19 0 10 1 2 1 2
|
||||
134 88 65 0 50 1 2 1 2
|
||||
135 2 29 0 25 1 2 1 2
|
||||
136 33 57 0 71 1 2 1 2
|
||||
137 -70 6 0 85 1 2 1 2
|
||||
138 -38 -56 0 51 1 2 1 2
|
||||
139 -80 -95 0 29 1 2 1 2
|
||||
140 -5 -39 0 55 1 2 1 2
|
||||
141 8 -22 0 45 1 2 1 2
|
||||
142 -61 -76 0 100 1 2 1 2
|
||||
143 76 -22 0 38 1 2 1 2
|
||||
144 49 -71 0 11 1 2 1 2
|
||||
145 -30 -68 0 82 1 2 1 2
|
||||
146 1 34 0 50 1 2 1 2
|
||||
147 77 79 0 39 1 2 1 2
|
||||
148 -58 64 0 6 1 2 1 2
|
||||
149 82 -97 0 87 1 2 1 2
|
||||
150 -80 55 0 83 1 2 1 2
|
||||
151 81 -86 0 22 1 2 1 2
|
||||
152 39 -49 0 24 1 2 1 2
|
||||
153 -67 72 0 69 1 2 1 2
|
||||
154 -25 -89 0 97 1 2 1 2
|
||||
155 -44 -95 0 65 1 2 1 2
|
||||
156 32 -68 0 97 1 2 1 2
|
||||
157 -17 49 0 79 1 2 1 2
|
||||
158 93 49 0 79 1 2 1 2
|
||||
159 99 81 0 46 1 2 1 2
|
||||
160 10 -49 0 52 1 2 1 2
|
||||
161 63 -41 0 39 1 2 1 2
|
||||
162 38 39 0 94 1 2 1 2
|
||||
163 -28 39 0 97 1 2 1 2
|
||||
164 -2 -47 0 18 1 2 1 2
|
||||
165 38 8 0 3 1 2 1 2
|
||||
166 -42 -6 0 23 1 2 1 2
|
||||
167 -67 88 0 19 1 2 1 2
|
||||
168 19 93 0 40 1 2 1 2
|
||||
169 40 27 0 49 1 2 1 2
|
||||
170 -61 56 0 96 1 2 1 2
|
||||
171 43 33 0 58 1 2 1 2
|
||||
172 -18 -39 0 15 1 2 1 2
|
||||
173 -69 19 0 21 1 2 1 2
|
||||
174 75 -18 0 56 1 2 1 2
|
||||
175 31 85 0 67 1 2 1 2
|
||||
176 25 58 0 10 1 2 1 2
|
||||
177 -16 36 0 36 1 2 1 2
|
||||
178 91 15 0 84 1 2 1 2
|
||||
179 60 -39 0 59 1 2 1 2
|
||||
180 49 -47 0 85 1 2 1 2
|
||||
181 42 33 0 60 1 2 1 2
|
||||
182 16 -81 0 33 1 2 1 2
|
||||
183 -78 53 0 62 1 2 1 2
|
||||
184 53 -80 0 70 1 2 1 2
|
||||
185 -46 -26 0 79 1 2 1 2
|
||||
186 -25 -54 0 98 1 2 1 2
|
||||
187 69 -46 0 99 1 2 1 2
|
||||
188 0 -78 0 18 1 2 1 2
|
||||
189 -84 74 0 55 1 2 1 2
|
||||
190 -16 16 0 75 1 2 1 2
|
||||
191 -63 -14 0 94 1 2 1 2
|
||||
192 51 -77 0 89 1 2 1 2
|
||||
193 -39 61 0 13 1 2 1 2
|
||||
194 5 97 0 19 1 2 1 2
|
||||
195 -55 39 0 19 1 2 1 2
|
||||
196 70 -14 0 90 1 2 1 2
|
||||
197 0 95 0 35 1 2 1 2
|
||||
198 -45 7 0 76 1 2 1 2
|
||||
199 38 -24 0 3 1 2 1 2
|
||||
200 50 -37 0 11 1 2 1 2
|
||||
201 59 71 0 98 1 2 1 2
|
||||
202 -73 -96 0 92 1 2 1 2
|
||||
203 -29 72 0 1 1 2 1 2
|
||||
204 -47 12 0 2 1 2 1 2
|
||||
205 -88 -61 0 63 1 2 1 2
|
||||
206 -88 36 0 57 1 2 1 2
|
||||
207 -46 -3 0 50 1 2 1 2
|
||||
208 26 -37 0 19 1 2 1 2
|
||||
209 -39 -67 0 24 1 2 1 2
|
||||
210 92 27 0 14 1 2 1 2
|
||||
211 -80 -31 0 18 1 2 1 2
|
||||
212 93 -50 0 77 1 2 1 2
|
||||
213 -20 -5 0 28 1 2 1 2
|
||||
214 -22 73 0 72 1 2 1 2
|
||||
215 -4 -7 0 49 1 2 1 2
|
||||
216 54 -48 0 58 1 2 1 2
|
||||
217 -70 39 0 84 1 2 1 2
|
||||
218 54 -82 0 58 1 2 1 2
|
||||
219 29 41 0 41 1 2 1 2
|
||||
220 -87 51 0 98 1 2 1 2
|
||||
221 -96 -36 0 77 1 2 1 2
|
||||
222 49 8 0 57 1 2 1 2
|
||||
223 -5 54 0 39 1 2 1 2
|
||||
224 -26 43 0 99 1 2 1 2
|
||||
225 -11 60 0 83 1 2 1 2
|
||||
226 40 61 0 54 1 2 1 2
|
||||
227 82 35 0 86 1 2 1 2
|
||||
228 -92 12 0 2 1 2 1 2
|
||||
229 -93 -86 0 14 1 2 1 2
|
||||
230 -66 63 0 42 1 2 1 2
|
||||
231 -72 -87 0 14 1 2 1 2
|
||||
232 -57 -84 0 55 1 2 1 2
|
||||
233 23 52 0 2 1 2 1 2
|
||||
234 -56 -62 0 18 1 2 1 2
|
||||
235 -19 59 0 17 1 2 1 2
|
||||
236 63 -14 0 22 1 2 1 2
|
||||
237 -13 38 0 28 1 2 1 2
|
||||
238 -19 87 0 3 1 2 1 2
|
||||
239 44 -84 0 96 1 2 1 2
|
||||
240 98 -17 0 53 1 2 1 2
|
||||
241 -16 62 0 15 1 2 1 2
|
||||
242 3 66 0 36 1 2 1 2
|
||||
243 26 22 0 98 1 2 1 2
|
||||
244 -38 -81 0 78 1 2 1 2
|
||||
245 70 -80 0 92 1 2 1 2
|
||||
246 17 -35 0 65 1 2 1 2
|
||||
247 96 -83 0 64 1 2 1 2
|
||||
248 -77 80 0 43 1 2 1 2
|
||||
249 -14 44 0 50 1 2 1 2
|
||||
250 -33 33 0 0 0 0
|
||||
251 33 -33 0 0 0 0
|
||||
52
jsprit-instances/src/test/resources/vrpnc1.txt
Normal file
52
jsprit-instances/src/test/resources/vrpnc1.txt
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
50 160 999999 0
|
||||
30 40
|
||||
37 52 7
|
||||
49 49 30
|
||||
52 64 16
|
||||
20 26 9
|
||||
40 30 21
|
||||
21 47 15
|
||||
17 63 19
|
||||
31 62 23
|
||||
52 33 11
|
||||
51 21 5
|
||||
42 41 19
|
||||
31 32 29
|
||||
5 25 23
|
||||
12 42 21
|
||||
36 16 10
|
||||
52 41 15
|
||||
27 23 3
|
||||
17 33 41
|
||||
13 13 9
|
||||
57 58 28
|
||||
62 42 8
|
||||
42 57 8
|
||||
16 57 16
|
||||
8 52 10
|
||||
7 38 28
|
||||
27 68 7
|
||||
30 48 15
|
||||
43 67 14
|
||||
58 48 6
|
||||
58 27 19
|
||||
37 69 11
|
||||
38 46 12
|
||||
46 10 23
|
||||
61 33 26
|
||||
62 63 17
|
||||
63 69 6
|
||||
32 22 9
|
||||
45 35 15
|
||||
59 15 14
|
||||
5 6 7
|
||||
10 17 27
|
||||
21 10 13
|
||||
5 64 11
|
||||
30 15 16
|
||||
39 10 10
|
||||
32 39 5
|
||||
25 32 25
|
||||
25 55 17
|
||||
48 28 18
|
||||
56 37 10
|
||||
122
jsprit-instances/src/test/resources/vrpnc13.txt
Normal file
122
jsprit-instances/src/test/resources/vrpnc13.txt
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
120 200 720 50
|
||||
10 45
|
||||
25 1 25
|
||||
25 3 7
|
||||
31 5 13
|
||||
32 5 6
|
||||
31 7 14
|
||||
32 9 5
|
||||
34 9 11
|
||||
46 9 19
|
||||
35 7 5
|
||||
34 6 15
|
||||
35 5 15
|
||||
47 6 17
|
||||
40 5 13
|
||||
39 3 12
|
||||
36 3 18
|
||||
73 6 13
|
||||
73 8 18
|
||||
24 36 12
|
||||
76 6 17
|
||||
76 10 4
|
||||
76 13 7
|
||||
78 3 12
|
||||
78 9 13
|
||||
79 3 8
|
||||
79 5 16
|
||||
79 11 15
|
||||
82 3 6
|
||||
82 7 5
|
||||
90 15 9
|
||||
84 3 11
|
||||
84 5 10
|
||||
84 9 3
|
||||
85 1 7
|
||||
87 5 2
|
||||
85 8 4
|
||||
87 7 4
|
||||
86 41 18
|
||||
86 44 14
|
||||
86 46 12
|
||||
85 55 17
|
||||
89 43 20
|
||||
89 46 14
|
||||
89 52 16
|
||||
92 42 10
|
||||
92 52 9
|
||||
94 42 11
|
||||
94 44 7
|
||||
94 48 13
|
||||
96 42 5
|
||||
99 46 4
|
||||
99 50 21
|
||||
83 80 13
|
||||
83 83 11
|
||||
85 81 12
|
||||
85 85 14
|
||||
85 89 10
|
||||
87 80 8
|
||||
87 86 16
|
||||
90 77 19
|
||||
90 88 5
|
||||
93 82 17
|
||||
93 84 7
|
||||
93 89 16
|
||||
94 86 14
|
||||
95 80 17
|
||||
99 89 13
|
||||
37 83 17
|
||||
50 80 13
|
||||
35 85 14
|
||||
35 87 16
|
||||
44 86 7
|
||||
46 89 13
|
||||
46 83 9
|
||||
46 87 11
|
||||
46 89 35
|
||||
48 83 5
|
||||
50 85 28
|
||||
50 88 7
|
||||
54 86 3
|
||||
54 90 10
|
||||
10 35 7
|
||||
10 40 12
|
||||
18 30 11
|
||||
17 35 10
|
||||
16 38 8
|
||||
14 40 11
|
||||
15 42 21
|
||||
11 42 4
|
||||
18 40 15
|
||||
21 39 16
|
||||
20 40 4
|
||||
18 41 16
|
||||
20 44 7
|
||||
22 44 10
|
||||
16 45 9
|
||||
20 45 11
|
||||
25 45 17
|
||||
30 55 12
|
||||
20 50 11
|
||||
22 51 7
|
||||
18 49 9
|
||||
16 48 11
|
||||
20 55 12
|
||||
18 53 7
|
||||
14 50 8
|
||||
15 51 6
|
||||
16 54 5
|
||||
28 33 12
|
||||
33 38 13
|
||||
30 50 7
|
||||
13 40 7
|
||||
15 36 8
|
||||
18 31 11
|
||||
25 37 13
|
||||
30 46 11
|
||||
25 52 10
|
||||
16 33 7
|
||||
25 35 4
|
||||
5 40 20
|
||||
5 50 13
|
||||
Loading…
Add table
Add a link
Reference in a new issue