From 818f69dd77e98dfa5423856dbd0b54d72dead66a Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Mon, 12 Aug 2024 14:02:49 +0200 Subject: [PATCH] rename shipment(s) to lspShipments, to avoid confusions with (Carrier) Shipments --- .../ForwardLogisticChainSchedulerImpl.java | 2 +- .../logistics/InitialShipmentAssigner.java | 2 +- .../org/matsim/freight/logistics/LSP.java | 6 +-- .../logistics/LSPControlerListener.java | 4 +- .../org/matsim/freight/logistics/LSPImpl.java | 38 +++++++++---------- .../logistics/LSPResourceScheduler.java | 16 ++++---- .../matsim/freight/logistics/LSPUtils.java | 2 +- .../freight/logistics/LogisticChain.java | 4 +- .../freight/logistics/LogisticChainImpl.java | 18 ++++----- .../logistics/LspShipmentWithTime.java | 10 ++--- .../freight/logistics/WaitingShipments.java | 6 +-- .../logistics/WaitingShipmentsImpl.java | 12 +++--- .../ExampleSchedulingOfInitialPlan.java | 22 +++++------ .../ExampleSchedulingOfTransportChain.java | 12 +++--- ...chedulingOfTransportChainHubsVsDirect.java | 8 ++-- .../initialPlans/ExampleTwoEchelonGrid.java | 4 +- .../ExampleTwoEchelonGrid_NR.java | 4 +- .../examples/initialPlans/MyLSPScorer.java | 4 +- .../AssignmentStrategyFactory.java | 10 ++--- .../lspReplanning/MaybeTodayAssigner.java | 4 +- ...morrowShipmentAssignerStrategyFactory.java | 18 ++++----- .../lspScoring/ExampleLSPScoring.java | 12 +++--- .../ExampleMobsimOfSimpleLSP.java | 24 ++++++------ .../ExampleMobsimOfTransportChain.java | 24 ++++++------ .../ExampleGroceryDeliveryMultipleChains.java | 4 +- .../ExampleMultipleMixedEchelonChains.java | 4 +- .../ExampleMultipleOneEchelonChains.java | 12 +++--- ...pleMultipleOneEchelonChainsReplanning.java | 4 +- ...pleMultipleTwoEchelonChainsReplanning.java | 4 +- ...eTwoLspsGroceryDeliveryMultipleChains.java | 8 ++-- ...GroceryDeliveryMultipleChainsWithToll.java | 8 ++-- .../examples/multipleChains/MyLSPScorer.java | 4 +- .../PrimaryLogisticChainShipmentAssigner.java | 4 +- .../ProximityStrategyFactory.java | 32 ++++++++-------- ...stributionAllShipmentsStrategyFactory.java | 6 +-- .../RandomLogisticChainShipmentAssigner.java | 4 +- .../RandomShiftingStrategyFactory.java | 20 +++++----- .../RebalancingStrategyFactory.java | 8 ++-- ...stributionAllShipmentsStrategyFactory.java | 6 +-- ...undRobinLogisticChainShipmentAssigner.java | 4 +- .../ExampleCheckRequirementsOfAssigner.java | 30 +++++++-------- .../RequirementsAssigner.java | 6 +-- .../ExampleSimulationTrackers.java | 12 +++--- .../logistics/io/LSPPlanXmlParserV1.java | 16 ++++---- .../logistics/io/LSPPlanXmlWriter.java | 34 ++++++++--------- .../CollectionCarrierScheduler.java | 36 +++++++++--------- .../DistributionCarrierScheduler.java | 38 +++++++++---------- .../MainRunCarrierScheduler.java | 36 +++++++++--------- .../ResourceImplementationUtils.java | 16 ++++---- .../SimpleForwardLogisticChainScheduler.java | 2 +- .../SingleLogisticChainShipmentAssigner.java | 4 +- .../TransshipmentHubScheduler.java | 12 +++--- .../TransshipmentHubTourEndEventHandler.java | 16 ++++---- .../CollectionLSPReplanningTest.java | 4 +- .../lspScoring/CollectionLSPScoringTest.java | 4 +- ...pleIterationsCollectionLSPScoringTest.java | 4 +- .../MultipleChainsReplanningTest.java | 2 +- .../AssignerRequirementsTest.java | 4 +- .../CollectionElementTest.java | 8 ++-- .../DistributionElementTest.java | 8 ++-- .../MainRunElementTest.java | 8 ++-- .../SecondHubElementTest.java | 8 ++-- .../CollectionChainTest.java | 4 +- .../CompleteLogisticChainTest.java | 4 +- .../CollectionLSPMobsimTest.java | 2 +- .../lspMobsimTests/CompleteLSPMobsimTest.java | 2 +- .../FirstAndSecondReloadLSPMobsimTest.java | 2 +- .../FirstReloadLSPMobsimTest.java | 2 +- .../lspMobsimTests/MainRunLSPMobsimTest.java | 2 +- .../MainRunOnlyLSPMobsimTest.java | 2 +- ...ipleIterationsCollectionLSPMobsimTest.java | 2 +- ...ltipleIterationsCompleteLSPMobsimTest.java | 2 +- ...ionsFirstAndSecondReloadLSPMobsimTest.java | 2 +- ...pleIterationsFirstReloadLSPMobsimTest.java | 2 +- ...ultipleIterationsMainRunLSPMobsimTest.java | 2 +- ...tipleShipmentsCollectionLSPMobsimTest.java | 2 +- ...ultipleShipmentsCompleteLSPMobsimTest.java | 2 +- ...entsFirstAndSecondReloadLSPMobsimTest.java | 2 +- ...ipleShipmentsFirstReloadLSPMobsimTest.java | 2 +- ...MultipleShipmentsMainRunLSPMobsimTest.java | 2 +- ...ultipleShipmentsCompleteLSPMobsimTest.java | 2 +- .../CollectionLSPShipmentAssigmentTest.java | 10 ++--- .../CompleteLSPShipmentAssignerTest.java | 8 ++-- .../CollectionLSPSchedulingTest.java | 12 +++--- .../CompleteLSPSchedulingTest.java | 26 ++++++------- .../FirstHubElementTest.java | 8 ++-- .../FirstReloadLSPSchedulingTest.java | 20 +++++----- .../MainRunLSPSchedulingTest.java | 20 +++++----- ...eShipmentsCollectionLSPSchedulingTest.java | 10 ++--- ...pleShipmentsCompleteLSPSchedulingTest.java | 24 ++++++------ ...ShipmentsFirstReloadLSPSchedulingTest.java | 18 ++++----- ...ipleShipmentsMainRunLSPSchedulingTest.java | 16 ++++---- ...hipmentsSecondReloadLSPSchedulingTest.java | 22 +++++------ .../SecondReloadLSPSchedulingTest.java | 24 ++++++------ 94 files changed, 483 insertions(+), 483 deletions(-) diff --git a/src/main/java/org/matsim/freight/logistics/ForwardLogisticChainSchedulerImpl.java b/src/main/java/org/matsim/freight/logistics/ForwardLogisticChainSchedulerImpl.java index 52eb84ac..35ab6d92 100644 --- a/src/main/java/org/matsim/freight/logistics/ForwardLogisticChainSchedulerImpl.java +++ b/src/main/java/org/matsim/freight/logistics/ForwardLogisticChainSchedulerImpl.java @@ -131,7 +131,7 @@ private void insertShipmentsAtBeginning() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { LogisticChainElement firstElement = getFirstElement(solution); assert firstElement != null; - for (Id lspShipmentId : solution.getShipmentIds()) { + 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/InitialShipmentAssigner.java b/src/main/java/org/matsim/freight/logistics/InitialShipmentAssigner.java index dd14b767..84592875 100644 --- a/src/main/java/org/matsim/freight/logistics/InitialShipmentAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/InitialShipmentAssigner.java @@ -39,5 +39,5 @@ */ public interface InitialShipmentAssigner { - void assignToPlan(LSPPlan lspPlan, LSPShipment shipment); + 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 28672be0..fd807005 100644 --- a/src/main/java/org/matsim/freight/logistics/LSP.java +++ b/src/main/java/org/matsim/freight/logistics/LSP.java @@ -34,7 +34,7 @@ public interface LSP extends HasPlansAndId, HasSimulationTrackers { /** yyyy does this have to be exposed? */ - Collection getShipments(); + Collection getLspShipments(); /** ok (behavioral method) */ void scheduleLogisticChains(); @@ -46,8 +46,8 @@ public interface LSP extends HasPlansAndId, HasSimulationTrackers< void scoreSelectedPlan(); /** - * @param shipment ok (LSP needs to be told that it is responsible for shipment) + * @param lspShipment ok (LSP needs to be told that it is responsible for lspShipment) */ - void assignShipmentToLSP(LSPShipment shipment); + 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 fc6dc0ef..4ec6b0c7 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPControlerListener.java +++ b/src/main/java/org/matsim/freight/logistics/LSPControlerListener.java @@ -134,8 +134,8 @@ public void notifyBeforeMobsim(BeforeMobsimEvent event) { } // simulation trackers of shipments: - for (LSPShipment shipment : lsp.getShipments()) { - registerSimulationTrackers(shipment); + for (LSPShipment lspShipment : lsp.getLspShipments()) { + registerSimulationTrackers(lspShipment); } // simulation trackers of solutions: diff --git a/src/main/java/org/matsim/freight/logistics/LSPImpl.java b/src/main/java/org/matsim/freight/logistics/LSPImpl.java index 99319351..a8824e66 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPImpl.java +++ b/src/main/java/org/matsim/freight/logistics/LSPImpl.java @@ -30,8 +30,8 @@ /* package-private */ class LSPImpl extends LSPDataObject implements LSP { private static final Logger log = LogManager.getLogger(LSPImpl.class); - private final Collection shipments; - private final ArrayList plans; + private final Collection lspShipments; + private final ArrayList lspPlans; private final LogisticChainScheduler logisticChainScheduler; private final Collection resources; private LSPPlan selectedPlan; @@ -41,13 +41,13 @@ LSPImpl(LSPUtils.LSPBuilder builder) { super(builder.id); - this.shipments = new ArrayList<>(); - this.plans = new ArrayList<>(); + this.lspShipments = new ArrayList<>(); + this.lspPlans = new ArrayList<>(); this.logisticChainScheduler = builder.logisticChainScheduler; this.logisticChainScheduler.setEmbeddingContainer(this); this.selectedPlan = builder.initialPlan; this.selectedPlan.setLSP(this); - this.plans.add(builder.initialPlan); + this.lspPlans.add(builder.initialPlan); this.resources = builder.resources; } @@ -57,7 +57,7 @@ public static LSPPlan copyPlan(LSPPlan plan2copy) { LogisticChain newPlanChain = LSPUtils.LogisticChainBuilder.newInstance(initialPlanChain.getId()).build(); newPlanChain.getLogisticChainElements().addAll(initialPlanChain.getLogisticChainElements()); - newPlanChain.getShipmentIds().addAll(initialPlanChain.getShipmentIds()); + newPlanChain.getLspShipmentIds().addAll(initialPlanChain.getLspShipmentIds()); newPlanChains.add(newPlanChain); } @@ -95,7 +95,7 @@ public boolean addPlan(LSPPlan plan) { } } plan.setLSP(this); - return plans.add(plan); + return lspPlans.add(plan); } @Override @@ -107,7 +107,7 @@ public LSPPlan createCopyOfSelectedPlanAndMakeSelected() { @Override public ArrayList getPlans() { - return plans; + return lspPlans; } @Override @@ -117,16 +117,16 @@ public LSPPlan getSelectedPlan() { @Override public void setSelectedPlan(LSPPlan selectedPlan) { - if (!plans.contains(selectedPlan)) { - plans.add(selectedPlan); + if (!lspPlans.contains(selectedPlan)) { + lspPlans.add(selectedPlan); } this.selectedPlan = selectedPlan; } @Override - public boolean removePlan(LSPPlan plan) { - if (plans.contains(plan)) { - plans.remove(plan); + public boolean removePlan(LSPPlan lspPlan) { + if (lspPlans.contains(lspPlan)) { + lspPlans.remove(lspPlan); return true; } else { return false; @@ -147,17 +147,17 @@ public void scoreSelectedPlan() { } @Override - public void assignShipmentToLSP(LSPShipment shipment) { + public void assignShipmentToLSP(LSPShipment lspShipment) { // shipment.setLspId(this.getId()); // und rückweg dann auch darüber und dann // lsp.getselectedPlan.getShipment... - shipments.add(shipment); - for (LSPPlan lspPlan : plans) { - lspPlan.getInitialShipmentAssigner().assignToPlan(lspPlan, shipment); + lspShipments.add(lspShipment); + for (LSPPlan lspPlan : lspPlans) { + lspPlan.getInitialShipmentAssigner().assignToPlan(lspPlan, lspShipment); } } @Override - public Collection getShipments() { - return this.shipments; + public Collection getLspShipments() { + return this.lspShipments; } } diff --git a/src/main/java/org/matsim/freight/logistics/LSPResourceScheduler.java b/src/main/java/org/matsim/freight/logistics/LSPResourceScheduler.java index 833e3a71..43e489e6 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPResourceScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/LSPResourceScheduler.java @@ -81,7 +81,7 @@ public final void scheduleShipments(LSPPlan lspPlan, LSPResource resource, int b private void presortIncomingShipments() { this.lspShipmentsWithTime = new ArrayList<>(); for (LogisticChainElement element : resource.getClientElements()) { - lspShipmentsWithTime.addAll(element.getIncomingShipments().getShipments()); + lspShipmentsWithTime.addAll(element.getIncomingShipments().getLspShipmentsWTime()); } lspShipmentsWithTime.sort(Comparator.comparingDouble(LspShipmentWithTime::getTime)); } @@ -89,17 +89,17 @@ private void presortIncomingShipments() { private void switchHandledShipments(int bufferTime) { for (LspShipmentWithTime lspShipmentWithTime : lspShipmentsWithTime) { var shipmentPlan = - ShipmentUtils.getOrCreateShipmentPlan(lspPlan, lspShipmentWithTime.getShipment().getId()); + ShipmentUtils.getOrCreateShipmentPlan(lspPlan, lspShipmentWithTime.getLspShipment().getId()); double endOfTransportTime = shipmentPlan.getMostRecentEntry().getEndTime() + bufferTime; LspShipmentWithTime outgoingTuple = - new LspShipmentWithTime(endOfTransportTime, lspShipmentWithTime.getShipment()); + new LspShipmentWithTime(endOfTransportTime, lspShipmentWithTime.getLspShipment()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(lspShipmentWithTime)) { - element.getOutgoingShipments().getShipments().add(outgoingTuple); - element.getIncomingShipments().getShipments().remove(lspShipmentWithTime); + if (element.getIncomingShipments().getLspShipmentsWTime().contains(lspShipmentWithTime)) { + element.getOutgoingShipments().getLspShipmentsWTime().add(outgoingTuple); + element.getIncomingShipments().getLspShipmentsWTime().remove(lspShipmentWithTime); if (element.getNextElement() != null) { - element.getNextElement().getIncomingShipments().getShipments().add(outgoingTuple); - element.getOutgoingShipments().getShipments().remove(outgoingTuple); + element.getNextElement().getIncomingShipments().getLspShipmentsWTime().add(outgoingTuple); + element.getOutgoingShipments().getLspShipmentsWTime().remove(outgoingTuple); } } } diff --git a/src/main/java/org/matsim/freight/logistics/LSPUtils.java b/src/main/java/org/matsim/freight/logistics/LSPUtils.java index 42b549b6..c4e7be3c 100644 --- a/src/main/java/org/matsim/freight/logistics/LSPUtils.java +++ b/src/main/java/org/matsim/freight/logistics/LSPUtils.java @@ -120,7 +120,7 @@ public static void setFixedCost(Attributable attributable, Double fixedCost) { * @return the lspShipment object or null, if it is not found. */ public static LSPShipment findLspShipment(LSP lsp, Id shipmentId) { - for (LSPShipment lspShipment : lsp.getShipments()) { + for (LSPShipment lspShipment : lsp.getLspShipments()) { if (lspShipment.getId().equals(shipmentId)) { return lspShipment; } diff --git a/src/main/java/org/matsim/freight/logistics/LogisticChain.java b/src/main/java/org/matsim/freight/logistics/LogisticChain.java index 9e83cb51..a1c24f18 100644 --- a/src/main/java/org/matsim/freight/logistics/LogisticChain.java +++ b/src/main/java/org/matsim/freight/logistics/LogisticChain.java @@ -42,7 +42,7 @@ public interface LogisticChain Collection getLogisticChainElements(); - Collection> getShipmentIds(); + Collection> getLspShipmentIds(); - void addShipmentToChain(LSPShipment shipment); + 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 a927ff58..6e54b99a 100644 --- a/src/main/java/org/matsim/freight/logistics/LogisticChainImpl.java +++ b/src/main/java/org/matsim/freight/logistics/LogisticChainImpl.java @@ -32,7 +32,7 @@ private static final Logger log = LogManager.getLogger(LogisticChainImpl.class); private final Collection logisticChainElements; - private final Collection> shipmentIds; + private final Collection> lspShipmentIds; private LSP lsp; LogisticChainImpl(LSPUtils.LogisticChainBuilder builder) { @@ -41,7 +41,7 @@ for (LogisticChainElement element : this.logisticChainElements) { element.setEmbeddingContainer(this); } - this.shipmentIds = new ArrayList<>(); + this.lspShipmentIds = new ArrayList<>(); } @Override @@ -60,13 +60,13 @@ public Collection getLogisticChainElements() { } @Override - public Collection> getShipmentIds() { - return shipmentIds; + public Collection> getLspShipmentIds() { + return lspShipmentIds; } @Override - public void addShipmentToChain(LSPShipment shipment) { - shipmentIds.add(shipment.getId()); + public void addShipmentToChain(LSPShipment lspShipment) { + lspShipmentIds.add(lspShipment.getId()); } @Override @@ -83,10 +83,10 @@ public String toString() { } strb.append("}"); } - strb.append("[No of Shipments=").append(shipmentIds.size()).append("] \n"); - if (!shipmentIds.isEmpty()) { + strb.append("[No of Shipments=").append(lspShipmentIds.size()).append("] \n"); + if (!lspShipmentIds.isEmpty()) { strb.append("{ShipmentIds="); - for (Id lspShipmentId : shipmentIds) { + for (Id lspShipmentId : lspShipmentIds) { strb.append("[").append(lspShipmentId.toString()).append("]"); } strb.append("}"); diff --git a/src/main/java/org/matsim/freight/logistics/LspShipmentWithTime.java b/src/main/java/org/matsim/freight/logistics/LspShipmentWithTime.java index 0b531ad5..04d68979 100644 --- a/src/main/java/org/matsim/freight/logistics/LspShipmentWithTime.java +++ b/src/main/java/org/matsim/freight/logistics/LspShipmentWithTime.java @@ -29,16 +29,16 @@ public class LspShipmentWithTime { // means (delivery time? current time?). kai, // jun'22 - private final LSPShipment shipment; + private final LSPShipment lspShipment; private final double time; - public LspShipmentWithTime(double time, LSPShipment shipment) { - this.shipment = shipment; + public LspShipmentWithTime(double time, LSPShipment lspShipment) { + this.lspShipment = lspShipment; this.time = time; } - public LSPShipment getShipment() { - return shipment; + public LSPShipment getLspShipment() { + return lspShipment; } public double getTime() { diff --git a/src/main/java/org/matsim/freight/logistics/WaitingShipments.java b/src/main/java/org/matsim/freight/logistics/WaitingShipments.java index ff7b7bb9..37362cb6 100644 --- a/src/main/java/org/matsim/freight/logistics/WaitingShipments.java +++ b/src/main/java/org/matsim/freight/logistics/WaitingShipments.java @@ -41,11 +41,11 @@ */ public interface WaitingShipments { - void addShipment(double time, LSPShipment shipment); + void addShipment(double time, LSPShipment lspShipment); - Collection getSortedShipments(); + Collection getSortedLspShipments(); - Collection getShipments(); + Collection getLspShipmentsWTime(); void clear(); } diff --git a/src/main/java/org/matsim/freight/logistics/WaitingShipmentsImpl.java b/src/main/java/org/matsim/freight/logistics/WaitingShipmentsImpl.java index 52381a2f..66f4eb1c 100644 --- a/src/main/java/org/matsim/freight/logistics/WaitingShipmentsImpl.java +++ b/src/main/java/org/matsim/freight/logistics/WaitingShipmentsImpl.java @@ -35,14 +35,14 @@ } @Override - public void addShipment(double time, LSPShipment shipment) { - LspShipmentWithTime tuple = new LspShipmentWithTime(time, shipment); + public void addShipment(double time, LSPShipment lspShipment) { + LspShipmentWithTime tuple = new LspShipmentWithTime(time, lspShipment); this.shipments.add(tuple); shipments.sort(Comparator.comparingDouble(LspShipmentWithTime::getTime)); } @Override - public Collection getSortedShipments() { + public Collection getSortedLspShipments() { shipments.sort(Comparator.comparingDouble(LspShipmentWithTime::getTime)); return shipments; } @@ -52,7 +52,7 @@ public void clear() { } @Override - public Collection getShipments() { + public Collection getLspShipmentsWTime() { return shipments; } @@ -62,8 +62,8 @@ public String toString() { strb.append("WaitingShipmentsImpl{").append("No of Shipments= ").append(shipments.size()); if (!shipments.isEmpty()) { strb.append("; ShipmentIds="); - for (LspShipmentWithTime shipment : getSortedShipments()) { - strb.append("[").append(shipment.getShipment().getId()).append("]"); + for (LspShipmentWithTime shipment : getSortedLspShipments()) { + strb.append("[").append(shipment.getLspShipment().getId()).append("]"); } } strb.append('}'); 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 3741d274..3d22cd08 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 @@ -160,33 +160,33 @@ public static void main(String[] args) { .readFile("scenarios/2regions/2regions-network.xml"); Network network = scenario.getNetwork(); - // Create LSP and shipments + // Create LSP and lspShipments LSP lsp = createInitialLSP(network); - Collection shipments = createInitialLSPShipments(network); + Collection lspShipments = createInitialLSPShipments(network); - // assign the shipments to the LSP - for (LSPShipment shipment : shipments) { - lsp.assignShipmentToLSP(shipment); + // assign the lspShipments to the LSP + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } - // schedule the LSP with the shipments and according to the scheduler of the Resource + // schedule the LSP with the lspShipments and according to the scheduler of the Resource lsp.scheduleLogisticChains(); // print the schedules for the assigned LSPShipments - for (LSPShipment shipment : shipments) { - System.out.println("Shipment: " + shipment.getId()); + for (LSPShipment lspShipment : lspShipments) { + System.out.println("Shipment: " + lspShipment.getId()); ArrayList scheduleElements = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) + ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()); scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); ArrayList logElements = - new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + new ArrayList<>(lspShipment.getShipmentLog().getPlanElements().values()); logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); for (ShipmentPlanElement element : - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) + ShipmentUtils.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 533ed60e..e26cdccc 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 @@ -341,25 +341,25 @@ public static void main(String[] args) { // Create LSP and shipments LSP lsp = createInitialLSP(scenario); - Collection shipments = createInitialLSPShipments(scenario.getNetwork()); + Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); // assign the shipments to the LSP - for (LSPShipment shipment : shipments) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } // schedule the LSP with the shipments and according to the scheduler of the Resource lsp.scheduleLogisticChains(); // print the schedules for the assigned LSPShipments - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment lspShipment : lsp.getLspShipments()) { ArrayList elementList = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) + ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()); elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); - System.out.println("Shipment: " + shipment.getId()); + System.out.println("Shipment: " + lspShipment.getId()); for (ShipmentPlanElement element : elementList) { System.out.println( element.getLogisticChainElement().getId() 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 ad950049..324fcf9a 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 @@ -121,8 +121,8 @@ public static void main(String[] args) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : createInitialLSPShipments(scenario.getNetwork())) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : createInitialLSPShipments(scenario.getNetwork())) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); @@ -575,8 +575,8 @@ private static Collection createInitialLSPShipments(Network network TimeWindow startTimeWindow = TimeWindow.newInstance(0, (24 * 3600)); builder.setStartTimeWindow(startTimeWindow); builder.setDeliveryServiceTime(capacityDemand * 60); - LSPShipment shipment = builder.build(); - shipmentList.add(shipment); + 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 7c597210..4f5c5f2c 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 @@ -391,8 +391,8 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : createInitialLSPShipments(network)) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : createInitialLSPShipments(network)) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); 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 5c3d86d9..86f43c50 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 @@ -401,8 +401,8 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : createInitialLSPShipments(network)) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : createInitialLSPShipments(network)) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); diff --git a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/MyLSPScorer.java b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/MyLSPScorer.java index 065899ea..3a70e72d 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/MyLSPScorer.java +++ b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/MyLSPScorer.java @@ -86,9 +86,9 @@ private void scoreMissingShipments() { LSPPlan lspPlan = lsp.getSelectedPlan(); int lspPlanShipmentCount = lspPlan.getLogisticChains().stream() - .mapToInt(logisticChain -> logisticChain.getShipmentIds().size()) + .mapToInt(logisticChain -> logisticChain.getLspShipmentIds().size()) .sum(); - if (lspPlanShipmentCount != lsp.getShipments().size()) { + if (lspPlanShipmentCount != lsp.getLspShipments().size()) { logger.error( "LspPlan doesn't contain the same number of shipments as LSP, " + "shipments probably lost during replanning."); 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 3620dda4..038a0491 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 @@ -64,17 +64,17 @@ public void prepareReplanning(ReplanningContext replanningContext) {} public void handlePlan(LSPPlan lspPlan) { for (LogisticChain solution : lspPlan.getLogisticChains()) { - solution.getShipmentIds().clear(); + solution.getLspShipmentIds().clear(); for (LogisticChainElement element : solution.getLogisticChainElements()) { element.getIncomingShipments().clear(); element.getOutgoingShipments().clear(); } } - for (LSPShipment shipment : lspPlan.getLSP().getShipments()) { - ShipmentUtils.getOrCreateShipmentPlan(lspPlan, shipment.getId()).clear(); - shipment.getShipmentLog().clear(); - lspPlan.getInitialShipmentAssigner().assignToPlan(lspPlan, shipment); + for (LSPShipment lspShipment : lspPlan.getLSP().getLspShipments()) { + ShipmentUtils.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 7962d26c..e27d0496 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 @@ -45,11 +45,11 @@ public MaybeTodayAssigner() { } @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) { + public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { boolean assignToday = random.nextBoolean(); if (assignToday) { Gbl.assertIf(lspPlan.getLogisticChains().size() == 1); - lspPlan.getLogisticChains().iterator().next().addShipmentToChain(shipment); + lspPlan.getLogisticChains().iterator().next().addShipmentToChain(lspShipment); } } 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 91e95fad..fd1b45c9 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 @@ -55,27 +55,27 @@ public void prepareReplanning(ReplanningContext replanningContext) { @Override public void handlePlan(LSPPlan plan) { - plan.getLogisticChains().iterator().next().getShipmentIds().clear(); + plan.getLogisticChains().iterator().next().getLspShipmentIds().clear(); plan.setInitialShipmentAssigner(assigner); // LSP lsp = assigner.getLSP(); LSP lsp = plan.getLSP(); - Collection shipments = lsp.getShipments(); - for (LSPShipment shipment : shipments) { - assigner.assignToPlan(plan, shipment); + Collection lspShipments = lsp.getLspShipments(); + for (LSPShipment lspShipment : lspShipments) { + assigner.assignToPlan(plan, lspShipment); } for (LogisticChain solution : plan.getLogisticChains()) { - solution.getShipmentIds().clear(); + solution.getLspShipmentIds().clear(); for (LogisticChainElement element : solution.getLogisticChainElements()) { element.getIncomingShipments().clear(); element.getOutgoingShipments().clear(); } } - for (LSPShipment shipment : plan.getLSP().getShipments()) { - ShipmentUtils.getOrCreateShipmentPlan(plan, shipment.getId()).clear(); - shipment.getShipmentLog().clear(); - plan.getInitialShipmentAssigner().assignToPlan(plan, shipment); + for (LSPShipment lspShipment : plan.getLSP().getLspShipments()) { + ShipmentUtils.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 04ae06d3..3892e49e 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 @@ -197,16 +197,16 @@ public void install() { static Scenario prepareScenario(Config config) { Scenario scenario = ScenarioUtils.loadScenario(config); - // Create LSP and shipments + // Create LSP and lspShipments LSP lsp = createLSPWithScorer(scenario.getNetwork()); - Collection shipments = createInitialLSPShipments(scenario.getNetwork()); + Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); - // assign the shipments to the LSP - for (LSPShipment shipment : shipments) { - lsp.assignShipmentToLSP(shipment); + // assign the lspShipments to the LSP + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } - // schedule the LSP with the shipments and according to the scheduler of the Resource + // schedule the LSP with the lspShipments and according to the scheduler of the Resource lsp.scheduleLogisticChains(); // Prepare LSPModule and add the LSP 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 fdccba43..745c366a 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 @@ -66,17 +66,17 @@ public static void main(String[] args) { new MatsimNetworkReader(scenario.getNetwork()) .readFile("scenarios/2regions/2regions-network.xml"); - // Create LSP and shipments + // Create LSP and lspShipments Network network = scenario.getNetwork(); LSP lsp = createInitialLSP(network); - Collection shipments = createInitialLSPShipments(network); + Collection lspShipments = createInitialLSPShipments(network); - // assign the shipments to the LSP - for (LSPShipment shipment : shipments) { - lsp.assignShipmentToLSP(shipment); + // assign the lspShipments to the LSP + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } - // schedule the LSP with the shipments and according to the scheduler of the Resource + // schedule the LSP with the lspShipments and according to the scheduler of the Resource lsp.scheduleLogisticChains(); // set up simulation controler and LSPModule @@ -105,21 +105,21 @@ public void install() { .setVspDefaultsCheckingLevel(VspExperimentalConfigGroup.VspDefaultsCheckingLevel.warn); controler.run(); - for (LSPShipment shipment : lsp.getShipments()) { - System.out.println("Shipment: " + shipment.getId()); + for (LSPShipment lspShipment : lsp.getLspShipments()) { + System.out.println("LspShipment: " + lspShipment.getId()); ArrayList scheduleElements = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) + ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()); scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); ArrayList logElements = - new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + new ArrayList<>(lspShipment.getShipmentLog().getPlanElements().values()); logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); for (int i = 0; i - < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) + < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .size(); i++) { @@ -136,7 +136,7 @@ public void install() { + scheduleElements.get(i).getEndTime()); } System.out.println(); - for (int i = 0; i < shipment.getShipmentLog().getPlanElements().size(); i++) { + for (int i = 0; i < lspShipment.getShipmentLog().getPlanElements().size(); i++) { System.out.println( "Logged: " + logElements.get(i).getLogisticChainElement().getId() 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 9b399f7d..5a666e9d 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 @@ -334,16 +334,16 @@ public static void main(String[] args) { new MatsimNetworkReader(scenario.getNetwork()) .readFile("scenarios/2regions/2regions-network.xml"); - // Create LSP and shipments + // Create LSP and lspShipments LSP lsp = createInitialLSP(scenario); - Collection shipments = createInitialLSPShipments(scenario.getNetwork()); + Collection lspShipments = createInitialLSPShipments(scenario.getNetwork()); - // assign the shipments to the LSP - for (LSPShipment shipment : shipments) { - lsp.assignShipmentToLSP(shipment); + // assign the lspShipments to the LSP + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } - // schedule the LSP with the shipments and according to the scheduler of the Resource + // schedule the LSP with the lspShipments and according to the scheduler of the Resource lsp.scheduleLogisticChains(); // set up simulation controler and LSPModule @@ -374,21 +374,21 @@ public void install() { .setVspDefaultsCheckingLevel(VspExperimentalConfigGroup.VspDefaultsCheckingLevel.warn); controler.run(); - for (LSPShipment shipment : lsp.getShipments()) { - System.out.println("Shipment: " + shipment.getId()); + for (LSPShipment lspShipment : lsp.getLspShipments()) { + System.out.println("Shipment: " + lspShipment.getId()); ArrayList scheduleElements = new ArrayList<>( - ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) + ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .values()); scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); ArrayList logElements = - new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + new ArrayList<>(lspShipment.getShipmentLog().getPlanElements().values()); logElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); for (int i = 0; i - < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) + < ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), lspShipment.getId()) .getPlanElements() .size(); i++) { @@ -405,7 +405,7 @@ public void install() { + scheduleElements.get(i).getEndTime()); } System.out.println(); - for (int i = 0; i < shipment.getShipmentLog().getPlanElements().size(); i++) { + for (int i = 0; i < lspShipment.getShipmentLog().getPlanElements().size(); i++) { System.out.println( "Logged: " + logElements.get(i).getLogisticChainElement().getId() 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 0b0a2054..987e1bd6 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 @@ -320,8 +320,8 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : createLSPShipmentsFromCarrierShipments(carrier)) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : createLSPShipmentsFromCarrierShipments(carrier)) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); 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 92c669be..7879a8b0 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 @@ -405,8 +405,8 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : createInitialLSPShipments(network)) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : createInitialLSPShipments(network)) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); 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 2f823588..2310fd00 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 @@ -305,8 +305,8 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : createInitialLSPShipments()) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : createInitialLSPShipments()) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); @@ -316,7 +316,7 @@ private static LSP createLSP(Scenario scenario) { } private static Collection createInitialLSPShipments() { - List shipmentList = new ArrayList<>(); + List lspShipmentList = new ArrayList<>(); int capacityDemand; switch (demandSetting) { @@ -339,7 +339,7 @@ private static Collection createInitialLSPShipments() { builder.setStartTimeWindow(TimeWindow.newInstance(0, (24 * 3600))); builder.setDeliveryServiceTime(capacityDemand * 60); - shipmentList.add(builder.build()); + lspShipmentList.add(builder.build()); } else { Id id = Id.create("ShipmentRight_" + i, LSPShipment.class); ShipmentUtils.LSPShipmentBuilder builder = ShipmentUtils.LSPShipmentBuilder.newInstance(id); @@ -353,10 +353,10 @@ private static Collection createInitialLSPShipments() { builder.setStartTimeWindow(TimeWindow.newInstance(0, (24 * 3600))); builder.setDeliveryServiceTime(capacityDemand * 60); - shipmentList.add(builder.build()); + lspShipmentList.add(builder.build()); } } - return shipmentList; + return lspShipmentList; } private static List createResourcesListFromLSPPlans(List lspPlans) { 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 8cd33ae1..d5793b72 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 @@ -329,8 +329,8 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : createInitialLSPShipments()) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : createInitialLSPShipments()) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); 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 a90e3579..c028362f 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 @@ -369,8 +369,8 @@ private static LSP createLSP(Scenario scenario) { log.info("create initial LSPShipments"); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : createInitialLSPShipments()) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : createInitialLSPShipments()) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); 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 d460747f..38b73ce9 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 @@ -248,8 +248,8 @@ private static LSP createLspWithTwoChains(Scenario scenario, String lspName, Col .build(); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : lspShipments) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); @@ -385,8 +385,8 @@ private static LSP createLspWithDirectChain(Scenario scenario, String lspName, C .build(); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : lspShipments) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); 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 8dee7bbd..0a2b2c99 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 @@ -274,8 +274,8 @@ private static LSP createLspWithTwoChains(Scenario scenario, String lspName, Col .build(); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : lspShipments) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); @@ -413,8 +413,8 @@ private static LSP createLspWithDirectChain(Scenario scenario, String lspName, C .build(); log.info("assign the shipments to the LSP"); - for (LSPShipment shipment : lspShipments) { - lsp.assignShipmentToLSP(shipment); + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } log.info("schedule the LSP with the shipments and according to the scheduler of the Resource"); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/MyLSPScorer.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/MyLSPScorer.java index 57cac251..e82311ff 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/MyLSPScorer.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/MyLSPScorer.java @@ -86,9 +86,9 @@ private void scoreMissingShipments() { LSPPlan lspPlan = lsp.getSelectedPlan(); int lspPlanShipmentCount = lspPlan.getLogisticChains().stream() - .mapToInt(logisticChain -> logisticChain.getShipmentIds().size()) + .mapToInt(logisticChain -> logisticChain.getLspShipmentIds().size()) .sum(); - int shipmentCountDifference = lsp.getShipments().size() - lspPlanShipmentCount; + int shipmentCountDifference = lsp.getLspShipments().size() - lspPlanShipmentCount; if (shipmentCountDifference > 0) { logger.error( "LspPlan contains less shipments than LSP, " 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 ece8051f..11ab298a 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 @@ -38,9 +38,9 @@ class PrimaryLogisticChainShipmentAssigner implements InitialShipmentAssigner { public PrimaryLogisticChainShipmentAssigner() {} @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) { + public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { Gbl.assertIf(!lspPlan.getLogisticChains().isEmpty()); LogisticChain firstLogisticChain = lspPlan.getLogisticChains().iterator().next(); - firstLogisticChain.addShipmentToChain(shipment); + 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 53701d2c..1a1b7b1a 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 @@ -76,26 +76,26 @@ public void handlePlan(LSPPlan lspPlan) { LSPResource minDistanceResource = null; // get all shipments assigned to the LSP - Map, LSPShipment> shipmentById = new HashMap<>(); - for (LSPShipment lspShipment : lsp.getShipments()) { - shipmentById.put(lspShipment.getId(), lspShipment); + 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<>(); for (LogisticChain logisticChain : lspPlan.getLogisticChains()) { - for (Id id : logisticChain.getShipmentIds()) { - LSPShipment shipment = shipmentById.get(id); - if (shipment != null) { - shipments.add(shipment); + for (Id id : logisticChain.getLspShipmentIds()) { + LSPShipment lspShipment = lspShipmentById.get(id); + if (lspShipment != null) { + shipments.add(lspShipment); } } } - // pick a random shipment from the shipments contained in the plan + // pick a random lspShipment from the shipments contained in the plan int shipmentIndex = MatsimRandom.getRandom().nextInt(shipments.size()); - LSPShipment shipment = shipments.get(shipmentIndex); + LSPShipment lspShipment = shipments.get(shipmentIndex); // Collect all resources of the logistic chains of the LSP plan ArrayList resources = new ArrayList<>(); @@ -106,9 +106,9 @@ public void handlePlan(LSPPlan lspPlan) { } } - // get the resource with the smallest distance to the shipment + // get the resource with the smallest distance to the lspShipment for (LSPResource resource : resources) { - Link shipmentLink = network.getLinks().get(shipment.getTo()); + Link shipmentLink = network.getLinks().get(lspShipment.getTo()); Link resourceLink = network.getLinks().get(resource.getStartLinkId()); double distance = NetworkUtils.getEuclideanDistance( @@ -119,21 +119,21 @@ public void handlePlan(LSPPlan lspPlan) { } } - // add randomly picked shipment to chain with resource of the smallest distance + // add randomly picked lspShipment to chain with resource of the smallest distance for (LogisticChain logisticChain : lspPlan.getLogisticChains()) { for (LogisticChainElement logisticChainElement : logisticChain.getLogisticChainElements()) { if (logisticChainElement.getResource().equals(minDistanceResource)) { - logisticChain.getShipmentIds().add(shipment.getId()); + logisticChain.getLspShipmentIds().add(lspShipment.getId()); } } } - // remove the shipment from the previous logistic chain, can be the same as the new + // remove the lspShipment from the previous logistic chain, can be the same as the new // logistic chain for (LogisticChain logisticChain : lspPlan.getLogisticChains()) { - if (logisticChain.getShipmentIds().contains(shipment.getId())) { - logisticChain.getShipmentIds().remove(shipment.getId()); + if (logisticChain.getLspShipmentIds().contains(lspShipment.getId())) { + logisticChain.getLspShipmentIds().remove(lspShipment.getId()); break; } } 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 7a889aa7..db428c9d 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 @@ -67,16 +67,16 @@ public void handlePlan(LSPPlan lspPlan) { if (lspPlan.getLogisticChains().size() < 2) return; for (LogisticChain logisticChain : lspPlan.getLogisticChains()) { - logisticChain.getShipmentIds().clear(); + logisticChain.getLspShipmentIds().clear(); } LSP lsp = lspPlan.getLSP(); List logisticChains = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains()); - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment lspShipment : lsp.getLspShipments()) { int index = MatsimRandom.getRandom().nextInt(logisticChains.size()); - logisticChains.get(index).addShipmentToChain(shipment); + 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 f4fe90a1..2e538c53 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 @@ -46,11 +46,11 @@ class RandomLogisticChainShipmentAssigner implements InitialShipmentAssigner { } @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) { + public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { Gbl.assertIf(!lspPlan.getLogisticChains().isEmpty()); List logisticChains = new ArrayList<>(lspPlan.getLogisticChains()); int index = random.nextInt(logisticChains.size()); LogisticChain logisticChain = logisticChains.get(index); - logisticChain.addShipmentToChain(shipment); + logisticChain.addShipmentToChain(lspShipment); } } 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 a1aa0600..d6a2cb3b 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 @@ -67,26 +67,26 @@ public void prepareReplanning(ReplanningContext replanningContext) {} @Override public void handlePlan(LSPPlan lspPlan) { - // Shifting shipments only makes sense for multiple chains + // Shifting lspShipments only makes sense for multiple chains if (lspPlan.getLogisticChains().size() < 2) return; LSP lsp = lspPlan.getLSP(); - // Make a new list of shipments and pick a random shipment from it - List shipments = new ArrayList<>(lsp.getShipments()); - int shipmentIndex = random.nextInt(lsp.getShipments().size()); - LSPShipment shipment = shipments.get(shipmentIndex); + // Make a new list of lspShipments and pick a random lspShipment from it + List lspShipments = new ArrayList<>(lsp.getLspShipments()); + int shipmentIndex = random.nextInt(lsp.getLspShipments().size()); + LSPShipment lspShipment = lspShipments.get(shipmentIndex); - // Find and remove the random shipment from its current logistic chain + // Find and remove the random lspShipment from its current logistic chain LogisticChain sourceLogisticChain = null; for (LogisticChain logisticChain : lsp.getSelectedPlan().getLogisticChains()) { - if (logisticChain.getShipmentIds().remove(shipment.getId())) { + if (logisticChain.getLspShipmentIds().remove(lspShipment.getId())) { sourceLogisticChain = logisticChain; break; } } - // Find a new logistic chain for the shipment + // Find a new logistic chain for the lspShipment // Ensure that the chain selected is not the same as the one it was removed from int chainIndex; LogisticChain targetLogisticChain = null; @@ -101,9 +101,9 @@ public void handlePlan(LSPPlan lspPlan) { } } while (targetLogisticChain == sourceLogisticChain); - // Add the shipment to the new logistic chain + // Add the lspShipment to the new logistic chain assert targetLogisticChain != null; - targetLogisticChain.addShipmentToChain(shipment); + targetLogisticChain.addShipmentToChain(lspShipment); } @Override 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 2ce3f0fd..bd61fbcc 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 @@ -72,7 +72,7 @@ public void handlePlan(LSPPlan lspPlan) { // fill the shipmentCountByChain map with each chain's shipment count for (LogisticChain chain : lsp.getSelectedPlan().getLogisticChains()) { - shipmentCountByChain.put(chain, chain.getShipmentIds().size()); + shipmentCountByChain.put(chain, chain.getLspShipmentIds().size()); } // find the chains with the minimum and maximum shipment counts @@ -87,15 +87,15 @@ 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.getShipmentIds().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()) { if (logisticChain.equals(maxChain)) { - logisticChain.getShipmentIds().remove(shipmentIdForReplanning); + logisticChain.getLspShipmentIds().remove(shipmentIdForReplanning); } if (logisticChain.equals(minChain)) { - logisticChain.getShipmentIds().add(shipmentIdForReplanning); + logisticChain.getLspShipmentIds().add(shipmentIdForReplanning); } } } 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 e9e9e436..c7753f9d 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 @@ -67,13 +67,13 @@ public void handlePlan(LSPPlan lspPlan) { if (lspPlan.getLogisticChains().size() < 2) return; for (LogisticChain logisticChain : lspPlan.getLogisticChains()) { - logisticChain.getShipmentIds().clear(); + logisticChain.getLspShipmentIds().clear(); } LSP lsp = lspPlan.getLSP(); Map shipmentCountByChain = new LinkedHashMap<>(); - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment lspShipment : lsp.getLspShipments()) { if (shipmentCountByChain.isEmpty()) { for (LogisticChain chain : lsp.getSelectedPlan().getLogisticChains()) { shipmentCountByChain.put(chain, 0); @@ -82,7 +82,7 @@ public void handlePlan(LSPPlan lspPlan) { LogisticChain minChain = Collections.min(shipmentCountByChain.entrySet(), Map.Entry.comparingByValue()) .getKey(); - minChain.addShipmentToChain(shipment); + minChain.addShipmentToChain(lspShipment); shipmentCountByChain.merge(minChain, 1, Integer::sum); } } 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 1aad45ed..26871c3e 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 @@ -45,7 +45,7 @@ class RoundRobinLogisticChainShipmentAssigner implements InitialShipmentAssigner RoundRobinLogisticChainShipmentAssigner() {} @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) { + 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()) { @@ -58,7 +58,7 @@ public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) { // its value by one LogisticChain minChain = Collections.min(shipmentCountByChain.entrySet(), Map.Entry.comparingByValue()).getKey(); - minChain.addShipmentToChain(shipment); + minChain.addShipmentToChain(lspShipment); shipmentCountByChain.merge(minChain, 1, Integer::sum); } } 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 e0da4b18..688a42cd 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 @@ -226,33 +226,33 @@ public static void main(String[] args) { .readFile("scenarios/2regions/2regions-network.xml"); Network network = scenario.getNetwork(); - // Create LSP and shipments + // Create LSP and lspShipments LSP lsp = createLSPWithProperties(network); - Collection shipments = createShipmentsWithRequirements(network); + Collection lspShipments = createShipmentsWithRequirements(network); - // assign the shipments to the LSP - for (LSPShipment shipment : shipments) { - lsp.assignShipmentToLSP(shipment); + // assign the lspShipments to the LSP + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } - for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { - if (solution.getId().toString().equals("RedSolution")) { - for (Id shipmentId : solution.getShipmentIds()) { - LSPShipment shipment = LSPUtils.findLspShipment(lsp, shipmentId); - if (shipment != null && !(shipment.getRequirements().iterator().next() instanceof RedRequirement)) { + for (LogisticChain logisticChain : lsp.getSelectedPlan().getLogisticChains()) { + if (logisticChain.getId().toString().equals("RedSolution")) { + for (Id lspShipmentId : logisticChain.getLspShipmentIds()) { + LSPShipment lspShipment = LSPUtils.findLspShipment(lsp, lspShipmentId); + if (lspShipment != null && !(lspShipment.getRequirements().iterator().next() instanceof RedRequirement)) { break; } } - System.out.println("All shipments in " + solution.getId() + " are red"); + System.out.println("All lspShipments in " + logisticChain.getId() + " are red"); } - if (solution.getId().toString().equals("BlueSolution")) { - for (Id shipmentId : solution.getShipmentIds()) { - LSPShipment shipment = LSPUtils.findLspShipment(lsp, shipmentId); + if (logisticChain.getId().toString().equals("BlueSolution")) { + for (Id lspShipmentId : logisticChain.getLspShipmentIds()) { + LSPShipment shipment = LSPUtils.findLspShipment(lsp, lspShipmentId); if (shipment != null && !(shipment.getRequirements().iterator().next() instanceof BlueRequirement)) { break; } } - System.out.println("All shipments in " + solution.getId() + " are blue"); + System.out.println("All lspShipments in " + logisticChain.getId() + " are blue"); } } } 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 4be950f3..ddcf408c 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 @@ -59,12 +59,12 @@ public RequirementsAssigner() { } @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) { + public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { feasibleLogisticChains.clear(); label: for (LogisticChain solution : lspPlan.getLogisticChains()) { - for (LSPShipmentRequirement requirement : shipment.getRequirements()) { + for (LSPShipmentRequirement requirement : lspShipment.getRequirements()) { if (!requirement.checkRequirement(solution)) { continue label; @@ -73,7 +73,7 @@ public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) { feasibleLogisticChains.add(solution); } LogisticChain chosenSolution = feasibleLogisticChains.iterator().next(); - chosenSolution.addShipmentToChain(shipment); + chosenSolution.addShipmentToChain(lspShipment); } } 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 6480b63c..fbfb5e53 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 @@ -174,16 +174,16 @@ public static void main(String[] args) { .readFile("scenarios/2regions/2regions-network.xml"); Network network = scenario.getNetwork(); - // Create LSP and shipments + // Create LSP and lspShipments LSP lsp = createLSPWithTracker(scenario); - Collection shipments = createInitialLSPShipments(network); + Collection lspShipments = createInitialLSPShipments(network); - // assign the shipments to the LSP - for (LSPShipment shipment : shipments) { - lsp.assignShipmentToLSP(shipment); + // assign the lspShipments to the LSP + for (LSPShipment lspShipment : lspShipments) { + lsp.assignShipmentToLSP(lspShipment); } - // schedule the LSP with the shipments and according to the scheduler of the Resource + // schedule the LSP with the lspShipments and according to the scheduler of the Resource lsp.scheduleLogisticChains(); // Prepare LSPModule and add the LSP 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 5dfdf901..5e446b2f 100644 --- a/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlParserV1.java +++ b/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlParserV1.java @@ -216,7 +216,7 @@ public void startTag(String name, Attributes atts, Stack context) { shipmentBuilder.setDeliveryServiceTime(parseTimeToDouble(deliveryServiceTime)); currentShipment = shipmentBuilder.build(); - currentLsp.getShipments().add(currentShipment); + currentLsp.getLspShipments().add(currentShipment); } case LSP_PLAN -> { currentLspPlan = LSPUtils.createLSPPlan(); @@ -405,19 +405,19 @@ public void endTag(String name, String content, Stack context) { } case SHIPMENT_PLAN -> { - for (LSPShipment shipment : currentLsp.getShipments()) { - if (shipment.getId().toString().equals(shipmentPlanId)) { + for (LSPShipment lspShipment : currentLsp.getLspShipments()) { + if (lspShipment.getId().toString().equals(shipmentPlanId)) { for (Map.Entry planElement : planElements.entrySet()) { - ShipmentUtils.getOrCreateShipmentPlan(currentLspPlan, shipment.getId()) + ShipmentUtils.getOrCreateShipmentPlan(currentLspPlan, lspShipment.getId()) .addPlanElement( Id.create(planElement.getKey(), ShipmentPlanElement.class), planElement.getValue()); } } - for (LogisticChain chain : currentLspPlan.getLogisticChains()) { - if (chain.getId().toString().equals(shipmentChainId) - && shipment.getId().toString().equals(shipmentPlanId)) { - chain.addShipmentToChain(shipment); + for (LogisticChain logisticChain : currentLspPlan.getLogisticChains()) { + if (logisticChain.getId().toString().equals(shipmentChainId) + && lspShipment.getId().toString().equals(shipmentPlanId)) { + logisticChain.addShipmentToChain(lspShipment); } } } 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 55e0efae..58901bd6 100644 --- a/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlWriter.java +++ b/src/main/java/org/matsim/freight/logistics/io/LSPPlanXmlWriter.java @@ -128,22 +128,22 @@ private void writeResources(LSP lsp) throws IOException { } private void writeShipments(LSP lsp) throws IOException { - if (lsp.getShipments().isEmpty()) return; + if (lsp.getLspShipments().isEmpty()) return; this.writeStartTag(SHIPMENTS, null); - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment lspShipment : lsp.getLspShipments()) { this.writeStartTag( SHIPMENT, List.of( - createTuple(ID, shipment.getId().toString()), - createTuple(FROM, shipment.getFrom().toString()), - createTuple(TO, shipment.getTo().toString()), - createTuple(SIZE, shipment.getSize()), - createTuple(START_PICKUP, shipment.getPickupTimeWindow().getStart()), - createTuple(END_PICKUP, shipment.getPickupTimeWindow().getEnd()), - createTuple(START_DELIVERY, shipment.getDeliveryTimeWindow().getStart()), - createTuple(END_DELIVERY, shipment.getDeliveryTimeWindow().getEnd()), - createTuple(PICKUP_SERVICE_TIME, shipment.getPickupServiceTime()), - createTuple(DELIVERY_SERVICE_TIME, shipment.getDeliveryServiceTime())), + createTuple(ID, lspShipment.getId().toString()), + createTuple(FROM, lspShipment.getFrom().toString()), + createTuple(TO, lspShipment.getTo().toString()), + createTuple(SIZE, lspShipment.getSize()), + createTuple(START_PICKUP, lspShipment.getPickupTimeWindow().getStart()), + createTuple(END_PICKUP, lspShipment.getPickupTimeWindow().getEnd()), + createTuple(START_DELIVERY, lspShipment.getDeliveryTimeWindow().getStart()), + createTuple(END_DELIVERY, lspShipment.getDeliveryTimeWindow().getEnd()), + createTuple(PICKUP_SERVICE_TIME, lspShipment.getPickupServiceTime()), + createTuple(DELIVERY_SERVICE_TIME, lspShipment.getDeliveryServiceTime())), true); } this.writeEndTag(SHIPMENTS); @@ -185,18 +185,18 @@ private void writePlans(LSP lsp, BufferedWriter writer) throws IOException { writeStartTag(SHIPMENT_PLANS, null); for (LogisticChain chain : plan.getLogisticChains()) { - for (Id shipmentId : chain.getShipmentIds()) { - if (chain.getShipmentIds().contains(shipmentId)) { + for (Id shipmentId : chain.getLspShipmentIds()) { + if (chain.getLspShipmentIds().contains(shipmentId)) { this.writeStartTag( SHIPMENT_PLAN, List.of( createTuple(SHIPMENT_ID, shipmentId.toString()), createTuple(CHAIN_ID, chain.getId().toString()))); } - LSPShipment shipment = LSPUtils.findLspShipment(lsp, shipmentId); - assert shipment != null; + LSPShipment lspShipment = LSPUtils.findLspShipment(lsp, shipmentId); + assert lspShipment != null; final Map, ShipmentPlanElement> planElements = - ShipmentUtils.getOrCreateShipmentPlan(plan, shipment.getId()).getPlanElements(); + ShipmentUtils.getOrCreateShipmentPlan(plan, lspShipment.getId()).getPlanElements(); for (Id elementId : planElements.keySet()) { ShipmentPlanElement element = planElements.get(elementId); this.writeStartTag( 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 c2cfaa45..7672784a 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java @@ -88,12 +88,12 @@ public void scheduleResource() { private CarrierService convertToCarrierService(LspShipmentWithTime tuple) { Id serviceId = - Id.create(tuple.getShipment().getId().toString(), CarrierService.class); + Id.create(tuple.getLspShipment().getId().toString(), CarrierService.class); CarrierService.Builder builder = - CarrierService.Builder.newInstance(serviceId, tuple.getShipment().getFrom()); - builder.setServiceStartTimeWindow(tuple.getShipment().getPickupTimeWindow()); - builder.setCapacityDemand(tuple.getShipment().getSize()); - builder.setServiceDuration(tuple.getShipment().getDeliveryServiceTime()); + CarrierService.Builder.newInstance(serviceId, tuple.getLspShipment().getFrom()); + builder.setServiceStartTimeWindow(tuple.getLspShipment().getPickupTimeWindow()); + builder.setCapacityDemand(tuple.getLspShipment().getSize()); + builder.setServiceDuration(tuple.getLspShipment().getDeliveryServiceTime()); CarrierService service = builder.build(); pairs.add(new LSPCarrierPair(tuple, service)); return service; @@ -129,7 +129,7 @@ private void addShipmentLoadElement( ShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticChainElement(element); } } @@ -138,13 +138,13 @@ private void addShipmentLoadElement( double startTimeOfLoading = legBeforeService.getExpectedDepartureTime() + legBeforeService.getExpectedTransportTime(); builder.setStartTime(startTimeOfLoading); - builder.setEndTime(startTimeOfLoading + tuple.getShipment().getDeliveryServiceTime()); + builder.setEndTime(startTimeOfLoading + tuple.getLspShipment().getDeliveryServiceTime()); ShipmentPlanElement load = builder.build(); String idString = load.getResourceId() + "" + load.getLogisticChainElement().getId() + load.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, load); } @@ -154,7 +154,7 @@ private void addShipmentTransportElement( ShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticChainElement(element); } } @@ -177,18 +177,18 @@ private void addShipmentTransportElement( + transport.getLogisticChainElement().getId() + transport.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, transport); } private void addCollectionServiceEventHandler( CarrierService carrierService, LspShipmentWithTime tuple, LSPCarrierResource resource) { for (LogisticChainElement element : this.resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { CollectionServiceEndEventHandler endHandler = new CollectionServiceEndEventHandler( - carrierService, tuple.getShipment(), element, resource); - tuple.getShipment().addSimulationTracker(endHandler); + carrierService, tuple.getLspShipment(), element, resource); + tuple.getLspShipment().addSimulationTracker(endHandler); break; } } @@ -200,11 +200,11 @@ private void addCollectionTourEndEventHandler( LSPCarrierResource resource, Tour tour) { for (LogisticChainElement element : this.resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { LSPTourEndEventHandler handler = new LSPTourEndEventHandler( - tuple.getShipment(), carrierService, element, resource, tour); - tuple.getShipment().addSimulationTracker(handler); + tuple.getLspShipment(), carrierService, element, resource, tour); + tuple.getLspShipment().addSimulationTracker(handler); break; } } @@ -216,7 +216,7 @@ private void addShipmentUnloadElement( ShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticsChainElement(element); } } @@ -232,7 +232,7 @@ private void addShipmentUnloadElement( + unload.getLogisticChainElement().getId() + unload.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, unload); } 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 b1371d92..876d92c2 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java @@ -98,7 +98,7 @@ protected void scheduleResource() { // gibt??? VehicleType vehicleType = ResourceImplementationUtils.getVehicleTypeCollection(carrier).iterator().next(); - if ((load + tuple.getShipment().getSize()) + if ((load + tuple.getLspShipment().getSize()) > vehicleType.getCapacity().getOther().intValue()) { load = 0; Carrier auxiliaryCarrier = @@ -112,8 +112,8 @@ protected void scheduleResource() { shipmentsInCurrentTour.clear(); } shipmentsInCurrentTour.add(tuple); - load = load + tuple.getShipment().getSize(); - cumulatedLoadingTime = cumulatedLoadingTime + tuple.getShipment().getDeliveryServiceTime(); + load = load + tuple.getLspShipment().getSize(); + cumulatedLoadingTime = cumulatedLoadingTime + tuple.getLspShipment().getDeliveryServiceTime(); availabilityTimeOfLastShipment = tuple.getTime(); } @@ -176,11 +176,11 @@ private Collection unifyTourIds(Collection carrierPl private CarrierService convertToCarrierService(LspShipmentWithTime tuple) { Id serviceId = - Id.create(tuple.getShipment().getId().toString(), CarrierService.class); + Id.create(tuple.getLspShipment().getId().toString(), CarrierService.class); CarrierService.Builder builder = - CarrierService.Builder.newInstance(serviceId, tuple.getShipment().getTo()); - builder.setCapacityDemand(tuple.getShipment().getSize()); - builder.setServiceDuration(tuple.getShipment().getDeliveryServiceTime()); + CarrierService.Builder.newInstance(serviceId, tuple.getLspShipment().getTo()); + builder.setCapacityDemand(tuple.getLspShipment().getSize()); + builder.setServiceDuration(tuple.getLspShipment().getDeliveryServiceTime()); CarrierService service = builder.build(); pairs.add(new LSPCarrierPair(tuple, service)); return service; @@ -216,7 +216,7 @@ private void addShipmentLoadElement( ShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticChainElement(element); } } @@ -237,7 +237,7 @@ private void addShipmentLoadElement( String idString = load.getResourceId() + "" + load.getLogisticChainElement().getId() + load.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, load); } @@ -247,7 +247,7 @@ private void addShipmentTransportElement( ShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticChainElement(element); } } @@ -279,7 +279,7 @@ private void addShipmentTransportElement( + transport.getLogisticChainElement().getId() + transport.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, transport); } @@ -289,7 +289,7 @@ private void addShipmentUnloadElement( ShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticsChainElement(element); } } @@ -311,7 +311,7 @@ private void addShipmentUnloadElement( + String.valueOf(unload.getLogisticChainElement().getId()) + unload.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, unload); } @@ -343,11 +343,11 @@ private Carrier createAuxiliaryCarrier( private void addDistributionServiceEventHandler( CarrierService carrierService, LspShipmentWithTime tuple, LSPCarrierResource resource) { for (LogisticChainElement element : this.resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { DistributionServiceStartEventHandler handler = new DistributionServiceStartEventHandler( - carrierService, tuple.getShipment(), element, resource); - tuple.getShipment().addSimulationTracker(handler); + carrierService, tuple.getLspShipment(), element, resource); + tuple.getLspShipment().addSimulationTracker(handler); break; } } @@ -359,11 +359,11 @@ private void addDistributionTourStartEventHandler( LSPCarrierResource resource, Tour tour) { for (LogisticChainElement element : this.resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { LSPTourStartEventHandler handler = new LSPTourStartEventHandler( - tuple.getShipment(), carrierService, element, resource, tour); - tuple.getShipment().addSimulationTracker(handler); + tuple.getLspShipment(), carrierService, element, resource, tour); + tuple.getLspShipment().addSimulationTracker(handler); break; } } 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 1177ed52..6efc211a 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java @@ -86,7 +86,7 @@ protected void scheduleResource() { VehicleType vehicleType = ResourceImplementationUtils.getVehicleTypeCollection(carrier).iterator().next(); - if ((load + tuple.getShipment().getSize()) + if ((load + tuple.getLspShipment().getSize()) > vehicleType.getCapacity().getOther().intValue()) { load = 0; CarrierPlan plan = createPlan(carrier, shipmentsInCurrentTour); @@ -94,7 +94,7 @@ protected void scheduleResource() { shipmentsInCurrentTour.clear(); } shipmentsInCurrentTour.add(tuple); - load = load + tuple.getShipment().getSize(); + load = load + tuple.getLspShipment().getSize(); } if (!shipmentsInCurrentTour.isEmpty()) { CarrierPlan plan = createPlan(carrier, shipmentsInCurrentTour); @@ -130,7 +130,7 @@ private CarrierPlan createPlan(Carrier carrier, List tuples double latestTupleTime = 0; for (LspShipmentWithTime tuple : tuples) { - totalLoadingTime = totalLoadingTime + tuple.getShipment().getDeliveryServiceTime(); + totalLoadingTime = totalLoadingTime + tuple.getLspShipment().getDeliveryServiceTime(); if (tuple.getTime() > latestTupleTime) { latestTupleTime = tuple.getTime(); } @@ -221,11 +221,11 @@ private double scorePlanManually(CarrierPlan plan) { private CarrierService convertToCarrierService(LspShipmentWithTime tuple) { Id serviceId = - Id.create(tuple.getShipment().getId().toString(), CarrierService.class); + Id.create(tuple.getLspShipment().getId().toString(), CarrierService.class); CarrierService.Builder builder = CarrierService.Builder.newInstance(serviceId, resource.getEndLinkId()); - builder.setCapacityDemand(tuple.getShipment().getSize()); - builder.setServiceDuration(tuple.getShipment().getDeliveryServiceTime()); + builder.setCapacityDemand(tuple.getLspShipment().getSize()); + builder.setServiceDuration(tuple.getLspShipment().getDeliveryServiceTime()); return builder.build(); } @@ -261,7 +261,7 @@ private void addShipmentLoadElement( ShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticChainElement(element); } } @@ -284,7 +284,7 @@ private void addShipmentLoadElement( + String.valueOf(load.getLogisticChainElement().getId()) + load.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, load); } @@ -294,7 +294,7 @@ private void addShipmentTransportElement( ShipmentUtils.ScheduledShipmentTransportBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticChainElement(element); } } @@ -314,7 +314,7 @@ private void addShipmentTransportElement( + String.valueOf(transport.getLogisticChainElement().getId()) + transport.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, transport); } @@ -324,7 +324,7 @@ private void addShipmentUnloadElement( ShipmentUtils.ScheduledShipmentUnloadBuilder.newInstance(); builder.setResourceId(resource.getId()); for (LogisticChainElement element : resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticsChainElement(element); } } @@ -350,7 +350,7 @@ private void addShipmentUnloadElement( + String.valueOf(unload.getLogisticChainElement().getId()) + unload.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, unload); } @@ -360,11 +360,11 @@ private void addMainTourRunStartEventHandler( LSPCarrierResource resource, Tour tour) { for (LogisticChainElement element : this.resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { LSPTourStartEventHandler handler = new LSPTourStartEventHandler( - tuple.getShipment(), carrierService, element, resource, tour); - tuple.getShipment().addSimulationTracker(handler); + tuple.getLspShipment(), carrierService, element, resource, tour); + tuple.getLspShipment().addSimulationTracker(handler); break; } } @@ -376,11 +376,11 @@ private void addMainRunTourEndEventHandler( LSPCarrierResource resource, Tour tour) { for (LogisticChainElement element : this.resource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { LSPTourEndEventHandler handler = new LSPTourEndEventHandler( - tuple.getShipment(),carrierService, element, resource, tour); - tuple.getShipment().addSimulationTracker(handler); + tuple.getLspShipment(),carrierService, element, resource, tour); + tuple.getLspShipment().addSimulationTracker(handler); break; } } 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 9c69547d..b3a82f17 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/ResourceImplementationUtils.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/ResourceImplementationUtils.java @@ -84,8 +84,8 @@ public static void printShipmentsOfLSP(String outputDir, LSP lsp) { final String str0 = "LSP: " + lsp.getId(); System.out.println(str0); writer.write(str0 + "\n"); - for (LSPShipment shipment : lsp.getShipments()) { - final String str1 = "Shipment: " + shipment; + for (LSPShipment lspShipment : lsp.getLspShipments()) { + final String str1 = "Shipment: " + lspShipment; System.out.println(str1); writer.write(str1 + "\n"); } @@ -101,7 +101,7 @@ 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.getShipments()) { + for (LSPShipment shipment : lsp.getLspShipments()) { ArrayList elementList = new ArrayList<>( ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()) @@ -116,9 +116,9 @@ public static void printResults_shipmentPlan(String outputDir, LSP lsp) { } private static void writeShipmentWithPlanElements( - BufferedWriter writer, LSPShipment shipment, ArrayList elementList) + BufferedWriter writer, LSPShipment lspShipment, ArrayList elementList) throws IOException { - final String str1 = "Shipment: " + shipment; + final String str1 = "Shipment: " + lspShipment; System.out.println(str1); writer.write(str1 + "\n"); for (ShipmentPlanElement element : elementList) { @@ -153,11 +153,11 @@ 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 shipment : lsp.getShipments()) { + for (LSPShipment lspShipment : lsp.getLspShipments()) { ArrayList elementList = - new ArrayList<>(shipment.getShipmentLog().getPlanElements().values()); + new ArrayList<>(lspShipment.getShipmentLog().getPlanElements().values()); elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); - writeShipmentWithPlanElements(writer, shipment, elementList); + writeShipmentWithPlanElements(writer, lspShipment, elementList); } } catch (IOException e) { e.printStackTrace(); 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 2be264cb..54d37eba 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/SimpleForwardLogisticChainScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/SimpleForwardLogisticChainScheduler.java @@ -76,7 +76,7 @@ private void insertShipmentsAtBeginning() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { LogisticChainElement firstElement = getFirstElement(solution); assert firstElement != null; - for (Id lspShipmentId : solution.getShipmentIds()) { + 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 c97b5475..5210d70e 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/SingleLogisticChainShipmentAssigner.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/SingleLogisticChainShipmentAssigner.java @@ -40,9 +40,9 @@ class SingleLogisticChainShipmentAssigner implements InitialShipmentAssigner { SingleLogisticChainShipmentAssigner() {} @Override - public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) { + public void assignToPlan(LSPPlan lspPlan, LSPShipment lspShipment) { Gbl.assertIf(lspPlan.getLogisticChains().size() == 1); LogisticChain singleSolution = lspPlan.getLogisticChains().iterator().next(); - singleSolution.addShipmentToChain(shipment); + singleSolution.addShipmentToChain(lspShipment); } } 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 6ac12820..9f5b226a 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubScheduler.java @@ -76,10 +76,10 @@ private void addShipmentHandleElement(LspShipmentWithTime tuple) { ShipmentUtils.ScheduledShipmentHandleBuilder.newInstance(); builder.setStartTime(tuple.getTime()); builder.setEndTime( - tuple.getTime() + capacityNeedFixed + capacityNeedLinear * tuple.getShipment().getSize()); + tuple.getTime() + capacityNeedFixed + capacityNeedLinear * tuple.getLspShipment().getSize()); builder.setResourceId(transshipmentHubResource.getId()); for (LogisticChainElement element : transshipmentHubResource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { builder.setLogisticsChainElement(element); } } @@ -89,16 +89,16 @@ private void addShipmentHandleElement(LspShipmentWithTime tuple) { + String.valueOf(handle.getLogisticChainElement().getId()) + handle.getElementType(); Id id = Id.create(idString, ShipmentPlanElement.class); - ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getShipment().getId()) + ShipmentUtils.getOrCreateShipmentPlan(super.lspPlan, tuple.getLspShipment().getId()) .addPlanElement(id, handle); } private void addShipmentToEventHandler(LspShipmentWithTime tuple) { for (LogisticChainElement element : transshipmentHubResource.getClientElements()) { - if (element.getIncomingShipments().getShipments().contains(tuple)) { + if (element.getIncomingShipments().getLspShipmentsWTime().contains(tuple)) { ShipmentPlan shipmentPlan = - ShipmentUtils.getOrCreateShipmentPlan(lspPlan, tuple.getShipment().getId()); - eventHandler.addShipment(tuple.getShipment(), element, shipmentPlan); + ShipmentUtils.getOrCreateShipmentPlan(lspPlan, tuple.getLspShipment().getId()); + eventHandler.addShipment(tuple.getLspShipment(), element, shipmentPlan); 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 26e4959b..687dfd5d 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubTourEndEventHandler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/TransshipmentHubTourEndEventHandler.java @@ -96,9 +96,9 @@ public void reset(int iteration) { } public void addShipment( - LSPShipment shipment, LogisticChainElement logisticChainElement, ShipmentPlan shipmentPlan) { + LSPShipment lspShipment, LogisticChainElement logisticChainElement, ShipmentPlan shipmentPlan) { TransshipmentHubEventHandlerPair pair = - new TransshipmentHubEventHandlerPair(shipment, logisticChainElement); + new TransshipmentHubEventHandlerPair(lspShipment, logisticChainElement); for (ShipmentPlanElement planElement : shipmentPlan.getPlanElements().values()) { if (planElement instanceof ShipmentLeg transport) { @@ -133,7 +133,7 @@ && allServicesAreInOnePoint(tour) && (tour.getStartLinkId() != transshipmentHubResource.getStartLinkId())) { final CarrierService carrierService = serviceActivity.getService(); - final LSPShipment lspShipment = servicesWaitedFor.get(carrierService).shipment; + 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).shipment; + 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,7 +204,7 @@ private double getTotalUnloadingTime(Tour tour) { private void logHandlingInHub( CarrierService carrierService, double startTime, double endTime) { - LSPShipment lspShipment = servicesWaitedFor.get(carrierService).shipment; + LSPShipment lspShipment = servicesWaitedFor.get(carrierService).lspShipment; { // Old logging approach - will be removed at some point in time ShipmentPlanElement handle = @@ -267,11 +267,11 @@ public Id getLinkId() { } public static class TransshipmentHubEventHandlerPair { - public final LSPShipment shipment; + public final LSPShipment lspShipment; public final LogisticChainElement element; - public TransshipmentHubEventHandlerPair(LSPShipment shipment, LogisticChainElement element) { - this.shipment = shipment; + public TransshipmentHubEventHandlerPair(LSPShipment lspShipment, LogisticChainElement element) { + this.lspShipment = lspShipment; this.element = element; } } 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 73114e40..9168991c 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 @@ -231,8 +231,8 @@ public void initialize() { @Test public void testCollectionLSPReplanning() { - System.out.println(collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getShipmentIds().size()); - assertTrue(collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getShipmentIds().size() < 20); + System.out.println(collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getLspShipmentIds().size()); + assertTrue(collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getLspShipmentIds().size() < 20); } @Test 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 7d9be2e9..74705dc4 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 @@ -165,8 +165,8 @@ public void initialize() { @Test public void testCollectionLSPScoring() { System.out.println(collectionLSP.getSelectedPlan().getScore()); - assertEquals(numberOfShipments, collectionLSP.getShipments().size()); - assertEquals(numberOfShipments, collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getShipmentIds() + assertEquals(numberOfShipments, collectionLSP.getLspShipments().size()); + assertEquals(numberOfShipments, collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getLspShipmentIds() .size()); assertTrue(collectionLSP.getSelectedPlan().getScore() > 0); assertTrue(collectionLSP.getSelectedPlan().getScore() <= (numberOfShipments * 5)); 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 caf856ad..9b474a59 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 @@ -196,8 +196,8 @@ public void initialize() { @Test public void testCollectionLSPScoring() { System.out.println("score=" + collectionLSP.getSelectedPlan().getScore()); - assertEquals(numberOfShipments, collectionLSP.getShipments().size()); - assertEquals(numberOfShipments, collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getShipmentIds().size()); + assertEquals(numberOfShipments, collectionLSP.getLspShipments().size()); + assertEquals(numberOfShipments, collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getLspShipmentIds().size()); assertTrue(collectionLSP.getSelectedPlan().getScore() > 0); assertTrue(collectionLSP.getSelectedPlan().getScore() <= (numberOfShipments * 5)); } 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 d73eaeee..b1eb771c 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 @@ -256,7 +256,7 @@ public void install() { updatedPlanCount = lsp.getPlans().size(); innovatedPlanShipmentPlanCount = lsp.getPlans().get(1).getShipmentPlans().size(); - innovatedPlanFirstLogisticChainShipmentCount = lsp.getPlans().get(1).getLogisticChains().iterator().next().getShipmentIds().size(); + innovatedPlanFirstLogisticChainShipmentCount = lsp.getPlans().get(1).getLogisticChains().iterator().next().getLspShipmentIds().size(); for (ShipmentPlan shipmentPlan : lsp.getPlans().get(1).getShipmentPlans()) { if (shipmentPlan.getPlanElements().isEmpty()) { innovatedPlanHasEmptyShipmentPlanElements = true; 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 8c6d2c20..86f387ab 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 @@ -201,11 +201,11 @@ public void initialize() { @Test public void testAssignerRequirements() { - for (Id shipmentId : blueChain.getShipmentIds()) { + for (Id shipmentId : blueChain.getLspShipmentIds()) { LSPShipment shipment = LSPUtils.findLspShipment(blueChain.getLSP(), shipmentId); assertTrue(shipment.getRequirements().iterator().next() instanceof BlueRequirement); } - for (Id shipmentId : redChain.getShipmentIds()) { + 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/logisticChainElementTests/CollectionElementTest.java b/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/CollectionElementTest.java index 71264abd..552270f7 100644 --- a/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/CollectionElementTest.java +++ b/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/CollectionElementTest.java @@ -87,15 +87,15 @@ public void initialize() { @Test public void testCollectionElement() { assertNotNull(collectionElement.getIncomingShipments()); - assertNotNull(collectionElement.getIncomingShipments().getShipments()); - assertTrue(collectionElement.getIncomingShipments().getSortedShipments().isEmpty()); + assertNotNull(collectionElement.getIncomingShipments().getLspShipmentsWTime()); + assertTrue(collectionElement.getIncomingShipments().getSortedLspShipments().isEmpty()); assertNotNull(collectionElement.getAttributes()); assertTrue(collectionElement.getAttributes().isEmpty()); // assertNull(collectionElement.getEmbeddingContainer() ); assertNull(collectionElement.getNextElement()); assertNotNull(collectionElement.getOutgoingShipments()); - assertNotNull(collectionElement.getOutgoingShipments().getShipments()); - assertTrue(collectionElement.getOutgoingShipments().getSortedShipments().isEmpty()); + assertNotNull(collectionElement.getOutgoingShipments().getLspShipmentsWTime()); + assertTrue(collectionElement.getOutgoingShipments().getSortedLspShipments().isEmpty()); assertNull(collectionElement.getPreviousElement()); assertSame(collectionElement.getResource(), carrierResource); assertSame(collectionElement.getResource().getClientElements().iterator().next(), collectionElement); diff --git a/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/DistributionElementTest.java b/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/DistributionElementTest.java index 3c9a923f..95eb61fc 100644 --- a/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/DistributionElementTest.java +++ b/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/DistributionElementTest.java @@ -93,15 +93,15 @@ public void initialize() { @Test public void testDistributionElement() { assertNotNull(distributionElement.getIncomingShipments()); - assertNotNull(distributionElement.getIncomingShipments().getShipments()); - assertTrue(distributionElement.getIncomingShipments().getSortedShipments().isEmpty()); + assertNotNull(distributionElement.getIncomingShipments().getLspShipmentsWTime()); + assertTrue(distributionElement.getIncomingShipments().getSortedLspShipments().isEmpty()); assertNotNull(distributionElement.getAttributes()); assertTrue(distributionElement.getAttributes().isEmpty()); // assertNull(distributionElement.getEmbeddingContainer() ); assertNull(distributionElement.getNextElement()); assertNotNull(distributionElement.getOutgoingShipments()); - assertNotNull(distributionElement.getOutgoingShipments().getShipments()); - assertTrue(distributionElement.getOutgoingShipments().getSortedShipments().isEmpty()); + assertNotNull(distributionElement.getOutgoingShipments().getLspShipmentsWTime()); + assertTrue(distributionElement.getOutgoingShipments().getSortedLspShipments().isEmpty()); assertNull(distributionElement.getPreviousElement()); assertSame(distributionElement.getResource(), adapter); assertSame(distributionElement.getResource().getClientElements().iterator().next(), distributionElement); diff --git a/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/MainRunElementTest.java b/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/MainRunElementTest.java index 39b436b7..3a7df87b 100644 --- a/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/MainRunElementTest.java +++ b/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/MainRunElementTest.java @@ -92,15 +92,15 @@ public void initialize() { @Test public void testDistributionElement() { assertNotNull(mainRunElement.getIncomingShipments()); - assertNotNull(mainRunElement.getIncomingShipments().getShipments()); - assertTrue(mainRunElement.getIncomingShipments().getSortedShipments().isEmpty()); + assertNotNull(mainRunElement.getIncomingShipments().getLspShipmentsWTime()); + assertTrue(mainRunElement.getIncomingShipments().getSortedLspShipments().isEmpty()); assertNotNull(mainRunElement.getAttributes()); assertTrue(mainRunElement.getAttributes().isEmpty()); // assertNull(mainRunElement.getEmbeddingContainer() ); assertNull(mainRunElement.getNextElement()); assertNotNull(mainRunElement.getOutgoingShipments()); - assertNotNull(mainRunElement.getOutgoingShipments().getShipments()); - assertTrue(mainRunElement.getOutgoingShipments().getSortedShipments().isEmpty()); + assertNotNull(mainRunElement.getOutgoingShipments().getLspShipmentsWTime()); + assertTrue(mainRunElement.getOutgoingShipments().getSortedLspShipments().isEmpty()); assertNull(mainRunElement.getPreviousElement()); assertSame(mainRunElement.getResource(), mainRunResource); assertSame(mainRunElement.getResource().getClientElements().iterator().next(), mainRunElement); diff --git a/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/SecondHubElementTest.java b/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/SecondHubElementTest.java index b06c426b..3b60dc7d 100644 --- a/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/SecondHubElementTest.java +++ b/src/test/java/org/matsim/freight/logistics/logisticChainElementTests/SecondHubElementTest.java @@ -57,15 +57,15 @@ public void initialize() { @Test public void testDistributionElement() { assertNotNull(hubElement.getIncomingShipments()); - assertNotNull(hubElement.getIncomingShipments().getShipments()); - assertTrue(hubElement.getIncomingShipments().getSortedShipments().isEmpty()); + assertNotNull(hubElement.getIncomingShipments().getLspShipmentsWTime()); + assertTrue(hubElement.getIncomingShipments().getSortedLspShipments().isEmpty()); assertNotNull(hubElement.getAttributes()); assertTrue(hubElement.getAttributes().isEmpty()); // assertNull(hubElement.getEmbeddingContainer() ); assertNull(hubElement.getNextElement()); assertNotNull(hubElement.getOutgoingShipments()); - assertNotNull(hubElement.getOutgoingShipments().getShipments()); - assertTrue(hubElement.getOutgoingShipments().getSortedShipments().isEmpty()); + assertNotNull(hubElement.getOutgoingShipments().getLspShipmentsWTime()); + assertTrue(hubElement.getOutgoingShipments().getSortedLspShipments().isEmpty()); assertNull(hubElement.getPreviousElement()); assertSame(hubElement.getResource(), point); assertSame(hubElement.getResource().getClientElements().iterator().next(), hubElement); diff --git a/src/test/java/org/matsim/freight/logistics/logisticChainTests/CollectionChainTest.java b/src/test/java/org/matsim/freight/logistics/logisticChainTests/CollectionChainTest.java index bc0a890c..dc07607b 100644 --- a/src/test/java/org/matsim/freight/logistics/logisticChainTests/CollectionChainTest.java +++ b/src/test/java/org/matsim/freight/logistics/logisticChainTests/CollectionChainTest.java @@ -101,8 +101,8 @@ public void testCollectionChain() { assertNotNull(logisticChain.getAttributes()); assertTrue(logisticChain.getAttributes().isEmpty()); assertNull(logisticChain.getLSP()); - assertNotNull(logisticChain.getShipmentIds()); - assertTrue(logisticChain.getShipmentIds().isEmpty()); + assertNotNull(logisticChain.getLspShipmentIds()); + assertTrue(logisticChain.getLspShipmentIds().isEmpty()); assertEquals(1, logisticChain.getLogisticChainElements().size()); ArrayList elements = new ArrayList<>(logisticChain.getLogisticChainElements()); for (LogisticChainElement element : elements) { diff --git a/src/test/java/org/matsim/freight/logistics/logisticChainTests/CompleteLogisticChainTest.java b/src/test/java/org/matsim/freight/logistics/logisticChainTests/CompleteLogisticChainTest.java index 8bb2b35c..ac45d868 100644 --- a/src/test/java/org/matsim/freight/logistics/logisticChainTests/CompleteLogisticChainTest.java +++ b/src/test/java/org/matsim/freight/logistics/logisticChainTests/CompleteLogisticChainTest.java @@ -222,8 +222,8 @@ public void testCompleteLogisticChain() { assertNotNull(logisticChain.getAttributes()); assertTrue(logisticChain.getAttributes().isEmpty()); assertNull(logisticChain.getLSP()); - assertNotNull(logisticChain.getShipmentIds()); - assertTrue(logisticChain.getShipmentIds().isEmpty()); + assertNotNull(logisticChain.getLspShipmentIds()); + assertTrue(logisticChain.getLspShipmentIds().isEmpty()); assertEquals(5, logisticChain.getLogisticChainElements().size()); ArrayList elements = new ArrayList<>(logisticChain.getLogisticChainElements()); for (LogisticChainElement element : elements) { 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 47e64691..4f2637bb 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CollectionLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CollectionLSPMobsimTest.java @@ -205,7 +205,7 @@ public void install() { @Test public void testCollectionLSPMobsim() { - for (LSPShipment shipment : collectionLSP.getShipments()) { + for (LSPShipment shipment : collectionLSP.getLspShipments()) { assertFalse(shipment.getShipmentLog().getPlanElements().isEmpty()); log.warn(""); 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 46601323..aaf282da 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CompleteLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/CompleteLSPMobsimTest.java @@ -310,7 +310,7 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : completeLSP.getShipments()) { + 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()); 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 fb8bb844..44f75e7f 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstAndSecondReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstAndSecondReloadLSPMobsimTest.java @@ -279,7 +279,7 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 d9614864..f2b04718 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstReloadLSPMobsimTest.java @@ -223,7 +223,7 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 051d1259..4cbb9f12 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunLSPMobsimTest.java @@ -255,7 +255,7 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 0566abd4..00ad9fb2 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunOnlyLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MainRunOnlyLSPMobsimTest.java @@ -201,7 +201,7 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 81ad1751..53aa2fa0 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCollectionLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCollectionLSPMobsimTest.java @@ -200,7 +200,7 @@ public void install() { @Test public void testCollectionLSPMobsim() { - for (LSPShipment shipment : collectionLSP.getShipments()) { + 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()); 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 75075a78..3fe2d208 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCompleteLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsCompleteLSPMobsimTest.java @@ -334,7 +334,7 @@ public void initialize() { @Test public void testCompleteLSPMobsim() { - for (LSPShipment shipment : completeLSP.getShipments()) { + 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()); 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 b935caf2..34ac3106 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstAndSecondReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstAndSecondReloadLSPMobsimTest.java @@ -293,7 +293,7 @@ public void initialize() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 43d4c958..319b5293 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsFirstReloadLSPMobsimTest.java @@ -236,7 +236,7 @@ public void initialize() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 d500a006..36c5ef0f 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsMainRunLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleIterationsMainRunLSPMobsimTest.java @@ -277,7 +277,7 @@ public void initialize() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 06e101cb..eaf9c67e 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCollectionLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCollectionLSPMobsimTest.java @@ -185,7 +185,7 @@ public void install() { @Test public void testCollectionLSPMobsim() { - for (LSPShipment shipment : collectionLSP.getShipments()) { + 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()); 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 bbdfe28d..869a8f9c 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCompleteLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsCompleteLSPMobsimTest.java @@ -337,7 +337,7 @@ public void initialize() { @Test public void testCompleteLSPMobsim() { - for (LSPShipment shipment : completeLSP.getShipments()) { + 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()); 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 5f3e77a6..24a70f11 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstAndSecondReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstAndSecondReloadLSPMobsimTest.java @@ -292,7 +292,7 @@ public void initialize() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 f476c7c5..37eeb985 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstReloadLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsFirstReloadLSPMobsimTest.java @@ -228,7 +228,7 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 9afd6277..fffd20d8 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsMainRunLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/MultipleShipmentsMainRunLSPMobsimTest.java @@ -261,7 +261,7 @@ public void install() { @Test public void testFirstReloadLSPMobsim() { - for (LSPShipment shipment : lsp.getShipments()) { + 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()); 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 d2e969ed..b5ef98d3 100644 --- a/src/test/java/org/matsim/freight/logistics/lspMobsimTests/RepeatedMultipleShipmentsCompleteLSPMobsimTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspMobsimTests/RepeatedMultipleShipmentsCompleteLSPMobsimTest.java @@ -317,7 +317,7 @@ public void testCompleteLSPMobsim() { int numberOfIterations = 1 + MatsimRandom.getRandom().nextInt(10); for (int i = 0; i < numberOfIterations; i++) { initialize(); - for (LSPShipment shipment : completeLSP.getShipments()) { + 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()); diff --git a/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLSPShipmentAssigmentTest.java b/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLSPShipmentAssigmentTest.java index a551a081..9dab68f3 100644 --- a/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLSPShipmentAssigmentTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CollectionLSPShipmentAssigmentTest.java @@ -144,20 +144,20 @@ public void initialize() { @Test public void testCollectionLSPShipmentAssignment() { assertSame(collectionLSP.getSelectedPlan(), collectionPlan); - assertFalse(collectionLSP.getShipments().isEmpty()); + assertFalse(collectionLSP.getLspShipments().isEmpty()); ArrayList solutions = new ArrayList<>(collectionLSP.getSelectedPlan().getLogisticChains()); for (LogisticChain solution : solutions) { if (solutions.indexOf(solution) == 0) { - assertEquals(10, solution.getShipmentIds().size()); + assertEquals(10, solution.getLspShipmentIds().size()); for (LogisticChainElement element : solution.getLogisticChainElements()) { if (element.getPreviousElement() == null) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } else { - assertTrue(solution.getShipmentIds().isEmpty()); + assertTrue(solution.getLspShipmentIds().isEmpty()); } } diff --git a/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLSPShipmentAssignerTest.java b/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLSPShipmentAssignerTest.java index 9163a96d..0cc98a4d 100644 --- a/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLSPShipmentAssignerTest.java +++ b/src/test/java/org/matsim/freight/logistics/lspShipmentAssignmentTests/CompleteLSPShipmentAssignerTest.java @@ -275,15 +275,15 @@ public void testCollectionLSPShipmentAssignment() { for (LogisticChain solution : solutions) { if (solutions.indexOf(solution) == 0) { - assertEquals(10, solution.getShipmentIds().size()); + assertEquals(10, solution.getLspShipmentIds().size()); for (LogisticChainElement element : solution.getLogisticChainElements()) { if (element.getPreviousElement() == null) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } else { - assertTrue(solution.getShipmentIds().isEmpty()); + assertTrue(solution.getLspShipmentIds().isEmpty()); } } 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 8da49e23..9138e715 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/CollectionLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/CollectionLSPSchedulingTest.java @@ -149,7 +149,7 @@ public void initialize() { @Test public void testCollectionLSPScheduling() { - for (LSPShipment shipment : collectionLSP.getShipments()) { + for (LSPShipment shipment : collectionLSP.getLspShipments()) { ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); @@ -160,7 +160,7 @@ public void testCollectionLSPScheduling() { System.out.println(); } - for (LSPShipment shipment : collectionLSP.getShipments()) { + 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()); assertEquals("UNLOAD", planElements.get(2).getElementType()); @@ -219,13 +219,13 @@ public void testCollectionLSPScheduling() { } for (LogisticChain solution : collectionLSP.getSelectedPlan().getLogisticChains()) { - assertEquals(1, solution.getShipmentIds().size()); + assertEquals(1, solution.getLspShipmentIds().size()); for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } 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 9ba0758b..f0bc11cf 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/CompleteLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/CompleteLSPSchedulingTest.java @@ -288,7 +288,7 @@ public void initialize() { @Test public void testCompletedLSPScheduling() { - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment shipment : lsp.getLspShipments()) { ArrayList elementList = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); @@ -301,7 +301,7 @@ public void testCompletedLSPScheduling() { ArrayList solutionElements = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements()); ArrayList resources = new ArrayList<>(lsp.getResources()); - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -435,7 +435,7 @@ public void testCompletedLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -449,8 +449,8 @@ public void testCompletedLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } assertEquals(1, secondTranshipmentHubResource.getSimulationTrackers().size()); @@ -462,7 +462,7 @@ public void testCompletedLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), toLinkId); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -476,11 +476,11 @@ public void testCompletedLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -594,13 +594,13 @@ public void testCompletedLSPScheduling() { } for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { - assertEquals(1, solution.getShipmentIds().size()); + assertEquals(1, solution.getLspShipmentIds().size()); for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } diff --git a/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstHubElementTest.java b/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstHubElementTest.java index 966ecd04..6e9db008 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstHubElementTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstHubElementTest.java @@ -56,15 +56,15 @@ public void initialize() { @Test public void testDistributionElement() { assertNotNull(reloadingElement.getIncomingShipments()); - assertNotNull(reloadingElement.getIncomingShipments().getShipments()); - assertTrue(reloadingElement.getIncomingShipments().getSortedShipments().isEmpty()); + assertNotNull(reloadingElement.getIncomingShipments().getLspShipmentsWTime()); + assertTrue(reloadingElement.getIncomingShipments().getSortedLspShipments().isEmpty()); assertNotNull(reloadingElement.getAttributes()); assertTrue(reloadingElement.getAttributes().isEmpty()); // assertNull(reloadingElement.getEmbeddingContainer() ); assertNull(reloadingElement.getNextElement()); assertNotNull(reloadingElement.getOutgoingShipments()); - assertNotNull(reloadingElement.getOutgoingShipments().getShipments()); - assertTrue(reloadingElement.getOutgoingShipments().getSortedShipments().isEmpty()); + assertNotNull(reloadingElement.getOutgoingShipments().getLspShipmentsWTime()); + assertTrue(reloadingElement.getOutgoingShipments().getSortedLspShipments().isEmpty()); assertNull(reloadingElement.getPreviousElement()); assertSame(reloadingElement.getResource(), point); assertSame(reloadingElement.getResource().getClientElements().iterator().next(), reloadingElement); 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 749febdb..e746f654 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstReloadLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/FirstReloadLSPSchedulingTest.java @@ -190,7 +190,7 @@ public void initialize() { @Test public void testFirstReloadLSPScheduling() { - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment shipment : lsp.getLspShipments()) { ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); @@ -202,7 +202,7 @@ public void testFirstReloadLSPScheduling() { } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -257,7 +257,7 @@ public void testFirstReloadLSPScheduling() { for (Entry entry : reloadEventHandler.getServicesWaitedFor().entrySet()) { CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -271,12 +271,12 @@ public void testFirstReloadLSPScheduling() { } assertTrue(handledByTranshipmentHub); //This asserts that the shipments waiting for handling have been handled and the queues have been cleared - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -307,13 +307,13 @@ public void testFirstReloadLSPScheduling() { } for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { - assertEquals(1, solution.getShipmentIds().size()); + assertEquals(1, solution.getLspShipmentIds().size()); for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } 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 71c4e43e..772cc082 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MainRunLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MainRunLSPSchedulingTest.java @@ -225,7 +225,7 @@ public void initialize() { @Test public void testMainRunLSPScheduling() { - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment shipment : lsp.getLspShipments()) { ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); @@ -237,7 +237,7 @@ public void testMainRunLSPScheduling() { } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -324,7 +324,7 @@ public void testMainRunLSPScheduling() { for (Entry entry : reloadEventHandler.getServicesWaitedFor().entrySet()) { CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -338,11 +338,11 @@ public void testMainRunLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -421,13 +421,13 @@ public void testMainRunLSPScheduling() { } for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { - assertEquals(1, solution.getShipmentIds().size()); + assertEquals(1, solution.getLspShipmentIds().size()); for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } 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 612ab56f..62c8702a 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCollectionLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCollectionLSPSchedulingTest.java @@ -152,7 +152,7 @@ public void initialize() { @Test public void testCollectionLSPScheduling() { - for (LSPShipment shipment : collectionLSP.getShipments()) { + for (LSPShipment shipment : collectionLSP.getLspShipments()) { ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(collectionLSP.getSelectedPlan(), shipment.getId()).getPlanElements().values()); scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); @@ -163,7 +163,7 @@ public void testCollectionLSPScheduling() { System.out.println(); } - for (LSPShipment shipment : collectionLSP.getShipments()) { + 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()); assertEquals("UNLOAD", planElements.get(2).getElementType()); @@ -223,11 +223,11 @@ public void testCollectionLSPScheduling() { for (LogisticChain solution : collectionLSP.getSelectedPlan().getLogisticChains()) { for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } 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 276235b8..44f22afb 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCompleteLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsCompleteLSPSchedulingTest.java @@ -291,7 +291,7 @@ public void initialize() { @Test public void testCompletedLSPScheduling() { - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment shipment : lsp.getLspShipments()) { ArrayList elementList = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); @@ -304,7 +304,7 @@ public void testCompletedLSPScheduling() { ArrayList solutionElements = new ArrayList<>(lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements()); ArrayList resources = new ArrayList<>(lsp.getResources()); - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -438,7 +438,7 @@ public void testCompletedLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -452,8 +452,8 @@ public void testCompletedLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } assertEquals(1, secondTranshipmentHubResource.getSimulationTrackers().size()); @@ -465,7 +465,7 @@ public void testCompletedLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), toLinkId); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -479,11 +479,11 @@ public void testCompletedLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -598,11 +598,11 @@ public void testCompletedLSPScheduling() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } 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 0ffafd11..8071308c 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsFirstReloadLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsFirstReloadLSPSchedulingTest.java @@ -189,7 +189,7 @@ public void initialize() { @Test public void testFirstReloadLSPScheduling() { - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment shipment : lsp.getLspShipments()) { ArrayList scheduleElements = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); scheduleElements.sort(ShipmentUtils.createShipmentPlanElementComparator()); @@ -201,7 +201,7 @@ public void testFirstReloadLSPScheduling() { } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -256,7 +256,7 @@ public void testFirstReloadLSPScheduling() { for (Entry entry : reloadEventHandler.getServicesWaitedFor().entrySet()) { CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -270,12 +270,12 @@ public void testFirstReloadLSPScheduling() { } assertTrue(handledByTranshipmentHub); //This asserts that the shipments waiting for handling have been handled and the queues have been cleared - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -307,11 +307,11 @@ public void testFirstReloadLSPScheduling() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } 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 3d4b1433..c5f5834a 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsMainRunLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsMainRunLSPSchedulingTest.java @@ -237,7 +237,7 @@ public void testMainRunLSPScheduling() { }*/ - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -324,7 +324,7 @@ public void testMainRunLSPScheduling() { for (Entry entry : reloadEventHandler.getServicesWaitedFor().entrySet()) { CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -338,11 +338,11 @@ public void testMainRunLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -422,11 +422,11 @@ public void testMainRunLSPScheduling() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } 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 d4da5c41..5274ddd9 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsSecondReloadLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/MultipleShipmentsSecondReloadLSPSchedulingTest.java @@ -264,7 +264,7 @@ public void testSecondReloadLSPScheduling() { System.out.println(); }*/ - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -365,7 +365,7 @@ public void testSecondReloadLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -379,8 +379,8 @@ public void testSecondReloadLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } assertEquals(1, secondTranshipmentHubResource.getSimulationTrackers().size()); @@ -392,7 +392,7 @@ public void testSecondReloadLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), toLinkId); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -406,11 +406,11 @@ public void testSecondReloadLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -491,11 +491,11 @@ public void testSecondReloadLSPScheduling() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } } 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 b16fad55..3fb601f1 100644 --- a/src/test/java/org/matsim/freight/logistics/resourceImplementations/SecondReloadLSPSchedulingTest.java +++ b/src/test/java/org/matsim/freight/logistics/resourceImplementations/SecondReloadLSPSchedulingTest.java @@ -254,7 +254,7 @@ public void initialize() { @Test public void testSecondReloadLSPScheduling() { - for (LSPShipment shipment : lsp.getShipments()) { + for (LSPShipment shipment : lsp.getLspShipments()) { ArrayList elementList = new ArrayList<>(ShipmentUtils.getOrCreateShipmentPlan(lsp.getSelectedPlan(), shipment.getId()).getPlanElements().values()); elementList.sort(ShipmentUtils.createShipmentPlanElementComparator()); System.out.println(); @@ -264,7 +264,7 @@ public void testSecondReloadLSPScheduling() { System.out.println(); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -365,7 +365,7 @@ public void testSecondReloadLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), shipment.getFrom()); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -379,8 +379,8 @@ public void testSecondReloadLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } assertEquals(1, secondTranshipmentHubResource.getSimulationTrackers().size()); @@ -392,7 +392,7 @@ public void testSecondReloadLSPScheduling() { while (iter.hasNext()) { Entry entry = iter.next(); CarrierService service = entry.getKey(); - LSPShipment shipment = entry.getValue().shipment; + LSPShipment shipment = entry.getValue().lspShipment; LogisticChainElement element = entry.getValue().element; assertSame(service.getLocationLinkId(), toLinkId); assertEquals(service.getCapacityDemand(), shipment.getSize()); @@ -406,11 +406,11 @@ public void testSecondReloadLSPScheduling() { } assertTrue(handledByTranshipmentHub); - assertFalse(element.getOutgoingShipments().getShipments().contains(shipment)); - assertFalse(element.getIncomingShipments().getShipments().contains(shipment)); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().contains(shipment)); + assertFalse(element.getIncomingShipments().getLspShipmentsWTime().contains(shipment)); } - for (LSPShipment shipment : lsp.getShipments()) { + 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()); @@ -491,11 +491,11 @@ public void testSecondReloadLSPScheduling() { for (LogisticChain solution : lsp.getSelectedPlan().getLogisticChains()) { for (LogisticChainElement element : solution.getLogisticChainElements()) { - assertTrue(element.getIncomingShipments().getShipments().isEmpty()); + assertTrue(element.getIncomingShipments().getLspShipmentsWTime().isEmpty()); if (element.getNextElement() != null) { - assertTrue(element.getOutgoingShipments().getShipments().isEmpty()); + assertTrue(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } else { - assertFalse(element.getOutgoingShipments().getShipments().isEmpty()); + assertFalse(element.getOutgoingShipments().getLspShipmentsWTime().isEmpty()); } } }