From 4a9c8977d02040da9fe4c8b2df3137ef703000a7 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Tue, 13 Aug 2024 14:46:15 +0200 Subject: [PATCH] rename classes and interfaces to indicate that it deals with LspShipments and avoid confusions with CarrierShipments --- .../ForwardLogisticChainSchedulerImpl.java | 4 +- .../freight/logistics/HasLspShipmentId.java | 4 +- .../logistics/InitialShipmentAssigner.java | 10 +- .../org/matsim/freight/logistics/LSP.java | 8 +- .../logistics/LSPControlerListener.java | 4 +- .../org/matsim/freight/logistics/LSPImpl.java | 8 +- .../org/matsim/freight/logistics/LSPPlan.java | 10 +- .../matsim/freight/logistics/LSPPlanImpl.java | 14 +-- .../logistics/LSPResourceScheduler.java | 10 +- .../matsim/freight/logistics/LSPUtils.java | 20 ++-- .../freight/logistics/LogisticChain.java | 6 +- .../freight/logistics/LogisticChainImpl.java | 10 +- .../logistics/LogisticChainScheduler.java | 4 +- .../logistics/LspShipmentWithTime.java | 8 +- .../freight/logistics/WaitingShipments.java | 4 +- .../logistics/WaitingShipmentsImpl.java | 4 +- .../events/AbstractLogisticEvent.java | 14 +-- .../events/HandlingInHubStartsEvent.java | 10 +- .../logistics/events/LspEventCreator.java | 4 +- .../ExampleSchedulingOfInitialPlan.java | 34 +++---- .../ExampleSchedulingOfTransportChain.java | 28 +++--- ...chedulingOfTransportChainHubsVsDirect.java | 16 ++-- .../initialPlans/ExampleTwoEchelonGrid.java | 20 ++-- .../ExampleTwoEchelonGrid_NR.java | 20 ++-- .../AssignmentStrategyFactory.java | 8 +- .../lspReplanning/MaybeTodayAssigner.java | 4 +- ...morrowShipmentAssignerStrategyFactory.java | 12 +-- .../lspScoring/ExampleLSPScoring.java | 16 ++-- .../ExampleMobsimOfSimpleLSP.java | 32 +++---- .../ExampleMobsimOfTransportChain.java | 32 +++---- .../ExampleGroceryDeliveryMultipleChains.java | 4 +- .../ExampleMultipleMixedEchelonChains.java | 18 ++-- .../ExampleMultipleOneEchelonChains.java | 18 ++-- ...pleMultipleOneEchelonChainsReplanning.java | 18 ++-- ...pleMultipleTwoEchelonChainsReplanning.java | 18 ++-- ...eTwoLspsGroceryDeliveryMultipleChains.java | 10 +- ...GroceryDeliveryMultipleChainsWithToll.java | 10 +- .../multipleChains/MultipleChainsUtils.java | 14 +-- .../PrimaryLogisticChainShipmentAssigner.java | 6 +- .../ProximityStrategyFactory.java | 14 +-- ...stributionAllShipmentsStrategyFactory.java | 4 +- .../RandomLogisticChainShipmentAssigner.java | 6 +- .../RandomShiftingStrategyFactory.java | 6 +- .../RebalancingStrategyFactory.java | 4 +- ...stributionAllShipmentsStrategyFactory.java | 4 +- ...undRobinLogisticChainShipmentAssigner.java | 6 +- .../requirementsChecking/BlueRequirement.java | 4 +- .../ExampleCheckRequirementsOfAssigner.java | 24 ++--- .../requirementsChecking/RedRequirement.java | 4 +- .../RequirementsAssigner.java | 8 +- .../ExampleSimulationTrackers.java | 16 ++-- .../logistics/io/LSPPlanXmlParserV1.java | 34 +++---- .../logistics/io/LSPPlanXmlWriter.java | 20 ++-- .../CollectionCarrierScheduler.java | 38 ++++---- .../CollectionServiceEndEventHandler.java | 34 +++---- .../DistributionCarrierScheduler.java | 34 +++---- .../DistributionServiceStartEventHandler.java | 32 +++---- .../LSPTourEndEventHandler.java | 32 +++---- .../LSPTourStartEventHandler.java | 34 +++---- .../MainRunCarrierScheduler.java | 34 +++---- .../ResourceImplementationUtils.java | 26 ++--- .../SimpleForwardLogisticChainScheduler.java | 8 +- .../SingleLogisticChainShipmentAssigner.java | 6 +- .../TransshipmentHubResource.java | 3 +- .../TransshipmentHubScheduler.java | 22 ++--- .../TransshipmentHubTourEndEventHandler.java | 26 ++--- ...ndle.java => LoggedLspShipmentHandle.java} | 24 ++--- ...ntLoad.java => LoggedLspShipmentLoad.java} | 4 +- ...t.java => LoggedLspShipmentTransport.java} | 4 +- ...load.java => LoggedLspShipmentUnload.java} | 4 +- .../{LSPShipment.java => LspShipment.java} | 8 +- ...ShipmentImpl.java => LspShipmentImpl.java} | 14 +-- .../{ShipmentLeg.java => LspShipmentLeg.java} | 2 +- ...ShipmentPlan.java => LspShipmentPlan.java} | 10 +- ...ement.java => LspShipmentPlanElement.java} | 2 +- ...PlanImpl.java => LspShipmentPlanImpl.java} | 24 ++--- ...ement.java => LspShipmentRequirement.java} | 2 +- ...ipmentUtils.java => LspShipmentUtils.java} | 76 +++++++-------- ...e.java => ScheduledLspShipmentHandle.java} | 24 ++--- ...oad.java => ScheduledLspShipmentLoad.java} | 4 +- ...ava => ScheduledLspShipmentTransport.java} | 4 +- .../shipment/ScheduledLspShipmentUnload.java | 66 +++++++++++++ .../shipment/ScheduledShipmentUnload.java | 68 ------------- .../ShipmentPlanElementComparator.java | 4 +- .../logistics/events/LspEventsReaderTest.java | 6 +- .../CollectionLSPReplanningTest.java | 10 +- .../lspScoring/CollectionLSPScoringTest.java | 10 +- ...pleIterationsCollectionLSPScoringTest.java | 10 +- .../MultipleChainsReplanningTest.java | 24 ++--- .../multipleChains/WorstPlanSelectorTest.java | 14 +-- .../AssignerRequirementsTest.java | 18 ++-- .../CollectionTrackerTest.java | 10 +- .../CollectionLSPMobsimTest.java | 32 +++---- .../lspMobsimTests/CompleteLSPMobsimTest.java | 26 ++--- .../FirstAndSecondReloadLSPMobsimTest.java | 30 +++--- .../FirstReloadLSPMobsimTest.java | 30 +++--- .../lspMobsimTests/MainRunLSPMobsimTest.java | 30 +++--- .../MainRunOnlyLSPMobsimTest.java | 30 +++--- ...ipleIterationsCollectionLSPMobsimTest.java | 30 +++--- ...ltipleIterationsCompleteLSPMobsimTest.java | 26 ++--- ...ionsFirstAndSecondReloadLSPMobsimTest.java | 30 +++--- ...pleIterationsFirstReloadLSPMobsimTest.java | 30 +++--- ...ultipleIterationsMainRunLSPMobsimTest.java | 30 +++--- ...tipleShipmentsCollectionLSPMobsimTest.java | 30 +++--- ...ultipleShipmentsCompleteLSPMobsimTest.java | 26 ++--- ...entsFirstAndSecondReloadLSPMobsimTest.java | 30 +++--- ...ipleShipmentsFirstReloadLSPMobsimTest.java | 30 +++--- ...MultipleShipmentsMainRunLSPMobsimTest.java | 30 +++--- ...ultipleShipmentsCompleteLSPMobsimTest.java | 28 +++--- ...> CollectionLspShipmentAssigmentTest.java} | 12 +-- ...a => CompleteLspShipmentAssignerTest.java} | 10 +- .../CollectionShipmentBuilderTest.java | 12 +-- .../CompleteShipmentBuilderTest.java | 12 +-- .../DistributionShipmentBuilderTest.java | 12 +-- .../CollectionLSPSchedulingTest.java | 26 ++--- .../CompleteLSPSchedulingTest.java | 38 ++++---- .../FirstReloadLSPSchedulingTest.java | 34 +++---- .../MainRunLSPSchedulingTest.java | 36 +++---- ...eShipmentsCollectionLSPSchedulingTest.java | 26 ++--- ...pleShipmentsCompleteLSPSchedulingTest.java | 38 ++++---- ...ShipmentsFirstReloadLSPSchedulingTest.java | 34 +++---- ...ipleShipmentsMainRunLSPSchedulingTest.java | 28 +++--- ...hipmentsSecondReloadLSPSchedulingTest.java | 30 +++--- .../SecondReloadLSPSchedulingTest.java | 38 ++++---- .../org/matsim/freight/logistics/io/lsps.xml | 96 +++++++++---------- 125 files changed, 1202 insertions(+), 1201 deletions(-) rename src/main/java/org/matsim/freight/logistics/shipment/{ScheduledShipmentHandle.java => LoggedLspShipmentHandle.java} (94%) rename src/main/java/org/matsim/freight/logistics/shipment/{LoggedShipmentLoad.java => LoggedLspShipmentLoad.java} (93%) rename src/main/java/org/matsim/freight/logistics/shipment/{LoggedShipmentTransport.java => LoggedLspShipmentTransport.java} (95%) rename src/main/java/org/matsim/freight/logistics/shipment/{LoggedShipmentUnload.java => LoggedLspShipmentUnload.java} (93%) rename src/main/java/org/matsim/freight/logistics/shipment/{LSPShipment.java => LspShipment.java} (91%) rename src/main/java/org/matsim/freight/logistics/shipment/{LSPShipmentImpl.java => LspShipmentImpl.java} (90%) rename src/main/java/org/matsim/freight/logistics/shipment/{ShipmentLeg.java => LspShipmentLeg.java} (86%) rename src/main/java/org/matsim/freight/logistics/shipment/{ShipmentPlan.java => LspShipmentPlan.java} (82%) rename src/main/java/org/matsim/freight/logistics/shipment/{ShipmentPlanElement.java => LspShipmentPlanElement.java} (97%) rename src/main/java/org/matsim/freight/logistics/shipment/{ShipmentPlanImpl.java => LspShipmentPlanImpl.java} (76%) rename src/main/java/org/matsim/freight/logistics/shipment/{LSPShipmentRequirement.java => LspShipmentRequirement.java} (97%) rename src/main/java/org/matsim/freight/logistics/shipment/{ShipmentUtils.java => LspShipmentUtils.java} (85%) rename src/main/java/org/matsim/freight/logistics/shipment/{LoggedShipmentHandle.java => ScheduledLspShipmentHandle.java} (93%) rename src/main/java/org/matsim/freight/logistics/shipment/{ScheduledShipmentLoad.java => ScheduledLspShipmentLoad.java} (93%) rename src/main/java/org/matsim/freight/logistics/shipment/{ScheduledShipmentTransport.java => ScheduledLspShipmentTransport.java} (95%) create mode 100644 src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentUnload.java delete mode 100644 src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentUnload.java rename src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/{CollectionLSPShipmentAssigmentTest.java => CollectionLspShipmentAssigmentTest.java} (95%) rename src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/{CompleteLSPShipmentAssignerTest.java => CompleteLspShipmentAssignerTest.java} (97%) diff --git a/src/main/java/org/matsim/freight/logistics/ForwardLogisticChainSchedulerImpl.java b/src/main/java/org/matsim/freight/logistics/ForwardLogisticChainSchedulerImpl.java index 35ab6d92..71d76c30 100644 --- a/src/main/java/org/matsim/freight/logistics/ForwardLogisticChainSchedulerImpl.java +++ b/src/main/java/org/matsim/freight/logistics/ForwardLogisticChainSchedulerImpl.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import org.matsim.api.core.v01.Id; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * .... Macht 3 Schritte: 1.) the LSPShipments are handed over to the first {@link @@ -131,7 +131,7 @@ private void insertShipmentsAtBeginning() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { LogisticChainElement firstElement = getFirstElement(solution); assert firstElement != null; - for (Id lspShipmentId : solution.getLspShipmentIds()) { + for (Id lspShipmentId : solution.getLspShipmentIds()) { var shipment = LSPUtils.findLspShipment(lsp, lspShipmentId); assert shipment != null; firstElement diff --git a/src/main/java/org/matsim/freight/logistics/HasLspShipmentId.java b/src/main/java/org/matsim/freight/logistics/HasLspShipmentId.java index 7fe90472..e3ddd1fc 100644 --- a/src/main/java/org/matsim/freight/logistics/HasLspShipmentId.java +++ b/src/main/java/org/matsim/freight/logistics/HasLspShipmentId.java @@ -19,7 +19,7 @@ package org.matsim.freight.logistics; import org.matsim.api.core.v01.Id; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * @author Kai Martins-Turner (kturner) @@ -28,5 +28,5 @@ public interface HasLspShipmentId { String ATTRIBUTE_LSP_SHIPMENT_ID = "lspShipmentId"; - Id getLspShipmentId(); + Id getLspShipmentId(); } diff --git a/src/main/java/org/matsim/freight/logistics/InitialShipmentAssigner.java b/src/main/java/org/matsim/freight/logistics/InitialShipmentAssigner.java index 84592875..eb6ff628 100644 --- a/src/main/java/org/matsim/freight/logistics/InitialShipmentAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/InitialShipmentAssigner.java @@ -20,24 +20,24 @@ package org.matsim.freight.logistics; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** - * Takes an {@link LSPShipment} and normally assigns it to something that belongs to an {@link LSP}. + * Takes an {@link LspShipment} and normally assigns it to something that belongs to an {@link LSP}. *
* After changes in fall 2023 (see master thesis of nrichter), the assingment is * there to be done one time initially. *
* If there are several {@link LogisticChain}s in a {@link LSPPlan}, the {@link LSP} has to assign each {@link - * LSPShipment} to the suitable {@link LogisticChain}. For this purpose, each {@link LSPPlan} + * LspShipment} to the suitable {@link LogisticChain}. For this purpose, each {@link LSPPlan} * (or only the LSP? - kmt'jan'24), contains a pluggable strategy * that is contained in classes implementing the interface {@link InitialShipmentAssigner}.
*
- * During iterations, it can happen that the {@link LSPShipment} should be moved to another + * During iterations, it can happen that the {@link LspShipment} should be moved to another * {@link LogisticChain} of the same {@link LSPPlan}. This is now (since fall 2023; see master * thesis of nrichter) part of the (innovative) **Replanning** strategies. */ public interface InitialShipmentAssigner { - void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment); + void assignToPlan(LSPPlan lspPlan, LspShipment lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/LSP.java b/src/main/java/org/matsim/freight/logistics/LSP.java index fd807005..0486cd0f 100644 --- a/src/main/java/org/matsim/freight/logistics/LSP.java +++ b/src/main/java/org/matsim/freight/logistics/LSP.java @@ -22,11 +22,11 @@ import java.util.Collection; import org.matsim.api.core.v01.population.HasPlansAndId; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * In the class library, the interface LSP has the following tasks: 1. Maintain one or several - * transport chains through which {@link LSPShipment}s are routed. 2. Assign {@link LSPShipment}s to + * transport chains through which {@link LspShipment}s are routed. 2. Assign {@link LspShipment}s to * the suitable transport chain. --> {@link InitialShipmentAssigner}. 3. Interact with the agents that * embody the demand side of the freight transport market, if they are specified in the setting. 4. * Coordinate carriers that are in charge of the physical transport. @@ -34,7 +34,7 @@ public interface LSP extends HasPlansAndId, HasSimulationTrackers { /** yyyy does this have to be exposed? */ - Collection getLspShipments(); + Collection getLspShipments(); /** ok (behavioral method) */ void scheduleLogisticChains(); @@ -48,6 +48,6 @@ public interface LSP extends HasPlansAndId, HasSimulationTrackers< /** * @param lspShipment ok (LSP needs to be told that it is responsible for lspShipment) */ - void assignShipmentToLSP(LSPShipment lspShipment); + void assignShipmentToLSP(LspShipment lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/LSPControlerListener.java b/src/main/java/org/matsim/freight/logistics/LSPControlerListener.java index 4ec6b0c7..e3c864be 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPControlerListener.java +++ b/src/main/java/org/matsim/freight/logistics/LSPControlerListener.java @@ -43,7 +43,7 @@ import org.matsim.freight.carriers.CarriersUtils; import org.matsim.freight.carriers.controler.CarrierAgentTracker; import org.matsim.freight.logistics.io.LSPPlanXmlWriter; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; class LSPControlerListener implements StartupListener, @@ -134,7 +134,7 @@ public void notifyBeforeMobsim(BeforeMobsimEvent event) { } // simulation trackers of shipments: - for (LSPShipment lspShipment : lsp.getLspShipments()) { + for (LspShipment lspShipment : lsp.getLspShipments()) { registerSimulationTrackers(lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/LSPImpl.java b/src/main/java/org/matsim/freight/logistics/LSPImpl.java index a8824e66..54840359 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPImpl.java +++ b/src/main/java/org/matsim/freight/logistics/LSPImpl.java @@ -25,12 +25,12 @@ import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /* package-private */ class LSPImpl extends LSPDataObject implements LSP { private static final Logger log = LogManager.getLogger(LSPImpl.class); - private final Collection lspShipments; + private final Collection lspShipments; private final ArrayList lspPlans; private final LogisticChainScheduler logisticChainScheduler; private final Collection resources; @@ -147,7 +147,7 @@ public void scoreSelectedPlan() { } @Override - public void assignShipmentToLSP(LSPShipment lspShipment) { + public void assignShipmentToLSP(LspShipment lspShipment) { // shipment.setLspId(this.getId()); // und rückweg dann auch darüber und dann // lsp.getselectedPlan.getShipment... lspShipments.add(lspShipment); @@ -157,7 +157,7 @@ public void assignShipmentToLSP(LSPShipment lspShipment) { } @Override - public Collection getLspShipments() { + public Collection getLspShipments() { return this.lspShipments; } } diff --git a/src/main/java/org/matsim/freight/logistics/LSPPlan.java b/src/main/java/org/matsim/freight/logistics/LSPPlan.java index 3de1c801..c6c3d48d 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPPlan.java +++ b/src/main/java/org/matsim/freight/logistics/LSPPlan.java @@ -22,8 +22,8 @@ import java.util.Collection; import org.matsim.api.core.v01.population.BasicPlan; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlan; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlan; /** * This interface has the following properties: @@ -31,7 +31,7 @@ *
    *
  • As a {@link BasicPlan} it has a score, so it can be used for evolutionary learning. kai, * may'22 - *
  • An {@link LSPShipment} is added via lspPlan#getAssigner().assignToSolution(shipment). The + *
  • An {@link LspShipment} is added via lspPlan#getAssigner().assignToSolution(shipment). The * {@link InitialShipmentAssigner} assigns it deterministically to a {@link LogisticChain}. *
*/ @@ -49,9 +49,9 @@ public interface LSPPlan extends BasicPlan, KnowsLSP { LSPPlan setInitialShipmentAssigner(InitialShipmentAssigner assigner); - Collection getShipmentPlans(); + Collection getShipmentPlans(); - LSPPlan addShipmentPlan(ShipmentPlan shipmentPlan); + LSPPlan addShipmentPlan(LspShipmentPlan lspShipmentPlan); String getType(); diff --git a/src/main/java/org/matsim/freight/logistics/LSPPlanImpl.java b/src/main/java/org/matsim/freight/logistics/LSPPlanImpl.java index e211bf8a..a1bfe4e2 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPPlanImpl.java +++ b/src/main/java/org/matsim/freight/logistics/LSPPlanImpl.java @@ -22,12 +22,12 @@ import java.util.ArrayList; import java.util.Collection; -import org.matsim.freight.logistics.shipment.ShipmentPlan; +import org.matsim.freight.logistics.shipment.LspShipmentPlan; public class LSPPlanImpl implements LSPPlan { private final Collection logisticChains; - private final Collection shipmentPlans; + private final Collection lspShipmentPlans; private LSP lsp; private Double score = null; private InitialShipmentAssigner assigner; @@ -35,7 +35,7 @@ public class LSPPlanImpl implements LSPPlan { public LSPPlanImpl() { this.logisticChains = new ArrayList<>(); - this.shipmentPlans = new ArrayList<>(); + this.lspShipmentPlans = new ArrayList<>(); } @Override @@ -62,13 +62,13 @@ public LSPPlan setInitialShipmentAssigner(InitialShipmentAssigner assigner) { } @Override - public Collection getShipmentPlans() { - return this.shipmentPlans; + public Collection getShipmentPlans() { + return this.lspShipmentPlans; } @Override - public LSPPlan addShipmentPlan(ShipmentPlan shipmentPlan) { - this.shipmentPlans.add(shipmentPlan); + public LSPPlan addShipmentPlan(LspShipmentPlan lspShipmentPlan) { + this.lspShipmentPlans.add(lspShipmentPlan); return null; } diff --git a/src/main/java/org/matsim/freight/logistics/LSPResourceScheduler.java b/src/main/java/org/matsim/freight/logistics/LSPResourceScheduler.java index 43e489e6..dbf68e4a 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPResourceScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/LSPResourceScheduler.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import java.util.Comparator; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /** * Resources are scheduled separately by calling their individual scheduling algorithm. @@ -71,9 +71,9 @@ public final void scheduleShipments(LSPPlan lspPlan, LSPResource resource, int b protected abstract void scheduleResource(); /** - * Endows the involved {@link LSPShipment}s with information that resulted from the scheduling in + * Endows the involved {@link LspShipment}s with information that resulted from the scheduling in * a narrow sense in scheduleResource(). The information can be divided into two main components. - * 1.) the schedule of the {@link LSPShipment}s is updated if necessary 2.) the information for a + * 1.) the schedule of the {@link LspShipment}s is updated if necessary 2.) the information for a * later logging of the is added. */ protected abstract void updateShipments(); @@ -89,7 +89,7 @@ private void presortIncomingShipments() { private void switchHandledShipments(int bufferTime) { for (LspShipmentWithTime lspShipmentWithTime : lspShipmentsWithTime) { var shipmentPlan = - ShipmentUtils.getOrCreateShipmentPlan(lspPlan, lspShipmentWithTime.getLspShipment().getId()); + LspShipmentUtils.getOrCreateShipmentPlan(lspPlan, lspShipmentWithTime.getLspShipment().getId()); double endOfTransportTime = shipmentPlan.getMostRecentEntry().getEndTime() + bufferTime; LspShipmentWithTime outgoingTuple = new LspShipmentWithTime(endOfTransportTime, lspShipmentWithTime.getLspShipment()); diff --git a/src/main/java/org/matsim/freight/logistics/LSPUtils.java b/src/main/java/org/matsim/freight/logistics/LSPUtils.java index 6154e6c6..2821a8a0 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPUtils.java +++ b/src/main/java/org/matsim/freight/logistics/LSPUtils.java @@ -26,8 +26,8 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.CarriersUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlan; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlan; import org.matsim.utils.objectattributes.attributable.Attributable; public final class LSPUtils { @@ -113,14 +113,14 @@ public static void setFixedCost(Attributable attributable, Double fixedCost) { } /** - * Gives back the {@link LSPShipment} object of the {@link LSP}, which matches to the shipmentId + * Gives back the {@link LspShipment} object of the {@link LSP}, which matches to the shipmentId * * @param lsp In this LSP this method tries to find the shipment. * @param shipmentId Id of the shipment that should be found. * @return the lspShipment object or null, if it is not found. */ - public static LSPShipment findLspShipment(LSP lsp, Id shipmentId) { - for (LSPShipment lspShipment : lsp.getLspShipments()) { + public static LspShipment findLspShipment(LSP lsp, Id shipmentId) { + for (LspShipment lspShipment : lsp.getLspShipments()) { if (lspShipment.getId().equals(shipmentId)) { return lspShipment; } @@ -129,16 +129,16 @@ public static LSPShipment findLspShipment(LSP lsp, Id shipmentId) { } /** - * Returns the {@link ShipmentPlan} of an {@link LSPShipment}. + * Returns the {@link LspShipmentPlan} of an {@link LspShipment}. * * @param lspPlan the lspPlan: It contains the information of its shipmentPlans * @param shipmentId Id of the shipment that should be found. * @return the shipmentPlan object or null, if it is not found. */ - public static ShipmentPlan findLspShipmentPlan(LSPPlan lspPlan, Id shipmentId) { - for (ShipmentPlan shipmentPlan : lspPlan.getShipmentPlans()) { - if (shipmentPlan.getLspShipmentId().equals(shipmentId)) { - return shipmentPlan; + public static LspShipmentPlan findLspShipmentPlan(LSPPlan lspPlan, Id shipmentId) { + for (LspShipmentPlan lspShipmentPlan : lspPlan.getShipmentPlans()) { + if (lspShipmentPlan.getLspShipmentId().equals(shipmentId)) { + return lspShipmentPlan; } } return null; diff --git a/src/main/java/org/matsim/freight/logistics/LogisticChain.java b/src/main/java/org/matsim/freight/logistics/LogisticChain.java index a1c24f18..f1b19be6 100644 --- a/src/main/java/org/matsim/freight/logistics/LogisticChain.java +++ b/src/main/java/org/matsim/freight/logistics/LogisticChain.java @@ -23,7 +23,7 @@ import java.util.Collection; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Identifiable; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; import org.matsim.utils.objectattributes.attributable.Attributable; /** @@ -42,7 +42,7 @@ public interface LogisticChain Collection getLogisticChainElements(); - Collection> getLspShipmentIds(); + Collection> getLspShipmentIds(); - void addShipmentToChain(LSPShipment lspShipment); + void addShipmentToChain(LspShipment lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/LogisticChainImpl.java b/src/main/java/org/matsim/freight/logistics/LogisticChainImpl.java index 6e54b99a..a8d50917 100644 --- a/src/main/java/org/matsim/freight/logistics/LogisticChainImpl.java +++ b/src/main/java/org/matsim/freight/logistics/LogisticChainImpl.java @@ -25,14 +25,14 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /* package-private */ class LogisticChainImpl extends LSPDataObject implements LogisticChain { private static final Logger log = LogManager.getLogger(LogisticChainImpl.class); private final Collection logisticChainElements; - private final Collection> lspShipmentIds; + private final Collection> lspShipmentIds; private LSP lsp; LogisticChainImpl(LSPUtils.LogisticChainBuilder builder) { @@ -60,12 +60,12 @@ public Collection getLogisticChainElements() { } @Override - public Collection> getLspShipmentIds() { + public Collection> getLspShipmentIds() { return lspShipmentIds; } @Override - public void addShipmentToChain(LSPShipment lspShipment) { + public void addShipmentToChain(LspShipment lspShipment) { lspShipmentIds.add(lspShipment.getId()); } @@ -86,7 +86,7 @@ public String toString() { strb.append("[No of Shipments=").append(lspShipmentIds.size()).append("] \n"); if (!lspShipmentIds.isEmpty()) { strb.append("{ShipmentIds="); - for (Id lspShipmentId : lspShipmentIds) { + for (Id lspShipmentId : lspShipmentIds) { strb.append("[").append(lspShipmentId.toString()).append("]"); } strb.append("}"); diff --git a/src/main/java/org/matsim/freight/logistics/LogisticChainScheduler.java b/src/main/java/org/matsim/freight/logistics/LogisticChainScheduler.java index ab407a39..e950405e 100644 --- a/src/main/java/org/matsim/freight/logistics/LogisticChainScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/LogisticChainScheduler.java @@ -20,8 +20,10 @@ package org.matsim.freight.logistics; +import org.matsim.freight.logistics.shipment.LspShipment; + /** - * Serve the purpose of routing a set of {@link org.matsim.freight.logistics.shipment.LSPShipment}s + * Serve the purpose of routing a set of {@link LspShipment}s * through a set of {@link LogisticChain}s, which, in turn, consist of several {@link * LogisticChainElement}s and the corresponding {@link LSPResource}s. */ diff --git a/src/main/java/org/matsim/freight/logistics/LspShipmentWithTime.java b/src/main/java/org/matsim/freight/logistics/LspShipmentWithTime.java index 04d68979..60eacfd1 100644 --- a/src/main/java/org/matsim/freight/logistics/LspShipmentWithTime.java +++ b/src/main/java/org/matsim/freight/logistics/LspShipmentWithTime.java @@ -20,7 +20,7 @@ package org.matsim.freight.logistics; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; public class LspShipmentWithTime { // yyyyyy find better solution for this. It is not so good to define an interface, and then @@ -29,15 +29,15 @@ public class LspShipmentWithTime { // means (delivery time? current time?). kai, // jun'22 - private final LSPShipment lspShipment; + private final LspShipment lspShipment; private final double time; - public LspShipmentWithTime(double time, LSPShipment lspShipment) { + public LspShipmentWithTime(double time, LspShipment lspShipment) { this.lspShipment = lspShipment; this.time = time; } - public LSPShipment getLspShipment() { + public LspShipment getLspShipment() { return lspShipment; } diff --git a/src/main/java/org/matsim/freight/logistics/WaitingShipments.java b/src/main/java/org/matsim/freight/logistics/WaitingShipments.java index 37362cb6..e76da764 100644 --- a/src/main/java/org/matsim/freight/logistics/WaitingShipments.java +++ b/src/main/java/org/matsim/freight/logistics/WaitingShipments.java @@ -21,7 +21,7 @@ package org.matsim.freight.logistics; import java.util.Collection; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * Each LogisticsSolutionElement maintains two collections of WaitingShipments. Instances of the @@ -41,7 +41,7 @@ */ public interface WaitingShipments { - void addShipment(double time, LSPShipment lspShipment); + void addShipment(double time, LspShipment lspShipment); Collection getSortedLspShipments(); diff --git a/src/main/java/org/matsim/freight/logistics/WaitingShipmentsImpl.java b/src/main/java/org/matsim/freight/logistics/WaitingShipmentsImpl.java index 66f4eb1c..2c73f797 100644 --- a/src/main/java/org/matsim/freight/logistics/WaitingShipmentsImpl.java +++ b/src/main/java/org/matsim/freight/logistics/WaitingShipmentsImpl.java @@ -24,7 +24,7 @@ import java.util.Collection; import java.util.Comparator; import java.util.List; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /* package-private */ class WaitingShipmentsImpl implements WaitingShipments { @@ -35,7 +35,7 @@ } @Override - public void addShipment(double time, LSPShipment lspShipment) { + public void addShipment(double time, LspShipment lspShipment) { LspShipmentWithTime tuple = new LspShipmentWithTime(time, lspShipment); this.shipments.add(tuple); shipments.sort(Comparator.comparingDouble(LspShipmentWithTime::getTime)); diff --git a/src/main/java/org/matsim/freight/logistics/events/AbstractLogisticEvent.java b/src/main/java/org/matsim/freight/logistics/events/AbstractLogisticEvent.java index 9a0832e2..fd9791a6 100644 --- a/src/main/java/org/matsim/freight/logistics/events/AbstractLogisticEvent.java +++ b/src/main/java/org/matsim/freight/logistics/events/AbstractLogisticEvent.java @@ -6,11 +6,11 @@ import org.matsim.api.core.v01.events.HasLinkId; import org.matsim.api.core.v01.network.Link; import org.matsim.freight.logistics.HasLspShipmentId; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * A general logistic event contains the information (= {@link Id}) of the - the location (= {@link - * Link}) - the lspShipment (= {@link LSPShipment}) belonging to it. + * Link}) - the lspShipment (= {@link LspShipment}) belonging to it. * *

Please note, that general _freight_ events can be found in the freight contrib. * @@ -19,19 +19,19 @@ public abstract class AbstractLogisticEvent extends Event implements HasLinkId, HasLspShipmentId { private final Id linkId; - private final Id lspShipmentId; + private final Id lspShipmentId; - public AbstractLogisticEvent(double time, Id linkId, Id lspShipmentId) { + public AbstractLogisticEvent(double time, Id linkId, Id lspShipmentId) { super(time); this.linkId = linkId; this.lspShipmentId = lspShipmentId; } /** - * @return id of the {@link LSPShipment} + * @return id of the {@link LspShipment} */ @Override - public final Id getLspShipmentId() { + public final Id getLspShipmentId() { return lspShipmentId; } @@ -41,7 +41,7 @@ public final Id getLinkId() { } /** - * Adds the {@link Id} to the list of attributes. {@link Id} is handled by + * Adds the {@link Id< LspShipment >} to the list of attributes. {@link Id} is handled by * superclass {@link Event} * * @return The map of attributes diff --git a/src/main/java/org/matsim/freight/logistics/events/HandlingInHubStartsEvent.java b/src/main/java/org/matsim/freight/logistics/events/HandlingInHubStartsEvent.java index f2eae805..c7e9f4a7 100644 --- a/src/main/java/org/matsim/freight/logistics/events/HandlingInHubStartsEvent.java +++ b/src/main/java/org/matsim/freight/logistics/events/HandlingInHubStartsEvent.java @@ -29,10 +29,10 @@ import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; import org.matsim.freight.logistics.LSPResource; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** - * An event, that informs that the handling of a {@link LSPShipment} in a hub has started. + * An event, that informs that the handling of a {@link LspShipment} in a hub has started. * * @author Kai Martins-Turner (kturner) */ @@ -45,7 +45,7 @@ public final class HandlingInHubStartsEvent extends AbstractLogisticEvent { public HandlingInHubStartsEvent( double time, Id linkId, - Id lspShipmentId, + Id lspShipmentId, Id hubId, double expHandlingDuration) { super(time, linkId, lspShipmentId); @@ -57,8 +57,8 @@ public static HandlingInHubStartsEvent convert(GenericEvent event) { Map attributes = event.getAttributes(); double time = Double.parseDouble(attributes.get(ATTRIBUTE_TIME)); Id linkId = Id.createLinkId(attributes.get(ATTRIBUTE_LINK)); - Id lspSipmentId = - Id.create(attributes.get(ATTRIBUTE_LSP_SHIPMENT_ID), LSPShipment.class); + Id lspSipmentId = + Id.create(attributes.get(ATTRIBUTE_LSP_SHIPMENT_ID), LspShipment.class); var hubId = Id.create(attributes.get(ATTRIBUTE_HUB_ID), LSPResource.class); double expHandlingDuration = Double.parseDouble(attributes.get(ATTRIBUTE_EXP_HANDLING_DURATION)); diff --git a/src/main/java/org/matsim/freight/logistics/events/LspEventCreator.java b/src/main/java/org/matsim/freight/logistics/events/LspEventCreator.java index 034592ca..b5a0933f 100644 --- a/src/main/java/org/matsim/freight/logistics/events/LspEventCreator.java +++ b/src/main/java/org/matsim/freight/logistics/events/LspEventCreator.java @@ -24,7 +24,7 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * @author Kai Martins-Turner (kturner) @@ -32,5 +32,5 @@ public interface LspEventCreator { // I am unsure, if I need the activity or not. kmt 'dec22 - Event createEvent(Event event, Id lspShipmentId, Activity activity); + Event createEvent(Event event, Id lspShipmentId, Activity activity); } diff --git a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfInitialPlan.java b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfInitialPlan.java index 05f6ffcd..0aaa8b0f 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfInitialPlan.java +++ b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfInitialPlan.java @@ -36,9 +36,9 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -116,14 +116,14 @@ private static LSP createInitialLSP(Scenario scenario) { .build(); } - private static Collection createInitialLSPShipments(Network network) { - ArrayList shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + ArrayList shipmentList = new ArrayList<>(); ArrayList linkList = new ArrayList<>(network.getLinks().values()); // Create five LSPShipments that are located in the left half of the network. for (int i = 1; i < 6; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -163,10 +163,10 @@ public static void main(String[] args) { // Create LSP and lspShipments LSP lsp = createInitialLSP(scenario); - Collection lspShipments = createInitialLSPShipments(network); + Collection lspShipments = createInitialLSPShipments(network); // assign the lspShipments to the LSP - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } @@ -174,20 +174,20 @@ public static void main(String[] args) { lsp.scheduleLogisticChains(); // print the schedules for the assigned LSPShipments - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { System.out.println("Shipment: " + lspShipment.getId()); - ArrayList scheduleElements = + ArrayList scheduleElements = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) + LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(lspShipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); - for (ShipmentPlanElement element : - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) + for (LspShipmentPlanElement element : + LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()) { System.out.println( diff --git a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChain.java b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChain.java index 139ed25e..533b3d38 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChain.java +++ b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChain.java @@ -38,9 +38,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.DistributionCarrierResourceBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -284,13 +284,13 @@ private static LSP createInitialLSP(Scenario scenario) { return completeLSPBuilder.build(); } - private static Collection createInitialLSPShipments(Network network) { - ArrayList shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + ArrayList shipmentList = new ArrayList<>(); ArrayList linkList = new ArrayList<>(network.getLinks().values()); Random rand = new Random(1); for (int i = 1; i < 6; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand.nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -341,10 +341,10 @@ public static void main(String[] args) { // Create LSP and shipments LSP lsp = createInitialLSP(scenario); - Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); + Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); // assign the shipments to the LSP - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } @@ -352,15 +352,15 @@ public static void main(String[] args) { lsp.scheduleLogisticChains(); // print the schedules for the assigned LSPShipments - for (LSPShipment lspShipment : lsp.getLspShipments()) { - ArrayList elementList = + for (LspShipment lspShipment : lsp.getLspShipments()) { + ArrayList elementList = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) + LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()); - elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); + elementList.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println("Shipment: " + lspShipment.getId()); - for (ShipmentPlanElement element : elementList) { + for (LspShipmentPlanElement element : elementList) { System.out.println( element.getLogisticChainElement().getId() + "\t\t" diff --git a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirect.java b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirect.java index 74cf3cc4..6c359b32 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirect.java +++ b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirect.java @@ -49,8 +49,8 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.examples.lspReplanning.AssignmentStrategyFactory; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; /** @@ -121,7 +121,7 @@ public static void main(String[] args) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : createInitialLSPShipments(scenario.getNetwork())) { + for (LspShipment lspShipment : createInitialLSPShipments(scenario.getNetwork())) { lsp.assignShipmentToLSP(lspShipment); } @@ -542,13 +542,13 @@ private static VehicleType createCarrierVehicleType(String vehicleTypeId) { .build(); } - private static Collection createInitialLSPShipments(Network network) { - ArrayList shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + ArrayList shipmentList = new ArrayList<>(); ArrayList linkList = new ArrayList<>(network.getLinks().values()); Random rand = new Random(1); for (int i = 1; i < 6; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand.nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -575,7 +575,7 @@ private static Collection createInitialLSPShipments(Network network TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment lspShipment = builder.build(); + LspShipment lspShipment = builder.build(); shipmentList.add(lspShipment); } return shipmentList; diff --git a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleTwoEchelonGrid.java b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleTwoEchelonGrid.java index de65bf2c..37714938 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleTwoEchelonGrid.java +++ b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleTwoEchelonGrid.java @@ -47,8 +47,8 @@ import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; /** @@ -391,7 +391,7 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : createInitialLSPShipments(network)) { + for (LspShipment lspShipment : createInitialLSPShipments(network)) { lsp.assignShipmentToLSP(lspShipment); } @@ -401,15 +401,15 @@ private static LSP createLSP(Scenario scenario) { return lsp; } - private static Collection createInitialLSPShipments(Network network) { - List shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + List shipmentList = new ArrayList<>(); switch (demandSetting) { case oneCustomer -> { - Id id = Id.create("Shipment_" + 1, LSPShipment.class); + Id id = Id.create("Shipment_" + 1, LspShipment.class); int capacityDemand = 1; - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); @@ -439,9 +439,9 @@ private static Collection createInitialLSPShipments(Network network } for (int i = 1; i <= 10; i++) { - Id id = Id.create("Shipment_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = - ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("Shipment_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = + LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand1.nextInt(5) + 1; // Random is drawn from 0 (incl) to bound (excl) -> adding 1. diff --git a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleTwoEchelonGrid_NR.java b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleTwoEchelonGrid_NR.java index 1f4f3261..695e7fe3 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleTwoEchelonGrid_NR.java +++ b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleTwoEchelonGrid_NR.java @@ -49,8 +49,8 @@ import org.matsim.freight.logistics.io.LSPPlanXmlReader; import org.matsim.freight.logistics.io.LSPPlanXmlWriter; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; /** @@ -401,7 +401,7 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : createInitialLSPShipments(network)) { + for (LspShipment lspShipment : createInitialLSPShipments(network)) { lsp.assignShipmentToLSP(lspShipment); } @@ -411,15 +411,15 @@ private static LSP createLSP(Scenario scenario) { return lsp; } - private static Collection createInitialLSPShipments(Network network) { - List shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + List shipmentList = new ArrayList<>(); switch (demandSetting) { case oneCustomer -> { - Id id = Id.create("Shipment_" + 1, LSPShipment.class); + Id id = Id.create("Shipment_" + 1, LspShipment.class); int capacityDemand = 1; - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); @@ -449,9 +449,9 @@ private static Collection createInitialLSPShipments(Network network } for (int i = 1; i <= 10; i++) { - Id id = Id.create("Shipment_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = - ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("Shipment_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = + LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand1.nextInt(5) + 1; // Random is drawn from 0 (incl) to bound (excl) -> adding 1. diff --git a/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/AssignmentStrategyFactory.java b/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/AssignmentStrategyFactory.java index 038a0491..cf2056d9 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/AssignmentStrategyFactory.java +++ b/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/AssignmentStrategyFactory.java @@ -30,8 +30,8 @@ import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; import org.matsim.freight.logistics.LogisticChainElement; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /** * @deprecated This class is a work-around. Please do not use this method for any new runs! @@ -71,8 +71,8 @@ public void handlePlan(LSPPlan lspPlan) { } } - for (LSPShipment lspShipment : lspPlan.getLSP().getLspShipments()) { - ShipmentUtils.getOrCreateShipmentPlan(lspPlan, lspShipment.getId()).clear(); + for (LspShipment lspShipment : lspPlan.getLSP().getLspShipments()) { + LspShipmentUtils.getOrCreateShipmentPlan(lspPlan, lspShipment.getId()).clear(); lspShipment.getShipmentLog().clear(); lspPlan.getInitialShipmentAssigner().assignToPlan(lspPlan, lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/MaybeTodayAssigner.java b/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/MaybeTodayAssigner.java index e27d0496..15850ba2 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/MaybeTodayAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/MaybeTodayAssigner.java @@ -25,7 +25,7 @@ import org.matsim.core.gbl.Gbl; import org.matsim.freight.logistics.InitialShipmentAssigner; import org.matsim.freight.logistics.LSPPlan; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * This class is deprecated and will be removed in the future. @@ -45,7 +45,7 @@ public MaybeTodayAssigner() { } @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { + public void assignToPlan(LSPPlan lspPlan, LspShipment lspShipment) { boolean assignToday = random.nextBoolean(); if (assignToday) { Gbl.assertIf(lspPlan.getLogisticChains().size() == 1); diff --git a/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/TomorrowShipmentAssignerStrategyFactory.java b/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/TomorrowShipmentAssignerStrategyFactory.java index fd1b45c9..2c96a791 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/TomorrowShipmentAssignerStrategyFactory.java +++ b/src/main/java/org/matsim/freight/logistics/examples/lspReplanning/TomorrowShipmentAssignerStrategyFactory.java @@ -28,8 +28,8 @@ import org.matsim.core.replanning.modules.GenericPlanStrategyModule; import org.matsim.core.replanning.selectors.BestPlanSelector; import org.matsim.freight.logistics.*; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; @Deprecated /*package-private*/ class TomorrowShipmentAssignerStrategyFactory { @@ -59,8 +59,8 @@ public void handlePlan(LSPPlan plan) { plan.setInitialShipmentAssigner(assigner); // LSP lsp = assigner.getLSP(); LSP lsp = plan.getLSP(); - Collection lspShipments = lsp.getLspShipments(); - for (LSPShipment lspShipment : lspShipments) { + Collection lspShipments = lsp.getLspShipments(); + for (LspShipment lspShipment : lspShipments) { assigner.assignToPlan(plan, lspShipment); } @@ -72,8 +72,8 @@ public void handlePlan(LSPPlan plan) { } } - for (LSPShipment lspShipment : plan.getLSP().getLspShipments()) { - ShipmentUtils.getOrCreateShipmentPlan(plan, lspShipment.getId()).clear(); + for (LspShipment lspShipment : plan.getLSP().getLspShipments()) { + LspShipmentUtils.getOrCreateShipmentPlan(plan, lspShipment.getId()).clear(); lspShipment.getShipmentLog().clear(); plan.getInitialShipmentAssigner().assignToPlan(plan, lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/examples/lspScoring/ExampleLSPScoring.java b/src/main/java/org/matsim/freight/logistics/examples/lspScoring/ExampleLSPScoring.java index 2fc800ce..769902b8 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/lspScoring/ExampleLSPScoring.java +++ b/src/main/java/org/matsim/freight/logistics/examples/lspScoring/ExampleLSPScoring.java @@ -41,8 +41,8 @@ import org.matsim.freight.carriers.events.eventhandler.CarrierServiceEndEventHandler; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; /* Example for customized scoring. Each customer that is visited will give a random tip between zero and five @@ -125,14 +125,14 @@ private static LSP createLSPWithScorer(Scenario scenario) { .build(); } - private static Collection createInitialLSPShipments(Network network) { - List shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + List shipmentList = new ArrayList<>(); ArrayList linkList = new ArrayList<>(network.getLinks().values()); // Create five LSPShipments that are located in the left half of the network. for (int i = 1; i < 6; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -200,10 +200,10 @@ static Scenario prepareScenario(Config config) { // Create LSP and lspShipments LSP lsp = createLSPWithScorer(scenario); - Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); + Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); // assign the lspShipments to the LSP - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/examples/mobsimExamples/ExampleMobsimOfSimpleLSP.java b/src/main/java/org/matsim/freight/logistics/examples/mobsimExamples/ExampleMobsimOfSimpleLSP.java index 2de2f74a..06daf2db 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/mobsimExamples/ExampleMobsimOfSimpleLSP.java +++ b/src/main/java/org/matsim/freight/logistics/examples/mobsimExamples/ExampleMobsimOfSimpleLSP.java @@ -41,9 +41,9 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -68,10 +68,10 @@ public static void main(String[] args) { // Create LSP and lspShipments LSP lsp = createInitialLSP(scenario); - Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); + Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); // assign the lspShipments to the LSP - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } @@ -104,21 +104,21 @@ public void install() { .setVspDefaultsCheckingLevel(VspExperimentalConfigGroup.VspDefaultsCheckingLevel.warn); controler.run(); - for (LSPShipment lspShipment : lsp.getLspShipments()) { + for (LspShipment lspShipment : lsp.getLspShipments()) { System.out.println("LspShipment: " + lspShipment.getId()); - ArrayList scheduleElements = + ArrayList scheduleElements = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) + LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(lspShipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); for (int i = 0; i - < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) + < LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .size(); i++) { @@ -225,14 +225,14 @@ private static LSP createInitialLSP(Scenario scenario) { return collectionLSPBuilder.build(); } - private static Collection createInitialLSPShipments(Network network) { - ArrayList shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + ArrayList shipmentList = new ArrayList<>(); ArrayList linkList = new ArrayList<>(network.getLinks().values()); // Create five LSPShipments that are located in the left half of the network. for (int i = 1; i < 6; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(4); builder.setCapacityDemand(capacityDemand); diff --git a/src/main/java/org/matsim/freight/logistics/examples/mobsimExamples/ExampleMobsimOfTransportChain.java b/src/main/java/org/matsim/freight/logistics/examples/mobsimExamples/ExampleMobsimOfTransportChain.java index b703c176..0e2fc449 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/mobsimExamples/ExampleMobsimOfTransportChain.java +++ b/src/main/java/org/matsim/freight/logistics/examples/mobsimExamples/ExampleMobsimOfTransportChain.java @@ -42,9 +42,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -280,13 +280,13 @@ private static LSP createInitialLSP(Scenario scenario) { return completeLSPBuilder.build(); } - private static Collection createInitialLSPShipments(Network network) { - ArrayList shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + ArrayList shipmentList = new ArrayList<>(); ArrayList linkList = new ArrayList<>(network.getLinks().values()); Random rand = new Random(1); for (int i = 1; i < 6; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand.nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -336,10 +336,10 @@ public static void main(String[] args) { // Create LSP and lspShipments LSP lsp = createInitialLSP(scenario); - Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); + Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); // assign the lspShipments to the LSP - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } @@ -374,21 +374,21 @@ public void install() { .setVspDefaultsCheckingLevel(VspExperimentalConfigGroup.VspDefaultsCheckingLevel.warn); controler.run(); - for (LSPShipment lspShipment : lsp.getLspShipments()) { + for (LspShipment lspShipment : lsp.getLspShipments()) { System.out.println("Shipment: " + lspShipment.getId()); - ArrayList scheduleElements = + ArrayList scheduleElements = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) + LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(lspShipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); for (int i = 0; i - < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) + < LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .size(); i++) { diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleGroceryDeliveryMultipleChains.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleGroceryDeliveryMultipleChains.java index 1d42b458..8cbe09e1 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleGroceryDeliveryMultipleChains.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleGroceryDeliveryMultipleChains.java @@ -50,7 +50,7 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.examples.ExampleConstants; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; import org.matsim.vehicles.VehicleType; final class ExampleGroceryDeliveryMultipleChains { @@ -320,7 +320,7 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : createLSPShipmentsFromCarrierShipments(carrier)) { + for (LspShipment lspShipment : createLSPShipmentsFromCarrierShipments(carrier)) { lsp.assignShipmentToLSP(lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleMixedEchelonChains.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleMixedEchelonChains.java index 0e18dbcd..8cc0cc30 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleMixedEchelonChains.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleMixedEchelonChains.java @@ -47,8 +47,8 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.examples.ExampleConstants; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; final class ExampleMultipleMixedEchelonChains { @@ -405,7 +405,7 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : createInitialLSPShipments(network)) { + for (LspShipment lspShipment : createInitialLSPShipments(network)) { lsp.assignShipmentToLSP(lspShipment); } @@ -415,8 +415,8 @@ private static LSP createLSP(Scenario scenario) { return lsp; } - private static Collection createInitialLSPShipments(Network network) { - List shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + List shipmentList = new ArrayList<>(); Random rand = MatsimRandom.getLocalInstance(); @@ -435,8 +435,8 @@ private static Collection createInitialLSPShipments(Network network for (int i = 1; i <= 10; i++) { if (i % 2 != 0) { - Id id = Id.create("ShipmentInside_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentInside_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); @@ -450,8 +450,8 @@ private static Collection createInitialLSPShipments(Network network shipmentList.add(builder.build()); } else { - Id id = Id.create("ShipmentOutside_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentOutside_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleOneEchelonChains.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleOneEchelonChains.java index a6cd35a8..4f095552 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleOneEchelonChains.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleOneEchelonChains.java @@ -48,8 +48,8 @@ import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; final class ExampleMultipleOneEchelonChains { @@ -305,7 +305,7 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : createInitialLSPShipments()) { + for (LspShipment lspShipment : createInitialLSPShipments()) { lsp.assignShipmentToLSP(lspShipment); } @@ -315,8 +315,8 @@ private static LSP createLSP(Scenario scenario) { return lsp; } - private static Collection createInitialLSPShipments() { - List lspShipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments() { + List lspShipmentList = new ArrayList<>(); int capacityDemand; switch (demandSetting) { @@ -327,8 +327,8 @@ private static Collection createInitialLSPShipments() { for (int i = 1; i <= 10; i++) { if (i % 2 != 0) { - Id id = Id.create("ShipmentLeft_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentLeft_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); @@ -341,8 +341,8 @@ private static Collection createInitialLSPShipments() { lspShipmentList.add(builder.build()); } else { - Id id = Id.create("ShipmentRight_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentRight_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleOneEchelonChainsReplanning.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleOneEchelonChainsReplanning.java index b1a1c5c7..c3056d98 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleOneEchelonChainsReplanning.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleOneEchelonChainsReplanning.java @@ -51,8 +51,8 @@ import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; final class ExampleMultipleOneEchelonChainsReplanning { @@ -329,7 +329,7 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : createInitialLSPShipments()) { + for (LspShipment lspShipment : createInitialLSPShipments()) { lsp.assignShipmentToLSP(lspShipment); } @@ -339,14 +339,14 @@ private static LSP createLSP(Scenario scenario) { return lsp; } - private static Collection createInitialLSPShipments() { - List shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments() { + List shipmentList = new ArrayList<>(); int capacityDemand = 1; for (int i = 1; i <= 10; i++) { if (i % 2 != 0) { - Id id = Id.create("ShipmentLeft_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentLeft_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); @@ -359,8 +359,8 @@ private static Collection createInitialLSPShipments() { shipmentList.add(builder.build()); } else { - Id id = Id.create("ShipmentRight_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentRight_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleTwoEchelonChainsReplanning.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleTwoEchelonChainsReplanning.java index adeca358..7b0521f1 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleTwoEchelonChainsReplanning.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleMultipleTwoEchelonChainsReplanning.java @@ -51,8 +51,8 @@ import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; final class ExampleMultipleTwoEchelonChainsReplanning { @@ -369,7 +369,7 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : createInitialLSPShipments()) { + for (LspShipment lspShipment : createInitialLSPShipments()) { lsp.assignShipmentToLSP(lspShipment); } @@ -379,14 +379,14 @@ private static LSP createLSP(Scenario scenario) { return lsp; } - private static Collection createInitialLSPShipments() { - List shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments() { + List shipmentList = new ArrayList<>(); int capacityDemand = 1; for (int i = 1; i <= 10; i++) { if (i % 2 != 0) { - Id id = Id.create("ShipmentLeft_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentLeft_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); @@ -399,8 +399,8 @@ private static Collection createInitialLSPShipments() { shipmentList.add(builder.build()); } else { - Id id = Id.create("ShipmentRight_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentRight_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChains.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChains.java index 03f5a53f..0895684c 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChains.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChains.java @@ -68,7 +68,7 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.examples.ExampleConstants; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; import org.matsim.vehicles.VehicleType; @@ -226,7 +226,7 @@ private static Config prepareConfig(String[] args) { * @param vehicleTypesDirect vehicle types for the direct run (direct chain) * @return the LSP */ - private static LSP createLspWithTwoChains(Scenario scenario, String lspName, Collection lspShipments, Id depotLinkId, Id hubLinkId, CarrierVehicleTypes vehicleTypesMainRun, CarrierVehicleTypes vehicleTypesDistributionRun, CarrierVehicleTypes vehicleTypesDirect) { + private static LSP createLspWithTwoChains(Scenario scenario, String lspName, Collection lspShipments, Id depotLinkId, Id hubLinkId, CarrierVehicleTypes vehicleTypesMainRun, CarrierVehicleTypes vehicleTypesDistributionRun, CarrierVehicleTypes vehicleTypesDirect) { log.info("create LSP"); //Chains LogisticChain directChain = createDirectChain(scenario, lspName, depotLinkId, vehicleTypesDirect); @@ -248,7 +248,7 @@ private static LSP createLspWithTwoChains(Scenario scenario, String lspName, Col .build(); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } @@ -369,7 +369,7 @@ private static LogisticChain createTwoEchelonChain(Scenario scenario, String lsp * @param vehicleTypesDirect vehicle types for the direct run (direct chain) * @return the LSP */ - private static LSP createLspWithDirectChain(Scenario scenario, String lspName, Collection lspShipments, Id depotLinkId, CarrierVehicleTypes vehicleTypesDirect) { + private static LSP createLspWithDirectChain(Scenario scenario, String lspName, Collection lspShipments, Id depotLinkId, CarrierVehicleTypes vehicleTypesDirect) { log.info("create LSP"); LSPPlan lspPlan = LSPUtils.createLSPPlan() @@ -385,7 +385,7 @@ private static LSP createLspWithDirectChain(Scenario scenario, String lspName, C .build(); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java index 88a1717e..7b1c9c1e 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java @@ -49,7 +49,7 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.examples.ExampleConstants; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -252,7 +252,7 @@ private static Config prepareConfig(String[] args) { * @param vehicleTypesDirect vehicle types for the direct run (direct chain) * @return the LSP */ - private static LSP createLspWithTwoChains(Scenario scenario, String lspName, Collection lspShipments, Id depotLinkId, Id hubLinkId, CarrierVehicleTypes vehicleTypesMainRun, CarrierVehicleTypes vehicleTypesDistributionRun, CarrierVehicleTypes vehicleTypesDirect) { + private static LSP createLspWithTwoChains(Scenario scenario, String lspName, Collection lspShipments, Id depotLinkId, Id hubLinkId, CarrierVehicleTypes vehicleTypesMainRun, CarrierVehicleTypes vehicleTypesDistributionRun, CarrierVehicleTypes vehicleTypesDirect) { log.info("create LSP"); //Chains LogisticChain directChain = createDirectChain(scenario, lspName, depotLinkId, vehicleTypesDirect); @@ -274,7 +274,7 @@ private static LSP createLspWithTwoChains(Scenario scenario, String lspName, Col .build(); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } @@ -395,7 +395,7 @@ private static LogisticChain createTwoEchelonChain(Scenario scenario, String lsp * @param vehicleTypesDirect vehicle types for the direct run (direct chain) * @return the LSP */ - private static LSP createLspWithDirectChain(Scenario scenario, String lspName, Collection lspShipments, Id depotLinkId, CarrierVehicleTypes vehicleTypesDirect) { + private static LSP createLspWithDirectChain(Scenario scenario, String lspName, Collection lspShipments, Id depotLinkId, CarrierVehicleTypes vehicleTypesDirect) { log.info("create LSP"); LSPPlan lspPlan = LSPUtils.createLSPPlan() @@ -411,7 +411,7 @@ private static LSP createLspWithDirectChain(Scenario scenario, String lspName, C .build(); log.info("assign the shipments to the LSP"); - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/MultipleChainsUtils.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/MultipleChainsUtils.java index cdc6ec64..30517805 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/MultipleChainsUtils.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/MultipleChainsUtils.java @@ -31,8 +31,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.freight.carriers.Carrier; import org.matsim.freight.carriers.CarrierShipment; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; class MultipleChainsUtils { private MultipleChainsUtils() {} @@ -50,15 +50,15 @@ public static PrimaryLogisticChainShipmentAssigner createPrimaryLogisticChainShi return new PrimaryLogisticChainShipmentAssigner(); } - public static Collection createLSPShipmentsFromCarrierShipments(Carrier carrier) { - List shipmentList = new ArrayList<>(); + public static Collection createLSPShipmentsFromCarrierShipments(Carrier carrier) { + List shipmentList = new ArrayList<>(); List carrierShipments = carrier.getShipments().values().stream().toList(); for (CarrierShipment shipment : carrierShipments) { - ShipmentUtils.LSPShipmentBuilder builder = - ShipmentUtils.LSPShipmentBuilder.newInstance( - Id.create(shipment.getId().toString(), LSPShipment.class)); + LspShipmentUtils.LspShipmentBuilder builder = + LspShipmentUtils.LspShipmentBuilder.newInstance( + Id.create(shipment.getId().toString(), LspShipment.class)); builder.setCapacityDemand(shipment.getSize()); builder.setFromLinkId(shipment.getFrom()); builder.setToLinkId(shipment.getTo()); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/PrimaryLogisticChainShipmentAssigner.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/PrimaryLogisticChainShipmentAssigner.java index 11ab298a..62365040 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/PrimaryLogisticChainShipmentAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/PrimaryLogisticChainShipmentAssigner.java @@ -25,10 +25,10 @@ import org.matsim.freight.logistics.InitialShipmentAssigner; import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** - * The {@link LSPShipment} is assigned to the first {@link LogisticChain}. In case of one chain the + * The {@link LspShipment} is assigned to the first {@link LogisticChain}. In case of one chain the * shipment is assigned to that chain. If there are more chains, the shipment is assigned to the * first of all chains. Requirements: There must be at least one logisticChain in the plan */ @@ -38,7 +38,7 @@ class PrimaryLogisticChainShipmentAssigner implements InitialShipmentAssigner { public PrimaryLogisticChainShipmentAssigner() {} @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { + public void assignToPlan(LSPPlan lspPlan, LspShipment lspShipment) { Gbl.assertIf(!lspPlan.getLogisticChains().isEmpty()); LogisticChain firstLogisticChain = lspPlan.getLogisticChains().iterator().next(); firstLogisticChain.addShipmentToChain(lspShipment); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ProximityStrategyFactory.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ProximityStrategyFactory.java index 1a1b7b1a..1e48dec8 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ProximityStrategyFactory.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ProximityStrategyFactory.java @@ -36,7 +36,7 @@ import org.matsim.core.replanning.modules.GenericPlanStrategyModule; import org.matsim.core.replanning.selectors.ExpBetaPlanSelector; import org.matsim.freight.logistics.*; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * This strategy removes **one** randomly selected shipment from logistic chain with the most shipments and reassign it to the chain with the closest chain. @@ -76,17 +76,17 @@ public void handlePlan(LSPPlan lspPlan) { LSPResource minDistanceResource = null; // get all shipments assigned to the LSP - Map, LSPShipment> lspShipmentById = new HashMap<>(); - for (LSPShipment lspShipment : lsp.getLspShipments()) { + Map, LspShipment> lspShipmentById = new HashMap<>(); + for (LspShipment lspShipment : lsp.getLspShipments()) { lspShipmentById.put(lspShipment.getId(), lspShipment); } // Retrieve all shipments in the logistic chains of the plan // These should be all shipments of the lsp, but not necessarily if shipments got lost - ArrayList shipments = new ArrayList<>(); + ArrayList shipments = new ArrayList<>(); for (LogisticChain logisticChain : lspPlan.getLogisticChains()) { - for (Id id : logisticChain.getLspShipmentIds()) { - LSPShipment lspShipment = lspShipmentById.get(id); + for (Id id : logisticChain.getLspShipmentIds()) { + LspShipment lspShipment = lspShipmentById.get(id); if (lspShipment != null) { shipments.add(lspShipment); } @@ -95,7 +95,7 @@ public void handlePlan(LSPPlan lspPlan) { // pick a random lspShipment from the shipments contained in the plan int shipmentIndex = MatsimRandom.getRandom().nextInt(shipments.size()); - LSPShipment lspShipment = shipments.get(shipmentIndex); + LspShipment lspShipment = shipments.get(shipmentIndex); // Collect all resources of the logistic chains of the LSP plan ArrayList resources = new ArrayList<>(); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomDistributionAllShipmentsStrategyFactory.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomDistributionAllShipmentsStrategyFactory.java index db428c9d..64371400 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomDistributionAllShipmentsStrategyFactory.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomDistributionAllShipmentsStrategyFactory.java @@ -33,7 +33,7 @@ import org.matsim.freight.logistics.LSP; import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * This strategy removes **all** shipments from the logistic chains and reassigns them randomly. @@ -74,7 +74,7 @@ public void handlePlan(LSPPlan lspPlan) { List logisticChains = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains()); - for (LSPShipment lspShipment : lsp.getLspShipments()) { + for (LspShipment lspShipment : lsp.getLspShipments()) { int index = MatsimRandom.getRandom().nextInt(logisticChains.size()); logisticChains.get(index).addShipmentToChain(lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomLogisticChainShipmentAssigner.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomLogisticChainShipmentAssigner.java index 2e538c53..7477d0e0 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomLogisticChainShipmentAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomLogisticChainShipmentAssigner.java @@ -29,10 +29,10 @@ import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; import org.matsim.freight.logistics.InitialShipmentAssigner; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** - * The {@link LSPShipment} is assigned randomly to a {@link LogisticChain}. The logistic chains of a + * The {@link LspShipment} is assigned randomly to a {@link LogisticChain}. The logistic chains of a * plan are collected in a list. The chain to which the shipment is to be assigned is selected by a * seeded random index. Requirements: There must be at least one logisticChain in the plan. */ @@ -46,7 +46,7 @@ class RandomLogisticChainShipmentAssigner implements InitialShipmentAssigner { } @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { + public void assignToPlan(LSPPlan lspPlan, LspShipment lspShipment) { Gbl.assertIf(!lspPlan.getLogisticChains().isEmpty()); List logisticChains = new ArrayList<>(lspPlan.getLogisticChains()); int index = random.nextInt(logisticChains.size()); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomShiftingStrategyFactory.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomShiftingStrategyFactory.java index d6a2cb3b..ee25acd1 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomShiftingStrategyFactory.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RandomShiftingStrategyFactory.java @@ -36,7 +36,7 @@ import org.matsim.freight.logistics.LSP; import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * This strategy removes **one** randomly selected shipment from the logistic chain it was assigned to and reassign it to another chain. @@ -73,9 +73,9 @@ public void handlePlan(LSPPlan lspPlan) { LSP lsp = lspPlan.getLSP(); // Make a new list of lspShipments and pick a random lspShipment from it - List lspShipments = new ArrayList<>(lsp.getLspShipments()); + List lspShipments = new ArrayList<>(lsp.getLspShipments()); int shipmentIndex = random.nextInt(lsp.getLspShipments().size()); - LSPShipment lspShipment = lspShipments.get(shipmentIndex); + LspShipment lspShipment = lspShipments.get(shipmentIndex); // Find and remove the random lspShipment from its current logistic chain LogisticChain sourceLogisticChain = null; diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RebalancingStrategyFactory.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RebalancingStrategyFactory.java index bd61fbcc..a9b08f94 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RebalancingStrategyFactory.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RebalancingStrategyFactory.java @@ -34,7 +34,7 @@ import org.matsim.freight.logistics.LSP; import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * This strategy removes **one** randomly selected shipment from logistic chain with the most shipments and reassign it to one of the chains with the lowest number of shipments. @@ -87,7 +87,7 @@ public void handlePlan(LSPPlan lspPlan) { if (minChain.equals(maxChain)) return; // get the first shipment ID from the chain with the maximum shipment count - Id shipmentIdForReplanning = maxChain.getLspShipmentIds().iterator().next(); + Id shipmentIdForReplanning = maxChain.getLspShipmentIds().iterator().next(); // iterate through the chains and move the shipment from the max chain to the min chain for (LogisticChain logisticChain : lsp.getSelectedPlan().getLogisticChains()) { diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RoundRobinDistributionAllShipmentsStrategyFactory.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RoundRobinDistributionAllShipmentsStrategyFactory.java index c7753f9d..74ac28b3 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RoundRobinDistributionAllShipmentsStrategyFactory.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RoundRobinDistributionAllShipmentsStrategyFactory.java @@ -33,7 +33,7 @@ import org.matsim.freight.logistics.LSP; import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * This strategy removes **all** shipments from the logistic chains and reassigns them. @@ -73,7 +73,7 @@ public void handlePlan(LSPPlan lspPlan) { LSP lsp = lspPlan.getLSP(); Map shipmentCountByChain = new LinkedHashMap<>(); - for (LSPShipment lspShipment : lsp.getLspShipments()) { + for (LspShipment lspShipment : lsp.getLspShipments()) { if (shipmentCountByChain.isEmpty()) { for (LogisticChain chain : lsp.getSelectedPlan().getLogisticChains()) { shipmentCountByChain.put(chain, 0); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RoundRobinLogisticChainShipmentAssigner.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RoundRobinLogisticChainShipmentAssigner.java index 26871c3e..c7d1dfae 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RoundRobinLogisticChainShipmentAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/RoundRobinLogisticChainShipmentAssigner.java @@ -28,10 +28,10 @@ import org.matsim.freight.logistics.InitialShipmentAssigner; import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** - * The {@link LSPShipment} is assigned consecutively to a {@link LogisticChain}. In case of one + * The {@link LspShipment} is assigned consecutively to a {@link LogisticChain}. In case of one * chain the shipment is assigned to that chain. If there are more chains, the shipment is assigned * to the chain which has the least shipments to this point and thus distributes the shipments * evenly in sequence across the logistics chains. Requirements: There must be at least one @@ -45,7 +45,7 @@ class RoundRobinLogisticChainShipmentAssigner implements InitialShipmentAssigner RoundRobinLogisticChainShipmentAssigner() {} @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { + public void assignToPlan(LSPPlan lspPlan, LspShipment lspShipment) { Gbl.assertIf(!lspPlan.getLogisticChains().isEmpty()); // prepare the map if empty for the first time with each number of assigned shipments being zero if (shipmentCountByChain.isEmpty()) { diff --git a/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/BlueRequirement.java b/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/BlueRequirement.java index ca54f5b0..4137417a 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/BlueRequirement.java +++ b/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/BlueRequirement.java @@ -45,9 +45,9 @@ import static org.matsim.freight.logistics.examples.requirementsChecking.ExampleCheckRequirementsOfAssigner.ATTRIBUTE_COLOR; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipmentRequirement; +import org.matsim.freight.logistics.shipment.LspShipmentRequirement; -/*package-private*/ class BlueRequirement implements LSPShipmentRequirement { +/*package-private*/ class BlueRequirement implements LspShipmentRequirement { static final String BLUE = "blue"; diff --git a/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/ExampleCheckRequirementsOfAssigner.java b/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/ExampleCheckRequirementsOfAssigner.java index a67fb803..0274903a 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/ExampleCheckRequirementsOfAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/ExampleCheckRequirementsOfAssigner.java @@ -57,8 +57,8 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -173,17 +173,17 @@ private static LSP createLSPWithProperties(Scenario scenario) { .build(); } - public static Collection createShipmentsWithRequirements(Network network) { + public static Collection createShipmentsWithRequirements(Network network) { // Create ten shipments with either a red or blue requirement, i.e. that they only can be // transported in a solution with the matching color - ArrayList shipmentList = new ArrayList<>(); + ArrayList shipmentList = new ArrayList<>(); ArrayList linkList = new ArrayList<>(network.getLinks().values()); Random rand = new Random(1); for (int i = 1; i < 11; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand.nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -230,17 +230,17 @@ public static void main(String[] args) { // Create LSP and lspShipments LSP lsp = createLSPWithProperties(scenario); - Collection lspShipments = createShipmentsWithRequirements(network); + Collection lspShipments = createShipmentsWithRequirements(network); // assign the lspShipments to the LSP - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } for (LogisticChain logisticChain : lsp.getSelectedPlan().getLogisticChains()) { if (logisticChain.getId().toString().equals("RedSolution")) { - for (Id lspShipmentId : logisticChain.getLspShipmentIds()) { - LSPShipment lspShipment = LSPUtils.findLspShipment(lsp, lspShipmentId); + for (Id lspShipmentId : logisticChain.getLspShipmentIds()) { + LspShipment lspShipment = LSPUtils.findLspShipment(lsp, lspShipmentId); if (lspShipment != null && !(lspShipment.getRequirements().iterator().next() instanceof RedRequirement)) { break; } @@ -248,8 +248,8 @@ public static void main(String[] args) { System.out.println("All lspShipments in " + logisticChain.getId() + " are red"); } if (logisticChain.getId().toString().equals("BlueSolution")) { - for (Id lspShipmentId : logisticChain.getLspShipmentIds()) { - LSPShipment shipment = LSPUtils.findLspShipment(lsp, lspShipmentId); + for (Id lspShipmentId : logisticChain.getLspShipmentIds()) { + LspShipment shipment = LSPUtils.findLspShipment(lsp, lspShipmentId); if (shipment != null && !(shipment.getRequirements().iterator().next() instanceof BlueRequirement)) { break; } diff --git a/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/RedRequirement.java b/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/RedRequirement.java index 7045bb25..0422427a 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/RedRequirement.java +++ b/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/RedRequirement.java @@ -43,9 +43,9 @@ package org.matsim.freight.logistics.examples.requirementsChecking; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipmentRequirement; +import org.matsim.freight.logistics.shipment.LspShipmentRequirement; -/*package-private*/ class RedRequirement implements LSPShipmentRequirement { +/*package-private*/ class RedRequirement implements LspShipmentRequirement { static final String RED = "red"; diff --git a/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/RequirementsAssigner.java b/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/RequirementsAssigner.java index ddcf408c..e47b3d35 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/RequirementsAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/examples/requirementsChecking/RequirementsAssigner.java @@ -47,8 +47,8 @@ import org.matsim.freight.logistics.InitialShipmentAssigner; import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.LSPShipmentRequirement; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentRequirement; class RequirementsAssigner implements InitialShipmentAssigner { @@ -59,12 +59,12 @@ public RequirementsAssigner() { } @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { + public void assignToPlan(LSPPlan lspPlan, LspShipment lspShipment) { feasibleLogisticChains.clear(); label: for (LogisticChain solution : lspPlan.getLogisticChains()) { - for (LSPShipmentRequirement requirement : lspShipment.getRequirements()) { + for (LspShipmentRequirement requirement : lspShipment.getRequirements()) { if (!requirement.checkRequirement(solution)) { continue label; diff --git a/src/main/java/org/matsim/freight/logistics/examples/simulationTrackers/ExampleSimulationTrackers.java b/src/main/java/org/matsim/freight/logistics/examples/simulationTrackers/ExampleSimulationTrackers.java index 877a7219..19b38fd0 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/simulationTrackers/ExampleSimulationTrackers.java +++ b/src/main/java/org/matsim/freight/logistics/examples/simulationTrackers/ExampleSimulationTrackers.java @@ -39,8 +39,8 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -129,14 +129,14 @@ static LSP createLSPWithTracker(Scenario scenario) { return collectionLSPBuilder.build(); } - public static Collection createInitialLSPShipments(Network network) { - ArrayList shipmentList = new ArrayList<>(); + public static Collection createInitialLSPShipments(Network network) { + ArrayList shipmentList = new ArrayList<>(); ArrayList linkList = new ArrayList<>(network.getLinks().values()); // Create five LSPShipments that are located in the left half of the network. for (int i = 1; i < 6; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -176,10 +176,10 @@ public static void main(String[] args) { // Create LSP and lspShipments LSP lsp = createLSPWithTracker(scenario); - Collection lspShipments = createInitialLSPShipments(network); + Collection lspShipments = createInitialLSPShipments(network); // assign the lspShipments to the LSP - for (LSPShipment lspShipment : lspShipments) { + for (LspShipment lspShipment : lspShipments) { lsp.assignShipmentToLSP(lspShipment); } diff --git a/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlParserV1.java b/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlParserV1.java index dc898f18..e555e9ad 100644 --- a/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlParserV1.java +++ b/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlParserV1.java @@ -36,9 +36,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.TransshipmentHubResource; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.utils.objectattributes.attributable.AttributesXmlReaderDelegate; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -57,12 +57,12 @@ class LSPPlanXmlParserV1 extends MatsimXmlParser { private final LSPs lsPs; private final Carriers carriers; private final Map elementIdResourceIdMap = new LinkedHashMap<>(); - private final Map planElements = new LinkedHashMap<>(); + private final Map planElements = new LinkedHashMap<>(); private final AttributesXmlReaderDelegate attributesReader = new AttributesXmlReaderDelegate(); private final List logisticChains = new LinkedList<>(); private LSP currentLsp = null; private Carrier currentCarrier = null; - private LSPShipment currentShipment = null; + private LspShipment currentShipment = null; private LSPPlan currentLspPlan = null; private CarrierCapabilities.Builder capabilityBuilder; private TransshipmentHubResource hubResource; @@ -180,7 +180,7 @@ public void startTag(String name, Attributes atts, Stack context) { case SHIPMENT -> { String shipmentId = atts.getValue(ID); Gbl.assertNotNull(shipmentId); - Id id = Id.create(shipmentId, LSPShipment.class); + Id id = Id.create(shipmentId, LspShipment.class); String from = atts.getValue(FROM); Gbl.assertNotNull(from); @@ -189,8 +189,8 @@ public void startTag(String name, Attributes atts, Stack context) { String sizeString = atts.getValue(SIZE); Gbl.assertNotNull(sizeString); int size = Integer.parseInt(sizeString); - ShipmentUtils.LSPShipmentBuilder shipmentBuilder = - ShipmentUtils.LSPShipmentBuilder.newInstance(id); + LspShipmentUtils.LspShipmentBuilder shipmentBuilder = + LspShipmentUtils.LspShipmentBuilder.newInstance(id); shipmentBuilder.setFromLinkId(Id.createLinkId(from)); shipmentBuilder.setToLinkId(Id.createLinkId(to)); @@ -258,32 +258,32 @@ public void startTag(String name, Attributes atts, Stack context) { String resourceId = atts.getValue(RESOURCE_ID); Gbl.assertNotNull(resourceId); - ShipmentPlanElement planElement = null; + LspShipmentPlanElement planElement = null; switch (type) { case "LOAD" -> { - var planElementBuilder = ShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); + var planElementBuilder = LspShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); planElementBuilder.setStartTime(parseTimeToDouble(startTime)); planElementBuilder.setEndTime(parseTimeToDouble(endTime)); planElementBuilder.setResourceId(Id.create(resourceId, LSPResource.class)); planElement = planElementBuilder.build(); } case "TRANSPORT" -> { - var planElementBuilder = ShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); + var planElementBuilder = LspShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); planElementBuilder.setStartTime(parseTimeToDouble(startTime)); planElementBuilder.setEndTime(parseTimeToDouble(endTime)); planElementBuilder.setResourceId(Id.create(resourceId, LSPResource.class)); planElement = planElementBuilder.build(); } case "UNLOAD" -> { - var planElementBuilder = ShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); + var planElementBuilder = LspShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); planElementBuilder.setStartTime(parseTimeToDouble(startTime)); planElementBuilder.setEndTime(parseTimeToDouble(endTime)); planElementBuilder.setResourceId(Id.create(resourceId, LSPResource.class)); planElement = planElementBuilder.build(); } case "HANDLE" -> { - var planElementBuilder = ShipmentUtils.ScheduledShipmentHandleBuilder.newInstance(); + var planElementBuilder = LspShipmentUtils.ScheduledShipmentHandleBuilder.newInstance(); planElementBuilder.setStartTime(parseTimeToDouble(startTime)); planElementBuilder.setEndTime(parseTimeToDouble(endTime)); planElementBuilder.setResourceId(Id.create(resourceId, LSPResource.class)); @@ -405,12 +405,12 @@ public void endTag(String name, String content, Stack context) { } case SHIPMENT_PLAN -> { - for (LSPShipment lspShipment : currentLsp.getLspShipments()) { + for (LspShipment lspShipment : currentLsp.getLspShipments()) { if (lspShipment.getId().toString().equals(shipmentPlanId)) { - for (Map.Entry planElement : planElements.entrySet()) { - ShipmentUtils.getOrCreateShipmentPlan(currentLspPlan, lspShipment.getId()) + for (Map.Entry planElement : planElements.entrySet()) { + LspShipmentUtils.getOrCreateShipmentPlan(currentLspPlan, lspShipment.getId()) .addPlanElement( - Id.create(planElement.getKey(), ShipmentPlanElement.class), + Id.create(planElement.getKey(), LspShipmentPlanElement.class), planElement.getValue()); } } diff --git a/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlWriter.java b/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlWriter.java index 58901bd6..2c97a9ae 100644 --- a/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlWriter.java +++ b/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlWriter.java @@ -37,9 +37,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.LSP; import org.matsim.freight.logistics.resourceImplementations.TransshipmentHubResource; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /** * Writes out resources, shipments and plans for each LSP in an XML-file including header for @@ -130,7 +130,7 @@ private void writeResources(LSP lsp) throws IOException { private void writeShipments(LSP lsp) throws IOException { if (lsp.getLspShipments().isEmpty()) return; this.writeStartTag(SHIPMENTS, null); - for (LSPShipment lspShipment : lsp.getLspShipments()) { + for (LspShipment lspShipment : lsp.getLspShipments()) { this.writeStartTag( SHIPMENT, List.of( @@ -185,7 +185,7 @@ private void writePlans(LSP lsp, BufferedWriter writer) throws IOException { writeStartTag(SHIPMENT_PLANS, null); for (LogisticChain chain : plan.getLogisticChains()) { - for (Id shipmentId : chain.getLspShipmentIds()) { + for (Id shipmentId : chain.getLspShipmentIds()) { if (chain.getLspShipmentIds().contains(shipmentId)) { this.writeStartTag( SHIPMENT_PLAN, @@ -193,12 +193,12 @@ private void writePlans(LSP lsp, BufferedWriter writer) throws IOException { createTuple(SHIPMENT_ID, shipmentId.toString()), createTuple(CHAIN_ID, chain.getId().toString()))); } - LSPShipment lspShipment = LSPUtils.findLspShipment(lsp, shipmentId); + LspShipment lspShipment = LSPUtils.findLspShipment(lsp, shipmentId); assert lspShipment != null; - final Map, ShipmentPlanElement> planElements = - ShipmentUtils.getOrCreateShipmentPlan(plan, lspShipment.getId()).getPlanElements(); - for (Id elementId : planElements.keySet()) { - ShipmentPlanElement element = planElements.get(elementId); + final Map, LspShipmentPlanElement> planElements = + LspShipmentUtils.getOrCreateShipmentPlan(plan, lspShipment.getId()).getPlanElements(); + for (Id elementId : planElements.keySet()) { + LspShipmentPlanElement element = planElements.get(elementId); this.writeStartTag( ELEMENT, List.of( diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java index 1e1e2d05..6588a1e2 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java @@ -31,14 +31,14 @@ import org.matsim.freight.carriers.Tour.Leg; import org.matsim.freight.carriers.Tour.TourElement; import org.matsim.freight.logistics.*; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /** * Schedules the {@link CollectionCarrierResource}. * - *

Converts the {@link LSPShipment}s into {@link CarrierService}s that are needed for the {@link + *

Converts the {@link LspShipment}s into {@link CarrierService}s that are needed for the {@link * Carrier} from the freight contrib of MATSim and then routes the vehicles of this {@link Carrier} * through the network by calling the corresponding methods of jsprit */ @@ -120,8 +120,8 @@ protected void updateShipments() { private void addShipmentLoadElement( LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { - ShipmentUtils.ScheduledShipmentLoadBuilder builder = - ShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentLoadBuilder builder = + LspShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -135,18 +135,18 @@ private void addShipmentLoadElement( builder.setStartTime(startTimeOfLoading); builder.setEndTime(startTimeOfLoading + tuple.getLspShipment().getDeliveryServiceTime()); - ShipmentPlanElement load = builder.build(); + LspShipmentPlanElement load = builder.build(); String idString = load.getResourceId() + "" + load.getLogisticChainElement().getId() + load.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, load); } private void addShipmentTransportElement( LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { - ShipmentUtils.ScheduledShipmentTransportBuilder builder = - ShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentTransportBuilder builder = + LspShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -165,14 +165,14 @@ private void addShipmentTransportElement( builder.setFromLinkId(serviceActivity.getLocation()); builder.setToLinkId(tour.getEndLinkId()); builder.setCarrierService(serviceActivity.getService()); - ShipmentPlanElement transport = builder.build(); + LspShipmentPlanElement transport = builder.build(); String idString = transport.getResourceId() + "" + transport.getLogisticChainElement().getId() + transport.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, transport); } @@ -207,8 +207,8 @@ private void addCollectionTourEndEventHandler( private void addShipmentUnloadElement( LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { - ShipmentUtils.ScheduledShipmentUnloadBuilder builder = - ShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentUnloadBuilder builder = + LspShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -220,14 +220,14 @@ private void addShipmentUnloadElement( builder.setStartTime(startTime); builder.setEndTime(startTime + getUnloadEndTime(tour)); - ShipmentPlanElement unload = builder.build(); + LspShipmentPlanElement unload = builder.build(); String idString = unload.getResourceId() + "" + unload.getLogisticChainElement().getId() + unload.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, unload); } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionServiceEndEventHandler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionServiceEndEventHandler.java index 4178f23b..ffd8f53c 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionServiceEndEventHandler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionServiceEndEventHandler.java @@ -31,24 +31,24 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LSPSimulationTracker; import org.matsim.freight.logistics.LogisticChainElement; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentLeg; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentLeg; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /*package-private*/ class CollectionServiceEndEventHandler implements AfterMobsimListener, CarrierServiceEndEventHandler, - LSPSimulationTracker { + LSPSimulationTracker { private final CarrierService carrierService; private final LogisticChainElement logisticChainElement; private final LSPCarrierResource resource; - private LSPShipment lspShipment; + private LspShipment lspShipment; public CollectionServiceEndEventHandler( CarrierService carrierService, - LSPShipment lspShipment, + LspShipment lspShipment, LogisticChainElement element, LSPCarrierResource resource) { this.carrierService = carrierService; @@ -73,39 +73,39 @@ public void handleEvent(CarrierServiceEndEvent event) { } private void logLoad(CarrierServiceEndEvent event) { - ShipmentUtils.LoggedShipmentLoadBuilder builder = - ShipmentUtils.LoggedShipmentLoadBuilder.newInstance(); + LspShipmentUtils.LoggedShipmentLoadBuilder builder = + LspShipmentUtils.LoggedShipmentLoadBuilder.newInstance(); builder.setStartTime(event.getTime() - event.getServiceDuration()); builder.setEndTime(event.getTime()); builder.setLogisticsChainElement(logisticChainElement); builder.setResourceId(resource.getId()); builder.setLinkId(event.getLinkId()); builder.setCarrierId(event.getCarrierId()); - ShipmentPlanElement loggedShipmentLoad = builder.build(); + LspShipmentPlanElement loggedShipmentLoad = builder.build(); String idString = loggedShipmentLoad.getResourceId() + "" + loggedShipmentLoad.getLogisticChainElement().getId() + loggedShipmentLoad.getElementType(); - Id loadId = Id.create(idString, ShipmentPlanElement.class); + Id loadId = Id.create(idString, LspShipmentPlanElement.class); lspShipment.getShipmentLog().addPlanElement(loadId, loggedShipmentLoad); } private void logTransport(CarrierServiceEndEvent event) { - ShipmentUtils.LoggedShipmentTransportBuilder builder = - ShipmentUtils.LoggedShipmentTransportBuilder.newInstance(); + LspShipmentUtils.LoggedShipmentTransportBuilder builder = + LspShipmentUtils.LoggedShipmentTransportBuilder.newInstance(); builder.setStartTime(event.getTime()); builder.setLogisticChainElement(logisticChainElement); builder.setResourceId(resource.getId()); builder.setFromLinkId(event.getLinkId()); builder.setCarrierId(event.getCarrierId()); - ShipmentLeg transport = builder.build(); + LspShipmentLeg transport = builder.build(); String idString = transport.getResourceId() + "" + transport.getLogisticChainElement().getId() + transport.getElementType(); - Id transportId = Id.create(idString, ShipmentPlanElement.class); + Id transportId = Id.create(idString, LspShipmentPlanElement.class); lspShipment.getShipmentLog().addPlanElement(transportId, transport); } @@ -113,7 +113,7 @@ public CarrierService getCarrierService() { return carrierService; } - public LSPShipment getLspShipment() { + public LspShipment getLspShipment() { return lspShipment; } @@ -126,7 +126,7 @@ public Id getResourceId() { } @Override - public void setEmbeddingContainer(LSPShipment pointer) { + public void setEmbeddingContainer(LspShipment pointer) { this.lspShipment = pointer; } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java index 4d8a59e9..7eaf9e73 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java @@ -34,8 +34,8 @@ import org.matsim.freight.carriers.Tour.ServiceActivity; import org.matsim.freight.carriers.Tour.TourElement; import org.matsim.freight.logistics.*; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; /** @@ -207,8 +207,8 @@ protected void updateShipments() { private void addShipmentLoadElement( LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { - ShipmentUtils.ScheduledShipmentLoadBuilder builder = - ShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentLoadBuilder builder = + LspShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -228,18 +228,18 @@ private void addShipmentLoadElement( builder.setStartTime(startTimeOfTransport - cumulatedLoadingTime); builder.setEndTime(startTimeOfTransport); - ShipmentPlanElement load = builder.build(); + LspShipmentPlanElement load = builder.build(); String idString = load.getResourceId() + "" + load.getLogisticChainElement().getId() + load.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, load); } private void addShipmentTransportElement( LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { - ShipmentUtils.ScheduledShipmentTransportBuilder builder = - ShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentTransportBuilder builder = + LspShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -267,21 +267,21 @@ private void addShipmentTransportElement( builder.setFromLinkId(tour.getStartLinkId()); builder.setToLinkId(serviceActivity.getLocation()); builder.setCarrierService(serviceActivity.getService()); - ShipmentPlanElement transport = builder.build(); + LspShipmentPlanElement transport = builder.build(); String idString = transport.getResourceId() + "" + transport.getLogisticChainElement().getId() + transport.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, transport); } private void addShipmentUnloadElement( LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { - ShipmentUtils.ScheduledShipmentUnloadBuilder builder = - ShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentUnloadBuilder builder = + LspShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -300,13 +300,13 @@ private void addShipmentUnloadElement( builder.setStartTime(startTime); builder.setEndTime(endTime); - ShipmentPlanElement unload = builder.build(); + LspShipmentPlanElement unload = builder.build(); String idString = unload.getResourceId() + String.valueOf(unload.getLogisticChainElement().getId()) + unload.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, unload); } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionServiceStartEventHandler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionServiceStartEventHandler.java index 64cc3e70..80e04fc5 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionServiceStartEventHandler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionServiceStartEventHandler.java @@ -30,24 +30,24 @@ import org.matsim.freight.logistics.LSPCarrierResource; import org.matsim.freight.logistics.LSPSimulationTracker; import org.matsim.freight.logistics.LogisticChainElement; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentLeg; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentLeg; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /*package-private*/ class DistributionServiceStartEventHandler implements AfterMobsimListener, CarrierServiceStartEventHandler, - LSPSimulationTracker { + LSPSimulationTracker { private final CarrierService carrierService; private final LogisticChainElement logisticChainElement; private final LSPCarrierResource resource; - private LSPShipment lspShipment; + private LspShipment lspShipment; DistributionServiceStartEventHandler( CarrierService carrierService, - LSPShipment lspShipment, + LspShipment lspShipment, LogisticChainElement element, LSPCarrierResource resource) { this.carrierService = carrierService; @@ -73,30 +73,30 @@ public void handleEvent(CarrierServiceStartEvent event) { private void logTransport(CarrierServiceStartEvent event) { String idString = resource.getId() + "" + logisticChainElement.getId() + "TRANSPORT"; - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentPlanElement abstractPlanElement = + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentPlanElement abstractPlanElement = lspShipment.getShipmentLog().getPlanElements().get(id); - if (abstractPlanElement instanceof ShipmentLeg transport) { + if (abstractPlanElement instanceof LspShipmentLeg transport) { transport.setEndTime(event.getTime()); } } private void logUnload(CarrierServiceStartEvent event) { - ShipmentUtils.LoggedShipmentUnloadBuilder builder = - ShipmentUtils.LoggedShipmentUnloadBuilder.newInstance(); + LspShipmentUtils.LoggedShipmentUnloadBuilder builder = + LspShipmentUtils.LoggedShipmentUnloadBuilder.newInstance(); builder.setCarrierId(event.getCarrierId()); builder.setLinkId(event.getLinkId()); builder.setLogisticChainElement(logisticChainElement); builder.setResourceId(resource.getId()); builder.setStartTime(event.getTime()); builder.setEndTime(event.getTime() + event.getServiceDuration()); - ShipmentPlanElement unload = builder.build(); + LspShipmentPlanElement unload = builder.build(); String idString = unload.getResourceId() + "" + unload.getLogisticChainElement().getId() + unload.getElementType(); - Id unloadId = Id.create(idString, ShipmentPlanElement.class); + Id unloadId = Id.create(idString, LspShipmentPlanElement.class); lspShipment.getShipmentLog().addPlanElement(unloadId, unload); } @@ -104,7 +104,7 @@ public CarrierService getCarrierService() { return carrierService; } - public LSPShipment getLspShipment() { + public LspShipment getLspShipment() { return lspShipment; } @@ -117,7 +117,7 @@ public LSPCarrierResource getResource() { } @Override - public void setEmbeddingContainer(LSPShipment pointer) { + public void setEmbeddingContainer(LspShipment pointer) { this.lspShipment = pointer; } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/LSPTourEndEventHandler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/LSPTourEndEventHandler.java index 2fcf210b..ac79bff1 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/LSPTourEndEventHandler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/LSPTourEndEventHandler.java @@ -32,22 +32,22 @@ import org.matsim.freight.carriers.events.CarrierTourEndEvent; import org.matsim.freight.carriers.events.eventhandler.CarrierTourEndEventHandler; import org.matsim.freight.logistics.*; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentLeg; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentLeg; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /*package-private*/ class LSPTourEndEventHandler - implements AfterMobsimListener, CarrierTourEndEventHandler, LSPSimulationTracker { + implements AfterMobsimListener, CarrierTourEndEventHandler, LSPSimulationTracker { private final CarrierService carrierService; private final LogisticChainElement logisticChainElement; private final LSPCarrierResource resource; private final Tour tour; - private LSPShipment lspShipment; + private LspShipment lspShipment; public LSPTourEndEventHandler( - LSPShipment lspShipment, + LspShipment lspShipment, CarrierService carrierService, LogisticChainElement logisticChainElement, LSPCarrierResource resource, @@ -91,30 +91,30 @@ public void handleEvent(CarrierTourEndEvent event) { } private void logUnload(Id carrierId, double startTime, double endTime) { - ShipmentUtils.LoggedShipmentUnloadBuilder builder = - ShipmentUtils.LoggedShipmentUnloadBuilder.newInstance(); + LspShipmentUtils.LoggedShipmentUnloadBuilder builder = + LspShipmentUtils.LoggedShipmentUnloadBuilder.newInstance(); builder.setStartTime(startTime); builder.setEndTime(endTime); builder.setLogisticChainElement(logisticChainElement); builder.setResourceId(resource.getId()); builder.setCarrierId(carrierId); - ShipmentPlanElement unload = builder.build(); + LspShipmentPlanElement unload = builder.build(); String idString = unload.getResourceId().toString() + unload.getLogisticChainElement().getId() + unload.getElementType(); - Id unloadId = Id.create(idString, ShipmentPlanElement.class); + Id unloadId = Id.create(idString, LspShipmentPlanElement.class); lspShipment.getShipmentLog().addPlanElement(unloadId, unload); } private void logTransport(double endTime, Id endLinkId) { String idString = resource.getId().toString() + logisticChainElement.getId() + "TRANSPORT"; - ShipmentPlanElement abstractPlanElement = + LspShipmentPlanElement abstractPlanElement = lspShipment .getShipmentLog() .getPlanElements() - .get(Id.create(idString, ShipmentPlanElement.class)); - if (abstractPlanElement instanceof ShipmentLeg transport) { + .get(Id.create(idString, LspShipmentPlanElement.class)); + if (abstractPlanElement instanceof LspShipmentLeg transport) { transport.setEndTime(endTime); transport.setToLinkId(endLinkId); } @@ -134,7 +134,7 @@ public CarrierService getCarrierService() { return carrierService; } - public LSPShipment getLspShipment() { + public LspShipment getLspShipment() { return lspShipment; } @@ -147,7 +147,7 @@ public Id getResourceId() { } @Override - public void setEmbeddingContainer(LSPShipment pointer) { + public void setEmbeddingContainer(LspShipment pointer) { this.lspShipment = pointer; } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/LSPTourStartEventHandler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/LSPTourStartEventHandler.java index f2bab117..cd6d94ed 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/LSPTourStartEventHandler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/LSPTourStartEventHandler.java @@ -34,22 +34,22 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LSPSimulationTracker; import org.matsim.freight.logistics.LogisticChainElement; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentLeg; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentLeg; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /*package-private*/ class LSPTourStartEventHandler - implements CarrierTourStartEventHandler, LSPSimulationTracker { + implements CarrierTourStartEventHandler, LSPSimulationTracker { private final Tour tour; private final CarrierService carrierService; private final LogisticChainElement logisticChainElement; private final LSPCarrierResource resource; - private LSPShipment lspShipment; + private LspShipment lspShipment; public LSPTourStartEventHandler( - LSPShipment lspShipment, + LspShipment lspShipment, CarrierService carrierService, LogisticChainElement logisticChainElement, LSPCarrierResource resource, @@ -101,41 +101,41 @@ public void handleEvent(CarrierTourStartEvent event) { private void logLoad(Id carrierId, Id linkId, double startTime, double endTime) { - ShipmentUtils.LoggedShipmentLoadBuilder builder = - ShipmentUtils.LoggedShipmentLoadBuilder.newInstance(); + LspShipmentUtils.LoggedShipmentLoadBuilder builder = + LspShipmentUtils.LoggedShipmentLoadBuilder.newInstance(); builder.setCarrierId(carrierId); builder.setLinkId(linkId); builder.setLogisticsChainElement(logisticChainElement); builder.setResourceId(resource.getId()); builder.setStartTime(startTime); builder.setEndTime(endTime); - ShipmentPlanElement loggedShipmentLoad = builder.build(); + LspShipmentPlanElement loggedShipmentLoad = builder.build(); String idString = loggedShipmentLoad.getResourceId() + "" + loggedShipmentLoad.getLogisticChainElement().getId() + loggedShipmentLoad.getElementType(); - Id loadId = Id.create(idString, ShipmentPlanElement.class); + Id loadId = Id.create(idString, LspShipmentPlanElement.class); lspShipment.getShipmentLog().addPlanElement(loadId, loggedShipmentLoad); } private void logTransport(Id carrierId, Id fromLinkId, Id toLinkId, double startTime) { - ShipmentUtils.LoggedShipmentTransportBuilder builder = - ShipmentUtils.LoggedShipmentTransportBuilder.newInstance(); + LspShipmentUtils.LoggedShipmentTransportBuilder builder = + LspShipmentUtils.LoggedShipmentTransportBuilder.newInstance(); builder.setCarrierId(carrierId); builder.setFromLinkId(fromLinkId); builder.setToLinkId(toLinkId); builder.setLogisticChainElement(logisticChainElement); builder.setResourceId(resource.getId()); builder.setStartTime(startTime); - ShipmentLeg transport = builder.build(); + LspShipmentLeg transport = builder.build(); String idString = transport.getResourceId() + "" + transport.getLogisticChainElement().getId() + transport.getElementType(); - Id transportId = Id.create(idString, ShipmentPlanElement.class); + Id transportId = Id.create(idString, LspShipmentPlanElement.class); lspShipment.getShipmentLog().addPlanElement(transportId, transport); } @@ -153,7 +153,7 @@ public CarrierService getCarrierService() { return carrierService; } - public LSPShipment getLspShipment() { + public LspShipment getLspShipment() { return lspShipment; } @@ -166,7 +166,7 @@ public Id getResourceId() { } @Override - public void setEmbeddingContainer(LSPShipment pointer) { + public void setEmbeddingContainer(LspShipment pointer) { this.lspShipment = pointer; } } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java index af84fd40..6c61da0c 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java @@ -32,8 +32,8 @@ import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkRouter; import org.matsim.freight.logistics.*; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; /** @@ -260,8 +260,8 @@ protected void updateShipments() { private void addShipmentLoadElement( LspShipmentWithTime tuple, Tour tour) { - ShipmentUtils.ScheduledShipmentLoadBuilder builder = - ShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentLoadBuilder builder = + LspShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -281,20 +281,20 @@ private void addShipmentLoadElement( builder.setStartTime(startTimeOfTransport - cumulatedLoadingTime); builder.setEndTime(startTimeOfTransport); - ShipmentPlanElement load = builder.build(); + LspShipmentPlanElement load = builder.build(); String idString = load.getResourceId() + String.valueOf(load.getLogisticChainElement().getId()) + load.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, load); } private void addShipmentTransportElement( LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { - ShipmentUtils.ScheduledShipmentTransportBuilder builder = - ShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentTransportBuilder builder = + LspShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -311,20 +311,20 @@ private void addShipmentTransportElement( builder.setFromLinkId(tour.getStartLinkId()); builder.setToLinkId(tour.getEndLinkId()); builder.setCarrierService(serviceActivity.getService()); - ShipmentPlanElement transport = builder.build(); + LspShipmentPlanElement transport = builder.build(); String idString = transport.getResourceId() + String.valueOf(transport.getLogisticChainElement().getId()) + transport.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, transport); } private void addShipmentUnloadElement( LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { - ShipmentUtils.ScheduledShipmentUnloadBuilder builder = - ShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentUnloadBuilder builder = + LspShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { @@ -347,13 +347,13 @@ private void addShipmentUnloadElement( + legAfterStart.getExpectedTransportTime() + cumulatedLoadingTime); - ShipmentPlanElement unload = builder.build(); + LspShipmentPlanElement unload = builder.build(); String idString = unload.getResourceId() + String.valueOf(unload.getLogisticChainElement().getId()) + unload.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, unload); } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/ResourceImplementationUtils.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/ResourceImplementationUtils.java index f8da646b..7e361725 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/ResourceImplementationUtils.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/ResourceImplementationUtils.java @@ -36,9 +36,9 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LSPResourceScheduler; import org.matsim.freight.logistics.LogisticChainElement; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; @SuppressWarnings("ClassEscapesDefinedScope") @@ -82,7 +82,7 @@ public static void printShipmentsOfLSP(String outputDir, LSP lsp) { final String str0 = "LSP: " + lsp.getId(); System.out.println(str0); writer.write(str0 + "\n"); - for (LSPShipment lspShipment : lsp.getLspShipments()) { + for (LspShipment lspShipment : lsp.getLspShipments()) { final String str1 = "Shipment: " + lspShipment; System.out.println(str1); writer.write(str1 + "\n"); @@ -99,13 +99,13 @@ public static void printResults_shipmentPlan(String outputDir, LSP lsp) { final String str0 = "LSP: " + lsp.getId(); System.out.println(str0); writer.write(str0 + "\n"); - for (LSPShipment shipment : lsp.getLspShipments()) { - ArrayList elementList = + for (LspShipment shipment : lsp.getLspShipments()) { + ArrayList elementList = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) + LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) .getPlanElements() .values()); - elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); + elementList.sort(LspShipmentUtils.createShipmentPlanElementComparator()); writeShipmentWithPlanElements(writer, shipment, elementList); } } catch (IOException e) { @@ -114,12 +114,12 @@ public static void printResults_shipmentPlan(String outputDir, LSP lsp) { } private static void writeShipmentWithPlanElements( - BufferedWriter writer, LSPShipment lspShipment, ArrayList elementList) + BufferedWriter writer, LspShipment lspShipment, ArrayList elementList) throws IOException { final String str1 = "Shipment: " + lspShipment; System.out.println(str1); writer.write(str1 + "\n"); - for (ShipmentPlanElement element : elementList) { + for (LspShipmentPlanElement element : elementList) { final String str2 = element.getLogisticChainElement().getId() + "\t\t" @@ -151,10 +151,10 @@ public static void printResults_shipmentLog(String outputDir, LSP lsp) { final String str0 = "LSP: " + lsp.getId(); System.out.println(str0); writer.write(str0 + "\n"); - for (LSPShipment lspShipment : lsp.getLspShipments()) { - ArrayList elementList = + for (LspShipment lspShipment : lsp.getLspShipments()) { + ArrayList elementList = new ArrayList<>(lspShipment.getShipmentLog().getPlanElements().values()); - elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); + elementList.sort(LspShipmentUtils.createShipmentPlanElementComparator()); writeShipmentWithPlanElements(writer, lspShipment, elementList); } } catch (IOException e) { diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/SimpleForwardLogisticChainScheduler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/SimpleForwardLogisticChainScheduler.java index 54d37eba..f046b80c 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/SimpleForwardLogisticChainScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/SimpleForwardLogisticChainScheduler.java @@ -23,19 +23,19 @@ import java.util.List; import org.matsim.api.core.v01.Id; import org.matsim.freight.logistics.*; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * In the class SimpleForwardSolutionScheduler two tasks are performed: * - *

1.) the {@link LSPShipment}s that were assigned to the suitable {@link LogisticChain} by the + *

1.) the {@link LspShipment}s that were assigned to the suitable {@link LogisticChain} by the * {@link InitialShipmentAssigner} in a previous step are handed over to the first {@link * LogisticChainElement}. * *

2.) all {@link LSPResource}s that were handed over to the SimpleForwardSolutionScheduler * exogenously, are now scheduled sequentially in an order that was also specified exogenously. This * order ensures that each {@link LogisticChain} is traversed from the first to the last {@link - * LogisticChainElement}. During this procedure, the concerned {@link LSPShipment}s are taken from + * LogisticChainElement}. During this procedure, the concerned {@link LspShipment}s are taken from * the collection of incoming shipments, handled by the {@link LSPResource} in charge and then added * to the collection of outgoing shipments of the client {@link LogisticChainElement}. * @@ -76,7 +76,7 @@ private void insertShipmentsAtBeginning() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { LogisticChainElement firstElement = getFirstElement(solution); assert firstElement != null; - for (Id lspShipmentId : solution.getLspShipmentIds()) { + for (Id lspShipmentId : solution.getLspShipmentIds()) { var shipment = LSPUtils.findLspShipment(lsp, lspShipmentId); assert shipment != null; firstElement diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/SingleLogisticChainShipmentAssigner.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/SingleLogisticChainShipmentAssigner.java index 5210d70e..a377be24 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/SingleLogisticChainShipmentAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/SingleLogisticChainShipmentAssigner.java @@ -24,13 +24,13 @@ import org.matsim.freight.logistics.InitialShipmentAssigner; import org.matsim.freight.logistics.LSPPlan; import org.matsim.freight.logistics.LogisticChain; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * Ganz einfacher {@link InitialShipmentAssigner}: Voraussetzung: Der {@link LSPPlan} hat genau 1 {@link * LogisticChain}. * - *

Dann wird das {@link LSPShipment} diesem zugeordnet. + *

Dann wird das {@link LspShipment} diesem zugeordnet. * *

(Falls die Voraussetzung "exakt 1 LogisticChain pro Plan" nicht erfüllt ist, kommt eine * RuntimeException) @@ -40,7 +40,7 @@ class SingleLogisticChainShipmentAssigner implements InitialShipmentAssigner { SingleLogisticChainShipmentAssigner() {} @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { + public void assignToPlan(LSPPlan lspPlan, LspShipment lspShipment) { Gbl.assertIf(lspPlan.getLogisticChains().size() == 1); LogisticChain singleSolution = lspPlan.getLogisticChains().iterator().next(); singleSolution.addShipmentToChain(lspShipment); diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubResource.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubResource.java index 88966658..fd168b32 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubResource.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubResource.java @@ -31,6 +31,7 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; +import org.matsim.freight.logistics.shipment.LspShipment; /** * {@link LSPResource} bei der die geplanten Tätigkeiten NICHT am Verkehr teilnehmen. @@ -40,7 +41,7 @@ * *

An entry is added to the schedule of the shipments that is an instance of * ScheduledShipmentHandle. There, the name of the Resource and the client element are entered, so - * that the way that the {@link org.matsim.freight.logistics.shipment.LSPShipment} takes is + * that the way that the {@link LspShipment} takes is * specified. In addition, the planned start and end time of the handling (i.e. cross-docking) of * the shipment is entered. In the example, cross-docking starts as soon as the considered * LSPShipment arrives at the {@link TransshipmentHubResource} and ends after a fixed and a size diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubScheduler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubScheduler.java index 9f5b226a..a5491b99 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubScheduler.java @@ -30,9 +30,9 @@ import org.matsim.freight.logistics.LogisticChainElement; import org.matsim.freight.logistics.LspShipmentWithTime; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; -import org.matsim.freight.logistics.shipment.ShipmentPlan; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipmentPlan; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; /*package-private*/ class TransshipmentHubScheduler extends LSPResourceScheduler { @@ -72,8 +72,8 @@ private void updateSchedule(LspShipmentWithTime tuple) { } private void addShipmentHandleElement(LspShipmentWithTime tuple) { - ShipmentUtils.ScheduledShipmentHandleBuilder builder = - ShipmentUtils.ScheduledShipmentHandleBuilder.newInstance(); + LspShipmentUtils.ScheduledShipmentHandleBuilder builder = + LspShipmentUtils.ScheduledShipmentHandleBuilder.newInstance(); builder.setStartTime(tuple.getTime()); builder.setEndTime( tuple.getTime() + capacityNeedFixed + capacityNeedLinear * tuple.getLspShipment().getSize()); @@ -83,22 +83,22 @@ private void addShipmentHandleElement(LspShipmentWithTime tuple) { builder.setLogisticsChainElement(element); } } - ShipmentPlanElement handle = builder.build(); + LspShipmentPlanElement handle = builder.build(); String idString = handle.getResourceId() + String.valueOf(handle.getLogisticChainElement().getId()) + handle.getElementType(); - Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) + Id id = Id.create(idString, LspShipmentPlanElement.class); + LspShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, handle); } private void addShipmentToEventHandler(LspShipmentWithTime tuple) { for (LogisticChainElement element : transshipmentHubResource.getClientElements()) { if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { - ShipmentPlan shipmentPlan = - ShipmentUtils.getOrCreateShipmentPlan(lspPlan, tuple.getLspShipment().getId()); - eventHandler.addShipment(tuple.getLspShipment(), element, shipmentPlan); + LspShipmentPlan lspShipmentPlan = + LspShipmentUtils.getOrCreateShipmentPlan(lspPlan, tuple.getLspShipment().getId()); + eventHandler.addShipment(tuple.getLspShipment(), element, lspShipmentPlan); break; } } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubTourEndEventHandler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubTourEndEventHandler.java index 687dfd5d..4250e867 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubTourEndEventHandler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubTourEndEventHandler.java @@ -96,12 +96,12 @@ public void reset(int iteration) { } public void addShipment( - LSPShipment lspShipment, LogisticChainElement logisticChainElement, ShipmentPlan shipmentPlan) { + LspShipment lspShipment, LogisticChainElement logisticChainElement, LspShipmentPlan lspShipmentPlan) { TransshipmentHubEventHandlerPair pair = new TransshipmentHubEventHandlerPair(lspShipment, logisticChainElement); - for (ShipmentPlanElement planElement : shipmentPlan.getPlanElements().values()) { - if (planElement instanceof ShipmentLeg transport) { + for (LspShipmentPlanElement planElement : lspShipmentPlan.getPlanElements().values()) { + if (planElement instanceof LspShipmentLeg transport) { if (transport.getLogisticChainElement().getNextElement() == logisticChainElement) { servicesWaitedFor.put(transport.getCarrierService(), pair); } @@ -133,7 +133,7 @@ && allServicesAreInOnePoint(tour) && (tour.getStartLinkId() != transshipmentHubResource.getStartLinkId())) { final CarrierService carrierService = serviceActivity.getService(); - final LSPShipment lspShipment = servicesWaitedFor.get(carrierService).lspShipment; + final LspShipment lspShipment = servicesWaitedFor.get(carrierService).lspShipment; // NOTE: Do NOT add time vor unloading all goods, because they are included for the // main run (Service activity at end of tour) final double expHandlingDuration = @@ -156,7 +156,7 @@ && allServicesAreInOnePoint(tour) if (tour.getEndLinkId() == transshipmentHubResource.getStartLinkId()) { final CarrierService carrierService = serviceActivity.getService(); - final LSPShipment lspShipment = servicesWaitedFor.get(carrierService).lspShipment; + final LspShipment lspShipment = servicesWaitedFor.get(carrierService).lspShipment; // TODO: Adding this here to be more in line with the schedule and have the shipment // log fitting to it. @@ -204,23 +204,23 @@ private double getTotalUnloadingTime(Tour tour) { private void logHandlingInHub( CarrierService carrierService, double startTime, double endTime) { - LSPShipment lspShipment = servicesWaitedFor.get(carrierService).lspShipment; + LspShipment lspShipment = servicesWaitedFor.get(carrierService).lspShipment; { // Old logging approach - will be removed at some point in time - ShipmentPlanElement handle = - ShipmentUtils.LoggedShipmentHandleBuilder.newInstance() + LspShipmentPlanElement handle = + LspShipmentUtils.LoggedShipmentHandleBuilder.newInstance() .setLinkId(linkId) .setResourceId(resourceId) .setStartTime(startTime) .setEndTime(endTime) .setLogisticsChainElement(servicesWaitedFor.get(carrierService).element) .build(); - Id loadId = + Id loadId = Id.create( handle.getResourceId() + String.valueOf(handle.getLogisticChainElement().getId()) + handle.getElementType(), - ShipmentPlanElement.class); + LspShipmentPlanElement.class); if (!lspShipment.getShipmentLog().getPlanElements().containsKey(loadId)) { lspShipment.getShipmentLog().addPlanElement(loadId, handle); } @@ -228,7 +228,7 @@ private void logHandlingInHub( } private void throwHandlingEvent( - CarrierTourEndEvent event, LSPShipment lspShipment, double expHandlingDuration) { + CarrierTourEndEvent event, LspShipment lspShipment, double expHandlingDuration) { // New event-based approach // Todo: We need to decide what we write into the exp. handling duration: See #175 for // discussion. @@ -267,10 +267,10 @@ public Id getLinkId() { } public static class TransshipmentHubEventHandlerPair { - public final LSPShipment lspShipment; + public final LspShipment lspShipment; public final LogisticChainElement element; - public TransshipmentHubEventHandlerPair(LSPShipment lspShipment, LogisticChainElement element) { + public TransshipmentHubEventHandlerPair(LspShipment lspShipment, LogisticChainElement element) { this.lspShipment = lspShipment; this.element = element; } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentHandle.java b/src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentHandle.java similarity index 94% rename from src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentHandle.java rename to src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentHandle.java index 5dc9d060..a9970d4b 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentHandle.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentHandle.java @@ -24,14 +24,14 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -class ScheduledShipmentHandle implements ShipmentPlanElement { +/*package*/ class LoggedLspShipmentHandle implements LspShipmentPlanElement { private final double startTime; private final double endTime; private final LogisticChainElement element; private final Id resourceId; - ScheduledShipmentHandle(ShipmentUtils.ScheduledShipmentHandleBuilder builder) { + LoggedLspShipmentHandle(LspShipmentUtils.LoggedShipmentHandleBuilder builder) { this.startTime = builder.startTime; this.endTime = builder.endTime; this.element = builder.element; @@ -39,27 +39,27 @@ class ScheduledShipmentHandle implements ShipmentPlanElement { } @Override - public String getElementType() { - return "HANDLE"; + public LogisticChainElement getLogisticChainElement() { + return element; } @Override - public double getStartTime() { - return startTime; + public Id getResourceId() { + return resourceId; } @Override - public double getEndTime() { - return endTime; + public String getElementType() { + return "HANDLE"; } @Override - public LogisticChainElement getLogisticChainElement() { - return element; + public double getStartTime() { + return startTime; } @Override - public Id getResourceId() { - return resourceId; + public double getEndTime() { + return endTime; } } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentLoad.java b/src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentLoad.java similarity index 93% rename from src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentLoad.java rename to src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentLoad.java index 825a871d..ac094116 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentLoad.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentLoad.java @@ -24,14 +24,14 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -/*package-private*/ class LoggedShipmentLoad implements ShipmentPlanElement { +/*package-private*/ class LoggedLspShipmentLoad implements LspShipmentPlanElement { private final double startTime; private final double endTime; private final LogisticChainElement element; private final Id resourceId; - LoggedShipmentLoad(ShipmentUtils.LoggedShipmentLoadBuilder builder) { + LoggedLspShipmentLoad(LspShipmentUtils.LoggedShipmentLoadBuilder builder) { this.startTime = builder.getStartTime(); this.endTime = builder.getEndTime(); this.element = builder.getElement(); diff --git a/src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentTransport.java b/src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentTransport.java similarity index 95% rename from src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentTransport.java rename to src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentTransport.java index 0554efc6..6ab1650c 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentTransport.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentTransport.java @@ -27,7 +27,7 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -final class LoggedShipmentTransport implements ShipmentLeg { +final class LoggedLspShipmentTransport implements LspShipmentLeg { private final double startTime; private final LogisticChainElement element; @@ -36,7 +36,7 @@ final class LoggedShipmentTransport implements ShipmentLeg { private double endTime; private Id toLinkId; - LoggedShipmentTransport(ShipmentUtils.LoggedShipmentTransportBuilder builder) { + LoggedLspShipmentTransport(LspShipmentUtils.LoggedShipmentTransportBuilder builder) { this.startTime = builder.getStartTime(); this.element = builder.getElement(); this.resourceId = builder.getResourceId(); diff --git a/src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentUnload.java b/src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentUnload.java similarity index 93% rename from src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentUnload.java rename to src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentUnload.java index ab895b19..20d88e70 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentUnload.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LoggedLspShipmentUnload.java @@ -24,14 +24,14 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -class LoggedShipmentUnload implements ShipmentPlanElement { +class LoggedLspShipmentUnload implements LspShipmentPlanElement { private final double startTime; private final double endTime; private final LogisticChainElement element; private final Id resourceId; - LoggedShipmentUnload(ShipmentUtils.LoggedShipmentUnloadBuilder builder) { + LoggedLspShipmentUnload(LspShipmentUtils.LoggedShipmentUnloadBuilder builder) { this.startTime = builder.startTime; this.endTime = builder.endTime; this.element = builder.element; diff --git a/src/main/java/org/matsim/freight/logistics/shipment/LSPShipment.java b/src/main/java/org/matsim/freight/logistics/shipment/LspShipment.java similarity index 91% rename from src/main/java/org/matsim/freight/logistics/shipment/LSPShipment.java rename to src/main/java/org/matsim/freight/logistics/shipment/LspShipment.java index bb8eaa85..700f969d 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/LSPShipment.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LspShipment.java @@ -39,8 +39,8 @@ * link IDs. * */ -public interface LSPShipment - extends Identifiable, Attributable, HasSimulationTrackers { +public interface LspShipment + extends Identifiable, Attributable, HasSimulationTrackers { Id getFrom(); // same as in CarrierShipment @@ -56,8 +56,8 @@ public interface LSPShipment double getPickupServiceTime(); // same as in CarrierShipment - ShipmentPlan getShipmentLog(); + LspShipmentPlan getShipmentLog(); - Collection getRequirements(); + Collection getRequirements(); } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/LSPShipmentImpl.java b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentImpl.java similarity index 90% rename from src/main/java/org/matsim/freight/logistics/shipment/LSPShipmentImpl.java rename to src/main/java/org/matsim/freight/logistics/shipment/LspShipmentImpl.java index 9be18a05..4d0f48a5 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/LSPShipmentImpl.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentImpl.java @@ -28,7 +28,7 @@ import org.matsim.freight.carriers.TimeWindow; import org.matsim.freight.logistics.LSPDataObject; -class LSPShipmentImpl extends LSPDataObject implements LSPShipment { +class LspShipmentImpl extends LSPDataObject implements LspShipment { private final Id fromLinkId; private final Id toLinkId; @@ -39,12 +39,12 @@ class LSPShipmentImpl extends LSPDataObject implements LSPShipment private final double pickupServiceTime; // private final ShipmentPlan shipmentPlan; @Deprecated // This will be removed in the future and replaced by using the events. KMT, Mai'23 - private final ShipmentPlan shipmentLog; - private final List lspShipmentRequirements; + private final LspShipmentPlan shipmentLog; + private final List lspShipmentRequirements; // private Id lspId; - LSPShipmentImpl(ShipmentUtils.LSPShipmentBuilder builder) { + LspShipmentImpl(LspShipmentUtils.LspShipmentBuilder builder) { super(builder.id); this.fromLinkId = builder.fromLinkId; this.toLinkId = builder.toLinkId; @@ -54,7 +54,7 @@ class LSPShipmentImpl extends LSPDataObject implements LSPShipment this.deliveryServiceTime = builder.deliveryServiceTime; this.pickupServiceTime = builder.pickupServiceTime; // this.shipmentPlan = new ShipmentPlanImpl(this.getId()); - this.shipmentLog = new ShipmentPlanImpl(this.getId()); + this.shipmentLog = new LspShipmentPlanImpl(this.getId()); this.lspShipmentRequirements = new ArrayList<>(); this.lspShipmentRequirements.addAll(builder.lspShipmentRequirements); } @@ -81,7 +81,7 @@ public TimeWindow getDeliveryTimeWindow() { @Deprecated // This will be removed in the future and replaced by using the events. KMT, Mai'23 @Override - public ShipmentPlan getShipmentLog() { + public LspShipmentPlan getShipmentLog() { return shipmentLog; } @@ -96,7 +96,7 @@ public double getDeliveryServiceTime() { } @Override - public Collection getRequirements() { + public Collection getRequirements() { return lspShipmentRequirements; } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentLeg.java b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentLeg.java similarity index 86% rename from src/main/java/org/matsim/freight/logistics/shipment/ShipmentLeg.java rename to src/main/java/org/matsim/freight/logistics/shipment/LspShipmentLeg.java index 3997d9fa..3b5d4c00 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentLeg.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentLeg.java @@ -5,7 +5,7 @@ import org.matsim.freight.carriers.Carrier; import org.matsim.freight.carriers.CarrierService; -public interface ShipmentLeg extends ShipmentPlanElement { +public interface LspShipmentLeg extends LspShipmentPlanElement { Id getToLinkId(); void setToLinkId(Id endLinkId); diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlan.java b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlan.java similarity index 82% rename from src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlan.java rename to src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlan.java index b45ac302..03cb42d0 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlan.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlan.java @@ -24,15 +24,15 @@ import org.matsim.api.core.v01.Id; import org.matsim.freight.logistics.HasBackpointer; -public interface ShipmentPlan extends HasBackpointer> { +public interface LspShipmentPlan extends HasBackpointer> { - Id getLspShipmentId(); + Id getLspShipmentId(); - Map, ShipmentPlanElement> getPlanElements(); + Map, LspShipmentPlanElement> getPlanElements(); - void addPlanElement(Id id, ShipmentPlanElement element); + void addPlanElement(Id id, LspShipmentPlanElement element); - ShipmentPlanElement getMostRecentEntry(); + LspShipmentPlanElement getMostRecentEntry(); void clear(); } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanElement.java b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlanElement.java similarity index 97% rename from src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanElement.java rename to src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlanElement.java index 299b990d..5809ddfa 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanElement.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlanElement.java @@ -24,7 +24,7 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -public interface ShipmentPlanElement { +public interface LspShipmentPlanElement { LogisticChainElement getLogisticChainElement(); diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanImpl.java b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlanImpl.java similarity index 76% rename from src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanImpl.java rename to src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlanImpl.java index 688e257f..89f1abcd 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanImpl.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentPlanImpl.java @@ -23,39 +23,39 @@ import java.util.*; import org.matsim.api.core.v01.Id; -/*package-private*/ class ShipmentPlanImpl implements ShipmentPlan { +/*package-private*/ class LspShipmentPlanImpl implements LspShipmentPlan { - private final Id lspShipmentId; - private final LinkedHashMap, ShipmentPlanElement> planElements; + private final Id lspShipmentId; + private final LinkedHashMap, LspShipmentPlanElement> planElements; - ShipmentPlanImpl(Id lspShipmentId) { + LspShipmentPlanImpl(Id lspShipmentId) { this.lspShipmentId = lspShipmentId; this.planElements = new LinkedHashMap<>(); } // TODO: Ist kein embedding container! @Override - public void setEmbeddingContainer(Id pointer) { + public void setEmbeddingContainer(Id pointer) { throw new RuntimeException("not implemented"); } @Override - public Id getLspShipmentId() { + public Id getLspShipmentId() { return lspShipmentId; } @Override - public void addPlanElement(Id id, ShipmentPlanElement element) { + public void addPlanElement(Id id, LspShipmentPlanElement element) { planElements.put(id, element); } @Override - public Map, ShipmentPlanElement> getPlanElements() { + public Map, LspShipmentPlanElement> getPlanElements() { return Collections.unmodifiableMap(planElements); } @Override - public ShipmentPlanElement getMostRecentEntry() { + public LspShipmentPlanElement getMostRecentEntry() { // there is no method to remove entries. in consequence, the only way to change the result of // this method is to "add" additional material into the plan. Possibly, @@ -63,7 +63,7 @@ public ShipmentPlanElement getMostRecentEntry() { // figure out how the next one can be added. However, this then // should be sorted by sequence of addition, not by timing. ??? kai/kai, apr'21 - ArrayList logList = new ArrayList<>(planElements.values()); + ArrayList logList = new ArrayList<>(planElements.values()); logList.sort(new LogElementComparator()); Collections.reverse(logList); return logList.getFirst(); @@ -74,10 +74,10 @@ public void clear() { planElements.clear(); } - static class LogElementComparator implements Comparator { + static class LogElementComparator implements Comparator { @Override - public int compare(ShipmentPlanElement o1, ShipmentPlanElement o2) { + public int compare(LspShipmentPlanElement o1, LspShipmentPlanElement o2) { if (o1.getStartTime() > o2.getStartTime()) { return 1; } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/LSPShipmentRequirement.java b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentRequirement.java similarity index 97% rename from src/main/java/org/matsim/freight/logistics/shipment/LSPShipmentRequirement.java rename to src/main/java/org/matsim/freight/logistics/shipment/LspShipmentRequirement.java index a1ebdbee..42a685d2 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/LSPShipmentRequirement.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentRequirement.java @@ -22,7 +22,7 @@ import org.matsim.freight.logistics.LogisticChain; -public interface LSPShipmentRequirement { +public interface LspShipmentRequirement { boolean checkRequirement(LogisticChain solution); } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentUtils.java b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentUtils.java similarity index 85% rename from src/main/java/org/matsim/freight/logistics/shipment/ShipmentUtils.java rename to src/main/java/org/matsim/freight/logistics/shipment/LspShipmentUtils.java index 074e72a5..4ce345f7 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentUtils.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/LspShipmentUtils.java @@ -32,37 +32,37 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -public final class ShipmentUtils { - private ShipmentUtils() {} // do not instantiate +public final class LspShipmentUtils { + private LspShipmentUtils() {} // do not instantiate - public static Comparator createShipmentPlanElementComparator() { + public static Comparator createShipmentPlanElementComparator() { return new ShipmentPlanElementComparator(); } /** - * Gives back the {@link ShipmentPlan} object of the {@link LSPPlan}, which matches to the id of - * the {@link LSPShipment} + * Gives back the {@link LspShipmentPlan} object of the {@link LSPPlan}, which matches to the id of + * the {@link LspShipment} * * @param lspPlan The lspPlan in which this method tries to find the shipmentPlan. * @param shipmentId Id of the shipment for which the Plan should be found. * @return the ShipmentPlan object or null, if it is not found. */ - public static ShipmentPlan getOrCreateShipmentPlan(LSPPlan lspPlan, Id shipmentId) { + public static LspShipmentPlan getOrCreateShipmentPlan(LSPPlan lspPlan, Id shipmentId) { // Return shipmentPlan if already existing in LspPlan - for (ShipmentPlan shipmentPlan : lspPlan.getShipmentPlans()) { - if (shipmentPlan.getLspShipmentId().equals(shipmentId)) { - return shipmentPlan; + for (LspShipmentPlan lspShipmentPlan : lspPlan.getShipmentPlans()) { + if (lspShipmentPlan.getLspShipmentId().equals(shipmentId)) { + return lspShipmentPlan; } } // ShipmentPlan does not exist in LspPlan. Will create one, add it to the LspPlan. - ShipmentPlan newShipmentPlan = new ShipmentPlanImpl(shipmentId); - lspPlan.addShipmentPlan(newShipmentPlan); - return newShipmentPlan; + LspShipmentPlan newLspShipmentPlan = new LspShipmentPlanImpl(shipmentId); + lspPlan.addShipmentPlan(newLspShipmentPlan); + return newLspShipmentPlan; } - public static final class LSPShipmentBuilder { - final Id id; - final List lspShipmentRequirements; + public static final class LspShipmentBuilder { + final Id id; + final List lspShipmentRequirements; Id fromLinkId; Id toLinkId; TimeWindow startTimeWindow; @@ -71,13 +71,13 @@ public static final class LSPShipmentBuilder { double deliveryServiceTime; double pickupServiceTime; - private LSPShipmentBuilder(Id id) { + private LspShipmentBuilder(Id id) { this.lspShipmentRequirements = new ArrayList<>(); this.id = id; } - public static LSPShipmentBuilder newInstance(Id id) { - return new LSPShipmentBuilder(id); + public static LspShipmentBuilder newInstance(Id id) { + return new LspShipmentBuilder(id); } public void setFromLinkId(Id fromLinkId) { @@ -104,17 +104,17 @@ public void setDeliveryServiceTime(double serviceTime) { this.deliveryServiceTime = serviceTime; } - public LSPShipmentBuilder setPickupServiceTime(double serviceTime) { + public LspShipmentBuilder setPickupServiceTime(double serviceTime) { this.pickupServiceTime = serviceTime; return this; } - public void addRequirement(LSPShipmentRequirement requirement) { + public void addRequirement(LspShipmentRequirement requirement) { lspShipmentRequirements.add(requirement); } - public LSPShipment build() { - return new LSPShipmentImpl(this); + public LspShipment build() { + return new LspShipmentImpl(this); } } @@ -141,8 +141,8 @@ public void setLogisticsChainElement(LogisticChainElement element) { this.element = element; } - public LoggedShipmentLoad build() { - return new LoggedShipmentLoad(this); + public LoggedLspShipmentLoad build() { + return new LoggedLspShipmentLoad(this); } public double getStartTime() { @@ -211,8 +211,8 @@ public void setLogisticChainElement(LogisticChainElement element) { this.element = element; } - public LoggedShipmentTransport build() { - return new LoggedShipmentTransport(this); + public LoggedLspShipmentTransport build() { + return new LoggedLspShipmentTransport(this); } // --- Getters --- // @@ -300,8 +300,8 @@ public void setCarrierId(Id carrierId) { this.carrierId = carrierId; } - public LoggedShipmentUnload build() { - return new LoggedShipmentUnload(this); + public LoggedLspShipmentUnload build() { + return new LoggedLspShipmentUnload(this); } } @@ -343,8 +343,8 @@ public LoggedShipmentHandleBuilder setLinkId(Id linkId) { return this; } - public ShipmentPlanElement build() { - return new LoggedShipmentHandle(this); + public LspShipmentPlanElement build() { + return new LoggedLspShipmentHandle(this); } } @@ -381,8 +381,8 @@ public void setResourceId(Id resourceId) { this.resourceId = resourceId; } - public ScheduledShipmentLoad build() { - return new ScheduledShipmentLoad(this); + public ScheduledLspShipmentLoad build() { + return new ScheduledLspShipmentLoad(this); } } @@ -435,8 +435,8 @@ public void setCarrierService(CarrierService carrierService) { this.carrierService = carrierService; } - public ScheduledShipmentTransport build() { - return new ScheduledShipmentTransport(this); + public ScheduledLspShipmentTransport build() { + return new ScheduledLspShipmentTransport(this); } } @@ -469,8 +469,8 @@ public void setResourceId(Id resourceId) { this.resourceId = resourceId; } - public ScheduledShipmentUnload build() { - return new ScheduledShipmentUnload(this); + public ScheduledLspShipmentUnload build() { + return new ScheduledLspShipmentUnload(this); } } @@ -503,8 +503,8 @@ public void setResourceId(Id resourceId) { this.resourceId = resourceId; } - public ScheduledShipmentHandle build() { - return new ScheduledShipmentHandle(this); + public ScheduledLspShipmentHandle build() { + return new ScheduledLspShipmentHandle(this); } } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentHandle.java b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentHandle.java similarity index 93% rename from src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentHandle.java rename to src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentHandle.java index 0f6fca91..54e6bef9 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/LoggedShipmentHandle.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentHandle.java @@ -24,30 +24,20 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -/*package*/ class LoggedShipmentHandle implements ShipmentPlanElement { +class ScheduledLspShipmentHandle implements LspShipmentPlanElement { private final double startTime; private final double endTime; private final LogisticChainElement element; private final Id resourceId; - LoggedShipmentHandle(ShipmentUtils.LoggedShipmentHandleBuilder builder) { + ScheduledLspShipmentHandle(LspShipmentUtils.ScheduledShipmentHandleBuilder builder) { this.startTime = builder.startTime; this.endTime = builder.endTime; this.element = builder.element; this.resourceId = builder.resourceId; } - @Override - public LogisticChainElement getLogisticChainElement() { - return element; - } - - @Override - public Id getResourceId() { - return resourceId; - } - @Override public String getElementType() { return "HANDLE"; @@ -62,4 +52,14 @@ public double getStartTime() { public double getEndTime() { return endTime; } + + @Override + public LogisticChainElement getLogisticChainElement() { + return element; + } + + @Override + public Id getResourceId() { + return resourceId; + } } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentLoad.java b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentLoad.java similarity index 93% rename from src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentLoad.java rename to src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentLoad.java index c9164338..df709de1 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentLoad.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentLoad.java @@ -24,14 +24,14 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -class ScheduledShipmentLoad implements ShipmentPlanElement { +class ScheduledLspShipmentLoad implements LspShipmentPlanElement { private final double startTime; private final double endTime; private final LogisticChainElement element; private final Id resourceId; - ScheduledShipmentLoad(ShipmentUtils.ScheduledShipmentLoadBuilder builder) { + ScheduledLspShipmentLoad(LspShipmentUtils.ScheduledShipmentLoadBuilder builder) { this.startTime = builder.startTime; this.endTime = builder.endTime; this.element = builder.element; diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentTransport.java b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentTransport.java similarity index 95% rename from src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentTransport.java rename to src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentTransport.java index dbc9b68d..d4f69efa 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentTransport.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentTransport.java @@ -27,7 +27,7 @@ import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; -final class ScheduledShipmentTransport implements ShipmentLeg { +final class ScheduledLspShipmentTransport implements LspShipmentLeg { private final double startTime; private final double endTime; @@ -38,7 +38,7 @@ final class ScheduledShipmentTransport implements ShipmentLeg { private final Id toLinkId; private final CarrierService carrierService; - ScheduledShipmentTransport(ShipmentUtils.ScheduledShipmentTransportBuilder builder) { + ScheduledLspShipmentTransport(LspShipmentUtils.ScheduledShipmentTransportBuilder builder) { this.startTime = builder.startTime; this.endTime = builder.endTime; this.element = builder.element; diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentUnload.java b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentUnload.java new file mode 100644 index 00000000..1746e854 --- /dev/null +++ b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledLspShipmentUnload.java @@ -0,0 +1,66 @@ +/* + * *********************************************************************** * + * * project: org.matsim.* + * * *********************************************************************** * + * * * + * * copyright : (C) 2022 by the members listed in the COPYING, * + * * LICENSE and WARRANTY file. * + * * email : info at matsim dot org * + * * * + * * *********************************************************************** * + * * * + * * This program is free software; you can redistribute it and/or modify * + * * it under the terms of the GNU General Public License as published by * + * * the Free Software Foundation; either version 2 of the License, or * + * * (at your option) any later version. * + * * See also COPYING, LICENSE and WARRANTY file * + * * * + * * *********************************************************************** + */ + +package org.matsim.freight.logistics.shipment; + +import org.matsim.api.core.v01.Id; +import org.matsim.freight.logistics.LSPResource; +import org.matsim.freight.logistics.LogisticChainElement; + +class ScheduledLspShipmentUnload implements LspShipmentPlanElement { + + private final double startTime; + private final double endTime; + private final LogisticChainElement element; + private final Id resourceId; + + ScheduledLspShipmentUnload(LspShipmentUtils.ScheduledShipmentUnloadBuilder builder) { + this.startTime = builder.startTime; + this.endTime = builder.endTime; + this.element = builder.element; + this.resourceId = builder.resourceId; + } + + @Override + public String getElementType() { + return "UNLOAD"; + } + + @Override + public double getStartTime() { + return startTime; + } + + @Override + public double getEndTime() { + return endTime; + } + + @Override + public LogisticChainElement getLogisticChainElement() { + return element; + } + + @Override + public Id getResourceId() { + return resourceId; + } + +} diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentUnload.java b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentUnload.java deleted file mode 100644 index cba573cf..00000000 --- a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentUnload.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * *********************************************************************** * - * * project: org.matsim.* - * * *********************************************************************** * - * * * - * * copyright : (C) 2022 by the members listed in the COPYING, * - * * LICENSE and WARRANTY file. * - * * email : info at matsim dot org * - * * * - * * *********************************************************************** * - * * * - * * This program is free software; you can redistribute it and/or modify * - * * it under the terms of the GNU General Public License as published by * - * * the Free Software Foundation; either version 2 of the License, or * - * * (at your option) any later version. * - * * See also COPYING, LICENSE and WARRANTY file * - * * * - * * *********************************************************************** - */ - -package org.matsim.freight.logistics.shipment; - -import org.matsim.api.core.v01.Id; -import org.matsim.freight.carriers.Carrier; -import org.matsim.freight.carriers.CarrierService; -import org.matsim.freight.logistics.LSPResource; -import org.matsim.freight.logistics.LogisticChainElement; - -class ScheduledShipmentUnload implements ShipmentPlanElement { - - private final double startTime; - private final double endTime; - private final LogisticChainElement element; - private final Id resourceId; - - ScheduledShipmentUnload(ShipmentUtils.ScheduledShipmentUnloadBuilder builder) { - this.startTime = builder.startTime; - this.endTime = builder.endTime; - this.element = builder.element; - this.resourceId = builder.resourceId; - } - - @Override - public String getElementType() { - return "UNLOAD"; - } - - @Override - public double getStartTime() { - return startTime; - } - - @Override - public double getEndTime() { - return endTime; - } - - @Override - public LogisticChainElement getLogisticChainElement() { - return element; - } - - @Override - public Id getResourceId() { - return resourceId; - } - -} diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanElementComparator.java b/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanElementComparator.java index 4ccc9bed..39eec066 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanElementComparator.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/ShipmentPlanElementComparator.java @@ -22,11 +22,11 @@ import java.util.Comparator; -final class ShipmentPlanElementComparator implements Comparator { +final class ShipmentPlanElementComparator implements Comparator { ShipmentPlanElementComparator() {} - public int compare(ShipmentPlanElement o1, ShipmentPlanElement o2) { + public int compare(LspShipmentPlanElement o1, LspShipmentPlanElement o2) { if (o1.getStartTime() > o2.getStartTime()) { return 1; } diff --git a/src/test/java/org/matsim/freight/logistics/events/LspEventsReaderTest.java b/src/test/java/org/matsim/freight/logistics/events/LspEventsReaderTest.java index f3135c8e..5455ab84 100644 --- a/src/test/java/org/matsim/freight/logistics/events/LspEventsReaderTest.java +++ b/src/test/java/org/matsim/freight/logistics/events/LspEventsReaderTest.java @@ -17,7 +17,7 @@ import org.matsim.freight.carriers.events.CarrierTourEndEvent; import org.matsim.freight.carriers.events.eventhandler.CarrierTourEndEventHandler; import org.matsim.freight.logistics.LSPResource; -import org.matsim.freight.logistics.shipment.LSPShipment; +import org.matsim.freight.logistics.shipment.LspShipment; /** * @author Kai Martins-Turner (kturner) @@ -25,8 +25,8 @@ public class LspEventsReaderTest { private final List lspEvents = List.of( - new HandlingInHubStartsEvent(110.0, Id.createLinkId("TestLink1"), Id.create("shipment1", LSPShipment.class), Id.create("Hub1", LSPResource.class), 42.0), - new HandlingInHubStartsEvent(142.0, Id.createLinkId("TestLink2"), Id.create("shipment2", LSPShipment.class), Id.create("Hub2", LSPResource.class), 13.0), + new HandlingInHubStartsEvent(110.0, Id.createLinkId("TestLink1"), Id.create("shipment1", LspShipment.class), Id.create("Hub1", LSPResource.class), 42.0), + new HandlingInHubStartsEvent(142.0, Id.createLinkId("TestLink2"), Id.create("shipment2", LspShipment.class), Id.create("Hub2", LSPResource.class), 13.0), //Check if also some of the regular CarrierEvents get read correctly -> Load their mapping in the LspEventsReaderMapping via createCustomEventMappers() works new CarrierTourEndEvent(500, Id.create("c1", Carrier.class), Id.createLinkId("TestLinkC1"), Id.createVehicleId("myVehicle"), Id.create("myCarrierTour", Tour.class)) diff --git a/src/test/java/org/matsim/freight/logistics/examples/lspReplanning/CollectionLSPReplanningTest.java b/src/test/java/org/matsim/freight/logistics/examples/lspReplanning/CollectionLSPReplanningTest.java index 1af7cb9a..fb34b02e 100644 --- a/src/test/java/org/matsim/freight/logistics/examples/lspReplanning/CollectionLSPReplanningTest.java +++ b/src/test/java/org/matsim/freight/logistics/examples/lspReplanning/CollectionLSPReplanningTest.java @@ -49,8 +49,8 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.CollectionCarrierResourceBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -149,8 +149,8 @@ public void initialize() { for (int i = 1; i < 21; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -173,7 +173,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } collectionLSP.scheduleLogisticChains(); diff --git a/src/test/java/org/matsim/freight/logistics/examples/lspScoring/CollectionLSPScoringTest.java b/src/test/java/org/matsim/freight/logistics/examples/lspScoring/CollectionLSPScoringTest.java index d7a2a28a..a4bba784 100644 --- a/src/test/java/org/matsim/freight/logistics/examples/lspScoring/CollectionLSPScoringTest.java +++ b/src/test/java/org/matsim/freight/logistics/examples/lspScoring/CollectionLSPScoringTest.java @@ -45,8 +45,8 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -108,8 +108,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); for (int i = 1; i < (numberOfShipments + 1); i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -132,7 +132,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } diff --git a/src/test/java/org/matsim/freight/logistics/examples/lspScoring/MultipleIterationsCollectionLSPScoringTest.java b/src/test/java/org/matsim/freight/logistics/examples/lspScoring/MultipleIterationsCollectionLSPScoringTest.java index a07f3d5f..e9ad8611 100644 --- a/src/test/java/org/matsim/freight/logistics/examples/lspScoring/MultipleIterationsCollectionLSPScoringTest.java +++ b/src/test/java/org/matsim/freight/logistics/examples/lspScoring/MultipleIterationsCollectionLSPScoringTest.java @@ -48,8 +48,8 @@ import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -135,8 +135,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); for (int i = 1; i < (numberOfShipments + 1); i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -159,7 +159,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } diff --git a/src/test/java/org/matsim/freight/logistics/examples/multipleChains/MultipleChainsReplanningTest.java b/src/test/java/org/matsim/freight/logistics/examples/multipleChains/MultipleChainsReplanningTest.java index 5002d177..fb13ae0c 100644 --- a/src/test/java/org/matsim/freight/logistics/examples/multipleChains/MultipleChainsReplanningTest.java +++ b/src/test/java/org/matsim/freight/logistics/examples/multipleChains/MultipleChainsReplanningTest.java @@ -51,9 +51,9 @@ import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlan; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlan; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -151,7 +151,7 @@ private static LSP createLSP(Scenario scenario) { .setLogisticChainScheduler(ResourceImplementationUtils.createDefaultSimpleForwardLogisticChainScheduler(createResourcesListFromLSPPlans(lspPlans))) .build(); - for (LSPShipment shipment : createInitialLSPShipments()) { + for (LspShipment shipment : createInitialLSPShipments()) { lsp.assignShipmentToLSP(shipment); } @@ -160,14 +160,14 @@ private static LSP createLSP(Scenario scenario) { return lsp; } - private static Collection createInitialLSPShipments() { - List shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments() { + List shipmentList = new ArrayList<>(); int capacityDemand = 1; for (int i = 1; i <= 10; i++) { if (i % 2 != 0) { - Id id = Id.create("ShipmentLeft_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentLeft_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); @@ -180,8 +180,8 @@ private static Collection createInitialLSPShipments() { shipmentList.add(builder.build()); } else { - Id id = Id.create("ShipmentRight_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("ShipmentRight_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); builder.setCapacityDemand(capacityDemand); builder.setFromLinkId(DEPOT_LINK_ID); @@ -257,8 +257,8 @@ public void install() { innovatedPlanShipmentPlanCount = lsp.getPlans().get(1).getShipmentPlans().size(); innovatedPlanFirstLogisticChainShipmentCount = lsp.getPlans().get(1).getLogisticChains().iterator().next().getLspShipmentIds().size(); - for (ShipmentPlan shipmentPlan : lsp.getPlans().get(1).getShipmentPlans()) { - if (shipmentPlan.getPlanElements().isEmpty()) { + for (LspShipmentPlan lspShipmentPlan : lsp.getPlans().get(1).getShipmentPlans()) { + if (lspShipmentPlan.getPlanElements().isEmpty()) { innovatedPlanHasEmptyShipmentPlanElements = true; } } diff --git a/src/test/java/org/matsim/freight/logistics/examples/multipleChains/WorstPlanSelectorTest.java b/src/test/java/org/matsim/freight/logistics/examples/multipleChains/WorstPlanSelectorTest.java index 81f6a499..1334632b 100644 --- a/src/test/java/org/matsim/freight/logistics/examples/multipleChains/WorstPlanSelectorTest.java +++ b/src/test/java/org/matsim/freight/logistics/examples/multipleChains/WorstPlanSelectorTest.java @@ -52,8 +52,8 @@ import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -182,7 +182,7 @@ private static LSP createLSP(Scenario scenario) { .build(); lsp.addPlan(lspPlan_twoChains); - for (LSPShipment shipment : createInitialLSPShipments(network)) { + for (LspShipment shipment : createInitialLSPShipments(network)) { lsp.assignShipmentToLSP(shipment); } @@ -191,8 +191,8 @@ private static LSP createLSP(Scenario scenario) { return lsp; } - private static Collection createInitialLSPShipments(Network network) { - List shipmentList = new ArrayList<>(); + private static Collection createInitialLSPShipments(Network network) { + List shipmentList = new ArrayList<>(); Random rand2 = MatsimRandom.getLocalInstance(); @@ -208,8 +208,8 @@ private static Collection createInitialLSPShipments(Network network } for(int i = 1; i <= 10; i++) { - Id id = Id.create("Shipment_" + i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create("Shipment_" + i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1; builder.setCapacityDemand(capacityDemand); diff --git a/src/test/java/org/matsim/freight/logistics/examples/requirementsChecking/AssignerRequirementsTest.java b/src/test/java/org/matsim/freight/logistics/examples/requirementsChecking/AssignerRequirementsTest.java index 19ced633..4e1c2b3f 100644 --- a/src/test/java/org/matsim/freight/logistics/examples/requirementsChecking/AssignerRequirementsTest.java +++ b/src/test/java/org/matsim/freight/logistics/examples/requirementsChecking/AssignerRequirementsTest.java @@ -60,8 +60,8 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -164,8 +164,8 @@ public void initialize() { Random rand = new Random(1); for (int i = 1; i < 11; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand.nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -194,19 +194,19 @@ public void initialize() { builder.addRequirement(new RedRequirement()); } - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } } @Test public void testAssignerRequirements() { - for (Id shipmentId : blueChain.getLspShipmentIds()) { - LSPShipment shipment = LSPUtils.findLspShipment(blueChain.getLSP(), shipmentId); + for (Id shipmentId : blueChain.getLspShipmentIds()) { + LspShipment shipment = LSPUtils.findLspShipment(blueChain.getLSP(), shipmentId); assertTrue(shipment.getRequirements().iterator().next() instanceof BlueRequirement); } - for (Id shipmentId : redChain.getLspShipmentIds()) { - LSPShipment shipment = LSPUtils.findLspShipment(redChain.getLSP(), shipmentId); + for (Id shipmentId : redChain.getLspShipmentIds()) { + LspShipment shipment = LSPUtils.findLspShipment(redChain.getLSP(), shipmentId); assertTrue(shipment.getRequirements().iterator().next() instanceof RedRequirement); } } diff --git a/src/test/java/org/matsim/freight/logistics/examples/simulationTrackers/CollectionTrackerTest.java b/src/test/java/org/matsim/freight/logistics/examples/simulationTrackers/CollectionTrackerTest.java index 56358341..a21406e5 100644 --- a/src/test/java/org/matsim/freight/logistics/examples/simulationTrackers/CollectionTrackerTest.java +++ b/src/test/java/org/matsim/freight/logistics/examples/simulationTrackers/CollectionTrackerTest.java @@ -52,8 +52,8 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.CollectionCarrierResourceBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -150,8 +150,8 @@ public void initialize() { for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -174,7 +174,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } collectionLSP.scheduleLogisticChains(); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CollectionLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CollectionLSPMobsimTest.java index bae6d195..4419384b 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CollectionLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CollectionLSPMobsimTest.java @@ -49,9 +49,9 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -148,8 +148,8 @@ public void initialize() { { List linkList = new LinkedList<>(scenario.getNetwork().getLinks().values()); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -171,7 +171,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } collectionLSP.scheduleLogisticChains(); @@ -205,26 +205,26 @@ public void install() { @Test public void testCollectionLSPMobsim() { - for (LSPShipment shipment : collectionLSP.getLspShipments()) { + for (LspShipment shipment : collectionLSP.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); log.warn(""); log.warn("shipment schedule plan elements:"); - for (ShipmentPlanElement planElement : ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()) { + for (LspShipmentPlanElement planElement : LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()) { log.warn(planElement); } log.warn(""); log.warn("shipment log plan elements:"); - for (ShipmentPlanElement planElement : shipment.getShipmentLog().getPlanElements().values()) { + for (LspShipmentPlanElement planElement : shipment.getShipmentLog().getPlanElements().values()) { log.warn(planElement); } log.warn(""); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); //Das muss besser in den SchedulingTest rein assertSame(collectionLSP.getResources().iterator().next(), collectionResource); @@ -232,8 +232,8 @@ public void testCollectionLSPMobsim() { assertSame(carrierResource.getCarrier(), carrier); assertEquals(1, carrier.getServices().size()); - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CompleteLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CompleteLSPMobsimTest.java index 8276d02f..1988bcec 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CompleteLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CompleteLSPMobsimTest.java @@ -44,9 +44,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -239,8 +239,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); Random rand = new Random(1); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + rand.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -277,7 +277,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); completeLSP.assignShipmentToLSP(shipment); } completeLSP.scheduleLogisticChains(); @@ -310,15 +310,15 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : completeLSP.getLspShipments()) { + for (LspShipment shipment : completeLSP.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstAndSecondReloadLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstAndSecondReloadLSPMobsimTest.java index 72a085ec..2b6e7a76 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstAndSecondReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstAndSecondReloadLSPMobsimTest.java @@ -48,9 +48,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -211,8 +211,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -249,7 +249,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -279,16 +279,16 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstReloadLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstReloadLSPMobsimTest.java index 64d4bd44..d8fdf860 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstReloadLSPMobsimTest.java @@ -48,9 +48,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -154,8 +154,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -193,7 +193,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -223,16 +223,16 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunLSPMobsimTest.java index e7657713..7d4e9723 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunLSPMobsimTest.java @@ -48,9 +48,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -187,8 +187,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -225,7 +225,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -255,16 +255,16 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunOnlyLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunOnlyLSPMobsimTest.java index 6d9704f7..ecc10a2a 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunOnlyLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunOnlyLSPMobsimTest.java @@ -46,9 +46,9 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -133,8 +133,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -171,7 +171,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -201,16 +201,16 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCollectionLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCollectionLSPMobsimTest.java index c2a9ed98..66960b3e 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCollectionLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCollectionLSPMobsimTest.java @@ -51,9 +51,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.CollectionCarrierResourceBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -136,8 +136,8 @@ public void initialize() { int numberOfShipments = 1 + MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -160,7 +160,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } collectionLSP.scheduleLogisticChains(); @@ -200,16 +200,16 @@ public void install() { @Test public void testCollectionLSPMobsim() { - for (LSPShipment shipment : collectionLSP.getLspShipments()) { + for (LspShipment shipment : collectionLSP.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCompleteLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCompleteLSPMobsimTest.java index 6ef78b8b..8f8c8a04 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCompleteLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCompleteLSPMobsimTest.java @@ -53,9 +53,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -253,8 +253,8 @@ public void initialize() { int numberOfShipments = MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -291,7 +291,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); completeLSP.assignShipmentToLSP(shipment); } completeLSP.scheduleLogisticChains(); @@ -334,15 +334,15 @@ public void initialize() { @Test public void testCompleteLSPMobsim() { - for (LSPShipment shipment : completeLSP.getLspShipments()) { + for (LspShipment shipment : completeLSP.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstAndSecondReloadLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstAndSecondReloadLSPMobsimTest.java index e2e7f500..391ca626 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstAndSecondReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstAndSecondReloadLSPMobsimTest.java @@ -53,9 +53,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -217,8 +217,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); int numberOfShipments = 1 + MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -255,7 +255,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -293,16 +293,16 @@ public void initialize() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstReloadLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstReloadLSPMobsimTest.java index 572f7bee..c5bb82b0 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstReloadLSPMobsimTest.java @@ -53,9 +53,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -158,8 +158,8 @@ public void initialize() { int numberOfShipments = 1 + MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -197,7 +197,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -236,16 +236,16 @@ public void initialize() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsMainRunLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsMainRunLSPMobsimTest.java index 6ca4a9cb..1a6fa2f4 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsMainRunLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsMainRunLSPMobsimTest.java @@ -53,9 +53,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -195,8 +195,8 @@ public void initialize() { int numberOfShipments = 1 + MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -233,7 +233,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -277,16 +277,16 @@ public void initialize() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCollectionLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCollectionLSPMobsimTest.java index 992cdded..fb6f8f90 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCollectionLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCollectionLSPMobsimTest.java @@ -47,9 +47,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.CollectionCarrierResourceBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -131,8 +131,8 @@ public void initialize() { int numberOfShipments = 1 + MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -155,7 +155,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } collectionLSP.scheduleLogisticChains(); @@ -185,16 +185,16 @@ public void install() { @Test public void testCollectionLSPMobsim() { - for (LSPShipment shipment : collectionLSP.getLspShipments()) { + for (LspShipment shipment : collectionLSP.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCompleteLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCompleteLSPMobsimTest.java index 98d133aa..f6f3960a 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCompleteLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCompleteLSPMobsimTest.java @@ -55,9 +55,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -256,8 +256,8 @@ public void initialize() { int numberOfShipments = MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -294,7 +294,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); completeLSP.assignShipmentToLSP(shipment); } completeLSP.scheduleLogisticChains(); @@ -337,16 +337,16 @@ public void initialize() { @Test public void testCompleteLSPMobsim() { - for (LSPShipment shipment : completeLSP.getLspShipments()) { + for (LspShipment shipment : completeLSP.getLspShipments()) { log.info("comparing shipment: " + shipment.getId()); assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstAndSecondReloadLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstAndSecondReloadLSPMobsimTest.java index fc0dc5c1..fd7a39fb 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstAndSecondReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstAndSecondReloadLSPMobsimTest.java @@ -53,9 +53,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -216,8 +216,8 @@ public void initialize() { List linkList = new LinkedList<>(network.getLinks().values()); int numberOfShipments = 1 + MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -254,7 +254,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -292,16 +292,16 @@ public void initialize() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstReloadLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstReloadLSPMobsimTest.java index fc8b079f..da82b7cf 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstReloadLSPMobsimTest.java @@ -48,9 +48,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -154,8 +154,8 @@ public void initialize() { int numberOfShipments = 1 + MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -193,7 +193,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -228,16 +228,16 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsMainRunLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsMainRunLSPMobsimTest.java index 8846bdad..e160cc96 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsMainRunLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsMainRunLSPMobsimTest.java @@ -48,9 +48,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -189,8 +189,8 @@ public void initialize() { int numberOfShipments = 1 + MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -227,7 +227,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -261,16 +261,16 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - assertEquals(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + assertEquals(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(), shipment.getShipmentLog().getPlanElements().size()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); assertEquals(scheduleElement.getElementType(), logElement.getElementType()); assertSame(scheduleElement.getResourceId(), logElement.getResourceId()); assertSame(scheduleElement.getLogisticChainElement(), logElement.getLogisticChainElement()); diff --git a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/RepeatedMultipleShipmentsCompleteLSPMobsimTest.java b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/RepeatedMultipleShipmentsCompleteLSPMobsimTest.java index 2229d579..adbecdef 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/RepeatedMultipleShipmentsCompleteLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/RepeatedMultipleShipmentsCompleteLSPMobsimTest.java @@ -48,9 +48,9 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -247,8 +247,8 @@ public void initialize() { int numberOfShipments = MatsimRandom.getRandom().nextInt(50); for (int i = 1; i < 1 + numberOfShipments; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = 1 + MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -285,7 +285,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); completeLSP.assignShipmentToLSP(shipment); } completeLSP.scheduleLogisticChains(); @@ -317,19 +317,19 @@ public void testCompleteLSPMobsim() { int numberOfIterations = 1 + MatsimRandom.getRandom().nextInt(10); for (int i = 0; i < numberOfIterations; i++) { initialize(); - for (LSPShipment shipment : completeLSP.getLspShipments()) { + for (LspShipment shipment : completeLSP.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); - ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); - logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); + ArrayList logElements = new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + logElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); - for (ShipmentPlanElement scheduleElement : scheduleElements) { - ShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); + for (LspShipmentPlanElement scheduleElement : scheduleElements) { + LspShipmentPlanElement logElement = logElements.get(scheduleElements.indexOf(scheduleElement)); if (!scheduleElement.getElementType().equals(logElement.getElementType())) { System.out.println(scheduleElement.getElementType()); System.out.println(logElement.getElementType()); - for (int j = 0; j < ShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(); j++) { + for (int j = 0; j < LspShipmentUtils.getOrCreateShipmentPlan(completeLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(); j++) { System.out.println("Scheduled: " + scheduleElements.get(j).getLogisticChainElement().getId() + " " + scheduleElements.get(j).getResourceId() + " " + scheduleElements.get(j).getElementType() + " Start: " + scheduleElements.get(j).getStartTime() + " End: " + scheduleElements.get(j).getEndTime()); } System.out.println(); diff --git a/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLSPShipmentAssigmentTest.java b/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLspShipmentAssigmentTest.java similarity index 95% rename from src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLSPShipmentAssigmentTest.java rename to src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLspShipmentAssigmentTest.java index 47adb865..fbe1c7f3 100644 --- a/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLSPShipmentAssigmentTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLspShipmentAssigmentTest.java @@ -39,11 +39,11 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.CollectionCarrierResourceBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; -public class CollectionLSPShipmentAssigmentTest { +public class CollectionLspShipmentAssigmentTest { private LSPPlan collectionPlan; private LSP collectionLSP; @@ -113,8 +113,8 @@ public void initialize() { for (int i = 1; i < 11; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = MatsimRandom.getRandom().nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -136,7 +136,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } } diff --git a/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLSPShipmentAssignerTest.java b/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLspShipmentAssignerTest.java similarity index 97% rename from src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLSPShipmentAssignerTest.java rename to src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLspShipmentAssignerTest.java index ca924374..0dc32141 100644 --- a/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLSPShipmentAssignerTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLspShipmentAssignerTest.java @@ -40,12 +40,12 @@ import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; -public class CompleteLSPShipmentAssignerTest { +public class CompleteLspShipmentAssignerTest { private LSPPlan completePlan; private LSP completeLSP; @@ -226,8 +226,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); for (int i = 1; i < 11; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = MatsimRandom.getRandom().nextInt(10); builder.setCapacityDemand(capacityDemand); diff --git a/src/test/java/org/matsim/freight/logistics/lspShipmentTest/CollectionShipmentBuilderTest.java b/src/test/java/org/matsim/freight/logistics/lspShipmentTest/CollectionShipmentBuilderTest.java index d117e117..7e886f5a 100644 --- a/src/test/java/org/matsim/freight/logistics/lspShipmentTest/CollectionShipmentBuilderTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspShipmentTest/CollectionShipmentBuilderTest.java @@ -35,13 +35,13 @@ import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; import org.matsim.freight.carriers.TimeWindow; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; public class CollectionShipmentBuilderTest { private Network network; - private ArrayList shipments; + private ArrayList shipments; @BeforeEach @@ -57,8 +57,8 @@ public void initialize() { this.shipments = new ArrayList<>(); for (int i = 1; i < 11; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = MatsimRandom.getRandom().nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -88,7 +88,7 @@ public void initialize() { @Test public void testShipments() { assertEquals(10, shipments.size()); - for (LSPShipment shipment : shipments) { + for (LspShipment shipment : shipments) { assertNotNull(shipment.getId()); assertNotNull(shipment.getSize()); assertNotNull(shipment.getDeliveryTimeWindow()); diff --git a/src/test/java/org/matsim/freight/logistics/lspShipmentTest/CompleteShipmentBuilderTest.java b/src/test/java/org/matsim/freight/logistics/lspShipmentTest/CompleteShipmentBuilderTest.java index 6049dae0..ad1fd3ea 100644 --- a/src/test/java/org/matsim/freight/logistics/lspShipmentTest/CompleteShipmentBuilderTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspShipmentTest/CompleteShipmentBuilderTest.java @@ -35,13 +35,13 @@ import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; import org.matsim.freight.carriers.TimeWindow; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; public class CompleteShipmentBuilderTest { private Network network; - private ArrayList shipments; + private ArrayList shipments; @BeforeEach public void initialize() { @@ -54,8 +54,8 @@ public void initialize() { this.shipments = new ArrayList<>(); for (int i = 1; i < 11; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = MatsimRandom.getRandom().nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -100,7 +100,7 @@ public void initialize() { @Test public void testShipments() { assertEquals(10, shipments.size()); - for (LSPShipment shipment : shipments) { + for (LspShipment shipment : shipments) { assertNotNull(shipment.getId()); assertNotNull(shipment.getSize()); assertNotNull(shipment.getDeliveryTimeWindow()); diff --git a/src/test/java/org/matsim/freight/logistics/lspShipmentTest/DistributionShipmentBuilderTest.java b/src/test/java/org/matsim/freight/logistics/lspShipmentTest/DistributionShipmentBuilderTest.java index 05082fd6..aaaa3966 100644 --- a/src/test/java/org/matsim/freight/logistics/lspShipmentTest/DistributionShipmentBuilderTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspShipmentTest/DistributionShipmentBuilderTest.java @@ -35,13 +35,13 @@ import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; import org.matsim.freight.carriers.TimeWindow; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; public class DistributionShipmentBuilderTest { private Network network; - private ArrayList shipments; + private ArrayList shipments; @BeforeEach @@ -57,8 +57,8 @@ public void initialize() { this.shipments = new ArrayList<>(); for (int i = 1; i < 11; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = MatsimRandom.getRandom().nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -90,7 +90,7 @@ public void initialize() { @Test public void testShipments() { assertEquals(10, shipments.size()); - for (LSPShipment shipment : shipments) { + for (LspShipment shipment : shipments) { assertNotNull(shipment.getId()); assertNotNull(shipment.getSize()); assertNotNull(shipment.getDeliveryTimeWindow()); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/CollectionLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/CollectionLSPSchedulingTest.java index 345b5563..76b370b3 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/CollectionLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/CollectionLSPSchedulingTest.java @@ -39,9 +39,9 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.CollectionCarrierResourceBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.VehicleType; public class CollectionLSPSchedulingTest { @@ -115,8 +115,8 @@ public void initialize() { for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -139,7 +139,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } collectionLSP.scheduleLogisticChains(); @@ -149,20 +149,20 @@ public void initialize() { @Test public void testCollectionLSPScheduling() { - for (LSPShipment shipment : collectionLSP.getLspShipments()) { - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : collectionLSP.getLspShipments()) { + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); - for (int i = 0; i < ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { + for (int i = 0; i < LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { System.out.println("Scheduled: " + scheduleElements.get(i).getLogisticChainElement().getId() + " " + scheduleElements.get(i).getResourceId() + " " + scheduleElements.get(i).getElementType() + " Start: " + scheduleElements.get(i).getStartTime() + " End: " + scheduleElements.get(i).getEndTime()); } System.out.println(); } - for (LSPShipment shipment : collectionLSP.getLspShipments()) { - assertEquals(3, ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + for (LspShipment shipment : collectionLSP.getLspShipments()) { + assertEquals(3, LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); assertEquals("UNLOAD", planElements.get(2).getElementType()); assertTrue(planElements.get(2).getEndTime() >= (0)); assertTrue(planElements.get(2).getEndTime() <= (24*3600)); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/CompleteLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/CompleteLSPSchedulingTest.java index b50e4bb5..0700e202 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/CompleteLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/CompleteLSPSchedulingTest.java @@ -42,9 +42,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -240,8 +240,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); Random rand = new Random(1); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -278,7 +278,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -288,11 +288,11 @@ public void initialize() { @Test public void testCompletedLSPScheduling() { - for (LSPShipment shipment : lsp.getLspShipments()) { - ArrayList elementList = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + ArrayList elementList = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + elementList.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); - for (ShipmentPlanElement element : elementList) { + for (LspShipmentPlanElement element : elementList) { System.out.println(element.getLogisticChainElement().getId() + "\t\t" + element.getResourceId() + "\t\t" + element.getElementType() + "\t\t" + element.getStartTime() + "\t\t" + element.getEndTime()); } System.out.println(); @@ -301,10 +301,10 @@ public void testCompletedLSPScheduling() { ArrayList solutionElements = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements()); ArrayList resources = new ArrayList<>(lsp.getResources()); - for (LSPShipment shipment : lsp.getLspShipments()) { - assertEquals(11, ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + assertEquals(11, LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertEquals("UNLOAD", planElements.get(10).getElementType()); assertTrue(planElements.get(10).getEndTime() >= (0)); @@ -435,7 +435,7 @@ public void testCompletedLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -462,7 +462,7 @@ public void testCompletedLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), toLinkId); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -480,11 +480,11 @@ public void testCompletedLSPScheduling() { assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertEquals(6, shipment.getSimulationTrackers().size()); eventHandlers = new ArrayList<>(shipment.getSimulationTrackers()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertTrue(eventHandlers.get(0) instanceof LSPTourEndEventHandler); LSPTourEndEventHandler endHandler = (LSPTourEndEventHandler) eventHandlers.get(0); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstReloadLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstReloadLSPSchedulingTest.java index 84b01f26..907bf933 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstReloadLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstReloadLSPSchedulingTest.java @@ -41,9 +41,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -141,8 +141,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -180,7 +180,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -190,22 +190,22 @@ public void initialize() { @Test public void testFirstReloadLSPScheduling() { - for (LSPShipment shipment : lsp.getLspShipments()) { - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); - for (int i = 0; i < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { + for (int i = 0; i < LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { System.out.println("Scheduled: " + scheduleElements.get(i).getLogisticChainElement().getId() + " " + scheduleElements.get(i).getResourceId() + " " + scheduleElements.get(i).getElementType() + " Start: " + scheduleElements.get(i).getStartTime() + " End: " + scheduleElements.get(i).getEndTime()); } System.out.println(); } - for (LSPShipment shipment : lsp.getLspShipments()) { - assertEquals(4, ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + assertEquals(4, LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertEquals("HANDLE", planElements.get(3).getElementType()); assertTrue(planElements.get(3).getEndTime() >= (0)); assertTrue(planElements.get(3).getEndTime() <= (24*3600)); @@ -257,7 +257,7 @@ public void testFirstReloadLSPScheduling() { for (Entry entry : reloadEventHandler.getServicesWaitedFor().entrySet()) { CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -276,10 +276,10 @@ public void testFirstReloadLSPScheduling() { } - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertEquals(2, shipment.getSimulationTrackers().size()); eventHandlers = new ArrayList<>(shipment.getSimulationTrackers()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); assertTrue(eventHandlers.get(0) instanceof LSPTourEndEventHandler); LSPTourEndEventHandler endHandler = (LSPTourEndEventHandler) eventHandlers.get(0); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MainRunLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MainRunLSPSchedulingTest.java index 60d727c0..f6ba4882 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MainRunLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MainRunLSPSchedulingTest.java @@ -41,9 +41,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -176,8 +176,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -215,7 +215,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -225,22 +225,22 @@ public void initialize() { @Test public void testMainRunLSPScheduling() { - for (LSPShipment shipment : lsp.getLspShipments()) { - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); - for (int i = 0; i < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { + for (int i = 0; i < LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { System.out.println("Scheduled: " + scheduleElements.get(i).getLogisticChainElement().getId() + " " + scheduleElements.get(i).getResourceId() + " " + scheduleElements.get(i).getElementType() + " Start: " + scheduleElements.get(i).getStartTime() + " End: " + scheduleElements.get(i).getEndTime()); } System.out.println(); } - for (LSPShipment shipment : lsp.getLspShipments()) { - assertEquals(7, ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + assertEquals(7, LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertEquals("UNLOAD", planElements.get(6).getElementType()); assertTrue(planElements.get(6).getEndTime() >= (0)); assertTrue(planElements.get(6).getEndTime() <= (24*3600)); @@ -324,7 +324,7 @@ public void testMainRunLSPScheduling() { for (Entry entry : reloadEventHandler.getServicesWaitedFor().entrySet()) { CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -342,11 +342,11 @@ public void testMainRunLSPScheduling() { assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertEquals(4, shipment.getSimulationTrackers().size()); eventHandlers = new ArrayList<>(shipment.getSimulationTrackers()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); ArrayList solutionElements = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements()); ArrayList resources = new ArrayList<>(lsp.getResources()); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCollectionLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCollectionLSPSchedulingTest.java index 540dc805..2d361882 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCollectionLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCollectionLSPSchedulingTest.java @@ -39,9 +39,9 @@ import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.CollectionCarrierResourceBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -118,8 +118,8 @@ public void initialize() { for (int i = 1; i < 100; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); Random random = new Random(1); int capacityDemand = random.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -142,7 +142,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); collectionLSP.assignShipmentToLSP(shipment); } collectionLSP.scheduleLogisticChains(); @@ -152,20 +152,20 @@ public void initialize() { @Test public void testCollectionLSPScheduling() { - for (LSPShipment shipment : collectionLSP.getLspShipments()) { - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : collectionLSP.getLspShipments()) { + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); - for (int i = 0; i < ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { + for (int i = 0; i < LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { System.out.println("Scheduled: " + scheduleElements.get(i).getLogisticChainElement().getId() + " " + scheduleElements.get(i).getResourceId() + " " + scheduleElements.get(i).getElementType() + " Start: " + scheduleElements.get(i).getStartTime() + " End: " + scheduleElements.get(i).getEndTime()); } System.out.println(); } - for (LSPShipment shipment : collectionLSP.getLspShipments()) { - assertEquals(3, ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + for (LspShipment shipment : collectionLSP.getLspShipments()) { + assertEquals(3, LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); assertEquals("UNLOAD", planElements.get(2).getElementType()); assertTrue(planElements.get(2).getEndTime() >= (0)); assertTrue(planElements.get(2).getEndTime() <= (24*3600)); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCompleteLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCompleteLSPSchedulingTest.java index 5d175cc0..a923362b 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCompleteLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCompleteLSPSchedulingTest.java @@ -42,9 +42,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -243,8 +243,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); Random rand = new Random(1); for (int i = 1; i < 100; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = rand.nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -281,7 +281,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -291,11 +291,11 @@ public void initialize() { @Test public void testCompletedLSPScheduling() { - for (LSPShipment shipment : lsp.getLspShipments()) { - ArrayList elementList = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + ArrayList elementList = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + elementList.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); - for (ShipmentPlanElement element : elementList) { + for (LspShipmentPlanElement element : elementList) { System.out.println(element.getLogisticChainElement().getId() + "\t\t" + element.getResourceId() + "\t\t" + element.getElementType() + "\t\t" + element.getStartTime() + "\t\t" + element.getEndTime()); } System.out.println(); @@ -304,10 +304,10 @@ public void testCompletedLSPScheduling() { ArrayList solutionElements = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements()); ArrayList resources = new ArrayList<>(lsp.getResources()); - for (LSPShipment shipment : lsp.getLspShipments()) { - assertEquals(11, ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + assertEquals(11, LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertEquals("UNLOAD", planElements.get(10).getElementType()); assertTrue(planElements.get(10).getEndTime() >= (0)); @@ -438,7 +438,7 @@ public void testCompletedLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -465,7 +465,7 @@ public void testCompletedLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), toLinkId); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -483,11 +483,11 @@ public void testCompletedLSPScheduling() { assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertEquals(6, shipment.getSimulationTrackers().size()); eventHandlers = new ArrayList<>(shipment.getSimulationTrackers()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertTrue(eventHandlers.get(0) instanceof LSPTourEndEventHandler); LSPTourEndEventHandler endHandler = (LSPTourEndEventHandler) eventHandlers.get(0); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsFirstReloadLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsFirstReloadLSPSchedulingTest.java index 0cc57219..28fc6df2 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsFirstReloadLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsFirstReloadLSPSchedulingTest.java @@ -41,9 +41,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -140,8 +140,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); for (int i = 1; i < 100; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -179,7 +179,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -189,22 +189,22 @@ public void initialize() { @Test public void testFirstReloadLSPScheduling() { - for (LSPShipment shipment : lsp.getLspShipments()) { - ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + ArrayList scheduleElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + scheduleElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); - for (int i = 0; i < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { + for (int i = 0; i < LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size(); i++) { System.out.println("Scheduled: " + scheduleElements.get(i).getLogisticChainElement().getId() + " " + scheduleElements.get(i).getResourceId() + " " + scheduleElements.get(i).getElementType() + " Start: " + scheduleElements.get(i).getStartTime() + " End: " + scheduleElements.get(i).getEndTime()); } System.out.println(); } - for (LSPShipment shipment : lsp.getLspShipments()) { - assertEquals(4, ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + assertEquals(4, LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertEquals("HANDLE", planElements.get(3).getElementType()); assertTrue(planElements.get(3).getEndTime() >= (0)); assertTrue(planElements.get(3).getEndTime() <= (24*3600)); @@ -256,7 +256,7 @@ public void testFirstReloadLSPScheduling() { for (Entry entry : reloadEventHandler.getServicesWaitedFor().entrySet()) { CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -275,10 +275,10 @@ public void testFirstReloadLSPScheduling() { } - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertEquals(2, shipment.getSimulationTrackers().size()); eventHandlers = new ArrayList<>(shipment.getSimulationTrackers()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); assertTrue(eventHandlers.get(0) instanceof LSPTourEndEventHandler); LSPTourEndEventHandler endHandler = (LSPTourEndEventHandler) eventHandlers.get(0); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsMainRunLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsMainRunLSPSchedulingTest.java index 5c37fec9..b530b0cd 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsMainRunLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsMainRunLSPSchedulingTest.java @@ -41,9 +41,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -176,8 +176,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); for (int i = 1; i < 100; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); //Random random = new Random(1); int capacityDemand = MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -215,7 +215,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -237,10 +237,10 @@ public void testMainRunLSPScheduling() { }*/ - for (LSPShipment shipment : lsp.getLspShipments()) { - assertEquals(7, ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + assertEquals(7, LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertEquals("UNLOAD", planElements.get(6).getElementType()); assertTrue(planElements.get(6).getEndTime() >= (0)); assertTrue(planElements.get(6).getEndTime() <= (24*3600)); @@ -324,7 +324,7 @@ public void testMainRunLSPScheduling() { for (Entry entry : reloadEventHandler.getServicesWaitedFor().entrySet()) { CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -342,11 +342,11 @@ public void testMainRunLSPScheduling() { assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertEquals(4, shipment.getSimulationTrackers().size()); eventHandlers = new ArrayList<>(shipment.getSimulationTrackers()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); ArrayList solutionElements = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements()); ArrayList resources = new ArrayList<>(lsp.getResources()); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsSecondReloadLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsSecondReloadLSPSchedulingTest.java index 77313d8f..0d0fa0c0 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsSecondReloadLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsSecondReloadLSPSchedulingTest.java @@ -42,9 +42,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -206,8 +206,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); for (int i = 1; i < 100; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = MatsimRandom.getRandom().nextInt(4); builder.setCapacityDemand(capacityDemand); @@ -244,7 +244,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -264,10 +264,10 @@ public void testSecondReloadLSPScheduling() { System.out.println(); }*/ - for (LSPShipment shipment : lsp.getLspShipments()) { - assertEquals(8, ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + assertEquals(8, LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertEquals("HANDLE", planElements.get(7).getElementType()); assertTrue(planElements.get(7).getEndTime() >= (0)); @@ -365,7 +365,7 @@ public void testSecondReloadLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -392,7 +392,7 @@ public void testSecondReloadLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), toLinkId); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -410,11 +410,11 @@ public void testSecondReloadLSPScheduling() { assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertEquals(4, shipment.getSimulationTrackers().size()); eventHandlers = new ArrayList<>(shipment.getSimulationTrackers()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); ArrayList solutionElements = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements()); ArrayList resources = new ArrayList<>(lsp.getResources()); diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/SecondReloadLSPSchedulingTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/SecondReloadLSPSchedulingTest.java index 2deeac37..3fc5b72d 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/SecondReloadLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/SecondReloadLSPSchedulingTest.java @@ -42,9 +42,9 @@ import org.matsim.freight.logistics.*; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TranshipmentHubSchedulerBuilder; import org.matsim.freight.logistics.resourceImplementations.ResourceImplementationUtils.TransshipmentHubBuilder; -import org.matsim.freight.logistics.shipment.LSPShipment; -import org.matsim.freight.logistics.shipment.ShipmentPlanElement; -import org.matsim.freight.logistics.shipment.ShipmentUtils; +import org.matsim.freight.logistics.shipment.LspShipment; +import org.matsim.freight.logistics.shipment.LspShipmentPlanElement; +import org.matsim.freight.logistics.shipment.LspShipmentUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -206,8 +206,8 @@ public void initialize() { ArrayList linkList = new ArrayList<>(network.getLinks().values()); for (int i = 1; i < 2; i++) { - Id id = Id.create(i, LSPShipment.class); - ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); + Id id = Id.create(i, LspShipment.class); + LspShipmentUtils.LspShipmentBuilder builder = LspShipmentUtils.LspShipmentBuilder.newInstance(id); int capacityDemand = MatsimRandom.getRandom().nextInt(10); builder.setCapacityDemand(capacityDemand); @@ -244,7 +244,7 @@ public void initialize() { TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); + LspShipment shipment = builder.build(); lsp.assignShipmentToLSP(shipment); } lsp.scheduleLogisticChains(); @@ -254,20 +254,20 @@ public void initialize() { @Test public void testSecondReloadLSPScheduling() { - for (LSPShipment shipment : lsp.getLspShipments()) { - ArrayList elementList = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + ArrayList elementList = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + elementList.sort(LspShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); - for (ShipmentPlanElement element : elementList) { + for (LspShipmentPlanElement element : elementList) { System.out.println(element.getLogisticChainElement().getId() + " " + element.getResourceId() + " " + element.getElementType() + " " + element.getStartTime() + " " + element.getEndTime()); } System.out.println(); } - for (LSPShipment shipment : lsp.getLspShipments()) { - assertEquals(8, ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + for (LspShipment shipment : lsp.getLspShipments()) { + assertEquals(8, LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().size()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); assertEquals("HANDLE", planElements.get(7).getElementType()); assertTrue(planElements.get(7).getEndTime() >= (0)); @@ -365,7 +365,7 @@ public void testSecondReloadLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -392,7 +392,7 @@ public void testSecondReloadLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().lspShipment; + LspShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), toLinkId); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -410,11 +410,11 @@ public void testSecondReloadLSPScheduling() { assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getLspShipments()) { + for (LspShipment shipment : lsp.getLspShipments()) { assertEquals(4, shipment.getSimulationTrackers().size()); eventHandlers = new ArrayList<>(shipment.getSimulationTrackers()); - ArrayList planElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); - planElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); + ArrayList planElements = new ArrayList<>(LspShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); + planElements.sort(LspShipmentUtils.createShipmentPlanElementComparator()); ArrayList solutionElements = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements()); ArrayList resources = new ArrayList<>(lsp.getResources()); diff --git a/test/input/org/matsim/freight/logistics/io/lsps.xml b/test/input/org/matsim/freight/logistics/io/lsps.xml index 556ef25c..959a594a 100644 --- a/test/input/org/matsim/freight/logistics/io/lsps.xml +++ b/test/input/org/matsim/freight/logistics/io/lsps.xml @@ -20,16 +20,16 @@ - + - - + + - + @@ -42,16 +42,16 @@ - + - - + + - + @@ -87,7 +87,7 @@ - + @@ -95,8 +95,8 @@ - - + + @@ -104,8 +104,8 @@ - - + + @@ -113,8 +113,8 @@ - - + + @@ -122,8 +122,8 @@ - - + + @@ -131,8 +131,8 @@ - - + + @@ -140,8 +140,8 @@ - - + + @@ -149,8 +149,8 @@ - - + + @@ -158,8 +158,8 @@ - - + + @@ -167,8 +167,8 @@ - - + + @@ -176,7 +176,7 @@ - + @@ -186,56 +186,56 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - +