mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
remove penalty vehicle stuff
This commit is contained in:
parent
a0419ab3fd
commit
657f85e896
13 changed files with 64 additions and 260 deletions
|
|
@ -17,11 +17,9 @@
|
|||
package jsprit.instance.reader;
|
||||
|
||||
|
||||
import jsprit.core.problem.Capacity;
|
||||
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;
|
||||
|
|
@ -119,26 +117,11 @@ public class CordeauReader {
|
|||
else if(counter <= (nOfCustomers+nOfDepots+nOfDepots)){
|
||||
Coordinate depotCoord = makeCoord(tokens[1].trim(),tokens[2].trim());
|
||||
List<Builder> vBuilders = vehiclesAtDepot.get(depotCounter);
|
||||
// int cap = 0;
|
||||
Capacity cap = Capacity.Builder.newInstance().build();
|
||||
double latestArrTime = 0.0;
|
||||
Coordinate coord = null;
|
||||
String typeId = null;
|
||||
for(Builder vBuilder : vBuilders){
|
||||
vBuilder.setStartLocationCoordinate(depotCoord);
|
||||
VehicleImpl vehicle = vBuilder.build();
|
||||
cap = vehicle.getType().getCapacityDimensions();
|
||||
typeId = vehicle.getType().getTypeId();
|
||||
latestArrTime = vehicle.getLatestArrival();
|
||||
coord = vehicle.getStartLocationCoordinate();
|
||||
vrpBuilder.addVehicle(vehicle);
|
||||
}
|
||||
if(addPenaltyVehicles){
|
||||
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance(typeId).setCapacityDimensions(cap).setCostPerDistance(3.0).setFixedCost(50).build();
|
||||
VehicleImpl penaltyVehicle = VehicleImpl.Builder.newInstance(counter + "_penaltyVehicle").setLatestArrival(latestArrTime)
|
||||
.setType(new PenaltyVehicleType(penaltyType)).setStartLocationCoordinate(coord).build();
|
||||
vrpBuilder.addVehicle(penaltyVehicle);
|
||||
}
|
||||
depotCounter++;
|
||||
}
|
||||
else{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ package jsprit.instance.reader;
|
|||
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;
|
||||
|
|
@ -38,9 +37,8 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int nuOfVehicles = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(!(v.getType() instanceof PenaltyVehicleType)){
|
||||
nuOfVehicles++;
|
||||
}
|
||||
nuOfVehicles++;
|
||||
|
||||
}
|
||||
assertEquals(17,nuOfVehicles);
|
||||
}
|
||||
|
|
@ -53,7 +51,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int nuOfType1Vehicles = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_1") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_1")){
|
||||
nuOfType1Vehicles++;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +66,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_1") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_1")){
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -83,7 +81,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int nuOfType1Vehicles = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_2") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_2")){
|
||||
nuOfType1Vehicles++;
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +96,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_2") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_2") ){
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -113,7 +111,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int nuOfType1Vehicles = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_3") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_3")){
|
||||
nuOfType1Vehicles++;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +126,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_3") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_3")){
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -143,7 +141,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int nuOfType1Vehicles = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_4") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_4")){
|
||||
nuOfType1Vehicles++;
|
||||
}
|
||||
}
|
||||
|
|
@ -158,7 +156,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_4") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_4")){
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -173,7 +171,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int nuOfType1Vehicles = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_5") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_5") ){
|
||||
nuOfType1Vehicles++;
|
||||
}
|
||||
}
|
||||
|
|
@ -188,7 +186,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_5") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_5")){
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -203,7 +201,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int nuOfType1Vehicles = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_6") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_6")){
|
||||
nuOfType1Vehicles++;
|
||||
}
|
||||
}
|
||||
|
|
@ -218,7 +216,7 @@ public class GoldenReaderTest {
|
|||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_6") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
if(v.getType().getTypeId().equals("type_6") ){
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue