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
|
|
@ -26,8 +26,11 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
|||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivityFactory;
|
||||
import jsprit.core.problem.vehicle.*;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
import jsprit.core.util.Coordinate;
|
||||
import jsprit.core.util.Resource;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
|
|
@ -577,18 +580,6 @@ public class VrpXMLReader{
|
|||
if(distC != null) typeBuilder.setCostPerDistance(distC);
|
||||
VehicleType type = typeBuilder.build();
|
||||
String id = type.getTypeId();
|
||||
String penalty = typeConfig.getString("[@type]");
|
||||
if(penalty != null){
|
||||
if(penalty.equals("penalty")){
|
||||
String penaltyFactor = typeConfig.getString("[@penaltyFactor]");
|
||||
if(penaltyFactor != null){
|
||||
type = new PenaltyVehicleType(type,Double.parseDouble(penaltyFactor));
|
||||
}
|
||||
else type = new PenaltyVehicleType(type);
|
||||
id = id + "_penalty";
|
||||
}
|
||||
}
|
||||
|
||||
types.put(id, type);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
|||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivity.JobActivity;
|
||||
import jsprit.core.problem.vehicle.PenaltyVehicleType;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
|
|
@ -315,9 +314,6 @@ public class VrpXMLWriter {
|
|||
String vehiclePathString = Schema.VEHICLES + "." + Schema.VEHICLE;
|
||||
int counter = 0;
|
||||
for(Vehicle vehicle : vrp.getVehicles()){
|
||||
if(vehicle.getType() instanceof PenaltyVehicleType){
|
||||
xmlConfig.setProperty(vehiclePathString + "("+counter+")[@type]", "penalty");
|
||||
}
|
||||
xmlConfig.setProperty(vehiclePathString + "("+counter+").id", vehicle.getId());
|
||||
xmlConfig.setProperty(vehiclePathString + "("+counter+").typeId", vehicle.getType().getTypeId());
|
||||
xmlConfig.setProperty(vehiclePathString + "("+counter+").startLocation.id", vehicle.getStartLocation().getId());
|
||||
|
|
@ -353,10 +349,6 @@ public class VrpXMLWriter {
|
|||
String typePathString = Schema.builder().append(Schema.TYPES).dot(Schema.TYPE).build();
|
||||
int typeCounter = 0;
|
||||
for(VehicleType type : vrp.getTypes()){
|
||||
if(type instanceof PenaltyVehicleType){
|
||||
xmlConfig.setProperty(typePathString + "("+typeCounter+")[@type]", "penalty");
|
||||
xmlConfig.setProperty(typePathString + "("+typeCounter+")[@penaltyFactor]", ((PenaltyVehicleType)type).getPenaltyFactor());
|
||||
}
|
||||
xmlConfig.setProperty(typePathString + "("+typeCounter+").id", type.getTypeId());
|
||||
|
||||
for(int i=0;i<type.getCapacityDimensions().getNuOfDimensions();i++){
|
||||
|
|
|
|||
|
|
@ -1,65 +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 jsprit.core.problem.vehicle;
|
||||
|
||||
import jsprit.core.problem.Capacity;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl.VehicleCostParams;
|
||||
|
||||
public class PenaltyVehicleType implements VehicleType{
|
||||
|
||||
private VehicleType type;
|
||||
|
||||
private double penaltyFactor = 2;
|
||||
|
||||
public PenaltyVehicleType(VehicleType type) {
|
||||
super();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public PenaltyVehicleType(VehicleType type, double penaltyFactor) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.penaltyFactor = penaltyFactor;
|
||||
}
|
||||
|
||||
public double getPenaltyFactor(){
|
||||
return this.penaltyFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeId() {
|
||||
return type.getTypeId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VehicleCostParams getVehicleCostParams() {
|
||||
return type.getVehicleCostParams();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxVelocity() {
|
||||
return type.getMaxVelocity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Capacity getCapacityDimensions() {
|
||||
return type.getCapacityDimensions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -120,27 +120,18 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
|||
if(v.getType() == null){
|
||||
throw new IllegalStateException("vehicle needs type");
|
||||
}
|
||||
String typeId = v.getType().getTypeId();
|
||||
if(v.getType() instanceof PenaltyVehicleType){
|
||||
VehicleTypeKey typeKey = new VehicleTypeKey(typeId, v.getStartLocationId(), v.getEndLocationId(), v.getEarliestDeparture(), v.getLatestArrival(), v.getSkills());
|
||||
penaltyVehicles.put(typeKey, v);
|
||||
}
|
||||
else{
|
||||
VehicleTypeKey typeKey = new VehicleTypeKey(v.getType().getTypeId(), v.getStartLocationId(), v.getEndLocationId(), v.getEarliestDeparture(), v.getLatestArrival(), v.getSkills());
|
||||
if(!typeMapOfAvailableVehicles.containsKey(typeKey)){
|
||||
typeMapOfAvailableVehicles.put(typeKey, new TypeContainer());
|
||||
}
|
||||
typeMapOfAvailableVehicles.get(typeKey).add(v);
|
||||
VehicleTypeKey typeKey = new VehicleTypeKey(v.getType().getTypeId(), v.getStartLocationId(), v.getEndLocationId(), v.getEarliestDeparture(), v.getLatestArrival(), v.getSkills());
|
||||
if(!typeMapOfAvailableVehicles.containsKey(typeKey)){
|
||||
typeMapOfAvailableVehicles.put(typeKey, new TypeContainer());
|
||||
}
|
||||
typeMapOfAvailableVehicles.get(typeKey).add(v);
|
||||
|
||||
}
|
||||
|
||||
private void removeVehicle(Vehicle v){
|
||||
//it might be better to introduce a class PenaltyVehicle
|
||||
if(!(v.getType() instanceof PenaltyVehicleType)){
|
||||
VehicleTypeKey key = new VehicleTypeKey(v.getType().getTypeId(), v.getStartLocationId(), v.getEndLocationId(), v.getEarliestDeparture(), v.getLatestArrival(), v.getSkills());
|
||||
if(typeMapOfAvailableVehicles.containsKey(key)){
|
||||
typeMapOfAvailableVehicles.get(key).remove(v);
|
||||
}
|
||||
VehicleTypeKey key = new VehicleTypeKey(v.getType().getTypeId(), v.getStartLocationId(), v.getEndLocationId(), v.getEarliestDeparture(), v.getLatestArrival(), v.getSkills());
|
||||
if(typeMapOfAvailableVehicles.containsKey(key)){
|
||||
typeMapOfAvailableVehicles.get(key).remove(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +184,6 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
|||
if(vehicles.isEmpty() || vehicle instanceof NoVehicle){
|
||||
return;
|
||||
}
|
||||
if(vehicle.getType() instanceof PenaltyVehicleType) return;
|
||||
boolean locked = lockedVehicles.add(vehicle);
|
||||
removeVehicle(vehicle);
|
||||
if(!locked){
|
||||
|
|
@ -210,7 +200,6 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
|||
return;
|
||||
}
|
||||
if(vehicle == null) return;
|
||||
if(vehicle.getType() instanceof PenaltyVehicleType) return;
|
||||
lockedVehicles.remove(vehicle);
|
||||
addVehicle(vehicle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
|||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivity.JobActivity;
|
||||
import jsprit.core.problem.vehicle.PenaltyVehicleType;
|
||||
|
||||
|
||||
/**
|
||||
* Printer to print the details of a vehicle-routing-problem solution.
|
||||
|
|
@ -143,10 +143,7 @@ public class SolutionPrinter {
|
|||
}
|
||||
|
||||
private static String getVehicleString(VehicleRoute route) {
|
||||
if(route.getVehicle().getType() instanceof PenaltyVehicleType){
|
||||
return route.getVehicle().getId()+"*";
|
||||
}
|
||||
return route.getVehicle().getId();
|
||||
return route.getVehicle().getId();
|
||||
}
|
||||
|
||||
private static Jobs getNuOfJobs(VehicleRoutingProblem problem) {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,8 @@ public class TestCalculatesServiceInsertion {
|
|||
jobs.add(third);
|
||||
jobs.add(second);
|
||||
|
||||
vrp = VehicleRoutingProblem.Builder.newInstance().addAllJobs(jobs).addVehicle(vehicle).setRoutingCost(costs).build();
|
||||
vrp = VehicleRoutingProblem.Builder.newInstance().addAllJobs(jobs)
|
||||
.addVehicle(vehicle).setRoutingCost(costs).build();
|
||||
|
||||
states = new StateManager(vrp);
|
||||
states.updateLoadStates();
|
||||
|
|
|
|||
|
|
@ -109,47 +109,7 @@ public class TestVehicleFleetManagerImpl {
|
|||
assertEquals(2, availableVehicles.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithPenalty_whenHavingTwoRegularVehicleAvailablePlusOnePenaltyVehicle_andOneIsLocked_returnTheOtherRegularVehicle(){
|
||||
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance("standard").build();
|
||||
PenaltyVehicleType penaltyVehicleType = new PenaltyVehicleType(penaltyType);
|
||||
|
||||
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setStartLocationId("loc").
|
||||
setType(penaltyVehicleType).build();
|
||||
|
||||
Vehicle v3 = VehicleImpl.Builder.newInstance("standard_v3").setStartLocationId("loc").
|
||||
setType(penaltyType).build();
|
||||
|
||||
List<Vehicle> vehicles = new ArrayList<Vehicle>();
|
||||
vehicles.add(v1);
|
||||
vehicles.add(v2);
|
||||
vehicles.add(penalty4standard);
|
||||
vehicles.add(v3);
|
||||
VehicleFleetManager fleetManager = new FiniteFleetManagerFactory(vehicles).createFleetManager();
|
||||
fleetManager.lock(v1);
|
||||
fleetManager.lock(v2);
|
||||
Collection<Vehicle> availableVehicles = fleetManager.getAvailableVehicles();
|
||||
assertEquals(1, availableVehicles.size());
|
||||
assertEquals(v3, availableVehicles.iterator().next());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithPenalty_whenHavingNoRegularVehicleAvailable_penaltyVehicleIsReturned(){
|
||||
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance("standard").build();
|
||||
|
||||
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setStartLocationId("loc").
|
||||
setType(penaltyType).build();
|
||||
|
||||
List<Vehicle> vehicles = new ArrayList<Vehicle>();
|
||||
vehicles.add(v1);
|
||||
vehicles.add(v2);
|
||||
vehicles.add(penalty4standard);
|
||||
VehicleFleetManager fleetManager = new FiniteFleetManagerFactory(vehicles).createFleetManager();
|
||||
fleetManager.lock(v1);
|
||||
fleetManager.lock(v2);
|
||||
Collection<Vehicle> availableVehicles = fleetManager.getAvailableVehicles();
|
||||
assertEquals(penalty4standard, availableVehicles.iterator().next());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void whenAddingTwoVehiclesWithSameTypeIdAndLocation_getAvailableVehicleShouldReturnOnlyOneOfThem(){
|
||||
|
|
|
|||
|
|
@ -194,15 +194,7 @@ public class VehicleImplTest {
|
|||
assertTrue(v.equals(v2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenTwoVehiclesHaveTheSameIdButDiffType_theyShouldNotBeEqual(){
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("type").build();
|
||||
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setType(type1).setEndLocationId("start").setReturnToDepot(false).build();
|
||||
PenaltyVehicleType penType = new PenaltyVehicleType(type1);
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v").setType(penType).setStartLocationId("start").setEndLocationId("start").setReturnToDepot(false).build();
|
||||
assertTrue(!v.equals(v2));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void whenAddingSkills_theyShouldBeAddedCorrectly(){
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("type").build();
|
||||
|
|
|
|||
|
|
@ -146,13 +146,7 @@ public class VehicleTypeImplTest {
|
|||
assertTrue(type.equals(type2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenHavingTwoTypesWithTheSameIdButDiffClass_theyShouldNotBeEqual(){
|
||||
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").setCostPerTime(10).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type").setCostPerTime(10).build();
|
||||
PenaltyVehicleType penType = new PenaltyVehicleType(type2);
|
||||
assertTrue(!type.equals(penType));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,24 @@
|
|||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>INFINITE</fleetSize>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<typeId>vehType2</typeId>
|
||||
<startLocation>
|
||||
<id>loc</id>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>loc</id>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<typeId>vehType</typeId>
|
||||
|
|
@ -33,58 +48,16 @@
|
|||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">200</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<location>
|
||||
<id>loc</id>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>2.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="service">
|
||||
<location>
|
||||
<id>loc2</id>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>4.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
<solutions>
|
||||
<solution>
|
||||
<cost>10.0</cost>
|
||||
<routes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>v1</vehicleId>
|
||||
<start>0.0</start>
|
||||
<act type="service">
|
||||
<serviceId>1</serviceId>
|
||||
<arrTime>0.0</arrTime>
|
||||
<endTime>0.0</endTime>
|
||||
</act>
|
||||
<end>0.0</end>
|
||||
</route>
|
||||
</routes>
|
||||
<unassignedJobs>
|
||||
<job id="2"/>
|
||||
</unassignedJobs>
|
||||
</solution>
|
||||
</solutions>
|
||||
</problem>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,10 @@ import jsprit.core.problem.solution.route.activity.ReverseActivityVisitor;
|
|||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivity.JobActivity;
|
||||
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
||||
import jsprit.core.problem.vehicle.*;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
import jsprit.core.reporting.SolutionPrinter;
|
||||
import jsprit.core.util.Coordinate;
|
||||
import jsprit.core.util.CrowFlyCosts;
|
||||
|
|
@ -318,10 +321,6 @@ public class BicycleMessenger {
|
|||
throw new IllegalStateException("three times less than ... constraint broken. this must not be. act.getArrTime(): " + act.getArrTime() + " allowed: " + 3*nearestMessengers.get(((JobActivity)act).getJob().getId()));
|
||||
}
|
||||
}
|
||||
if(route.getVehicle().getType() instanceof PenaltyVehicleType){
|
||||
SolutionPrinter.print(bicycleMessengerProblem, bestOf, SolutionPrinter.Print.VERBOSE);
|
||||
throw new IllegalStateException("penaltyVehicle in solution. if there is a valid solution, this should not be");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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