mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
Merge branch 'restructureAPIinPreparationForV0.1.1'
Conflicts: CHANGELOG.md
This commit is contained in:
commit
a0ad012768
369 changed files with 75965 additions and 6728 deletions
1056
jsprit-instances/instances/lilim/1000/LC1101.txt
Normal file
1056
jsprit-instances/instances/lilim/1000/LC1101.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LC11010.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LC11010.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LC1102.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LC1102.txt
Normal file
File diff suppressed because it is too large
Load diff
1050
jsprit-instances/instances/lilim/1000/LC1103.txt
Normal file
1050
jsprit-instances/instances/lilim/1000/LC1103.txt
Normal file
File diff suppressed because it is too large
Load diff
1040
jsprit-instances/instances/lilim/1000/LC1104.txt
Normal file
1040
jsprit-instances/instances/lilim/1000/LC1104.txt
Normal file
File diff suppressed because it is too large
Load diff
1060
jsprit-instances/instances/lilim/1000/LC1105.txt
Normal file
1060
jsprit-instances/instances/lilim/1000/LC1105.txt
Normal file
File diff suppressed because it is too large
Load diff
1056
jsprit-instances/instances/lilim/1000/LC1106.txt
Normal file
1056
jsprit-instances/instances/lilim/1000/LC1106.txt
Normal file
File diff suppressed because it is too large
Load diff
1054
jsprit-instances/instances/lilim/1000/LC1107.txt
Normal file
1054
jsprit-instances/instances/lilim/1000/LC1107.txt
Normal file
File diff suppressed because it is too large
Load diff
1054
jsprit-instances/instances/lilim/1000/LC1108.txt
Normal file
1054
jsprit-instances/instances/lilim/1000/LC1108.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LC1109.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LC1109.txt
Normal file
File diff suppressed because it is too large
Load diff
1016
jsprit-instances/instances/lilim/1000/LC2101.txt
Normal file
1016
jsprit-instances/instances/lilim/1000/LC2101.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LC21010.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LC21010.txt
Normal file
File diff suppressed because it is too large
Load diff
1018
jsprit-instances/instances/lilim/1000/LC2102.txt
Normal file
1018
jsprit-instances/instances/lilim/1000/LC2102.txt
Normal file
File diff suppressed because it is too large
Load diff
1018
jsprit-instances/instances/lilim/1000/LC2103.txt
Normal file
1018
jsprit-instances/instances/lilim/1000/LC2103.txt
Normal file
File diff suppressed because it is too large
Load diff
1020
jsprit-instances/instances/lilim/1000/LC2104.txt
Normal file
1020
jsprit-instances/instances/lilim/1000/LC2104.txt
Normal file
File diff suppressed because it is too large
Load diff
1016
jsprit-instances/instances/lilim/1000/LC2105.txt
Normal file
1016
jsprit-instances/instances/lilim/1000/LC2105.txt
Normal file
File diff suppressed because it is too large
Load diff
1020
jsprit-instances/instances/lilim/1000/LC2106.txt
Normal file
1020
jsprit-instances/instances/lilim/1000/LC2106.txt
Normal file
File diff suppressed because it is too large
Load diff
1020
jsprit-instances/instances/lilim/1000/LC2107.txt
Normal file
1020
jsprit-instances/instances/lilim/1000/LC2107.txt
Normal file
File diff suppressed because it is too large
Load diff
1016
jsprit-instances/instances/lilim/1000/LC2108.txt
Normal file
1016
jsprit-instances/instances/lilim/1000/LC2108.txt
Normal file
File diff suppressed because it is too large
Load diff
1024
jsprit-instances/instances/lilim/1000/LC2109.txt
Normal file
1024
jsprit-instances/instances/lilim/1000/LC2109.txt
Normal file
File diff suppressed because it is too large
Load diff
1056
jsprit-instances/instances/lilim/1000/LR1101.txt
Normal file
1056
jsprit-instances/instances/lilim/1000/LR1101.txt
Normal file
File diff suppressed because it is too large
Load diff
1040
jsprit-instances/instances/lilim/1000/LR11010.txt
Normal file
1040
jsprit-instances/instances/lilim/1000/LR11010.txt
Normal file
File diff suppressed because it is too large
Load diff
1042
jsprit-instances/instances/lilim/1000/LR1102.txt
Normal file
1042
jsprit-instances/instances/lilim/1000/LR1102.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LR1103.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LR1103.txt
Normal file
File diff suppressed because it is too large
Load diff
1040
jsprit-instances/instances/lilim/1000/LR1104.txt
Normal file
1040
jsprit-instances/instances/lilim/1000/LR1104.txt
Normal file
File diff suppressed because it is too large
Load diff
1050
jsprit-instances/instances/lilim/1000/LR1105.txt
Normal file
1050
jsprit-instances/instances/lilim/1000/LR1105.txt
Normal file
File diff suppressed because it is too large
Load diff
1050
jsprit-instances/instances/lilim/1000/LR1106.txt
Normal file
1050
jsprit-instances/instances/lilim/1000/LR1106.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LR1107.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LR1107.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LR1108.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LR1108.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LR1109.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LR1109.txt
Normal file
File diff suppressed because it is too large
Load diff
1008
jsprit-instances/instances/lilim/1000/LR2101.txt
Normal file
1008
jsprit-instances/instances/lilim/1000/LR2101.txt
Normal file
File diff suppressed because it is too large
Load diff
1006
jsprit-instances/instances/lilim/1000/LR21010.txt
Normal file
1006
jsprit-instances/instances/lilim/1000/LR21010.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LR2102.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LR2102.txt
Normal file
File diff suppressed because it is too large
Load diff
1012
jsprit-instances/instances/lilim/1000/LR2103.txt
Normal file
1012
jsprit-instances/instances/lilim/1000/LR2103.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LR2104.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LR2104.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LR2105.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LR2105.txt
Normal file
File diff suppressed because it is too large
Load diff
1014
jsprit-instances/instances/lilim/1000/LR2106.txt
Normal file
1014
jsprit-instances/instances/lilim/1000/LR2106.txt
Normal file
File diff suppressed because it is too large
Load diff
1012
jsprit-instances/instances/lilim/1000/LR2107.txt
Normal file
1012
jsprit-instances/instances/lilim/1000/LR2107.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LR2108.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LR2108.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LR2109.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LR2109.txt
Normal file
File diff suppressed because it is too large
Load diff
1056
jsprit-instances/instances/lilim/1000/LRC1101.txt
Normal file
1056
jsprit-instances/instances/lilim/1000/LRC1101.txt
Normal file
File diff suppressed because it is too large
Load diff
1046
jsprit-instances/instances/lilim/1000/LRC11010.txt
Normal file
1046
jsprit-instances/instances/lilim/1000/LRC11010.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LRC1102.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LRC1102.txt
Normal file
File diff suppressed because it is too large
Load diff
1050
jsprit-instances/instances/lilim/1000/LRC1103.txt
Normal file
1050
jsprit-instances/instances/lilim/1000/LRC1103.txt
Normal file
File diff suppressed because it is too large
Load diff
1044
jsprit-instances/instances/lilim/1000/LRC1104.txt
Normal file
1044
jsprit-instances/instances/lilim/1000/LRC1104.txt
Normal file
File diff suppressed because it is too large
Load diff
1054
jsprit-instances/instances/lilim/1000/LRC1105.txt
Normal file
1054
jsprit-instances/instances/lilim/1000/LRC1105.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LRC1106.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LRC1106.txt
Normal file
File diff suppressed because it is too large
Load diff
1048
jsprit-instances/instances/lilim/1000/LRC1107.txt
Normal file
1048
jsprit-instances/instances/lilim/1000/LRC1107.txt
Normal file
File diff suppressed because it is too large
Load diff
1046
jsprit-instances/instances/lilim/1000/LRC1108.txt
Normal file
1046
jsprit-instances/instances/lilim/1000/LRC1108.txt
Normal file
File diff suppressed because it is too large
Load diff
1050
jsprit-instances/instances/lilim/1000/LRC1109.txt
Normal file
1050
jsprit-instances/instances/lilim/1000/LRC1109.txt
Normal file
File diff suppressed because it is too large
Load diff
1016
jsprit-instances/instances/lilim/1000/LRC2101.txt
Normal file
1016
jsprit-instances/instances/lilim/1000/LRC2101.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LRC21010.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LRC21010.txt
Normal file
File diff suppressed because it is too large
Load diff
1012
jsprit-instances/instances/lilim/1000/LRC2102.txt
Normal file
1012
jsprit-instances/instances/lilim/1000/LRC2102.txt
Normal file
File diff suppressed because it is too large
Load diff
1016
jsprit-instances/instances/lilim/1000/LRC2103.txt
Normal file
1016
jsprit-instances/instances/lilim/1000/LRC2103.txt
Normal file
File diff suppressed because it is too large
Load diff
1014
jsprit-instances/instances/lilim/1000/LRC2104.txt
Normal file
1014
jsprit-instances/instances/lilim/1000/LRC2104.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LRC2105.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LRC2105.txt
Normal file
File diff suppressed because it is too large
Load diff
1010
jsprit-instances/instances/lilim/1000/LRC2106.txt
Normal file
1010
jsprit-instances/instances/lilim/1000/LRC2106.txt
Normal file
File diff suppressed because it is too large
Load diff
1012
jsprit-instances/instances/lilim/1000/LRC2107.txt
Normal file
1012
jsprit-instances/instances/lilim/1000/LRC2107.txt
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -14,7 +14,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
|
@ -22,18 +22,17 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
import jsprit.core.util.Coordinate;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import readers.ChristofidesReader;
|
||||
import util.Coordinate;
|
||||
|
||||
import basics.route.Vehicle;
|
||||
import basics.route.VehicleImpl;
|
||||
import basics.route.VehicleType;
|
||||
import basics.route.VehicleTypeImpl;
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
|
||||
/**
|
||||
* Reader that reads Christophides, Mingozzi and Toth instances.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
|
@ -24,19 +24,18 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.vehicle.PenaltyVehicleType;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
import jsprit.core.util.Coordinate;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import readers.CordeauReader;
|
||||
import util.Coordinate;
|
||||
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.PenaltyVehicleType;
|
||||
import basics.route.VehicleImpl;
|
||||
import basics.route.VehicleImpl.Builder;
|
||||
import basics.route.VehicleType;
|
||||
import basics.route.VehicleTypeImpl;
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
|
||||
/**
|
||||
* Reader that reads instances developed by:
|
||||
|
|
@ -14,26 +14,25 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.Builder;
|
||||
import jsprit.core.problem.cost.VehicleRoutingTransportCosts;
|
||||
import jsprit.core.problem.driver.Driver;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.util.CrowFlyCosts;
|
||||
import jsprit.core.util.Locations;
|
||||
|
||||
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;
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2013 Stefan Schroeder
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package jsprit.instance.reader;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.Builder;
|
||||
import jsprit.core.problem.job.Shipment;
|
||||
import jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
import jsprit.core.util.Coordinate;
|
||||
import jsprit.core.util.Locations;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* 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 LiLimReader {
|
||||
|
||||
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 Coordinate coord;
|
||||
public double start;
|
||||
public double end;
|
||||
public double serviceTime;
|
||||
|
||||
public CustomerData(Coordinate coord, double start, double end, double serviceTime) {
|
||||
super();
|
||||
this.coord = coord;
|
||||
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(LiLimReader.class);
|
||||
|
||||
private VehicleRoutingProblem.Builder vrpBuilder;
|
||||
|
||||
private int vehicleCapacity;
|
||||
|
||||
private String depotId;
|
||||
|
||||
private Map<String,CustomerData> customers;
|
||||
|
||||
private Collection<Relation> relations;
|
||||
|
||||
private double depotOpeningTime;
|
||||
|
||||
private double depotClosingTime;
|
||||
|
||||
private int fixCosts = 0;
|
||||
|
||||
public LiLimReader(Builder vrpBuilder) {
|
||||
customers = new HashMap<String, LiLimReader.CustomerData>();
|
||||
relations = new ArrayList<LiLimReader.Relation>();
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
}
|
||||
|
||||
public LiLimReader(Builder builder, int fixCosts) {
|
||||
customers = new HashMap<String, LiLimReader.CustomerData>();
|
||||
relations = new ArrayList<LiLimReader.Relation>();
|
||||
this.vrpBuilder = builder;
|
||||
this.fixCosts = fixCosts;
|
||||
}
|
||||
|
||||
public void read(String filename){
|
||||
readShipments(filename);
|
||||
buildShipments();
|
||||
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type", vehicleCapacity)
|
||||
.setCostPerDistance(1.0).setFixedCost(fixCosts).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle")
|
||||
.setEarliestStart(depotOpeningTime).setLatestArrival(depotClosingTime)
|
||||
.setLocationCoord(customers.get(depotId).coord).setType(type).build();
|
||||
vrpBuilder.addVehicle(vehicle);
|
||||
}
|
||||
|
||||
private void buildShipments() {
|
||||
Integer counter = 0;
|
||||
for(Relation rel : relations){
|
||||
counter++;
|
||||
String from = rel.from;
|
||||
String to = rel.to;
|
||||
int demand = rel.demand;
|
||||
Shipment s = Shipment.Builder.newInstance(counter.toString(), demand)
|
||||
.setPickupCoord(customers.get(from).coord).setPickupServiceTime(customers.get(from).serviceTime)
|
||||
.setPickupTimeWindow(TimeWindow.newInstance(customers.get(from).start, customers.get(from).end))
|
||||
.setDeliveryCoord(customers.get(to).coord).setDeliveryServiceTime(customers.get(to).serviceTime)
|
||||
.setDeliveryTimeWindow(TimeWindow.newInstance(customers.get(to).start, customers.get(to).end)).build();
|
||||
vrpBuilder.addJob(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private BufferedReader getReader(String file) {
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader(file));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error(e1);
|
||||
System.exit(1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
||||
private void readShipments(String file) {
|
||||
BufferedReader reader = getReader(file);
|
||||
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]);
|
||||
int demand = getInt(tokens[3]);
|
||||
double startTimeWindow = getDouble(tokens[4]);
|
||||
double endTimeWindow = getDouble(tokens[5]);
|
||||
double serviceTime = getDouble(tokens[6]);
|
||||
// vrpBuilder.addLocation(customerId, coord);
|
||||
customers.put(customerId, new CustomerData(coord,startTimeWindow,endTimeWindow, serviceTime));
|
||||
if(customerId.equals("0")){
|
||||
depotId = customerId;
|
||||
depotOpeningTime = startTimeWindow;
|
||||
depotClosingTime = endTimeWindow;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
|
@ -22,20 +22,19 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetComposition;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
import jsprit.core.util.Coordinate;
|
||||
|
||||
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.VehicleType;
|
||||
import basics.route.VehicleTypeImpl;
|
||||
|
||||
public class LuiShenReader {
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
|
@ -22,19 +22,18 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
import jsprit.core.util.Coordinate;
|
||||
|
||||
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.VehicleType;
|
||||
import basics.route.VehicleTypeImpl;
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
|
||||
/**
|
||||
* Reader that reads the well-known solomon-instances.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
//package instances;
|
||||
//
|
||||
//import java.io.BufferedReader;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package util;
|
||||
package jsprit.instance.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
|
|
@ -26,10 +26,12 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import readers.ChristofidesReader;
|
||||
import readers.CordeauReader;
|
||||
import readers.SolomonReader;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.util.BenchmarkInstance;
|
||||
import jsprit.instance.reader.ChristofidesReader;
|
||||
import jsprit.instance.reader.CordeauReader;
|
||||
import jsprit.instance.reader.SolomonReader;
|
||||
|
||||
|
||||
public class Instances {
|
||||
|
||||
|
|
@ -1,219 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2013 Stefan Schroeder
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
|
@ -14,16 +14,17 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.instance.reader.ChristofidesReader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.Vehicle;
|
||||
|
||||
public class ChristophidesReaderTest {
|
||||
|
||||
|
|
@ -14,17 +14,18 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.instance.reader.CordeauReader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.Vehicle;
|
||||
|
||||
public class CordeauReaderTest {
|
||||
|
||||
|
|
@ -14,16 +14,17 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetComposition;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.instance.reader.LuiShenReader;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetComposition;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
|
||||
public class LuiShenReaderTest {
|
||||
|
||||
|
|
@ -14,16 +14,17 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package readers;
|
||||
package jsprit.instance.reader;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.instance.reader.SolomonReader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import basics.Service;
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
import basics.route.Vehicle;
|
||||
|
||||
public class SolomonReaderTest {
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue