mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
adapt tests to changes in vehicleFleetManager
This commit is contained in:
parent
8b01497cfc
commit
4761b30b16
2 changed files with 7 additions and 2 deletions
|
|
@ -25,6 +25,8 @@ import static org.junit.Assert.assertThat;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
@ -59,6 +61,8 @@ public class CalcVehicleTypeDependentServiceInsertionTest {
|
||||||
service = mock(Service.class);
|
service = mock(Service.class);
|
||||||
vehicleRoute = mock(VehicleRoute.class);
|
vehicleRoute = mock(VehicleRoute.class);
|
||||||
|
|
||||||
|
when(fleetManager.getAvailableVehicles()).thenReturn(Arrays.asList(veh1,veh2));
|
||||||
|
|
||||||
when(veh1.getCapacity()).thenReturn(10);
|
when(veh1.getCapacity()).thenReturn(10);
|
||||||
when(veh2.getCapacity()).thenReturn(10);
|
when(veh2.getCapacity()).thenReturn(10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import basics.io.VrpXMLReader;
|
||||||
import basics.route.PenaltyVehicleType;
|
import basics.route.PenaltyVehicleType;
|
||||||
import basics.route.Vehicle;
|
import basics.route.Vehicle;
|
||||||
import basics.route.VehicleImpl;
|
import basics.route.VehicleImpl;
|
||||||
|
import basics.route.VehicleType;
|
||||||
import basics.route.VehicleTypeImpl;
|
import basics.route.VehicleTypeImpl;
|
||||||
|
|
||||||
public class MultipleDepotExampleWithPenaltyVehicles {
|
public class MultipleDepotExampleWithPenaltyVehicles {
|
||||||
|
|
@ -52,7 +53,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
||||||
int depotCounter = 1;
|
int depotCounter = 1;
|
||||||
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second)){
|
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second)){
|
||||||
for(int i=0;i<nuOfVehicles;i++){
|
for(int i=0;i<nuOfVehicles;i++){
|
||||||
VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
|
VehicleType vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
|
||||||
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle";
|
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle";
|
||||||
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicleId);
|
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicleId);
|
||||||
vehicleBuilder.setLocationCoord(depotCoord);
|
vehicleBuilder.setLocationCoord(depotCoord);
|
||||||
|
|
@ -64,7 +65,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
||||||
/*
|
/*
|
||||||
* define penalty-type with the same id, but other higher fixed and variable costs
|
* define penalty-type with the same id, but other higher fixed and variable costs
|
||||||
*/
|
*/
|
||||||
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
|
VehicleType penaltyType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
|
||||||
/*
|
/*
|
||||||
* to mark the penalty-type as penalty-type, wrap it with PenaltyVehicleType(Wrapper)
|
* to mark the penalty-type as penalty-type, wrap it with PenaltyVehicleType(Wrapper)
|
||||||
* this is to tell the fleetManager that this is not a regular but a penalty vehicle
|
* this is to tell the fleetManager that this is not a regular but a penalty vehicle
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue