mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
replace get/setDeliveryLocation(...) with get/setDeliveryLocationId(...)
replace get/setPickupLocation(...) with get/setPickupLocationId(...)
This commit is contained in:
parent
9971d3d349
commit
afe98c1051
22 changed files with 278 additions and 308 deletions
|
|
@ -1,3 +1,20 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2014 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.algorithm;
|
||||
|
||||
|
||||
|
|
@ -252,10 +269,10 @@ public class InitialRoutesTest {
|
|||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0, 100).build();
|
||||
VehicleImpl vehicle = VehicleImpl.Builder.newInstance("veh").setStartLocationCoordinate(Coordinate.newInstance(0, 0)).setType(type).setStartLocationId("start").build();
|
||||
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocation("pick").setDeliveryLocation("del").setPickupCoord(Coordinate.newInstance(10, 0))
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocationId("pick").setDeliveryLocationId("del").setPickupCoord(Coordinate.newInstance(10, 0))
|
||||
.setDeliveryCoord(Coordinate.newInstance(0, 10)).addSizeDimension(0, 100).build();
|
||||
|
||||
Shipment another_shipment = Shipment.Builder.newInstance("another_s").setPickupLocation("pick").setDeliveryLocation("del").setPickupCoord(Coordinate.newInstance(10, 0))
|
||||
Shipment another_shipment = Shipment.Builder.newInstance("another_s").setPickupLocationId("pick").setDeliveryLocationId("del").setPickupCoord(Coordinate.newInstance(10, 0))
|
||||
.setDeliveryCoord(Coordinate.newInstance(0, 10)).addSizeDimension(0, 50).build();
|
||||
|
||||
VehicleRoute iniRoute = VehicleRoute.Builder.newInstance(vehicle).addPickup(shipment).addDelivery(shipment).build();
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Stefan Schroeder.
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
package jsprit.core.algorithm.recreate;
|
||||
|
||||
|
|
@ -113,7 +111,7 @@ public class ShipmentInsertionCalculatorTest {
|
|||
|
||||
@Test
|
||||
public void whenCalculatingInsertionCostsOfShipment_itShouldReturnCorrectCostValue(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("0,10").setDeliveryLocation("10,0").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("0,10").setDeliveryLocationId("10,0").build();
|
||||
VehicleRoute route = VehicleRoute.emptyRoute();
|
||||
JobActivityFactory activityFactory = mock(JobActivityFactory.class);
|
||||
List<AbstractActivity> activities = new ArrayList<AbstractActivity>();
|
||||
|
|
@ -127,8 +125,8 @@ public class ShipmentInsertionCalculatorTest {
|
|||
|
||||
@Test
|
||||
public void whenCalculatingInsertionIntoExistingRoute_itShouldReturnCorrectCosts(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("0,10").setDeliveryLocation("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocation("10,10").setDeliveryLocation("0,0").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("0,10").setDeliveryLocationId("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("10,10").setDeliveryLocationId("0,0").build();
|
||||
VehicleRoute route = VehicleRoute.emptyRoute();
|
||||
when(vehicleRoutingProblem.copyAndGetActivities(shipment)).thenReturn(getTourActivities(shipment));
|
||||
new Inserter(new InsertionListeners(), vehicleRoutingProblem).insertJob(shipment, new InsertionData(0,0,0,vehicle,null), route);
|
||||
|
|
@ -157,8 +155,8 @@ public class ShipmentInsertionCalculatorTest {
|
|||
|
||||
@Test
|
||||
public void whenInsertingShipmentInRouteWithNotEnoughCapacity_itShouldReturnNoInsertion(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("0,10").setDeliveryLocation("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocation("10,10").setDeliveryLocation("0,0").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("0,10").setDeliveryLocationId("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("10,10").setDeliveryLocationId("0,0").build();
|
||||
VehicleRoute route = VehicleRoute.emptyRoute();
|
||||
when(vehicleRoutingProblem.copyAndGetActivities(shipment)).thenReturn(getTourActivities(shipment));
|
||||
new Inserter(new InsertionListeners(), vehicleRoutingProblem).insertJob(shipment, new InsertionData(0,0,0,vehicle,null), route);
|
||||
|
|
@ -186,9 +184,9 @@ public class ShipmentInsertionCalculatorTest {
|
|||
|
||||
@Test
|
||||
public void whenInsertingThirdShipment_itShouldCalcCorrectVal(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("0,10").setDeliveryLocation("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocation("10,10").setDeliveryLocation("0,0").build();
|
||||
Shipment shipment3 = Shipment.Builder.newInstance("s3").addSizeDimension(0, 1).setPickupLocation("0,0").setDeliveryLocation("9,10").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("0,10").setDeliveryLocationId("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("10,10").setDeliveryLocationId("0,0").build();
|
||||
Shipment shipment3 = Shipment.Builder.newInstance("s3").addSizeDimension(0, 1).setPickupLocationId("0,0").setDeliveryLocationId("9,10").build();
|
||||
|
||||
VehicleRoute route = VehicleRoute.emptyRoute();
|
||||
when(vehicleRoutingProblem.copyAndGetActivities(shipment)).thenReturn(getTourActivities(shipment));
|
||||
|
|
@ -212,9 +210,9 @@ public class ShipmentInsertionCalculatorTest {
|
|||
|
||||
@Test
|
||||
public void whenInsertingThirdShipment_itShouldCalcCorrectVal2(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("0,10").setDeliveryLocation("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocation("10,10").setDeliveryLocation("0,0").build();
|
||||
Shipment shipment3 = Shipment.Builder.newInstance("s3").addSizeDimension(0, 1).setPickupLocation("0,0").setDeliveryLocation("9,9").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("0,10").setDeliveryLocationId("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("10,10").setDeliveryLocationId("0,0").build();
|
||||
Shipment shipment3 = Shipment.Builder.newInstance("s3").addSizeDimension(0, 1).setPickupLocationId("0,0").setDeliveryLocationId("9,9").build();
|
||||
when(vehicleRoutingProblem.copyAndGetActivities(shipment)).thenReturn(getTourActivities(shipment));
|
||||
when(vehicleRoutingProblem.copyAndGetActivities(shipment2)).thenReturn(getTourActivities(shipment2));
|
||||
VehicleRoute route = VehicleRoute.emptyRoute();
|
||||
|
|
@ -238,9 +236,9 @@ public class ShipmentInsertionCalculatorTest {
|
|||
|
||||
@Test
|
||||
public void whenInstertingShipmentWithLoadConstraintWhereCapIsNotSufficient_capConstraintsAreFulfilled(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("0,10").setDeliveryLocation("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocation("10,10").setDeliveryLocation("0,0").build();
|
||||
Shipment shipment3 = Shipment.Builder.newInstance("s3").addSizeDimension(0, 1).setPickupLocation("0,0").setDeliveryLocation("9,9").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("0,10").setDeliveryLocationId("10,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("10,10").setDeliveryLocationId("0,0").build();
|
||||
Shipment shipment3 = Shipment.Builder.newInstance("s3").addSizeDimension(0, 1).setPickupLocationId("0,0").setDeliveryLocationId("9,9").build();
|
||||
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleRoutingProblem vrp = vrpBuilder.addJob(shipment).addJob(shipment2).addJob(shipment3).build();
|
||||
|
|
@ -271,8 +269,8 @@ public class ShipmentInsertionCalculatorTest {
|
|||
|
||||
@Test
|
||||
public void whenInsertingServiceWhileNoCapIsAvailable_itMustReturnNoInsertionData(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("0,10").setDeliveryLocation("0,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocation("10,10").setDeliveryLocation("0,0").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("0,10").setDeliveryLocationId("0,0").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("10,10").setDeliveryLocationId("0,0").build();
|
||||
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleRoutingProblem vrp = vrpBuilder.addJob(shipment).addJob(shipment2).build();
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Stefan Schroeder.
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
package jsprit.core.algorithm.recreate;
|
||||
|
||||
|
|
@ -125,7 +123,7 @@ public class TestInserter {
|
|||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||
|
||||
InsertionData iData = mock(InsertionData.class);
|
||||
when(iData.getPickupInsertionIndex()).thenReturn(2);
|
||||
|
|
@ -138,8 +136,8 @@ public class TestInserter {
|
|||
inserter.insertJob(shipmentToInsert, iData, route);
|
||||
|
||||
assertEquals(4,route.getTourActivities().getActivities().size());
|
||||
assertEquals(route.getTourActivities().getActivities().get(2).getLocationId(),shipmentToInsert.getPickupLocation());
|
||||
assertEquals(route.getTourActivities().getActivities().get(3).getLocationId(),shipmentToInsert.getDeliveryLocation());
|
||||
assertEquals(route.getTourActivities().getActivities().get(2).getLocationId(),shipmentToInsert.getPickupLocationId());
|
||||
assertEquals(route.getTourActivities().getActivities().get(3).getLocationId(),shipmentToInsert.getDeliveryLocationId());
|
||||
assertEquals(route.getEnd().getLocationId(),vehicle.getEndLocationId());
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +159,7 @@ public class TestInserter {
|
|||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||
InsertionData iData = mock(InsertionData.class);
|
||||
when(iData.getPickupInsertionIndex()).thenReturn(2);
|
||||
when(iData.getDeliveryInsertionIndex()).thenReturn(2);
|
||||
|
|
@ -173,9 +171,9 @@ public class TestInserter {
|
|||
inserter.insertJob(shipmentToInsert, iData, route);
|
||||
|
||||
assertEquals(4,route.getTourActivities().getActivities().size());
|
||||
assertEquals(route.getTourActivities().getActivities().get(2).getLocationId(),shipmentToInsert.getPickupLocation());
|
||||
assertEquals(route.getTourActivities().getActivities().get(3).getLocationId(),shipmentToInsert.getDeliveryLocation());
|
||||
assertEquals(route.getEnd().getLocationId(),shipmentToInsert.getDeliveryLocation());
|
||||
assertEquals(route.getTourActivities().getActivities().get(2).getLocationId(),shipmentToInsert.getPickupLocationId());
|
||||
assertEquals(route.getTourActivities().getActivities().get(3).getLocationId(),shipmentToInsert.getDeliveryLocationId());
|
||||
assertEquals(route.getEnd().getLocationId(),shipmentToInsert.getDeliveryLocationId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -188,7 +186,7 @@ public class TestInserter {
|
|||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").setDeliveryLocation("delLoc").build();
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc").build();
|
||||
|
||||
InsertionData iData = mock(InsertionData.class);
|
||||
when(iData.getPickupInsertionIndex()).thenReturn(2);
|
||||
|
|
@ -213,7 +211,7 @@ public class TestInserter {
|
|||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").setDeliveryLocation("delLoc").build();
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc").build();
|
||||
|
||||
InsertionData iData = mock(InsertionData.class);
|
||||
when(iData.getPickupInsertionIndex()).thenReturn(2);
|
||||
|
|
@ -233,13 +231,13 @@ public class TestInserter {
|
|||
Shipment shipment = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(shipment.getSize()).thenReturn(capacity);
|
||||
when(shipment.getDeliveryLocation()).thenReturn("oldShipmentDelLoc");
|
||||
when(shipment.getDeliveryLocationId()).thenReturn("oldShipmentDelLoc");
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setReturnToDepot(false).setStartLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setReturnToDepot(false).setStartLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").setDeliveryLocation("delLoc").build();
|
||||
Shipment shipmentToInsert = Shipment.Builder.newInstance("s").setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc").build();
|
||||
|
||||
InsertionData iData = mock(InsertionData.class);
|
||||
when(iData.getPickupInsertionIndex()).thenReturn(0);
|
||||
|
|
|
|||
|
|
@ -1,35 +1,32 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Stefan Schroeder.
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
package jsprit.core.algorithm.ruin.distance;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import jsprit.core.algorithm.ruin.distance.AvgServiceAndShipmentDistance;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.job.Shipment;
|
||||
import jsprit.core.util.Coordinate;
|
||||
import jsprit.core.util.CrowFlyCosts;
|
||||
import jsprit.core.util.Locations;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
public class AverageJobDistanceTest {
|
||||
|
||||
|
|
@ -55,15 +52,15 @@ public class AverageJobDistanceTest {
|
|||
|
||||
@Test
|
||||
public void distanceOfTwoEqualShipmentsShouldBeSmallerThanAnyOtherDistance(){
|
||||
Shipment s1 = Shipment.Builder.newInstance("s1").addSizeDimension(0, 1).setPickupLocation("0,0").setDeliveryLocation("10,10").build();
|
||||
Shipment s2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocation("0,0").setDeliveryLocation("10,10").build();
|
||||
Shipment s1 = Shipment.Builder.newInstance("s1").addSizeDimension(0, 1).setPickupLocationId("0,0").setDeliveryLocationId("10,10").build();
|
||||
Shipment s2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("0,0").setDeliveryLocationId("10,10").build();
|
||||
|
||||
double dist = new AvgServiceAndShipmentDistance(routingCosts).getDistance(s1, s2);
|
||||
|
||||
for(int i=0;i<10;i++){
|
||||
for(int j=0;j<10;j++){
|
||||
Shipment other1 = Shipment.Builder.newInstance("s1").addSizeDimension(0, 1).setPickupLocation("0,0").setDeliveryLocation(i+","+j).build();
|
||||
Shipment other2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocation("0,0").setDeliveryLocation("10,10").build();
|
||||
Shipment other1 = Shipment.Builder.newInstance("s1").addSizeDimension(0, 1).setPickupLocationId("0,0").setDeliveryLocationId(i + "," + j).build();
|
||||
Shipment other2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("0,0").setDeliveryLocationId("10,10").build();
|
||||
double dist2 = new AvgServiceAndShipmentDistance(routingCosts).getDistance(other1, other2);
|
||||
System.out.println("("+i+","+j+"), dist=" + dist + ", dist2=" + dist2);
|
||||
assertTrue(dist<=dist2+dist2*0.001);
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Stefan Schroeder.
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
package jsprit.core.algorithm.state;
|
||||
|
||||
|
|
@ -60,7 +58,7 @@ public class HardPickupAndDeliveryShipmentActivityConstraintTest {
|
|||
public void doBefore(){
|
||||
s1 = Service.Builder.newInstance("s1").setLocationId("loc").build();
|
||||
s2 = Service.Builder.newInstance("s2").setLocationId("loc").build();
|
||||
shipment = Shipment.Builder.newInstance("shipment").setPickupLocation("pickLoc").setDeliveryLocation("delLoc").addSizeDimension(0,1).build();
|
||||
shipment = Shipment.Builder.newInstance("shipment").setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc").addSizeDimension(0,1).build();
|
||||
|
||||
|
||||
// when(vehicle.getCapacity()).thenReturn(2);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2014 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.algorithm.state;
|
||||
|
||||
import jsprit.core.problem.AbstractActivity;
|
||||
|
|
@ -52,8 +69,8 @@ public class LoadStateTest {
|
|||
final VehicleRoutingProblem pdProblem = pdProblemBuilder.build();
|
||||
|
||||
final VehicleRoutingProblem.Builder shipmentProblemBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
Shipment shipment1 = Shipment.Builder.newInstance("s1").addSizeDimension(0,10).setPickupLocation("pick").setDeliveryLocation("del").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0,5).setPickupLocation("pick").setDeliveryLocation("del").build();
|
||||
Shipment shipment1 = Shipment.Builder.newInstance("s1").addSizeDimension(0,10).setPickupLocationId("pick").setDeliveryLocationId("del").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0,5).setPickupLocationId("pick").setDeliveryLocationId("del").build();
|
||||
shipmentProblemBuilder.addJob(shipment1).addJob(shipment2).build();
|
||||
final VehicleRoutingProblem shipmentProblem = shipmentProblemBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -111,8 +111,8 @@ public class VehicleRoutingProblemTest {
|
|||
|
||||
@Test
|
||||
public void whenShipmentsAreAdded_vrpShouldContainThem(){
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foofoo").setDeliveryLocation("foo").build();
|
||||
Shipment s2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 100).setPickupLocation("foofoo").setDeliveryLocation("foo").build();
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocationId("foofoo").setDeliveryLocationId("foo").build();
|
||||
Shipment s2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 100).setPickupLocationId("foofoo").setDeliveryLocationId("foo").build();
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
vrpBuilder.addJob(s);
|
||||
vrpBuilder.addJob(s2);
|
||||
|
|
@ -534,7 +534,7 @@ public class VehicleRoutingProblemTest {
|
|||
@Test
|
||||
public void whenAddingTwoJobs_theyShouldHaveProperIndeces(){
|
||||
Service service = Service.Builder.newInstance("myService").setLocationId("loc").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("shipment").setPickupLocation("pick").setDeliveryLocation("del").build();
|
||||
Shipment shipment = Shipment.Builder.newInstance("shipment").setPickupLocationId("pick").setDeliveryLocationId("del").build();
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
vrpBuilder.addJob(service);
|
||||
vrpBuilder.addJob(shipment);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2014 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.constraint;
|
||||
|
||||
import jsprit.core.algorithm.state.StateManager;
|
||||
|
|
@ -55,8 +72,8 @@ public class LoadConstraintTest {
|
|||
final VehicleRoutingProblem pdProblem = pdProblemBuilder.build();
|
||||
|
||||
final VehicleRoutingProblem.Builder shipmentProblemBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
Shipment shipment1 = Shipment.Builder.newInstance("s1").addSizeDimension(0,10).setPickupLocation("pick").setDeliveryLocation("del").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0,5).setPickupLocation("pick").setDeliveryLocation("del").build();
|
||||
Shipment shipment1 = Shipment.Builder.newInstance("s1").addSizeDimension(0,10).setPickupLocationId("pick").setDeliveryLocationId("del").build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0,5).setPickupLocationId("pick").setDeliveryLocationId("del").build();
|
||||
shipmentProblemBuilder.addJob(shipment1).addJob(shipment2).build();
|
||||
final VehicleRoutingProblem shipmentProblem = shipmentProblemBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Stefan Schroeder.
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
package jsprit.core.problem.solution.route;
|
||||
|
||||
|
|
@ -115,7 +113,7 @@ public class VehicleRouteBuilderTest {
|
|||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
when(s2.getDeliveryLocation()).thenReturn("delLoc");
|
||||
when(s2.getDeliveryLocationId()).thenReturn("delLoc");
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(false);
|
||||
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
|
||||
|
|
@ -125,7 +123,7 @@ public class VehicleRouteBuilderTest {
|
|||
builder.addDelivery(s);
|
||||
builder.addDelivery(s2);
|
||||
VehicleRoute route = builder.build();
|
||||
assertEquals(route.getEnd().getLocationId(), s2.getDeliveryLocation());
|
||||
assertEquals(route.getEnd().getLocationId(), s2.getDeliveryLocationId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -135,7 +133,7 @@ public class VehicleRouteBuilderTest {
|
|||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
when(s2.getDeliveryLocation()).thenReturn("delLoc");
|
||||
when(s2.getDeliveryLocationId()).thenReturn("delLoc");
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(false);
|
||||
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
|
||||
|
|
@ -158,7 +156,7 @@ public class VehicleRouteBuilderTest {
|
|||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
when(s2.getDeliveryLocation()).thenReturn("delLoc");
|
||||
when(s2.getDeliveryLocationId()).thenReturn("delLoc");
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(false);
|
||||
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
|
||||
|
|
|
|||
|
|
@ -1,28 +1,26 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Stefan Schroeder.
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
package jsprit.core.problem.solution.route.activity;
|
||||
|
||||
import jsprit.core.problem.job.Shipment;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import jsprit.core.problem.job.Shipment;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class DefaultShipmentActivityFactoryTest {
|
||||
|
||||
|
|
@ -30,7 +28,7 @@ public class DefaultShipmentActivityFactoryTest {
|
|||
public void whenCreatingPickupActivityWithShipment_itShouldReturnPickupShipment(){
|
||||
DefaultShipmentActivityFactory factory = new DefaultShipmentActivityFactory();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s")
|
||||
.setPickupLocation("pLoc").setDeliveryLocation("dLoc").build();
|
||||
.setPickupLocationId("pLoc").setDeliveryLocationId("dLoc").build();
|
||||
TourActivity act = factory.createPickup(shipment);
|
||||
assertNotNull(act);
|
||||
assertTrue(act instanceof PickupShipment);
|
||||
|
|
@ -40,7 +38,7 @@ public class DefaultShipmentActivityFactoryTest {
|
|||
public void whenCreatingDeliverActivityWithShipment_itShouldReturnDeliverShipment(){
|
||||
DefaultShipmentActivityFactory factory = new DefaultShipmentActivityFactory();
|
||||
Shipment shipment = Shipment.Builder.newInstance("s")
|
||||
.setPickupLocation("pLoc").setDeliveryLocation("dLoc").build();
|
||||
.setPickupLocationId("pLoc").setDeliveryLocationId("dLoc").build();
|
||||
TourActivity act = factory.createDelivery(shipment);
|
||||
assertNotNull(act);
|
||||
assertTrue(act instanceof DeliverShipment);
|
||||
|
|
|
|||
|
|
@ -1,30 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Stefan Schroeder.
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
package jsprit.core.problem.solution.route.activity;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import jsprit.core.problem.job.Shipment;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class DeliverShipmentTest {
|
||||
|
||||
private Shipment shipment;
|
||||
|
|
@ -33,8 +31,8 @@ public class DeliverShipmentTest {
|
|||
|
||||
@Before
|
||||
public void doBefore(){
|
||||
shipment = Shipment.Builder.newInstance("shipment").setPickupLocation("pickupLoc")
|
||||
.setDeliveryLocation("deliveryLoc")
|
||||
shipment = Shipment.Builder.newInstance("shipment").setPickupLocationId("pickupLoc")
|
||||
.setDeliveryLocationId("deliveryLoc")
|
||||
.setPickupTimeWindow(TimeWindow.newInstance(1., 2.))
|
||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3., 4.))
|
||||
.addSizeDimension(0, 10).addSizeDimension(1, 100).addSizeDimension(2, 1000).build();
|
||||
|
|
@ -90,7 +88,7 @@ public class DeliverShipmentTest {
|
|||
|
||||
@Test
|
||||
public void whenGettingCapacity_itShouldReturnItCorrectly(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").setDeliveryLocation("delLoc")
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc")
|
||||
.addSizeDimension(0, 10).addSizeDimension(1, 100).build();
|
||||
PickupShipment pick = new PickupShipment(shipment);
|
||||
assertEquals(10,pick.getSize().get(0));
|
||||
|
|
|
|||
|
|
@ -1,30 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Stefan Schroeder.
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
package jsprit.core.problem.solution.route.activity;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import jsprit.core.problem.job.Shipment;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class PickupShipmentTest {
|
||||
|
||||
private Shipment shipment;
|
||||
|
|
@ -33,8 +31,8 @@ public class PickupShipmentTest {
|
|||
|
||||
@Before
|
||||
public void doBefore(){
|
||||
shipment = Shipment.Builder.newInstance("shipment").setPickupLocation("pickupLoc")
|
||||
.setDeliveryLocation("deliveryLoc")
|
||||
shipment = Shipment.Builder.newInstance("shipment").setPickupLocationId("pickupLoc")
|
||||
.setDeliveryLocationId("deliveryLoc")
|
||||
.setPickupTimeWindow(TimeWindow.newInstance(1., 2.))
|
||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3., 4.))
|
||||
.addSizeDimension(0, 10).addSizeDimension(1, 100).addSizeDimension(2, 1000).build();
|
||||
|
|
@ -90,7 +88,7 @@ public class PickupShipmentTest {
|
|||
|
||||
@Test
|
||||
public void whenGettingCapacity_itShouldReturnItCorrectly(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").setDeliveryLocation("delLoc")
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc")
|
||||
.addSizeDimension(0, 10).addSizeDimension(1, 100).build();
|
||||
PickupShipment pick = new PickupShipment(shipment);
|
||||
assertEquals(10,pick.getSize().get(0));
|
||||
|
|
|
|||
|
|
@ -1,35 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2013 Stefan Schroeder
|
||||
*
|
||||
* Copyright (C) 2014 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
|
||||
* 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.solution.route.activity;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.job.Shipment;
|
||||
import jsprit.core.problem.solution.route.activity.DefaultShipmentActivityFactory;
|
||||
import jsprit.core.problem.solution.route.activity.ServiceActivity;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivities;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||
import jsprit.core.problem.solution.route.activity.TourShipmentActivityFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
|
||||
public class TestTour {
|
||||
|
|
@ -82,7 +75,7 @@ public class TestTour {
|
|||
|
||||
@Test
|
||||
public void whenAddingAShipmentActivity_tourShouldServeShipment(){
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||
TourShipmentActivityFactory fac = new DefaultShipmentActivityFactory();
|
||||
TourActivity pickupShipment = fac.createPickup(s);
|
||||
TourActivity deliverShipment = fac.createDelivery(s);
|
||||
|
|
@ -96,7 +89,7 @@ public class TestTour {
|
|||
|
||||
@Test
|
||||
public void whenRemovingShipment_tourShouldNotServiceItAnymore(){
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||
TourShipmentActivityFactory fac = new DefaultShipmentActivityFactory();
|
||||
TourActivity pickupShipment = fac.createPickup(s);
|
||||
TourActivity deliverShipment = fac.createDelivery(s);
|
||||
|
|
@ -110,7 +103,7 @@ public class TestTour {
|
|||
|
||||
@Test
|
||||
public void whenRemovingShipment_theirCorrespondingActivitiesShouldBeRemoved(){
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||
TourShipmentActivityFactory fac = new DefaultShipmentActivityFactory();
|
||||
TourActivity pickupShipment = fac.createPickup(s);
|
||||
TourActivity deliverShipment = fac.createDelivery(s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue