1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

Merge branch 'master' into routes-with-specified-start-and-end

This commit is contained in:
Stefan Schroeder 2014-01-23 11:10:43 +01:00
commit 5b556c461c
8 changed files with 30 additions and 134 deletions

View file

@ -320,9 +320,9 @@ public class VrpXMLReader{
builder.setPickupLocation(pickupLocationId);
Coordinate pickupCoord = getCoord(shipmentConfig,"pickup.");
builder.setPickupCoord(pickupCoord);
if(pickupCoord != null){
builder.setPickupCoord(pickupCoord);
if(pickupLocationId != null){
vrpBuilder.addLocation(pickupLocationId,pickupCoord);
}
@ -341,9 +341,9 @@ public class VrpXMLReader{
builder.setDeliveryLocation(deliveryLocationId);
Coordinate deliveryCoord = getCoord(shipmentConfig,"delivery.");
builder.setDeliveryCoord(deliveryCoord);
if(deliveryCoord != null){
builder.setDeliveryCoord(deliveryCoord);
if(deliveryLocationId != null){
vrpBuilder.addLocation(deliveryLocationId,deliveryCoord);
}

View file

@ -1,29 +0,0 @@
20
0 30 40 0
1 37 52 7
2 49 49 30
3 52 64 16
4 20 26 9
5 40 30 21
6 21 47 15
7 17 63 19
8 31 62 23
9 52 33 11
10 51 21 5
11 42 41 19
12 31 32 29
13 5 25 23
14 12 42 21
15 36 16 10
16 52 41 15
17 27 23 3
18 17 33 41
19 13 13 9
20 57 58 28
//Vehicles characteristics: type, volume, fixed cost
5
v 1 20 20
v 2 30 35
v 3 40 50
v 4 70 120
v 5 120 225

View file

@ -1,27 +0,0 @@
20
0 30 40 0
1 37 52 7
2 49 49 30
3 52 64 16
4 20 26 9
5 40 30 21
6 21 47 15
7 17 63 19
8 31 62 23
9 52 33 11
10 51 21 5
11 42 41 19
12 31 32 29
13 5 25 23
14 12 42 21
15 36 16 10
16 52 41 15
17 27 23 3
18 17 33 41
19 13 13 9
20 57 58 28
//Vehicles characteristics: type, volume, fixed cost
3
v 1 60 1000
v 2 80 1500
v 3 150 3000

View file

@ -1,29 +0,0 @@
20
0 30 40 0
1 37 52 7
2 49 49 30
3 52 64 16
4 20 26 9
5 40 30 21
6 21 47 15
7 17 63 19
8 31 62 23
9 52 33 11
10 51 21 5
11 42 41 19
12 31 32 29
13 5 25 23
14 12 42 21
15 36 16 10
16 52 41 15
17 27 23 3
18 17 33 41
19 13 13 9
20 57 58 28
//Vehicles characteristics: type, volume, fixed cost
5
v 1 20 20
v 2 30 35
v 3 40 50
v 4 70 120
v 5 120 225

View file

@ -1,27 +0,0 @@
20
0 30 40 0
1 37 52 7
2 49 49 30
3 52 64 16
4 20 26 9
5 40 30 21
6 21 47 15
7 17 63 19
8 31 62 23
9 52 33 11
10 51 21 5
11 42 41 19
12 31 32 29
13 5 25 23
14 12 42 21
15 36 16 10
16 52 41 15
17 27 23 3
18 17 33 41
19 13 13 9
20 57 58 28
//Vehicles characteristics: type, volume, fixed cost
3
v 1 60 1000
v 2 80 1500
v 3 150 3000

View file

@ -78,10 +78,11 @@
//Vehicles characteristics: volume, fixed cost, variable cost, number available
//See E. D. Taillard, "A heuristic column generation method for the heterogeneous fleet vrp"
//RAIRO Rech. Op<4F>r. 33 (1) 1999, pp 1-14)
//see http://ina2.eivd.ch/collaborateurs/etd/articles.dir/vrphen.pdf50 25 1.0 4
v 1 120 80 1.2 4
v 2 200 150 1.5 2
v 3 350 320 1.8 1
//see http://ina2.eivd.ch/collaborateurs/etd/articles.dir/vrphen.pdf
v 1 50 25 1.0 4
v 2 120 80 1.2 4
v 3 200 150 1.5 2
v 4 350 320 1.8 1
7 350 0 1000000 703.124497 + 7 * 150 = 1753.12
14 27 57 15 37 20 70 60 71 69 36 47 5 29 45 2685412

View file

@ -23,8 +23,6 @@ import jsprit.core.util.Coordinate;
*
* <p>See {@link VrphType} what kind of problems can be generated
*
* <p>Note that c20_3-c20_6 do not have variable costs and a limited nuVehicle, thus they can only be used for FSMF.
*
* @author schroeder
*
*/
@ -110,6 +108,7 @@ public class VrphGoldenReader {
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
nuOfVehicles = Integer.parseInt(tokens[5]);
vrpBuilder.setFleetSize(FleetSize.FINITE);
vrpBuilder.addPenaltyVehicles(5.0, 5000);
}
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
}
@ -119,6 +118,7 @@ public class VrphGoldenReader {
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
nuOfVehicles = Integer.parseInt(tokens[5]);
vrpBuilder.setFleetSize(FleetSize.FINITE);
vrpBuilder.addPenaltyVehicles(5.0, 5000);
}
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
}

View file

@ -6,6 +6,7 @@ import static org.junit.Assert.assertTrue;
import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.job.Job;
import jsprit.core.problem.job.Service;
import jsprit.core.problem.vehicle.PenaltyVehicleType;
import jsprit.core.problem.vehicle.Vehicle;
import jsprit.core.util.Coordinate;
import jsprit.instance.reader.VrphGoldenReader.VrphType;
@ -20,7 +21,13 @@ public class GoldenReaderTest {
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
VehicleRoutingProblem vrp = vrpBuilder.build();
assertEquals(17,vrp.getVehicles().size());
int nuOfVehicles = 0;
for(Vehicle v : vrp.getVehicles()){
if(!(v.getType() instanceof PenaltyVehicleType)){
nuOfVehicles++;
}
}
assertEquals(17,nuOfVehicles);
}
@Test
@ -31,7 +38,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int nuOfType1Vehicles = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_1")){
if(v.getType().getTypeId().equals("type_1") && !(v.getType() instanceof PenaltyVehicleType) ){
nuOfType1Vehicles++;
}
}
@ -46,7 +53,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int sumOfType1Cap = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_1")){
if(v.getType().getTypeId().equals("type_1") && !(v.getType() instanceof PenaltyVehicleType) ){
sumOfType1Cap+=v.getCapacity();
}
}
@ -61,7 +68,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int nuOfType1Vehicles = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_2")){
if(v.getType().getTypeId().equals("type_2") && !(v.getType() instanceof PenaltyVehicleType) ){
nuOfType1Vehicles++;
}
}
@ -76,7 +83,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int sumOfType1Cap = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_2")){
if(v.getType().getTypeId().equals("type_2") && !(v.getType() instanceof PenaltyVehicleType) ){
sumOfType1Cap+=v.getCapacity();
}
}
@ -91,7 +98,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int nuOfType1Vehicles = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_3")){
if(v.getType().getTypeId().equals("type_3") && !(v.getType() instanceof PenaltyVehicleType) ){
nuOfType1Vehicles++;
}
}
@ -106,7 +113,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int sumOfType1Cap = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_3")){
if(v.getType().getTypeId().equals("type_3") && !(v.getType() instanceof PenaltyVehicleType) ){
sumOfType1Cap+=v.getCapacity();
}
}
@ -121,7 +128,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int nuOfType1Vehicles = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_4")){
if(v.getType().getTypeId().equals("type_4") && !(v.getType() instanceof PenaltyVehicleType) ){
nuOfType1Vehicles++;
}
}
@ -136,7 +143,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int sumOfType1Cap = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_4")){
if(v.getType().getTypeId().equals("type_4") && !(v.getType() instanceof PenaltyVehicleType) ){
sumOfType1Cap+=v.getCapacity();
}
}
@ -151,7 +158,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int nuOfType1Vehicles = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_5")){
if(v.getType().getTypeId().equals("type_5") && !(v.getType() instanceof PenaltyVehicleType) ){
nuOfType1Vehicles++;
}
}
@ -166,7 +173,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int sumOfType1Cap = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_5")){
if(v.getType().getTypeId().equals("type_5") && !(v.getType() instanceof PenaltyVehicleType) ){
sumOfType1Cap+=v.getCapacity();
}
}
@ -181,7 +188,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int nuOfType1Vehicles = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_6")){
if(v.getType().getTypeId().equals("type_6") && !(v.getType() instanceof PenaltyVehicleType) ){
nuOfType1Vehicles++;
}
}
@ -196,7 +203,7 @@ public class GoldenReaderTest {
VehicleRoutingProblem vrp = vrpBuilder.build();
int sumOfType1Cap = 0;
for(Vehicle v : vrp.getVehicles()){
if(v.getType().getTypeId().equals("type_6")){
if(v.getType().getTypeId().equals("type_6") && !(v.getType() instanceof PenaltyVehicleType) ){
sumOfType1Cap+=v.getCapacity();
}
}