From f3c2efb9f8cd27fb90627a631a12f07a83d0d8ec Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Thu, 12 Oct 2023 22:19:00 +0200 Subject: [PATCH 1/8] rename/move packages: ....contrib.freight.* -> ....freight.carriers.* --- .../CarrierReaderFromCSV.java | 8 +- .../DemandReaderFromCSV.java | 4 +- .../FreightDemandGeneration.java | 16 ++-- .../FreightDemandGenerationUtils.java | 8 +- ...rateSmallScaleCommercialTrafficDemand.java | 10 +-- .../SmallScaleCommercialTrafficUtils.java | 14 +-- .../TrafficVolumeGeneration.java | 10 +-- .../TripDistributionMatrix.java | 2 +- .../CarrierReaderFromCSVTest.java | 12 +-- .../DemandReaderFromCSVTest.java | 12 +-- ...nerateSmallScaleCommercialTrafficTest.java | 6 +- .../TrafficVolumeGenerationTest.java | 8 +- .../ChangeCommercialJobOperator.java | 4 +- .../jointDemand/CommercialJobGenerator.java | 2 +- .../CommercialTrafficAnalysisListener.java | 6 +- .../jointDemand/CommercialTrafficChecker.java | 4 +- .../DefaultCommercialJobGenerator.java | 26 +++--- .../jointDemand/JointDemandModule.java | 8 +- .../jointDemand/JointDemandUtils.java | 6 +- .../RunJointDemandCarToggleJspritExample.java | 4 +- .../jointDemand/ScoreCommercialJobs.java | 8 +- .../jointDemand/TourLengthAnalyzer.java | 2 +- .../jointDemand/TourPlanning.java | 21 ++--- .../examples/RunJointDemandCarExample.java | 4 +- .../examples/RunJointDemandDRTExample.java | 4 +- .../ChangeCommercialJobOperatorTest.java | 9 +- .../CommercialTrafficIntegrationTest.java | 4 +- .../IsTheRightCustomerScoredTest.java | 6 +- .../jointDemand/TestScenarioGeneration.java | 2 +- .../contrib/freight/events/HasCarrierId.java | 13 --- .../Vehicle2CarrierEventHandler.java | 69 --------------- .../contrib/freight/jsprit/NetworkRouter.java | 42 --------- .../carriers}/FreightConfigGroup.java | 43 +++++----- .../carriers}/carrier/Carrier.java | 8 +- .../carrier/CarrierCapabilities.java | 6 +- .../carriers}/carrier/CarrierConstants.java | 2 +- .../carriers}/carrier/CarrierImpl.java | 10 +-- .../carriers}/carrier/CarrierPlan.java | 7 +- .../carrier/CarrierPlanReaderV1.java | 11 +-- .../carriers}/carrier/CarrierPlanWriter.java | 2 +- .../carrier/CarrierPlanXmlParserV2.java | 21 ++--- .../carrier/CarrierPlanXmlParserV2_1.java | 8 +- .../carrier/CarrierPlanXmlReader.java | 2 +- .../carrier/CarrierPlanXmlWriterV1.java | 24 +++--- .../carrier/CarrierPlanXmlWriterV2.java | 18 ++-- .../carrier/CarrierPlanXmlWriterV2_1.java | 21 +++-- .../carriers}/carrier/CarrierService.java | 40 ++++----- .../carriers}/carrier/CarrierShipment.java | 2 +- .../carriers}/carrier/CarrierUtils.java | 2 +- .../carriers}/carrier/CarrierVehicle.java | 2 +- .../carriers}/carrier/CarrierVehicleType.java | 2 +- .../carrier/CarrierVehicleTypeLoader.java | 2 +- .../carrier/CarrierVehicleTypeReader.java | 2 +- .../carrier/CarrierVehicleTypeReaderV1.java | 2 +- .../carrier/CarrierVehicleTypeWriter.java | 4 +- .../carrier/CarrierVehicleTypeWriterV1.java | 2 +- .../carrier/CarrierVehicleTypes.java | 8 +- .../carriers}/carrier/Carriers.java | 11 ++- .../carriers}/carrier/ScheduledTour.java | 14 +-- .../carriers}/carrier/TimeWindow.java | 2 +- .../carriers}/carrier/Tour.java | 2 +- .../carriers}/controler/CarrierAgent.java | 27 ++---- .../controler/CarrierAgentTracker.java | 10 +-- .../controler/CarrierControlerListener.java | 40 ++++----- .../controler/CarrierDriverAgent.java | 27 +++++- .../carriers}/controler/CarrierModule.java | 43 +++++----- .../controler/CarrierReRouteVehicles.java | 44 +++++----- .../CarrierScoringFunctionFactory.java | 4 +- .../controler/CarrierStrategyManager.java | 6 +- .../controler/CarrierStrategyManagerImpl.java | 28 +++++- .../CarrierTimeAllocationMutator.java | 50 +++++------ .../CarrierTimeAndSpaceTourRouter.java | 18 ++-- .../controler/CarrierVehicleReRouter.java | 19 ++-- .../carriers}/controler/FreightActivity.java | 10 +-- .../controler/FreightAgentSource.java | 44 +++++----- .../carriers}/controler/FreightUtils.java | 55 ++++++------ .../WithinDayActivityReScheduling.java | 15 ++-- .../events/AbstractCarrierEvent.java | 25 +++++- .../events/CarrierEventAttributes.java | 2 +- .../carriers}/events/CarrierEventCreator.java | 6 +- .../events/CarrierEventCreatorUtils.java | 2 +- .../events/CarrierEventsReaders.java | 37 ++++---- .../events/CarrierServiceEndEvent.java | 18 ++-- .../events/CarrierServiceEndEventCreator.java | 15 ++-- .../events/CarrierServiceStartEvent.java | 20 ++--- .../CarrierServiceStartEventCreator.java | 15 ++-- .../CarrierShipmentDeliveryEndEvent.java | 20 ++--- ...arrierShipmentDeliveryEndEventCreator.java | 15 ++-- .../CarrierShipmentDeliveryStartEvent.java | 8 +- ...rierShipmentDeliveryStartEventCreator.java | 15 ++-- .../events/CarrierShipmentPickupEndEvent.java | 8 +- .../CarrierShipmentPickupEndEventCreator.java | 15 ++-- .../CarrierShipmentPickupStartEvent.java | 20 ++--- ...arrierShipmentPickupStartEventCreator.java | 15 ++-- .../carriers}/events/CarrierTourEndEvent.java | 14 ++- .../events/CarrierTourEndEventCreator.java | 8 +- .../events/CarrierTourStartEvent.java | 8 +- .../events/CarrierTourStartEventCreator.java | 8 +- .../freight/carriers/events/HasCarrierId.java | 34 ++++++++ .../FreightServiceEndEventHandler.java | 4 +- .../FreightServiceStartEventHandler.java | 4 +- .../FreightShipmentDeliveryEventHandler.java | 4 +- .../FreightShipmentPickupEventHandler.java | 4 +- .../FreightTourEndEventHandler.java | 4 +- .../FreightTourStartEventHandler.java | 4 +- .../Vehicle2CarrierEventHandler.java | 70 +++++++++++++++ .../carriers}/jsprit/DistanceConstraint.java | 6 +- .../carriers}/jsprit/DistanceUpdater.java | 4 +- .../carriers}/jsprit/FiFoTravelTime.java | 2 +- .../carriers}/jsprit/MatsimJspritFactory.java | 81 ++++++++++-------- .../jsprit/NetworkBasedTransportCosts.java | 36 +++++--- .../NetworkBasedTransportCostsFactory.java | 6 +- .../carriers/jsprit/NetworkRouter.java | 50 +++++++++++ .../carriers}/jsprit/VRPTransportCosts.java | 2 +- .../jsprit/VRPTransportCostsFactory.java | 2 +- ...cleTypeDependentRoadPricingCalculator.java | 39 +++++---- .../carriers}/package-info.java | 7 +- .../usecases/analysis/CarrierScoreStats.java | 49 +++++------ .../usecases/analysis/LegHistogram.java | 64 +++++++------- .../CarrierScoringFunctionFactoryImpl.java | 10 +-- .../chessboard/CarrierTravelDisutilities.java | 10 +-- .../chessboard/FreightScenarioCreator.java | 6 +- .../chessboard/InitialCarrierPlanCreator.java | 15 ++-- .../InnerOuterCityScenarioCreator.java | 8 +- .../chessboard/PassengerScenarioCreator.java | 16 ++-- .../usecases/chessboard/PlotPlans.java | 12 +-- .../usecases/chessboard/RunChessboard.java | 17 ++-- .../RunPassengerAlongWithCarriers.java | 23 +++-- .../RunPassengerPlansFromConfig.java | 2 +- .../RunPassengerPlansFromScratch.java | 4 +- ...PlanAndOptimizeItsVehicleRouteFactory.java | 21 +++-- .../carrier/CarrierPlanXmlWriterV1Test.java | 61 ------------- .../carrier/CarrierVehicleTypeWriterTest.java | 21 ----- .../RunPassengerAlongWithCarriersIT.java | 30 ------- .../carriers}/FreightConfigGroupTest.java | 27 +++++- .../carriers}/carrier/CarrierModuleTest.java | 53 ++++++------ .../carrier/CarrierPlanReaderV1Test.java | 40 ++++----- .../carrier/CarrierPlanXmlReaderV2Test.java | 44 +++++++--- .../CarrierPlanXmlReaderV2WithDtdTest.java | 33 +++++-- .../carrier/CarrierPlanXmlWriterV1Test.java | 54 ++++++++++++ .../carrier/CarrierPlanXmlWriterV2Test.java | 25 +++++- .../carrier/CarrierPlanXmlWriterV2_1Test.java | 27 +++++- .../carrier/CarrierReadWriteV2_1Test.java | 23 ++++- .../carriers}/carrier/CarrierUtilsTest.java | 45 ++++------ .../carrier/CarrierVehicleTypeLoaderTest.java | 23 ++++- .../carrier/CarrierVehicleTypeReaderTest.java | 23 ++++- .../carrier/CarrierVehicleTypeTest.java | 23 ++++- .../carrier/CarrierVehicleTypeWriterTest.java | 42 +++++++++ .../EquilWithCarrierWithPersonsIT.java | 51 +++++------ .../EquilWithCarrierWithoutPersonsIT.java | 57 ++++++------ ...istanceConstraintFromVehiclesFileTest.java | 14 +-- .../jsprit/DistanceConstraintTest.java | 14 +-- .../carriers}/jsprit/FixedCostsTest.java | 55 ++++++------ .../carriers}/jsprit/IntegrationIT.java | 31 +++++-- .../jsprit/MatsimTransformerTest.java | 56 ++++++++---- .../NetworkBasedTransportCostsTest.java | 34 ++++++-- .../carriers}/jsprit/SkillsIT.java | 43 +++++----- ...istanceScoringFunctionFactoryForTests.java | 40 ++++++--- .../ScoringFunctionFactoryForTests.java | 39 +++++++-- .../StrategyManagerFactoryForTests.java | 35 ++++++-- .../TimeScoringFunctionFactoryForTests.java | 40 ++++++--- .../usecases/chessboard/RunChessboardIT.java | 23 ++++- .../RunPassengerAlongWithCarriersIT.java | 51 +++++++++++ .../carriers}/utils/FreightUtilsIT.java | 69 +++++++-------- .../carriers}/utils/FreightUtilsTest.java | 76 ++++++++-------- .../testSetupScenario/grid10.xml | 0 .../CarrierModuleTest/carrierPlansEquils.xml | 0 .../carrier/CarrierModuleTest/network.xml | 0 .../carrier/CarrierModuleTest/plans100.xml | 0 .../CarrierModuleTest/vehicleTypes.xml | 0 .../carrierPlansEquils.xml | 0 ...carrierPlansEquils_unscored_unselected.xml | 0 .../carrierPlansEquils.xml | 0 .../carrierPlansEquilsFiniteFleet.xml | 0 .../carrierPlansEquilsFiniteFleetWithDtd.xml | 0 .../carrierPlansEquilsWithDtd.xml | 0 .../carrierPlansEquils.xml | 0 .../carrierPlansEquils.xml | 0 .../carrierPlansEquilsWritten.xml | 0 .../carrierPlansEquils.xml | 0 .../CarrierReadWriteV2_1Test/carriers.xml | 0 .../CarrierReadWriteV2_1Test/vehicles.xml | 0 .../carrierPlansEquils.xml | 0 .../vehicleTypes.xml | 0 .../vehicleTypes.xml | 0 .../vehicleTypes_v2.xml | 0 .../carrierVehicleTypes_v1.xsd | 0 .../carrierVehicleTypes_v2.xsd | 0 .../vehicleTypes.xml | 0 .../carriers}/carrier/vehicleTypes_v2.xml | 0 .../carrierPlansEquils.xml | 0 .../EquilWithCarrierWithPersonsIT/network.xml | 0 .../plans100.xml | 0 .../carrierPlansEquils.xml | 0 .../network.xml | 0 .../output_events.xml.gz | Bin .../carriers}/controler/vehicleTypes_v2.xml | 0 .../jsprit/IntegrationIT/carrier.xml | 0 .../merged-network-simplified.xml.gz | Bin .../jsprit/IntegrationIT/vehicleTypes.xml | 0 .../MatsimTransformerTest/grid-network.xml | 0 .../network.xml | 0 .../jsprit/SkillsIT/grid-network.xml | 0 .../jsprit/vehicleTypesForDCTest.xml | 0 .../CarrierAgentTest/carrierPlansEquils.xml | 0 .../mobsim/CarrierAgentTest/network.xml | 0 .../runChessboard/output_events.xml.gz | Bin .../runChessboard/output_plans.xml.gz | Bin .../carriers}/utils/grid-network.xml | 0 .../testCreateTours/carrierPlansEquils.xml | 0 .../carrierPlansEquils.xml | 0 .../carrierPlansEquils.xml | 0 .../network.xml | 0 .../freightreceiver/ReceiverAgent.java | 6 +- .../ReceiverControlerListener.java | 8 +- .../ReceiverCostAllocation.java | 2 +- ...ReceiverCostAllocationEqualProportion.java | 2 +- .../ReceiverCostAllocationFixed.java | 2 +- .../freightreceiver/ReceiverModule.java | 2 +- .../freightreceiver/ReceiverOrder.java | 2 +- .../contrib/freightreceiver/ReceiverPlan.java | 4 +- .../freightreceiver/ReceiverScoreStats.java | 2 +- ...iverTriggersCarrierReplanningListener.java | 13 +-- .../freightreceiver/ReceiverUtils.java | 2 +- .../freightreceiver/ReceiversReaderV2.java | 4 +- .../freightreceiver/ReceiversWriter.java | 2 +- .../ReceiversWriterHandler.java | 2 +- .../ReceiversWriterHandlerImplV1.java | 2 +- .../ReceiversWriterHandlerImplV2.java | 2 +- ...UsecasesCarrierScoringFunctionFactory.java | 6 +- .../collaboration/Coalition.java | 2 +- .../collaboration/CollaborationUtils.java | 6 +- .../collaboration/CollaborationUtilsNew.java | 2 +- .../collaboration/MutableCoalition.java | 2 +- .../collaboration/TimeWindowMutator.java | 2 +- .../replanning/ReceiverStrategyManager.java | 2 +- .../TimeWindowUpperBoundMutator.java | 2 +- .../ReceiverChessboardScenario.java | 6 +- ...iverChessboardWithEqualProportionCost.java | 6 +- ...eceiverChessboardWithFixedCarrierCost.java | 6 +- .../freightreceiver/ReceiversReaderTest.java | 4 +- .../analysis/CarrierLoadAnalysis.java | 31 +++++-- .../analysis/CarrierPlanAnalysis.java | 27 +++++- .../analysis/FreightAnalysisEventHandler.java | 28 +++--- .../FreightAnalysisServiceTracking.java | 10 +-- .../FreightAnalysisShipmentTracking.java | 12 +-- .../FreightAnalysisVehicleTracking.java | 6 +- ...tTimeAndDistanceAnalysisEventsHandler.java | 33 +++++-- .../carriers/analysis}/analysis/Readme.md | 0 .../analysis/RunFreightAnalysis.java | 10 +-- .../RunFreightAnalysisEventBased.java | 10 +-- .../FreightAnalysisEventBasedTest.java | 25 ------ .../MyServiceTrackerEventHandler.java | 59 ------------- .../FreightAnalysisEventBasedTest.java | 47 ++++++++++ .../MyFreightVehicleTrackerEventHandler.java | 7 +- .../MyServiceTrackerEventHandler.java | 81 ++++++++++++++++++ .../MyShipmentTrackerEventHandler.java | 38 ++++++-- .../analysis/RunFreightAnalysisIT.java | 6 +- .../RunFreightAnalysisWithShipmentTest.java | 32 +++++-- .../output_allVehicles.xml.gz | Bin .../output_carriers.xml.gz | Bin .../output_events.xml.gz | Bin .../output_network.xml.gz | Bin .../Carrier_stats.tsv | 0 .../Load_perVehicle.tsv | 0 .../TimeDistance_perVehicle.tsv | 0 .../TimeDistance_perVehicleType.tsv | 0 .../compareResults/carrierStats.tsv | 0 .../carrier_##carrier1_tripStats.tsv | 0 .../carrier_##carrier1_vehicleStats.tsv | 0 .../carrier_carrier1_ServiceStats.tsv | 0 .../carrier_carrier1_ShipmentStats.tsv | 0 .../carrier_carrier1_VehicleTypeStats.tsv | 0 .../compareResults/freightVehicleStats.tsv | 0 .../freightVehicleTripStats.tsv | 0 .../compareResults/serviceStats.tsv | 0 .../compareResults/shipmentStats.tsv | 0 .../output_allVehicles.xml.gz | Bin .../output_carriers.xml.gz | Bin .../RunFreightAnalysisIT/output_events.xml.gz | Bin .../output_network.xml.gz | Bin .../compareResults/shipment/carrierStats.tsv | 0 .../shipment/carrier_##carrier1_tripStats.tsv | 0 .../carrier_##carrier1_vehicleStats.tsv | 0 .../carrier_carrier1_ShipmentStats.tsv | 0 .../carrier_carrier1_VehicleTypeStats.tsv | 0 .../shipment/freightVehicleStats.tsv | 0 .../shipment/freightVehicleTripStats.tsv | 0 .../shipment/output_allVehicles.xml.gz | Bin .../shipment/output_carriers.xml.gz | Bin .../shipment/output_events.xml.gz | Bin .../shipment/output_network.xml.gz | Bin 292 files changed, 2238 insertions(+), 1637 deletions(-) delete mode 100644 contribs/freight/src/main/java/org/matsim/contrib/freight/events/HasCarrierId.java delete mode 100644 contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/Vehicle2CarrierEventHandler.java delete mode 100644 contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkRouter.java rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/FreightConfigGroup.java (85%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/Carrier.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierCapabilities.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierConstants.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierImpl.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlan.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanReaderV1.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanWriter.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlParserV2.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlParserV2_1.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlReader.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV1.java (95%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV2.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV2_1.java (94%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierService.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierShipment.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierUtils.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicle.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleType.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeLoader.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeReader.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeReaderV1.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeWriter.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeWriterV1.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypes.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/Carriers.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/ScheduledTour.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/TimeWindow.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/carrier/Tour.java (99%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierAgent.java (91%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierAgentTracker.java (95%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierControlerListener.java (65%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierDriverAgent.java (87%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierModule.java (78%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierReRouteVehicles.java (68%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierScoringFunctionFactory.java (93%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierStrategyManager.java (93%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierStrategyManagerImpl.java (54%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierTimeAllocationMutator.java (65%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierTimeAndSpaceTourRouter.java (94%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/CarrierVehicleReRouter.java (95%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/FreightActivity.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/FreightAgentSource.java (67%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/FreightUtils.java (93%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/controler/WithinDayActivityReScheduling.java (96%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/AbstractCarrierEvent.java (54%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierEventAttributes.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierEventCreator.java (92%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierEventCreatorUtils.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierEventsReaders.java (61%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierServiceEndEvent.java (86%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierServiceEndEventCreator.java (80%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierServiceStartEvent.java (83%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierServiceStartEventCreator.java (80%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierShipmentDeliveryEndEvent.java (80%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierShipmentDeliveryEndEventCreator.java (81%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierShipmentDeliveryStartEvent.java (94%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierShipmentDeliveryStartEventCreator.java (81%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierShipmentPickupEndEvent.java (93%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierShipmentPickupEndEventCreator.java (81%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierShipmentPickupStartEvent.java (80%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierShipmentPickupStartEventCreator.java (81%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierTourEndEvent.java (89%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierTourEndEventCreator.java (90%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierTourStartEvent.java (93%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/CarrierTourStartEventCreator.java (95%) create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/events/HasCarrierId.java rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/eventhandler/FreightServiceEndEventHandler.java (92%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/eventhandler/FreightServiceStartEventHandler.java (92%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/eventhandler/FreightShipmentDeliveryEventHandler.java (92%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/eventhandler/FreightShipmentPickupEventHandler.java (92%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/eventhandler/FreightTourEndEventHandler.java (92%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/events/eventhandler/FreightTourStartEventHandler.java (92%) create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/Vehicle2CarrierEventHandler.java rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/DistanceConstraint.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/DistanceUpdater.java (96%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/FiFoTravelTime.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/MatsimJspritFactory.java (92%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/NetworkBasedTransportCosts.java (95%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/NetworkBasedTransportCostsFactory.java (95%) create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkRouter.java rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/VRPTransportCosts.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/VRPTransportCostsFactory.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/VehicleTypeDependentRoadPricingCalculator.java (79%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/package-info.java (95%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/analysis/CarrierScoreStats.java (85%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/analysis/LegHistogram.java (90%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java (96%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/CarrierTravelDisutilities.java (94%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/FreightScenarioCreator.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/InitialCarrierPlanCreator.java (96%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/InnerOuterCityScenarioCreator.java (97%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/PassengerScenarioCreator.java (93%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/PlotPlans.java (86%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/RunChessboard.java (93%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/RunPassengerAlongWithCarriers.java (89%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/RunPassengerPlansFromConfig.java (96%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/RunPassengerPlansFromScratch.java (98%) rename contribs/freight/src/main/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java (94%) delete mode 100644 contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1Test.java delete mode 100644 contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterTest.java delete mode 100644 contribs/freight/src/test/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerAlongWithCarriersIT.java rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/FreightConfigGroupTest.java (63%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierModuleTest.java (73%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanReaderV1Test.java (75%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlReaderV2Test.java (82%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlReaderV2WithDtdTest.java (78%) create mode 100644 contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test.java rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV2Test.java (79%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV2_1Test.java (81%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierReadWriteV2_1Test.java (63%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierUtilsTest.java (72%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeLoaderTest.java (69%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeReaderTest.java (73%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeTest.java (85%) create mode 100644 contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest.java rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/controler/EquilWithCarrierWithPersonsIT.java (72%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/controler/EquilWithCarrierWithoutPersonsIT.java (83%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/DistanceConstraintFromVehiclesFileTest.java (97%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/DistanceConstraintTest.java (98%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/FixedCostsTest.java (87%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/IntegrationIT.java (72%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/MatsimTransformerTest.java (93%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/NetworkBasedTransportCostsTest.java (83%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/jsprit/SkillsIT.java (88%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/mobsim/DistanceScoringFunctionFactoryForTests.java (76%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/mobsim/ScoringFunctionFactoryForTests.java (74%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/mobsim/StrategyManagerFactoryForTests.java (60%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/mobsim/TimeScoringFunctionFactoryForTests.java (77%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/RunChessboardIT.java (58%) create mode 100644 contribs/freight/src/test/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriersIT.java rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/utils/FreightUtilsIT.java (89%) rename contribs/freight/src/test/java/org/matsim/{contrib/freight => freight/carriers}/utils/FreightUtilsTest.java (93%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/algorithms/SetupSimpleFreightScenarioTest/testSetupScenario/grid10.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierModuleTest/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierModuleTest/network.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierModuleTest/plans100.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierModuleTest/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanReaderV1Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierReadWriteV2_1Test/carriers.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierReadWriteV2_1Test/vehicles.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeLoaderTest/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeReaderTest/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/CarrierVehicleTypeWriterTest/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/carrier/vehicleTypes_v2.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/controler/EquilWithCarrierWithPersonsIT/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/controler/EquilWithCarrierWithPersonsIT/network.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/controler/EquilWithCarrierWithPersonsIT/plans100.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/controler/EquilWithCarrierWithoutPersonsIT/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/controler/EquilWithCarrierWithoutPersonsIT/network.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/controler/EquilWithCarrierWithoutPersonsIT/output_events.xml.gz (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/controler/vehicleTypes_v2.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/jsprit/IntegrationIT/carrier.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/jsprit/IntegrationIT/merged-network-simplified.xml.gz (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/jsprit/IntegrationIT/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/jsprit/MatsimTransformerTest/grid-network.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/jsprit/NetworkBasedTransportCostsTest/network.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/jsprit/SkillsIT/grid-network.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/jsprit/vehicleTypesForDCTest.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/mobsim/CarrierAgentTest/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/mobsim/CarrierAgentTest/network.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/RunChessboardIT/runChessboard/output_events.xml.gz (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/usecases/chessboard/RunChessboardIT/runChessboard/output_plans.xml.gz (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/utils/grid-network.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/vrp/Matsim2VrpUtilsTest/testCreateTours/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/vrp/Matsim2VrpUtilsTest/testCreateVehicleRoutes/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/{contrib/freight => freight/carriers}/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/network.xml (100%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/CarrierLoadAnalysis.java (64%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/CarrierPlanAnalysis.java (56%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/FreightAnalysisEventHandler.java (95%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/FreightAnalysisServiceTracking.java (96%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/FreightAnalysisShipmentTracking.java (93%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/FreightAnalysisVehicleTracking.java (97%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java (83%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/Readme.md (100%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/RunFreightAnalysis.java (92%) rename contribs/vsp/src/main/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/RunFreightAnalysisEventBased.java (94%) delete mode 100644 contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest.java delete mode 100644 contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyServiceTrackerEventHandler.java create mode 100644 contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventBasedTest.java rename contribs/vsp/src/test/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/MyFreightVehicleTrackerEventHandler.java (92%) create mode 100644 contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java rename contribs/vsp/src/test/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/MyShipmentTrackerEventHandler.java (51%) rename contribs/vsp/src/test/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/RunFreightAnalysisIT.java (99%) rename contribs/vsp/src/test/java/org/matsim/{contrib/freight => freight/carriers/analysis}/analysis/RunFreightAnalysisWithShipmentTest.java (73%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/output_carriers.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/output_events.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisIT/output_network.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/{contrib => }/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz (100%) diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java index 591a895aa84..a499851f09f 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java @@ -27,10 +27,10 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java index fa3357d473c..f8243d5d4d4 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java @@ -31,8 +31,8 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.network.NetworkUtils; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.core.utils.geometry.geotools.MGC; diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java index 8f6c2e87446..58653204d18 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java @@ -26,14 +26,14 @@ import org.matsim.api.core.v01.population.Population; import org.matsim.application.MATSimAppCommand; import org.matsim.application.options.ShpOptions; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlanWriter; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.controler.CarrierModule; -import org.matsim.contrib.freight.controler.CarrierScoringFunctionFactory; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.usecases.chessboard.CarrierScoringFunctionFactoryImpl; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlanWriter; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.controler.CarrierModule; +import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.usecases.chessboard.CarrierScoringFunctionFactoryImpl; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ControllerConfigGroup; diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java index 82be3284375..5b54115b3af 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java @@ -29,10 +29,10 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.*; import org.matsim.application.options.ShpOptions; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierService; -import org.matsim.contrib.freight.carrier.CarrierShipment; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierService; +import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.controler.Controler; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.core.utils.geometry.geotools.MGC; diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 1ef1365d510..a5e51cb8346 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -38,11 +38,11 @@ import org.matsim.application.MATSimAppCommand; import org.matsim.application.options.ShpOptions; import org.matsim.application.options.ShpOptions.Index; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.*; -import org.matsim.contrib.freight.usecases.chessboard.CarrierTravelDisutilities; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.usecases.chessboard.CarrierTravelDisutilities; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ControllerConfigGroup; diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java index 9d7ab8ad305..294b5c8ab0b 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java @@ -40,13 +40,13 @@ import org.matsim.api.core.v01.population.*; import org.matsim.application.options.ShpOptions; import org.matsim.application.options.ShpOptions.Index; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.carrier.Tour.Pickup; -import org.matsim.contrib.freight.carrier.Tour.ServiceActivity; -import org.matsim.contrib.freight.carrier.Tour.TourElement; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.carrier.Tour.Pickup; +import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; +import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.network.NetworkUtils; import org.matsim.core.population.PopulationUtils; diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java index 6f747bc2ee5..301f14decca 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java @@ -27,11 +27,11 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.Tour.Pickup; -import org.matsim.contrib.freight.carrier.Tour.ServiceActivity; -import org.matsim.contrib.freight.carrier.Tour.TourElement; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.Tour.Pickup; +import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; +import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.utils.io.IOUtils; diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TripDistributionMatrix.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TripDistributionMatrix.java index 698f43a967a..0f3a2f3dcfe 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TripDistributionMatrix.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TripDistributionMatrix.java @@ -33,7 +33,7 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.application.options.ShpOptions; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.core.utils.io.IOUtils; import org.matsim.core.utils.io.UncheckedIOException; import org.matsim.vehicles.VehicleType; diff --git a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java index cca68b4d44b..11097157601 100644 --- a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java +++ b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java @@ -17,12 +17,12 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.application.options.ShpOptions; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.carrier.CarrierUtils; -import org.matsim.contrib.freight.carrier.CarrierVehicle; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.carrier.CarrierVehicle; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.NetworkUtils; diff --git a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java index fdc2aa30d12..10d7118b0c1 100644 --- a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java +++ b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java @@ -18,12 +18,12 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; import org.matsim.application.options.ShpOptions; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierService; -import org.matsim.contrib.freight.carrier.CarrierShipment; -import org.matsim.contrib.freight.carrier.TimeWindow; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierService; +import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.NetworkUtils; diff --git a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java index 7e05a64a48e..c1e44d96aaf 100644 --- a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java +++ b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java @@ -25,9 +25,9 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.population.PopulationUtils; diff --git a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java index 1d2109fcec7..5833eadb4dd 100644 --- a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java +++ b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java @@ -27,10 +27,10 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; import org.matsim.application.options.ShpOptions; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.carrier.CarrierUtils; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.scenario.ScenarioUtils; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperator.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperator.java index 29c3c8662e9..5d44ae94997 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperator.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperator.java @@ -23,8 +23,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.core.config.groups.GlobalConfigGroup; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.population.algorithms.PlanAlgorithm; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialJobGenerator.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialJobGenerator.java index 024ab6e45e6..4faafad6785 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialJobGenerator.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialJobGenerator.java @@ -21,7 +21,7 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.population.Population; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.core.controler.listener.AfterMobsimListener; import org.matsim.core.controler.listener.BeforeMobsimListener; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficAnalysisListener.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficAnalysisListener.java index fb67736cd99..26091293d12 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficAnalysisListener.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficAnalysisListener.java @@ -25,8 +25,8 @@ import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVPrinter; import org.matsim.api.core.v01.Id; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.core.controler.MatsimServices; import org.matsim.core.controler.events.IterationEndsEvent; import org.matsim.core.controler.listener.IterationEndsListener; @@ -77,7 +77,7 @@ public void notifyIterationEnds(IterationEndsEvent event) { writeIterationCarrierStats(event); writeJobStats(services.getControlerIO().getIterationFilename(event.getIteration(), "commercialJobStats.csv")); analyzeCarrierMarketShares(event.getIteration()); - + firstIteration = false; } diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficChecker.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficChecker.java index 88e68e04d36..471cdf9a84e 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficChecker.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficChecker.java @@ -27,8 +27,8 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Plan; import org.matsim.api.core.v01.population.Population; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carriers; import java.util.Collection; import java.util.Map; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/DefaultCommercialJobGenerator.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/DefaultCommercialJobGenerator.java index c9a1becb44f..0d2c4e52661 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/DefaultCommercialJobGenerator.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/DefaultCommercialJobGenerator.java @@ -36,18 +36,18 @@ import org.matsim.api.core.v01.population.Population; import org.matsim.api.core.v01.population.Route; import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlanWriter; -import org.matsim.contrib.freight.carrier.CarrierService; -import org.matsim.contrib.freight.carrier.CarrierUtils; -import org.matsim.contrib.freight.carrier.CarrierVehicle; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypes; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.TimeWindow; -import org.matsim.contrib.freight.carrier.Tour; -import org.matsim.contrib.freight.jsprit.VRPTransportCostsFactory; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlanWriter; +import org.matsim.freight.carriers.carrier.CarrierService; +import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.jsprit.VRPTransportCostsFactory; import org.matsim.core.config.Config; import org.matsim.core.config.groups.ReplanningConfigGroup.StrategySettings; import org.matsim.core.controler.events.AfterMobsimEvent; @@ -223,7 +223,7 @@ private Plan createPlainPlanFromTour(Carrier carrier, ScheduledTour scheduledTou plan.addActivity(startActivity); for (Tour.TourElement tourElement : scheduledTour.getTour().getTourElements()) { - if (tourElement instanceof org.matsim.contrib.freight.carrier.Tour.Leg) { + if (tourElement instanceof Tour.Leg) { // Take information from scheduled leg and create a defaultLeg Tour.Leg tourLeg = (Tour.Leg) tourElement; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java index 5860e8a5cd9..87977da1288 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java @@ -27,10 +27,10 @@ import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; import org.matsim.contrib.drt.run.MultiModeDrtModule; import org.matsim.contrib.dvrp.run.DvrpModule; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCostsFactory; -import org.matsim.contrib.freight.jsprit.VRPTransportCostsFactory; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCostsFactory; +import org.matsim.freight.carriers.jsprit.VRPTransportCostsFactory; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.controler.AbstractModule; import org.matsim.core.replanning.PlanStrategy; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandUtils.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandUtils.java index 5089e8b9e87..3ca98d6ade6 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandUtils.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandUtils.java @@ -22,9 +22,9 @@ import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Plan; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierVehicle; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.carrier.Carriers; import javax.annotation.Nullable; import java.util.*; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java index e2b9e8b9260..6c4da322185 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java @@ -22,8 +22,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ScoringConfigGroup; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ScoreCommercialJobs.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ScoreCommercialJobs.java index 7cdab223e4b..7baed018f31 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ScoreCommercialJobs.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ScoreCommercialJobs.java @@ -30,10 +30,10 @@ import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.*; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierService; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierService; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.carrier.CarrierConstants; import org.matsim.core.api.experimental.events.EventsManager; import java.util.*; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourLengthAnalyzer.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourLengthAnalyzer.java index 5ea36ca6528..c448116ac5f 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourLengthAnalyzer.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourLengthAnalyzer.java @@ -33,7 +33,7 @@ import org.matsim.api.core.v01.events.handler.PersonLeavesVehicleEventHandler; import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.CarrierConstants; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.vehicles.Vehicle; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourPlanning.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourPlanning.java index 1a3fd7e9713..314e11224fe 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourPlanning.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourPlanning.java @@ -31,14 +31,15 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.carrier.CarrierUtils; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; -import org.matsim.contrib.freight.jsprit.VRPTransportCosts; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.VRPTransportCosts; import org.matsim.core.router.util.TravelTime; +import org.matsim.freight.carriers.jsprit.NetworkRouter; import org.matsim.vehicles.VehicleType; import java.util.ArrayList; @@ -91,8 +92,8 @@ static void runTourPlanningForCarriers(Carriers carriers, Scenario scenario, VRP HashMap, Integer> sortedMap = carrierServiceCounterMap.entrySet().stream() .sorted(Collections.reverseOrder(Map.Entry.comparingByValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new)); - - + + ArrayList> tempList = new ArrayList<>(sortedMap.keySet()); ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors()); forkJoinPool.submit(() -> tempList.parallelStream().forEach(carrierId -> { @@ -167,7 +168,7 @@ static void runTourPlanningForCarriers(Carriers carriers, Scenario scenario, VRP CarrierPlan carrierPlan = MatsimJspritFactory.createPlan(carrier, bestSolution); log.info("routing plan for carrier " + carrier.getId()); - org.matsim.contrib.freight.jsprit.NetworkRouter.routePlan(carrierPlan, transportCosts); // we need to route + NetworkRouter.routePlan(carrierPlan, transportCosts); // we need to route // the plans in // order to create // reasonable diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java index a8ba7de6f45..dc8324f75ab 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java @@ -25,8 +25,8 @@ import org.matsim.contrib.commercialTrafficApplications.jointDemand.ChangeCommercialJobOperator; import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandConfigGroup; import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandModule; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ReplanningConfigGroup; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java index 30619130f39..dcb0cbb0cc3 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java @@ -36,8 +36,8 @@ import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; import org.matsim.contrib.dvrp.run.DvrpConfigGroup; import org.matsim.contrib.dvrp.run.DvrpQSimComponents; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ScoringConfigGroup; diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperatorTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperatorTest.java index a66096756ac..ecf7813bd97 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperatorTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperatorTest.java @@ -7,11 +7,8 @@ import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Plan; -import org.matsim.contrib.commercialTrafficApplications.jointDemand.ChangeCommercialJobOperator; -import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandUtils; -import org.matsim.contrib.commercialTrafficApplications.jointDemand.TestScenarioGeneration; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.core.router.util.TravelTime; import org.matsim.core.trafficmonitoring.FreeSpeedTravelTime; @@ -49,4 +46,4 @@ public void getPlanAlgoInstance() { } -} \ No newline at end of file +} diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java index 501f4057ae9..14880b6a7a5 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java @@ -2,8 +2,8 @@ import org.junit.Test; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.Controler; diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java index 339caa1695e..98d4b90baf6 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java @@ -27,9 +27,9 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Plan; import org.matsim.api.core.v01.population.PopulationFactory; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.Controler; diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TestScenarioGeneration.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TestScenarioGeneration.java index 629c1bbd6c6..b7092208fd6 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TestScenarioGeneration.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TestScenarioGeneration.java @@ -26,9 +26,9 @@ import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Plan; -import org.matsim.contrib.freight.carrier.*; import org.matsim.core.config.Config; import org.matsim.core.population.PopulationUtils; +import org.matsim.freight.carriers.carrier.*; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/HasCarrierId.java b/contribs/freight/src/main/java/org/matsim/contrib/freight/events/HasCarrierId.java deleted file mode 100644 index dbf01dd9590..00000000000 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/HasCarrierId.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.matsim.contrib.freight.events; - -import org.matsim.api.core.v01.Id; -import org.matsim.contrib.freight.carrier.Carrier; - -/** - * @author Kai Martins-Turner (kturner) - */ -public interface HasCarrierId { - String ATTRIBUTE_CARRIER_ID = "carrierId"; - - Id getCarrierId(); -} diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/Vehicle2CarrierEventHandler.java b/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/Vehicle2CarrierEventHandler.java deleted file mode 100644 index 0757c8b1333..00000000000 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/Vehicle2CarrierEventHandler.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * *********************************************************************** * - * * project: org.matsim.* * - * * * - * * *********************************************************************** * - * * * - * * copyright : (C) 2022 by the members listed in the COPYING, * - * * LICENSE and WARRANTY file. * - * * email : info at matsim dot org * - * * * - * * *********************************************************************** * - * * * - * * This program is free software; you can redistribute it and/or modify * - * * it under the terms of the GNU General Public License as published by * - * * the Free Software Foundation; either version 2 of the License, or * - * * (at your option) any later version. * - * * See also COPYING, LICENSE and WARRANTY file * - * * * - * * *********************************************************************** - */ -package org.matsim.contrib.freight.events.eventhandler; - -import org.matsim.api.core.v01.Id; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.events.CarrierTourEndEvent; -import org.matsim.contrib.freight.events.CarrierTourStartEvent; -import org.matsim.vehicles.Vehicle; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Basic event handler that collects the relation between vehicles and carrier. - * Necessary since link enter and leave events do not contain any information of the carrier. - * For the connection between driver and Vehicle the {@link Vehicle2CarrierEventHandler} can be used. - * - * @author kturner - */ -public final class Vehicle2CarrierEventHandler implements FreightTourStartEventHandler, FreightTourEndEventHandler { - - - // Comment from Janek (in https://github.com/matsim-org/matsim-libs/pull/2128) - // Is this handler ever going to be called concurrently? If not a normal HashMap is probably sufficient - // At least the default events manager guarantees single threaded invocation of your handler. - // --> we can check this. Currently, it was made only analogous to Vehicle2DriverEventHandler kmt sep'22 - private final Map, Id> carrierVehicles = new ConcurrentHashMap<>(); - - @Override - public void reset(int iteration) { - carrierVehicles.clear(); - } - - @Override - public void handleEvent(CarrierTourStartEvent event) { - carrierVehicles.put(event.getVehicleId(), event.getCarrierId()); - } - - @Override - public void handleEvent(CarrierTourEndEvent event) { - carrierVehicles.remove(event.getVehicleId()); - } - - /** - * @param vehicleId the unique vehicle identifier. - * @return person id of the driver - */ - public Id getCarrierOfVehicle(Id vehicleId){ - return carrierVehicles.get(vehicleId); - } -} diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkRouter.java b/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkRouter.java deleted file mode 100644 index 4d43abb8e73..00000000000 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkRouter.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Stefan Schroeder. - * eMail: stefan.schroeder@kit.edu - *

- * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v2.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - *

- * Contributors: - * Stefan Schroeder - initial API and implementation - ******************************************************************************/ -package org.matsim.contrib.freight.jsprit; - -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.controler.CarrierTimeAndSpaceTourRouter; - -/** - * Router that routes {@link CarrierPlan}. - * - * @author stefan schröder - * - */ -public class NetworkRouter { - - /** - * Routes the {@link CarrierPlan} with the router defined in {@link NetworkBasedTransportCosts}. - * - *

Note that this changes the plan, i.e. it adds routes to the input-plan. - * - * @param {@link CarrierPlan} - * @param {@link NetworkBasedTransportCosts} - */ - public static void routePlan(CarrierPlan plan, VRPTransportCosts freightTransportCosts){ - if( plan == null) throw new IllegalStateException("plan is missing."); - for( ScheduledTour tour : plan.getScheduledTours()){ - new CarrierTimeAndSpaceTourRouter( freightTransportCosts.getRouter(), freightTransportCosts.getNetwork(), freightTransportCosts.getTravelTime()).route(tour ); - } - } - -} diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/FreightConfigGroup.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/FreightConfigGroup.java similarity index 85% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/FreightConfigGroup.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/FreightConfigGroup.java index a8bc1db3e98..7c5da781595 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/FreightConfigGroup.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/FreightConfigGroup.java @@ -1,27 +1,30 @@ -/* *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2007 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - -package org.matsim.contrib.freight; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers; +import jakarta.validation.constraints.Positive; import org.matsim.core.config.ConfigGroup; import org.matsim.core.config.ReflectiveConfigGroup; -import jakarta.validation.constraints.Positive; import java.net.URL; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Carrier.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carrier.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Carrier.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carrier.java index 52812bfbac7..29ddead11a6 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Carrier.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carrier.java @@ -19,15 +19,15 @@ * */ -package org.matsim.contrib.freight.carrier; - -import java.util.List; -import java.util.Map; +package org.matsim.freight.carriers.carrier; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.HasPlansAndId; import org.matsim.utils.objectattributes.attributable.Attributable; +import java.util.List; +import java.util.Map; + /** * A carrier. * diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierCapabilities.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierCapabilities.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierCapabilities.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierCapabilities.java index 08808a2db6c..e0078021f38 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierCapabilities.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierCapabilities.java @@ -19,14 +19,14 @@ * */ -package org.matsim.contrib.freight.carrier; - -import java.util.*; +package org.matsim.freight.carriers.carrier; import org.matsim.api.core.v01.Id; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; +import java.util.*; + /** * This contains the capabilities/resources a carrier has/can deploy. * diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierConstants.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierConstants.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierConstants.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierConstants.java index 4382b2b5bd9..b7dc2e3a5f9 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierConstants.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierConstants.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; public class CarrierConstants { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierImpl.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierImpl.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierImpl.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierImpl.java index 706010e95f5..b51274fa1a9 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierImpl.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierImpl.java @@ -19,17 +19,17 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; + +import org.matsim.api.core.v01.Id; +import org.matsim.utils.objectattributes.attributable.Attributes; +import org.matsim.utils.objectattributes.attributable.AttributesImpl; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.matsim.api.core.v01.Id; -import org.matsim.utils.objectattributes.attributable.Attributes; -import org.matsim.utils.objectattributes.attributable.AttributesImpl; - /** * This is a carrier that has capabilities and resources, jobs and plans to fulfill its obligations. *

diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlan.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlan.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java index b63e0556eb8..77c1c43d2a0 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlan.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java @@ -19,15 +19,16 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; -import java.util.Collection; import org.matsim.api.core.v01.population.BasicPlan; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.utils.objectattributes.attributable.Attributable; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesImpl; +import java.util.Collection; + /** * * A specific plan of a carrier, and its score. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1.java index ea924762842..7fa4ed91f4a 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1.java @@ -19,14 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Stack; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -41,6 +34,8 @@ import org.matsim.vehicles.VehicleType; import org.xml.sax.Attributes; +import java.util.*; + /** * A reader that reads carriers and their plans. * diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanWriter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanWriter.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanWriter.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanWriter.java index 4a20ad55610..87447a0d0a2 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanWriter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanWriter.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import com.google.inject.Inject; import org.matsim.utils.objectattributes.AttributeConverter; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlParserV2.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlParserV2.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2.java index 42b4ca52eac..38ab9e33745 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlParserV2.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2.java @@ -19,33 +19,30 @@ * */ -package org.matsim.contrib.freight.carrier; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Stack; +package org.matsim.freight.carriers.carrier; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.Builder; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; import org.matsim.core.gbl.Gbl; import org.matsim.core.network.NetworkUtils; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.population.routes.RouteUtils; import org.matsim.core.utils.io.MatsimXmlParser; import org.matsim.core.utils.misc.Time; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.Builder; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.utils.objectattributes.AttributeConverter; import org.matsim.utils.objectattributes.attributable.AttributesXmlReaderDelegate; -import org.matsim.vehicles.*; +import org.matsim.vehicles.Vehicle; +import org.matsim.vehicles.VehicleType; import org.xml.sax.Attributes; -import static org.matsim.contrib.freight.carrier.CarrierConstants.*; + +import java.util.*; + +import static org.matsim.freight.carriers.carrier.CarrierConstants.*; class CarrierPlanXmlParserV2 extends MatsimXmlParser { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlParserV2_1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2_1.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlParserV2_1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2_1.java index ac34b2fef83..0007f6fa2f6 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlParserV2_1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2_1.java @@ -19,21 +19,21 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.Builder; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; import org.matsim.core.gbl.Gbl; import org.matsim.core.network.NetworkUtils; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.population.routes.RouteUtils; import org.matsim.core.utils.io.MatsimXmlParser; import org.matsim.core.utils.misc.Time; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.Builder; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.utils.objectattributes.AttributeConverter; import org.matsim.utils.objectattributes.attributable.AttributesXmlReaderDelegate; import org.matsim.vehicles.Vehicle; @@ -42,7 +42,7 @@ import java.util.*; -import static org.matsim.contrib.freight.carrier.CarrierConstants.*; +import static org.matsim.freight.carriers.carrier.CarrierConstants.*; class CarrierPlanXmlParserV2_1 extends MatsimXmlParser { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReader.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReader.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReader.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReader.java index 9a97bf55522..cb5acfed7f5 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReader.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReader.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1.java similarity index 95% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1.java index edfb26cefeb..d4732408b46 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1.java @@ -19,27 +19,23 @@ * */ -package org.matsim.contrib.freight.carrier; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; +package org.matsim.freight.carriers.carrier; import com.graphhopper.jsprit.core.problem.job.Shipment; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Tour.Leg; -import org.matsim.contrib.freight.carrier.Tour.ShipmentBasedActivity; -import org.matsim.contrib.freight.carrier.Tour.TourElement; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.utils.io.MatsimXmlWriter; import org.matsim.core.utils.misc.Time; +import java.io.BufferedWriter; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + /** * A writer that writes carriers and their plans in a xml-file. * @@ -181,8 +177,8 @@ private void writePlans(Carrier carrier, BufferedWriter writer) writer.write("\t\t\t\t\t\n"); - for (TourElement tourElement : tour.getTour().getTourElements()) { - if (tourElement instanceof Leg leg) { + for (Tour.TourElement tourElement : tour.getTour().getTourElements()) { + if (tourElement instanceof Tour.Leg leg) { writer.write("\t\t\t\t\t\n"); } } - if (tourElement instanceof ShipmentBasedActivity act) { + if (tourElement instanceof Tour.ShipmentBasedActivity act) { writer.write("\t\t\t\t\t id, Id locationLinkId){ return new Builder(id,locationLinkId); } - + private final Id id; private final Id locationLinkId; private String name = "service"; - + private double serviceTime = 0.0; private TimeWindow timeWindow = TimeWindow.newInstance(0.0, Integer.MAX_VALUE); private int capacityDemand = 0; - + private Builder(Id id, Id locationLinkId) { super(); this.id = id; this.locationLinkId = locationLinkId; } - + public Builder setName(String name){ this.name = name; return this; } - + /** * By default it is [0.0,Integer.MaxValue]. - * + * * @param serviceDuration * @return */ @@ -65,13 +65,13 @@ public Builder setServiceDuration(double serviceDuration){ this.serviceTime = serviceDuration; return this; } - + /** * Sets a time-window for the service. - * + * *

Note that the time-window restricts the start-time of the service (i.e. serviceActivity). If one works with hard time-windows (which means that * time-windows must be met) than the service is allowed to start between startTimeWindow.getStart() and startTimeWindow.getEnd(). - * + * * @param startTimeWindow * @return */ @@ -79,7 +79,7 @@ public Builder setServiceStartTimeWindow(TimeWindow startTimeWindow){ this.timeWindow = startTimeWindow; return this; } - + public CarrierService build(){ return new CarrierService(this); } @@ -88,16 +88,16 @@ public Builder setCapacityDemand(int value) { this.capacityDemand = value; return this; } - + } - - + + private final Id id; private final Id locationId; - + private final String name; - + private final double serviceDuration; private final TimeWindow timeWindow; @@ -130,7 +130,7 @@ public double getServiceDuration() { public TimeWindow getServiceStartTimeWindow(){ return timeWindow; } - + public int getCapacityDemand() { return demand; } @@ -180,6 +180,6 @@ public boolean equals(Object obj) { } else return id.equals(other.id); } - - + + } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierShipment.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierShipment.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierShipment.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierShipment.java index 07bee15376d..516484b3015 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierShipment.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierShipment.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierUtils.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java index a2f2c0d4cdb..37aed64d38b 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierUtils.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicle.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicle.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicle.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicle.java index 314c3e56a2f..d0288621dad 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicle.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicle.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleType.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleType.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleType.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleType.java index 89cae4f6f63..82600bb4b1f 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleType.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleType.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.matsim.api.core.v01.Id; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoader.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoader.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoader.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoader.java index d71e1562ed7..7aeaba2da3d 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoader.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoader.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReader.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReader.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReader.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReader.java index c8f55f0344e..be2ec4e3e07 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReader.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReader.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderV1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderV1.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderV1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderV1.java index fcc30581b16..aee8dfac36b 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderV1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderV1.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriter.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriter.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriter.java index ec8a6a86a88..6f423686b51 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriter.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.matsim.api.core.v01.Id; import org.matsim.core.api.internal.MatsimWriter; @@ -32,7 +32,7 @@ /** * A writer that writes carriers and their plans in a xml-file. - * + * * @author sschroeder * */ diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterV1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterV1.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterV1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterV1.java index f65029abd09..bec3b89dd37 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterV1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterV1.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypes.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypes.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypes.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypes.java index a2e8399cfaa..93d7028f6fd 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypes.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypes.java @@ -19,14 +19,14 @@ * */ -package org.matsim.contrib.freight.carrier; - -import java.util.HashMap; -import java.util.Map; +package org.matsim.freight.carriers.carrier; import org.matsim.api.core.v01.Id; import org.matsim.vehicles.VehicleType; +import java.util.HashMap; +import java.util.Map; + /** * VehicleTypeContainer mapping all vehicleTypes. * diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Carriers.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carriers.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Carriers.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carriers.java index ca801c90f90..1268b09f18a 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Carriers.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carriers.java @@ -19,17 +19,16 @@ * */ -package org.matsim.contrib.freight.carrier; - -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - import org.matsim.api.core.v01.Id; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.Map; + /** * A container that maps carriers. * diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/ScheduledTour.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/ScheduledTour.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/ScheduledTour.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/ScheduledTour.java index f8769b4070f..e8e2f4250e6 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/ScheduledTour.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/ScheduledTour.java @@ -19,24 +19,24 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; /** * A concrete assignment of a tour, a vehicle and a departure time. - * + * * @author sschroeder, mzilske * */ public class ScheduledTour { - + /** * Returns a new instance of ScheduledTour. - * - *

Look at the builder. It might be easier to build a scheduled tour. + * + *

Look at the builder. It might be easier to build a scheduled tour. * You get the builder this way: ScheduledTour.Builder.newInstance(carrierVehicle). - * + * * @param tour * @param vehicle * @param departureTime @@ -46,7 +46,7 @@ public class ScheduledTour { public static ScheduledTour newInstance(Tour tour, CarrierVehicle vehicle, double departureTime){ return new ScheduledTour(tour,vehicle,departureTime); } - + private final Tour tour; private final CarrierVehicle vehicle; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/TimeWindow.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/TimeWindow.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/TimeWindow.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/TimeWindow.java index c198aa2ed79..d835d3845c8 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/TimeWindow.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/TimeWindow.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.matsim.core.utils.misc.Time; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Tour.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Tour.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Tour.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Tour.java index b1cadaef2cc..25fe3ee7894 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carrier/Tour.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Tour.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierAgent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java similarity index 91% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierAgent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java index cfe0cea13dc..ebb5c165865 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierAgent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java @@ -19,36 +19,27 @@ * */ -package org.matsim.contrib.freight.controler; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +package org.matsim.freight.carriers.controler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Identifiable; -import org.matsim.api.core.v01.events.*; -import org.matsim.api.core.v01.population.Activity; -import org.matsim.api.core.v01.population.Leg; -import org.matsim.api.core.v01.population.Person; -import org.matsim.api.core.v01.population.Plan; -import org.matsim.api.core.v01.population.Route; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.Tour.TourActivity; -import org.matsim.contrib.freight.carrier.Tour.TourElement; -import org.matsim.contrib.freight.events.CarrierEventCreator; +import org.matsim.api.core.v01.events.Event; +import org.matsim.api.core.v01.population.*; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.gbl.Gbl; import org.matsim.core.population.PopulationUtils; import org.matsim.core.scoring.ScoringFunction; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.Tour.TourActivity; +import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.events.CarrierEventCreator; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleUtils; +import java.util.*; + /** * This keeps track of the carrier during simulation. * diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierAgentTracker.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgentTracker.java similarity index 95% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierAgentTracker.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgentTracker.java index b93698f9034..cfa6b18b59d 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierAgentTracker.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgentTracker.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.controler; +package org.matsim.freight.carriers.controler; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; @@ -27,13 +27,13 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.*; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.events.CarrierEventCreator; -import org.matsim.contrib.freight.events.CarrierEventCreatorUtils; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.events.algorithms.Vehicle2DriverEventHandler; import org.matsim.core.events.handler.BasicEventHandler; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.events.CarrierEventCreator; +import org.matsim.freight.carriers.events.CarrierEventCreatorUtils; import java.util.*; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierControlerListener.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java similarity index 65% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierControlerListener.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java index afbc91c7c8a..156c3fe4fe2 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierControlerListener.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java @@ -1,28 +1,27 @@ /* - * *********************************************************************** * -// * * project: org.matsim.* - * * ${file_name} - * * * - * * *********************************************************************** * - * * * - * * copyright : (C) ${year} by the members listed in the COPYING, * - * * LICENSE and WARRANTY file. * - * * email : info at matsim dot org * - * * * - * * *********************************************************************** * - * * * - * * This program is free software; you can redistribute it and/or modify * - * * it under the terms of the GNU General Public License as published by * - * * the Free Software Foundation; either version 2 of the License, or * - * * (at your option) any later version. * - * * See also COPYING, LICENSE and WARRANTY file * - * * * - * * *********************************************************************** + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** * */ -package org.matsim.contrib.freight.controler; +package org.matsim.freight.carriers.controler; +import jakarta.inject.Inject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; @@ -32,7 +31,6 @@ import org.matsim.core.controler.listener.ScoringListener; import javax.annotation.Nullable; -import jakarta.inject.Inject; /** * Controls the workflow of the simulation. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierDriverAgent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierDriverAgent.java similarity index 87% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierDriverAgent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierDriverAgent.java index 2a39409b5f9..eb52fe3770c 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierDriverAgent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierDriverAgent.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.controler; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.controler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -11,13 +32,13 @@ import org.matsim.api.core.v01.population.Leg; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Route; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.events.CarrierEventCreator; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.population.PopulationUtils; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.population.routes.RouteUtils; import org.matsim.core.scoring.ScoringFunction; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.events.CarrierEventCreator; import org.matsim.vehicles.Vehicle; import java.util.ArrayList; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierModule.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java similarity index 78% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierModule.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java index 2e4a2980780..4ed43f82baa 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierModule.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java @@ -1,26 +1,25 @@ /* - * *********************************************************************** * - * * project: org.matsim.* - * * CarrierModule.java - * * * - * * *********************************************************************** * - * * * - * * copyright : (C) 2015 by the members listed in the COPYING, * - * * LICENSE and WARRANTY file. * - * * email : info at matsim dot org * - * * * - * * *********************************************************************** * - * * * - * * This program is free software; you can redistribute it and/or modify * - * * it under the terms of the GNU General Public License as published by * - * * the Free Software Foundation; either version 2 of the License, or * - * * (at your option) any later version. * - * * See also COPYING, LICENSE and WARRANTY file * - * * * - * * *********************************************************************** + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * */ -package org.matsim.contrib.freight.controler; +package org.matsim.freight.carriers.controler; import com.google.inject.Inject; import com.google.inject.Provider; @@ -29,8 +28,6 @@ import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Leg; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.*; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.AbstractModule; @@ -39,6 +36,8 @@ import org.matsim.core.mobsim.qsim.AbstractQSimModule; import org.matsim.core.mobsim.qsim.components.QSimComponentsConfigGroup; import org.matsim.core.scoring.ScoringFunction; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; import java.util.List; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierReRouteVehicles.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierReRouteVehicles.java similarity index 68% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierReRouteVehicles.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierReRouteVehicles.java index 27d1153f804..7a3e26e4263 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierReRouteVehicles.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierReRouteVehicles.java @@ -1,34 +1,36 @@ -/* *********************************************************************** * - * project: org.matsim.* - * * - * *********************************************************************** * - * * - * copyright : (C) 2012 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ -package org.matsim.contrib.freight.controler; +package org.matsim.freight.carriers.controler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.carrier.ScheduledTour; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.replanning.ReplanningContext; import org.matsim.core.replanning.modules.GenericPlanStrategyModule; import org.matsim.core.router.util.LeastCostPathCalculator; import org.matsim.core.router.util.TravelTime; +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.carrier.ScheduledTour; /** * Strategy module to reRoute a carrierPlan. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierScoringFunctionFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierScoringFunctionFactory.java similarity index 93% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierScoringFunctionFactory.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierScoringFunctionFactory.java index d412280b6cd..24dc40548ae 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierScoringFunctionFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierScoringFunctionFactory.java @@ -19,10 +19,10 @@ * */ -package org.matsim.contrib.freight.controler; +package org.matsim.freight.carriers.controler; -import org.matsim.contrib.freight.carrier.Carrier; import org.matsim.core.scoring.ScoringFunction; +import org.matsim.freight.carriers.carrier.Carrier; public interface CarrierScoringFunctionFactory { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierStrategyManager.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManager.java similarity index 93% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierStrategyManager.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManager.java index 5fa8140a3ee..299fbb34ae7 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierStrategyManager.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManager.java @@ -19,12 +19,12 @@ * */ -package org.matsim.contrib.freight.controler; +package org.matsim.freight.carriers.controler; import com.google.inject.Provider; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlan; import org.matsim.core.replanning.GenericStrategyManager; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlan; /** * The current (jul'22) logic of this is:

    diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierStrategyManagerImpl.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManagerImpl.java similarity index 54% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierStrategyManagerImpl.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManagerImpl.java index 1d9dbd2694c..bedc43262d6 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierStrategyManagerImpl.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManagerImpl.java @@ -1,14 +1,34 @@ -package org.matsim.contrib.freight.controler; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.controler; import org.matsim.api.core.v01.population.HasPlansAndId; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.controler.CarrierStrategyManager; import org.matsim.core.replanning.GenericPlanStrategy; import org.matsim.core.replanning.GenericStrategyManager; import org.matsim.core.replanning.GenericStrategyManagerImpl; import org.matsim.core.replanning.ReplanningContext; import org.matsim.core.replanning.selectors.PlanSelector; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlan; import java.util.List; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierTimeAllocationMutator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAllocationMutator.java similarity index 65% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierTimeAllocationMutator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAllocationMutator.java index 18fdf8f54c0..54f406baefc 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierTimeAllocationMutator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAllocationMutator.java @@ -1,31 +1,33 @@ -/* *********************************************************************** * - * project: org.matsim.* * - * * - * *********************************************************************** * - * * - * copyright : (C) 2008 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ -package org.matsim.contrib.freight.controler; - -import java.util.ArrayList; -import java.util.Collection; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ +package org.matsim.freight.carriers.controler; -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.carrier.ScheduledTour; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.replanning.ReplanningContext; import org.matsim.core.replanning.modules.GenericPlanStrategyModule; +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.carrier.ScheduledTour; + +import java.util.ArrayList; +import java.util.Collection; /** * @author nagel diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierTimeAndSpaceTourRouter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAndSpaceTourRouter.java similarity index 94% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierTimeAndSpaceTourRouter.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAndSpaceTourRouter.java index 1bf53c04623..7d627ffa687 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierTimeAndSpaceTourRouter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAndSpaceTourRouter.java @@ -19,31 +19,31 @@ * */ -package org.matsim.contrib.freight.controler; - -import java.util.ArrayList; -import java.util.List; +package org.matsim.freight.carriers.controler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.CarrierVehicle; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour.Leg; -import org.matsim.contrib.freight.carrier.Tour.TourActivity; -import org.matsim.contrib.freight.carrier.Tour.TourElement; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.population.routes.RouteUtils; import org.matsim.core.router.util.LeastCostPathCalculator; import org.matsim.core.router.util.LeastCostPathCalculator.Path; import org.matsim.core.router.util.TravelTime; +import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour.Leg; +import org.matsim.freight.carriers.carrier.Tour.TourActivity; +import org.matsim.freight.carriers.carrier.Tour.TourElement; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesImpl; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; +import java.util.ArrayList; +import java.util.List; + /** * Router routing scheduledTours. * diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierVehicleReRouter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierVehicleReRouter.java similarity index 95% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierVehicleReRouter.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierVehicleReRouter.java index 6ce15469347..2034e447ac6 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/CarrierVehicleReRouter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierVehicleReRouter.java @@ -19,9 +19,7 @@ * */ -package org.matsim.contrib.freight.controler; - -import java.util.Collection; +package org.matsim.freight.carriers.controler; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.state.StateManager; @@ -37,17 +35,18 @@ import com.graphhopper.jsprit.io.algorithm.AlgorithmConfig; import com.graphhopper.jsprit.io.algorithm.AlgorithmConfigXmlReader; import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms; - import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypes; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; -import org.matsim.contrib.freight.jsprit.VehicleTypeDependentRoadPricingCalculator; import org.matsim.core.replanning.ReplanningContext; import org.matsim.core.replanning.modules.GenericPlanStrategyModule; import org.matsim.core.router.util.TravelTime; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.VehicleTypeDependentRoadPricingCalculator; + +import java.util.Collection; class CarrierVehicleReRouter implements GenericPlanStrategyModule{ diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightActivity.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightActivity.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightActivity.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightActivity.java index cabfe8b35e1..8e02571389b 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightActivity.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightActivity.java @@ -19,29 +19,29 @@ * */ -package org.matsim.contrib.freight.controler; +package org.matsim.freight.carriers.controler; import org.matsim.api.core.v01.Coord; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.TimeWindow; import org.matsim.core.utils.misc.OptionalTime; import org.matsim.facilities.ActivityFacility; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.utils.objectattributes.attributable.Attributes; public class FreightActivity implements Activity { private final Activity act; - + private final TimeWindow timeWindow; - + public FreightActivity(Activity act, TimeWindow timeWindow) { super(); this.act = act; this.timeWindow = timeWindow; } - + public TimeWindow getTimeWindow(){ return timeWindow; } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightAgentSource.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java similarity index 67% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightAgentSource.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java index 18c39f8f2b7..02da4e926b6 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightAgentSource.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java @@ -1,30 +1,25 @@ /* - * *********************************************************************** * - * * project: org.matsim.* - * * ${file_name} - * * * - * * *********************************************************************** * - * * * - * * copyright : (C) ${year} by the members listed in the COPYING, * - * * LICENSE and WARRANTY file. * - * * email : info at matsim dot org * - * * * - * * *********************************************************************** * - * * * - * * This program is free software; you can redistribute it and/or modify * - * * it under the terms of the GNU General Public License as published by * - * * the Free Software Foundation; either version 2 of the License, or * - * * (at your option) any later version. * - * * See also COPYING, LICENSE and WARRANTY file * - * * * - * * *********************************************************************** + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** * */ -package org.matsim.contrib.freight.controler; - -import java.util.ArrayList; -import java.util.Collection; +package org.matsim.freight.carriers.controler; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; @@ -38,6 +33,9 @@ import org.matsim.core.mobsim.qsim.qnetsimengine.QVehicleImpl; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleUtils; + +import java.util.ArrayList; +import java.util.Collection; /** * Created by IntelliJ IDEA. User: zilske Date: 10/31/11 Time: 5:59 PM To change * this template use File | Settings | File Templates. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightUtils.java similarity index 93% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightUtils.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightUtils.java index c56598c5968..10e0b481547 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/FreightUtils.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightUtils.java @@ -1,22 +1,25 @@ -/* *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2018 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - -package org.matsim.contrib.freight.controler; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.controler; import com.graphhopper.jsprit.analysis.toolbox.StopWatch; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; @@ -30,15 +33,15 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Plan; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.Tour.ServiceActivity; -import org.matsim.contrib.freight.carrier.Tour.TourElement; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; -import org.matsim.contrib.freight.jsprit.NetworkRouter; import org.matsim.core.config.ConfigUtils; import org.matsim.core.utils.io.IOUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; +import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.NetworkRouter; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/WithinDayActivityReScheduling.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/WithinDayActivityReScheduling.java similarity index 96% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/controler/WithinDayActivityReScheduling.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/controler/WithinDayActivityReScheduling.java index eff76a7613f..eff80d01698 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/controler/WithinDayActivityReScheduling.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/WithinDayActivityReScheduling.java @@ -19,20 +19,15 @@ * */ -package org.matsim.contrib.freight.controler; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; +package org.matsim.freight.carriers.controler; +import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.PlanElement; -import org.matsim.contrib.freight.carrier.Tour.Start; -import org.matsim.contrib.freight.carrier.Tour.TourActivity; import org.matsim.core.mobsim.framework.Mobsim; import org.matsim.core.mobsim.framework.MobsimAgent; import org.matsim.core.mobsim.framework.PlanAgent; @@ -40,8 +35,12 @@ import org.matsim.core.mobsim.framework.listeners.MobsimBeforeSimStepListener; import org.matsim.core.mobsim.framework.listeners.MobsimListener; import org.matsim.core.mobsim.qsim.agents.WithinDayAgentUtils; +import org.matsim.freight.carriers.carrier.Tour.Start; +import org.matsim.freight.carriers.carrier.Tour.TourActivity; -import com.google.inject.Inject; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; /* * Physically enforces beginnings of time windows for freight activities, i.e. freight agents diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/AbstractCarrierEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/AbstractCarrierEvent.java similarity index 54% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/AbstractCarrierEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/AbstractCarrierEvent.java index eade49a4dd5..10e13752f07 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/AbstractCarrierEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/AbstractCarrierEvent.java @@ -1,11 +1,32 @@ -package org.matsim.contrib.freight.events; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.events.HasLinkId; import org.matsim.api.core.v01.events.HasVehicleId; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventAttributes.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventAttributes.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventAttributes.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventAttributes.java index 2fc71288457..db7fb1a2738 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventAttributes.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventAttributes.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; /** * Some constants, that are used for the Attributes of different FreightEvents. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreator.java similarity index 92% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreator.java index 3271eceaa5f..e4d03f78afb 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreator.java @@ -19,13 +19,13 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.ScheduledTour; import org.matsim.vehicles.Vehicle; public interface CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventCreatorUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreatorUtils.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventCreatorUtils.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreatorUtils.java index d3ce308c6ef..df84c797ac5 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventCreatorUtils.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreatorUtils.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import java.util.ArrayList; import java.util.Collection; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventsReaders.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventsReaders.java similarity index 61% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventsReaders.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventsReaders.java index 20eb9dad5a8..23c9176a0ff 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierEventsReaders.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventsReaders.java @@ -1,24 +1,25 @@ /* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2023 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** * + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.events.MatsimEventsReader; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceEndEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEvent.java similarity index 86% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceEndEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEvent.java index 0c4585932a0..50b15c9afc5 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceEndEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEvent.java @@ -19,18 +19,16 @@ * */ -package org.matsim.contrib.freight.events; - -import java.util.Map; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierService; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierService; import org.matsim.vehicles.Vehicle; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.*; +import java.util.Map; /** * An event, that informs that a Freight {@link CarrierService} activity has ended. @@ -65,8 +63,8 @@ public double getServiceDuration() { @Override public Map getAttributes() { Map attr = super.getAttributes(); - attr.put(ATTRIBUTE_SERVICE_ID, serviceId.toString()); - attr.put(ATTRIBUTE_SERVICE_DURATION, String.valueOf(serviceDuration)); + attr.put(CarrierEventAttributes.ATTRIBUTE_SERVICE_ID, serviceId.toString()); + attr.put(CarrierEventAttributes.ATTRIBUTE_SERVICE_DURATION, String.valueOf(serviceDuration)); return attr; } @@ -74,10 +72,10 @@ public static CarrierServiceEndEvent convert(GenericEvent event) { Map attributes = event.getAttributes(); double time = Double.parseDouble(attributes.get(ATTRIBUTE_TIME)); Id carrierId = Id.create(attributes.get(ATTRIBUTE_CARRIER_ID), Carrier.class); - Id carrierServiceId = Id.create(attributes.get(ATTRIBUTE_SERVICE_ID), CarrierService.class); + Id carrierServiceId = Id.create(attributes.get(CarrierEventAttributes.ATTRIBUTE_SERVICE_ID), CarrierService.class); Id locationLinkId = Id.createLinkId(attributes.get(ATTRIBUTE_LINK)); CarrierService service = CarrierService.Builder.newInstance(carrierServiceId, locationLinkId) - .setServiceDuration(Double.parseDouble(attributes.get(ATTRIBUTE_SERVICE_DURATION))) + .setServiceDuration(Double.parseDouble(attributes.get(CarrierEventAttributes.ATTRIBUTE_SERVICE_DURATION))) .build(); Id vehicleId = Id.create(attributes.get(ATTRIBUTE_VEHICLE), Vehicle.class); return new CarrierServiceEndEvent(time, carrierId, service, vehicleId); diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceEndEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEventCreator.java similarity index 80% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceEndEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEventCreator.java index 6ef0929f021..b2d682ca1e5 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceEndEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEventCreator.java @@ -19,17 +19,16 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityEndEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour.ServiceActivity; -import org.matsim.contrib.freight.carrier.Tour.TourElement; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierServiceEndEventCreator implements CarrierEventCreator { @@ -37,8 +36,8 @@ @Override public Event createEvent(Event event, Carrier carrier, Activity activity, ScheduledTour scheduledTour, int activityCounter, Id vehicleId) { if(event instanceof ActivityEndEvent endEvent && CarrierConstants.SERVICE.equals(endEvent.getActType())) { - TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); - if(element instanceof ServiceActivity serviceActivity) { + Tour.TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); + if(element instanceof Tour.ServiceActivity serviceActivity) { return new CarrierServiceEndEvent(event.getTime(), carrier.getId(), serviceActivity.getService(), vehicleId); } } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceStartEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEvent.java similarity index 83% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceStartEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEvent.java index 6c8550df63f..a8b0567ee23 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceStartEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEvent.java @@ -19,19 +19,17 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierService; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierService; import org.matsim.vehicles.Vehicle; import java.util.Map; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.*; - /** * An event, that informs that a Freight {@link CarrierService} activity has started. * @@ -74,9 +72,9 @@ public int getCapacityDemand() { @Override public Map getAttributes() { Map attr = super.getAttributes(); - attr.put(ATTRIBUTE_SERVICE_ID, serviceId.toString()); - attr.put(ATTRIBUTE_SERVICE_DURATION, String.valueOf(serviceDuration)); - attr.put(ATTRIBUTE_CAPACITYDEMAND, String.valueOf(capacityDemand)); + attr.put(CarrierEventAttributes.ATTRIBUTE_SERVICE_ID, serviceId.toString()); + attr.put(CarrierEventAttributes.ATTRIBUTE_SERVICE_DURATION, String.valueOf(serviceDuration)); + attr.put(CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND, String.valueOf(capacityDemand)); return attr; } @@ -84,11 +82,11 @@ public static CarrierServiceStartEvent convert(GenericEvent event) { Map attributes = event.getAttributes(); double time = Double.parseDouble(attributes.get(ATTRIBUTE_TIME)); Id carrierId = Id.create(attributes.get(ATTRIBUTE_CARRIER_ID), Carrier.class); - Id carrierServiceId = Id.create(attributes.get(ATTRIBUTE_SERVICE_ID), CarrierService.class); + Id carrierServiceId = Id.create(attributes.get(CarrierEventAttributes.ATTRIBUTE_SERVICE_ID), CarrierService.class); Id locationLinkId = Id.createLinkId(attributes.get(ATTRIBUTE_LINK)); CarrierService service = CarrierService.Builder.newInstance(carrierServiceId, locationLinkId) - .setServiceDuration(Double.parseDouble(attributes.get(ATTRIBUTE_SERVICE_DURATION))) - .setCapacityDemand(Integer.parseInt(attributes.get(ATTRIBUTE_CAPACITYDEMAND))) + .setServiceDuration(Double.parseDouble(attributes.get(CarrierEventAttributes.ATTRIBUTE_SERVICE_DURATION))) + .setCapacityDemand(Integer.parseInt(attributes.get(CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND))) .build(); Id vehicleId = Id.create(attributes.get(ATTRIBUTE_VEHICLE), Vehicle.class); return new CarrierServiceStartEvent(time, carrierId, service, vehicleId); diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceStartEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEventCreator.java similarity index 80% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceStartEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEventCreator.java index 370dd7e02c8..7700d1d5e7f 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierServiceStartEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEventCreator.java @@ -19,17 +19,16 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour.ServiceActivity; -import org.matsim.contrib.freight.carrier.Tour.TourElement; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierServiceStartEventCreator implements CarrierEventCreator { @@ -37,8 +36,8 @@ @Override public Event createEvent(Event event, Carrier carrier, Activity activity, ScheduledTour scheduledTour, int activityCounter, Id vehicleId) { if( event instanceof ActivityStartEvent startEvent && CarrierConstants.SERVICE.equals(startEvent.getActType()) ){ - TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); - if( element instanceof ServiceActivity serviceActivity ) { + Tour.TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); + if( element instanceof Tour.ServiceActivity serviceActivity ) { return new CarrierServiceStartEvent(event.getTime(), carrier.getId(), serviceActivity.getService(), vehicleId); } } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryEndEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEvent.java similarity index 80% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryEndEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEvent.java index eb462b77a88..971062fe2a1 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryEndEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEvent.java @@ -19,19 +19,17 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierShipment; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierShipment; import org.matsim.vehicles.Vehicle; import java.util.Map; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.*; - /** * An event, that informs that a Freight {@link CarrierShipment} delivery-activity has ended. * @@ -72,9 +70,9 @@ public int getCapacityDemand() { public Map getAttributes() { Map attr = super.getAttributes(); - attr.put(ATTRIBUTE_SHIPMENT_ID, this.shipmentId.toString()); - attr.put(ATTRIBUTE_DROPOFF_DURATION, String.valueOf(this.deliveryDuration)); - attr.put(ATTRIBUTE_CAPACITYDEMAND, String.valueOf(capacityDemand)); + attr.put(CarrierEventAttributes.ATTRIBUTE_SHIPMENT_ID, this.shipmentId.toString()); + attr.put(CarrierEventAttributes.ATTRIBUTE_DROPOFF_DURATION, String.valueOf(this.deliveryDuration)); + attr.put(CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND, String.valueOf(capacityDemand)); return attr; } @@ -82,11 +80,11 @@ public static CarrierShipmentDeliveryEndEvent convert(GenericEvent event) { var attributes = event.getAttributes(); double time = Double.parseDouble(attributes.get(ATTRIBUTE_TIME)); Id carrierId = Id.create(attributes.get(ATTRIBUTE_CARRIER_ID), Carrier.class); - Id shipmentId = Id.create(attributes.get(ATTRIBUTE_SHIPMENT_ID), CarrierShipment.class); + Id shipmentId = Id.create(attributes.get(CarrierEventAttributes.ATTRIBUTE_SHIPMENT_ID), CarrierShipment.class); Id shipmentTo = Id.createLinkId(attributes.get(ATTRIBUTE_LINK)); - int size = Integer.parseInt(attributes.get(ATTRIBUTE_CAPACITYDEMAND)); + int size = Integer.parseInt(attributes.get(CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND)); CarrierShipment shipment = CarrierShipment.Builder.newInstance(shipmentId, null, shipmentTo, size) - .setDeliveryServiceTime(Double.parseDouble(attributes.get(ATTRIBUTE_SERVICE_DURATION))) + .setDeliveryServiceTime(Double.parseDouble(attributes.get(CarrierEventAttributes.ATTRIBUTE_SERVICE_DURATION))) .build(); Id vehicleId = Id.createVehicleId(attributes.get(ATTRIBUTE_VEHICLE)); return new CarrierShipmentDeliveryEndEvent(time, carrierId, shipment, vehicleId); diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryEndEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEventCreator.java similarity index 81% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryEndEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEventCreator.java index 37e4035e94b..2520b534f14 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryEndEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEventCreator.java @@ -19,17 +19,16 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityEndEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour.Delivery; -import org.matsim.contrib.freight.carrier.Tour.TourElement; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierShipmentDeliveryEndEventCreator implements CarrierEventCreator { @@ -37,8 +36,8 @@ @Override public Event createEvent(Event event, Carrier carrier, Activity activity, ScheduledTour scheduledTour, int activityCounter, Id vehicleId) { if(event instanceof ActivityEndEvent endEvent && CarrierConstants.DELIVERY.equals(endEvent.getActType()) ) { - TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); - if (element instanceof Delivery deliveryActivity) { + Tour.TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); + if (element instanceof Tour.Delivery deliveryActivity) { return new CarrierShipmentDeliveryEndEvent(event.getTime(), carrier.getId(), deliveryActivity.getShipment(), vehicleId ); } } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryStartEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEvent.java similarity index 94% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryStartEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEvent.java index 08b77671842..7c1ee95782d 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryStartEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEvent.java @@ -19,18 +19,18 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierShipment; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierShipment; import org.matsim.vehicles.Vehicle; import java.util.Map; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.*; +import static org.matsim.freight.carriers.events.CarrierEventAttributes.*; /** * An event, that informs that a Freight {@link CarrierShipment} delivery-activity has started. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryStartEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEventCreator.java similarity index 81% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryStartEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEventCreator.java index 8031c885ea4..bb7e650405a 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentDeliveryStartEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEventCreator.java @@ -19,17 +19,16 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour.Delivery; -import org.matsim.contrib.freight.carrier.Tour.TourElement; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierShipmentDeliveryStartEventCreator implements CarrierEventCreator { @@ -37,8 +36,8 @@ @Override public Event createEvent(Event event, Carrier carrier, Activity activity, ScheduledTour scheduledTour, int activityCounter, Id vehicleId) { if(event instanceof ActivityStartEvent startEvent && CarrierConstants.DELIVERY.equals(startEvent.getActType()) ) { - TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); - if (element instanceof Delivery deliveryActivity) { + Tour.TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); + if (element instanceof Tour.Delivery deliveryActivity) { return new CarrierShipmentDeliveryStartEvent(event.getTime(), carrier.getId(), deliveryActivity.getShipment(), vehicleId ); } } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupEndEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEvent.java similarity index 93% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupEndEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEvent.java index e88ead0cb37..c1a44cd5479 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupEndEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEvent.java @@ -19,18 +19,18 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierShipment; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierShipment; import org.matsim.vehicles.Vehicle; import java.util.Map; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.*; +import static org.matsim.freight.carriers.events.CarrierEventAttributes.*; /** * An event, that informs that a Freight {@link CarrierShipment} pickup-activity has ended. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupEndEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEventCreator.java similarity index 81% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupEndEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEventCreator.java index 9b3847191db..7c9f2d96c76 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupEndEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEventCreator.java @@ -19,17 +19,16 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityEndEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour.Pickup; -import org.matsim.contrib.freight.carrier.Tour.TourElement; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierShipmentPickupEndEventCreator implements CarrierEventCreator { @@ -37,8 +36,8 @@ @Override public Event createEvent(Event event, Carrier carrier, Activity activity, ScheduledTour scheduledTour, int activityCounter, Id vehicleId) { if(event instanceof ActivityEndEvent endEvent && CarrierConstants.PICKUP.equals((endEvent).getActType()) ) { - TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); - if (element instanceof Pickup pickupActivity) { + Tour.TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); + if (element instanceof Tour.Pickup pickupActivity) { return new CarrierShipmentPickupEndEvent(event.getTime(), carrier.getId(), pickupActivity.getShipment(), vehicleId ); } } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupStartEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEvent.java similarity index 80% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupStartEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEvent.java index 4f7725e6ece..534a5750b4c 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupStartEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEvent.java @@ -19,19 +19,17 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierShipment; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierShipment; import org.matsim.vehicles.Vehicle; import java.util.Map; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.*; - /** * An event, that informs that a Freight {@link CarrierShipment} pickup-activity has started. * @@ -66,9 +64,9 @@ public Id getShipmentId() { public Map getAttributes() { Map attr = super.getAttributes(); - attr.put(ATTRIBUTE_SHIPMENT_ID, this.shipmentId.toString()); - attr.put(ATTRIBUTE_PICKUP_DURATION, String.valueOf(this.pickupDuration)); - attr.put(ATTRIBUTE_CAPACITYDEMAND, String.valueOf(capacityDemand)); + attr.put(CarrierEventAttributes.ATTRIBUTE_SHIPMENT_ID, this.shipmentId.toString()); + attr.put(CarrierEventAttributes.ATTRIBUTE_PICKUP_DURATION, String.valueOf(this.pickupDuration)); + attr.put(CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND, String.valueOf(capacityDemand)); return attr; } @@ -76,11 +74,11 @@ public static CarrierShipmentPickupStartEvent convert(GenericEvent event) { Map attributes = event.getAttributes(); double time = Double.parseDouble(attributes.get(ATTRIBUTE_TIME)); Id carrierId = Id.create(attributes.get(ATTRIBUTE_CARRIER_ID), Carrier.class); - Id shipmentId = Id.create(attributes.get(ATTRIBUTE_SHIPMENT_ID), CarrierShipment.class); + Id shipmentId = Id.create(attributes.get(CarrierEventAttributes.ATTRIBUTE_SHIPMENT_ID), CarrierShipment.class); Id shipmentFrom = Id.createLinkId(attributes.get(ATTRIBUTE_LINK)); - int shipmentSize = Integer.parseInt(attributes.get(ATTRIBUTE_CAPACITYDEMAND)); + int shipmentSize = Integer.parseInt(attributes.get(CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND)); CarrierShipment shipment = CarrierShipment.Builder.newInstance(shipmentId, shipmentFrom, null, shipmentSize) - .setPickupServiceTime(Double.parseDouble(attributes.get(ATTRIBUTE_PICKUP_DURATION))) + .setPickupServiceTime(Double.parseDouble(attributes.get(CarrierEventAttributes.ATTRIBUTE_PICKUP_DURATION))) .build(); Id vehicleId = Id.createVehicleId(attributes.get(ATTRIBUTE_VEHICLE)); return new CarrierShipmentPickupStartEvent(time, carrierId, shipment, vehicleId); diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupStartEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEventCreator.java similarity index 81% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupStartEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEventCreator.java index 63ef107b14f..10f8aaddab0 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierShipmentPickupStartEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEventCreator.java @@ -19,17 +19,16 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour.Pickup; -import org.matsim.contrib.freight.carrier.Tour.TourElement; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierShipmentPickupStartEventCreator implements CarrierEventCreator { @@ -37,8 +36,8 @@ @Override public Event createEvent(Event event, Carrier carrier, Activity activity, ScheduledTour scheduledTour, int activityCounter, Id vehicleId) { if(event instanceof ActivityStartEvent startEvent && CarrierConstants.PICKUP.equals((startEvent).getActType()) ) { - TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); - if (element instanceof Pickup pickupActivity) { + Tour.TourElement element = scheduledTour.getTour().getTourElements().get(activityCounter); + if (element instanceof Tour.Pickup pickupActivity) { return new CarrierShipmentPickupStartEvent(event.getTime(), carrier.getId(), pickupActivity.getShipment(), vehicleId ); } } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourEndEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEvent.java similarity index 89% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourEndEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEvent.java index b382e09e908..5c2218ab802 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourEndEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEvent.java @@ -19,18 +19,16 @@ * */ -package org.matsim.contrib.freight.events; - -import java.util.Map; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Tour; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Tour; import org.matsim.vehicles.Vehicle; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.ATTRIBUTE_TOUR_ID; +import java.util.Map; /** * An event, that informs when a Freight {@link Tour} has ended. @@ -62,7 +60,7 @@ public Id getTourId() { @Override public Map getAttributes() { Map attr = super.getAttributes(); - attr.put(ATTRIBUTE_TOUR_ID, this.tourId.toString()); + attr.put(CarrierEventAttributes.ATTRIBUTE_TOUR_ID, this.tourId.toString()); return attr; } @@ -72,7 +70,7 @@ public static CarrierTourEndEvent convert(GenericEvent event) { Id carrierId = Id.create(attributes.get(ATTRIBUTE_CARRIER_ID), Carrier.class); Id vehicleId = Id.create(attributes.get(ATTRIBUTE_VEHICLE), Vehicle.class); Id linkId = Id.createLinkId(attributes.get(ATTRIBUTE_LINK)); - Id tourId = Id.create(attributes.get(ATTRIBUTE_TOUR_ID), Tour.class); + Id tourId = Id.create(attributes.get(CarrierEventAttributes.ATTRIBUTE_TOUR_ID), Tour.class); return new CarrierTourEndEvent(time, carrierId, linkId, vehicleId, tourId); } } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourEndEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEventCreator.java similarity index 90% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourEndEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEventCreator.java index dce286a5259..9c27b86033a 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourEndEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEventCreator.java @@ -19,15 +19,15 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierTourEndEventCreator implements CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourStartEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEvent.java similarity index 93% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourStartEvent.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEvent.java index b3313c39a5b..2c6d5c42b33 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourStartEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEvent.java @@ -19,18 +19,18 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Tour; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Tour; import org.matsim.vehicles.Vehicle; import java.util.Map; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.ATTRIBUTE_TOUR_ID; +import static org.matsim.freight.carriers.events.CarrierEventAttributes.ATTRIBUTE_TOUR_ID; /** * An event, that informs when a Freight {@link Tour} has started. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourStartEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEventCreator.java similarity index 95% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourStartEventCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEventCreator.java index a9cf3ad5fe3..368755ab0d2 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/CarrierTourStartEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEventCreator.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.events; +package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityEndEvent; @@ -27,9 +27,9 @@ import org.matsim.api.core.v01.events.PersonEntersVehicleEvent; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.ScheduledTour; import org.matsim.vehicles.Vehicle; import java.util.TreeMap; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/HasCarrierId.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/HasCarrierId.java new file mode 100644 index 00000000000..1b680fd34c4 --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/HasCarrierId.java @@ -0,0 +1,34 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.events; + +import org.matsim.api.core.v01.Id; +import org.matsim.freight.carriers.carrier.Carrier; + +/** + * @author Kai Martins-Turner (kturner) + */ +public interface HasCarrierId { + String ATTRIBUTE_CARRIER_ID = "carrierId"; + + Id getCarrierId(); +} diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightServiceEndEventHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightServiceEndEventHandler.java similarity index 92% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightServiceEndEventHandler.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightServiceEndEventHandler.java index 48cf81c212e..65db8298b92 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightServiceEndEventHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightServiceEndEventHandler.java @@ -19,11 +19,11 @@ * */ -package org.matsim.contrib.freight.events.eventhandler; +package org.matsim.freight.carriers.events.eventhandler; -import org.matsim.contrib.freight.events.CarrierServiceEndEvent; import org.matsim.core.events.handler.EventHandler; +import org.matsim.freight.carriers.events.CarrierServiceEndEvent; public interface FreightServiceEndEventHandler extends EventHandler{ diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightServiceStartEventHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightServiceStartEventHandler.java similarity index 92% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightServiceStartEventHandler.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightServiceStartEventHandler.java index 2e2b609e68c..78534b0337e 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightServiceStartEventHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightServiceStartEventHandler.java @@ -19,10 +19,10 @@ * */ -package org.matsim.contrib.freight.events.eventhandler; +package org.matsim.freight.carriers.events.eventhandler; -import org.matsim.contrib.freight.events.CarrierServiceStartEvent; import org.matsim.core.events.handler.EventHandler; +import org.matsim.freight.carriers.events.CarrierServiceStartEvent; public interface FreightServiceStartEventHandler extends EventHandler { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightShipmentDeliveryEventHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightShipmentDeliveryEventHandler.java similarity index 92% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightShipmentDeliveryEventHandler.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightShipmentDeliveryEventHandler.java index c3560daf9c5..858a91fdca5 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightShipmentDeliveryEventHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightShipmentDeliveryEventHandler.java @@ -19,10 +19,10 @@ * */ -package org.matsim.contrib.freight.events.eventhandler; +package org.matsim.freight.carriers.events.eventhandler; -import org.matsim.contrib.freight.events.CarrierShipmentDeliveryEndEvent; import org.matsim.core.events.handler.EventHandler; +import org.matsim.freight.carriers.events.CarrierShipmentDeliveryEndEvent; /** * Interface to listen to shipmentDeliveredEvents. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightShipmentPickupEventHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightShipmentPickupEventHandler.java similarity index 92% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightShipmentPickupEventHandler.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightShipmentPickupEventHandler.java index 43f0671150e..126942b432f 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightShipmentPickupEventHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightShipmentPickupEventHandler.java @@ -19,10 +19,10 @@ * */ -package org.matsim.contrib.freight.events.eventhandler; +package org.matsim.freight.carriers.events.eventhandler; -import org.matsim.contrib.freight.events.CarrierShipmentPickupEndEvent; import org.matsim.core.events.handler.EventHandler; +import org.matsim.freight.carriers.events.CarrierShipmentPickupEndEvent; /** * Interface to listen to shipmentPickedUpEvents. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightTourEndEventHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightTourEndEventHandler.java similarity index 92% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightTourEndEventHandler.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightTourEndEventHandler.java index 68f84017089..7a91f767c4d 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightTourEndEventHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightTourEndEventHandler.java @@ -19,10 +19,10 @@ * */ -package org.matsim.contrib.freight.events.eventhandler; +package org.matsim.freight.carriers.events.eventhandler; -import org.matsim.contrib.freight.events.CarrierTourEndEvent; import org.matsim.core.events.handler.EventHandler; +import org.matsim.freight.carriers.events.CarrierTourEndEvent; public interface FreightTourEndEventHandler extends EventHandler { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightTourStartEventHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightTourStartEventHandler.java similarity index 92% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightTourStartEventHandler.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightTourStartEventHandler.java index 7be16fe69eb..21b14f86ce0 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/events/eventhandler/FreightTourStartEventHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/FreightTourStartEventHandler.java @@ -19,10 +19,10 @@ * */ -package org.matsim.contrib.freight.events.eventhandler; +package org.matsim.freight.carriers.events.eventhandler; -import org.matsim.contrib.freight.events.CarrierTourStartEvent; import org.matsim.core.events.handler.EventHandler; +import org.matsim.freight.carriers.events.CarrierTourStartEvent; public interface FreightTourStartEventHandler extends EventHandler { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/Vehicle2CarrierEventHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/Vehicle2CarrierEventHandler.java new file mode 100644 index 00000000000..f0a06daecf9 --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/Vehicle2CarrierEventHandler.java @@ -0,0 +1,70 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ +package org.matsim.freight.carriers.events.eventhandler; + +import org.matsim.api.core.v01.Id; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.events.CarrierTourEndEvent; +import org.matsim.freight.carriers.events.CarrierTourStartEvent; +import org.matsim.vehicles.Vehicle; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Basic event handler that collects the relation between vehicles and carrier. + * Necessary since link enter and leave events do not contain any information of the carrier. + * For the connection between driver and Vehicle the {@link Vehicle2CarrierEventHandler} can be used. + * + * @author kturner + */ +public final class Vehicle2CarrierEventHandler implements FreightTourStartEventHandler, FreightTourEndEventHandler { + + + // Comment from Janek (in https://github.com/matsim-org/matsim-libs/pull/2128) + // Is this handler ever going to be called concurrently? If not a normal HashMap is probably sufficient + // At least the default events manager guarantees single threaded invocation of your handler. + // --> we can check this. Currently, it was made only analogous to Vehicle2DriverEventHandler kmt sep'22 + private final Map, Id> carrierVehicles = new ConcurrentHashMap<>(); + + @Override + public void reset(int iteration) { + carrierVehicles.clear(); + } + + @Override + public void handleEvent(CarrierTourStartEvent event) { + carrierVehicles.put(event.getVehicleId(), event.getCarrierId()); + } + + @Override + public void handleEvent(CarrierTourEndEvent event) { + carrierVehicles.remove(event.getVehicleId()); + } + + /** + * @param vehicleId the unique vehicle identifier. + * @return person id of the driver + */ + public Id getCarrierOfVehicle(Id vehicleId){ + return carrierVehicles.get(vehicleId); + } +} diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/DistanceConstraint.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceConstraint.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/DistanceConstraint.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceConstraint.java index 44e2fea63df..da418a3e9d9 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/DistanceConstraint.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceConstraint.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2020 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.jsprit; +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.problem.constraint.HardActivityConstraint; import com.graphhopper.jsprit.core.problem.misc.JobInsertionContext; @@ -31,7 +31,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/DistanceUpdater.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceUpdater.java similarity index 96% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/DistanceUpdater.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceUpdater.java index 16ce48e5635..241202e1cb4 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/DistanceUpdater.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceUpdater.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2020 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.jsprit; +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.algorithm.state.StateId; import com.graphhopper.jsprit.core.algorithm.state.StateManager; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/FiFoTravelTime.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/FiFoTravelTime.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/FiFoTravelTime.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/FiFoTravelTime.java index f7e93cdedb7..e526819617f 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/FiFoTravelTime.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/FiFoTravelTime.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.jsprit; +package org.matsim.freight.carriers.jsprit; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Person; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/MatsimJspritFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java similarity index 92% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/MatsimJspritFactory.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java index 3fe6af08455..62e9e395601 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/MatsimJspritFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java @@ -1,16 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2011 Stefan Schroeder. - * eMail: stefan.schroeder@kit.edu - *

    - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v2.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - *

    - * Contributors: - * Stefan Schroeder - initial API and implementation - ******************************************************************************/ -package org.matsim.contrib.freight.jsprit; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; @@ -43,13 +51,10 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.TimeWindow; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.Tour.Leg; -import org.matsim.contrib.freight.carrier.Tour.TourElement; -import org.matsim.contrib.freight.controler.FreightUtils; import org.matsim.core.utils.io.IOUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -78,7 +83,7 @@ public final class MatsimJspritFactory { * * @param jspritShipment to be transformed to MATSim * @return CarrierShipment - * @see CarrierShipment, Shipment + * @see CarrierShipment , Shipment */ static CarrierShipment createCarrierShipment(Shipment jspritShipment) { CarrierShipment carrierShipment = CarrierShipment.Builder @@ -86,10 +91,10 @@ static CarrierShipment createCarrierShipment(Shipment jspritShipment) { Id.createLinkId(jspritShipment.getPickupLocation().getId()), Id.createLinkId(jspritShipment.getDeliveryLocation().getId()), jspritShipment.getSize().get(0)) .setDeliveryServiceTime(jspritShipment.getDeliveryServiceTime()) - .setDeliveryTimeWindow(TimeWindow.newInstance(jspritShipment.getDeliveryTimeWindow().getStart(), + .setDeliveryTimeWindow(org.matsim.freight.carriers.carrier.TimeWindow.newInstance(jspritShipment.getDeliveryTimeWindow().getStart(), jspritShipment.getDeliveryTimeWindow().getEnd())) .setPickupServiceTime(jspritShipment.getPickupServiceTime()) - .setPickupTimeWindow(TimeWindow.newInstance(jspritShipment.getPickupTimeWindow().getStart(), + .setPickupTimeWindow(org.matsim.freight.carriers.carrier.TimeWindow.newInstance(jspritShipment.getPickupTimeWindow().getStart(), jspritShipment.getPickupTimeWindow().getEnd())) .build(); FreightUtils.setSkills(carrierShipment, jspritShipment.getRequiredSkills().values()); @@ -101,7 +106,7 @@ static CarrierShipment createCarrierShipment(Shipment jspritShipment) { * * @param carrierShipment to be transformed to jsprit * @return Shipment - * @see CarrierShipment, Shipment + * @see CarrierShipment , Shipment */ static Shipment createJspritShipment(CarrierShipment carrierShipment) { Shipment.Builder shipmentBuilder = Shipment.Builder.newInstance(carrierShipment.getId().toString()) @@ -184,7 +189,7 @@ static CarrierService createCarrierService(Service jspritService) { serviceBuilder.setCapacityDemand(jspritService.getSize().get(0)); serviceBuilder.setServiceDuration(jspritService.getServiceDuration()); serviceBuilder.setServiceStartTimeWindow( - TimeWindow.newInstance(jspritService.getTimeWindow().getStart(), jspritService.getTimeWindow().getEnd())); + org.matsim.freight.carriers.carrier.TimeWindow.newInstance(jspritService.getTimeWindow().getStart(), jspritService.getTimeWindow().getEnd())); CarrierService carrierService = serviceBuilder.build(); FreightUtils.setSkills(carrierService, jspritService.getRequiredSkills().values()); return carrierService; @@ -231,7 +236,7 @@ static com.graphhopper.jsprit.core.problem.vehicle.Vehicle createJspritVehicle(C * * @param jspritVehicle to be transformed to CarrierVehicle * @return carrierVehicle - * @see CarrierVehicle, Vehicle + * @see CarrierVehicle , Vehicle */ static CarrierVehicle createCarrierVehicle(com.graphhopper.jsprit.core.problem.vehicle.Vehicle jspritVehicle) { VehicleType matsimVehicleType; @@ -370,28 +375,28 @@ static ScheduledTour createScheduledTour(VehicleRoute jspritRoute, Id tour + act.getLocation().getId() + " : " + act.getLocation().getCoordinate()); Service job = (Service) ((JobActivity) act).getJob(); CarrierService carrierService = createCarrierService(job); - matsimFreightTourBuilder.addLeg(new Leg()); + matsimFreightTourBuilder.addLeg(new Tour.Leg()); matsimFreightTourBuilder.scheduleService(carrierService); } else if (act instanceof DeliverShipment) { log.debug("Found DeliveryShipment: " + act.getName() + " at location " + act.getLocation().getId() + " : " + act.getLocation().getCoordinate()); Shipment job = (Shipment) ((JobActivity) act).getJob(); CarrierShipment carrierShipment = createCarrierShipment(job); - matsimFreightTourBuilder.addLeg(new Leg()); + matsimFreightTourBuilder.addLeg(new Tour.Leg()); matsimFreightTourBuilder.scheduleDelivery(carrierShipment); } else if (act instanceof PickupShipment) { log.debug("Found PickupShipment: " + act.getName() + " at location " + act.getLocation().getId() + " : " + act.getLocation().getCoordinate()); Shipment job = (Shipment) ((JobActivity) act).getJob(); CarrierShipment carrierShipment = createCarrierShipment(job); - matsimFreightTourBuilder.addLeg(new Leg()); + matsimFreightTourBuilder.addLeg(new Tour.Leg()); matsimFreightTourBuilder.schedulePickup(carrierShipment); } else throw new IllegalStateException("unknown tourActivity occurred. this cannot be"); } - matsimFreightTourBuilder.addLeg(new Leg()); + matsimFreightTourBuilder.addLeg(new Tour.Leg()); matsimFreightTourBuilder.scheduleEnd(Id.create(jspritRoute.getEnd().getLocation().getId(), Link.class)); - org.matsim.contrib.freight.carrier.Tour matsimVehicleTour = matsimFreightTourBuilder.build(); + Tour matsimVehicleTour = matsimFreightTourBuilder.build(); ScheduledTour sTour = ScheduledTour.newInstance(matsimVehicleTour, carrierVehicle, depTime); if (jspritRoute.getDepartureTime() != sTour.getDeparture()) @@ -429,10 +434,10 @@ public static VehicleRoute createRoute(ScheduledTour scheduledTour, VehicleRouti jspritRouteBuilder.setJobActivityFactory(vehicleRoutingProblem.getJobActivityFactory()); jspritRouteBuilder.setDepartureTime(depTime); - for (TourElement e : tour.getTourElements()) { - if (e instanceof org.matsim.contrib.freight.carrier.Tour.TourActivity) { - if (e instanceof org.matsim.contrib.freight.carrier.Tour.ServiceActivity) { - CarrierService carrierService = ((org.matsim.contrib.freight.carrier.Tour.ServiceActivity) e) + for (Tour.TourElement e : tour.getTourElements()) { + if (e instanceof Tour.TourActivity) { + if (e instanceof Tour.ServiceActivity) { + CarrierService carrierService = ((Tour.ServiceActivity) e) .getService(); Service service = (Service) vehicleRoutingProblem.getJobs().get(carrierService.getId().toString()); if (service == null) @@ -483,7 +488,7 @@ public static VehicleRoutingProblem createRoutingProblem(Carrier carrier, Networ FleetSize fleetSize; CarrierCapabilities carrierCapabilities = carrier.getCarrierCapabilities(); if (carrierCapabilities.getFleetSize() - .equals(org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize.INFINITE)) { + .equals(CarrierCapabilities.FleetSize.INFINITE)) { fleetSize = FleetSize.INFINITE; vrpBuilder.setFleetSize(fleetSize); } else { @@ -587,7 +592,7 @@ public static VehicleRoutingProblem.Builder createRoutingProblemBuilder(Carrier FleetSize fleetSize; CarrierCapabilities carrierCapabilities = carrier.getCarrierCapabilities(); if (carrierCapabilities.getFleetSize() - .equals(org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize.INFINITE)) { + .equals(CarrierCapabilities.FleetSize.INFINITE)) { fleetSize = FleetSize.INFINITE; vrpBuilder.setFleetSize(fleetSize); } else { @@ -683,9 +688,9 @@ public static Carrier createCarrier(String carrierId, VehicleRoutingProblem vrp) // fleet and vehicles if (vrp.getFleetSize().equals(FleetSize.FINITE)) { - capabilityBuilder.setFleetSize(org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize.FINITE); + capabilityBuilder.setFleetSize(CarrierCapabilities.FleetSize.FINITE); } else - capabilityBuilder.setFleetSize(org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize.INFINITE); + capabilityBuilder.setFleetSize(CarrierCapabilities.FleetSize.INFINITE); for (com.graphhopper.jsprit.core.problem.vehicle.VehicleType type : vrp.getTypes()) { capabilityBuilder.addType(createMatsimVehicleType(type)); } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCosts.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCosts.java similarity index 95% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCosts.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCosts.java index 01f79137571..d30ec1fb616 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCosts.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCosts.java @@ -1,16 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2011 Stefan Schroeder. - * eMail: stefan.schroeder@kit.edu - *

    - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v2.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - *

    - * Contributors: - * Stefan Schroeder - initial API and implementation - ******************************************************************************/ -package org.matsim.contrib.freight.jsprit; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; @@ -22,7 +30,6 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.CarrierVehicle; import org.matsim.core.router.speedy.SpeedyALTFactory; import org.matsim.core.router.util.LeastCostPathCalculator; import org.matsim.core.router.util.LeastCostPathCalculator.Path; @@ -30,6 +37,7 @@ import org.matsim.core.router.util.TravelDisutility; import org.matsim.core.router.util.TravelTime; import org.matsim.core.utils.misc.Counter; +import org.matsim.freight.carriers.carrier.CarrierVehicle; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesImpl; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCostsFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java similarity index 95% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCostsFactory.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java index 66cac6f5633..3cb414f29d6 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCostsFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java @@ -19,15 +19,15 @@ * */ -package org.matsim.contrib.freight.jsprit; +package org.matsim.freight.carriers.jsprit; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.Carriers; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.router.util.TravelTime; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.vehicles.VehicleType; import java.util.HashSet; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkRouter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkRouter.java new file mode 100644 index 00000000000..26debecd9b4 --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkRouter.java @@ -0,0 +1,50 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ +package org.matsim.freight.carriers.jsprit; + +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.controler.CarrierTimeAndSpaceTourRouter; + +/** + * Router that routes {@link CarrierPlan}. + * + * @author stefan schröder + * + */ +public class NetworkRouter { + + /** + * Routes the {@link CarrierPlan} with the router defined in {@link NetworkBasedTransportCosts}. + * + *

    Note that this changes the plan, i.e. it adds routes to the input-plan. + * + * @param {@link CarrierPlan} + * @param {@link NetworkBasedTransportCosts} + */ + public static void routePlan(CarrierPlan plan, VRPTransportCosts freightTransportCosts){ + if( plan == null) throw new IllegalStateException("plan is missing."); + for( ScheduledTour tour : plan.getScheduledTours()){ + new CarrierTimeAndSpaceTourRouter( freightTransportCosts.getRouter(), freightTransportCosts.getNetwork(), freightTransportCosts.getTravelTime()).route(tour ); + } + } + +} diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VRPTransportCosts.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VRPTransportCosts.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VRPTransportCosts.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VRPTransportCosts.java index 260bf10bba4..d831d329fc9 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VRPTransportCosts.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VRPTransportCosts.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.jsprit; +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.problem.cost.VehicleRoutingTransportCosts; import org.matsim.api.core.v01.network.Network; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VRPTransportCostsFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VRPTransportCostsFactory.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VRPTransportCostsFactory.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VRPTransportCostsFactory.java index 5c7e36b58f5..bb6efbdd9ec 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VRPTransportCostsFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VRPTransportCostsFactory.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.jsprit; +package org.matsim.freight.carriers.jsprit; /** * @author steffenaxer diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VehicleTypeDependentRoadPricingCalculator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VehicleTypeDependentRoadPricingCalculator.java similarity index 79% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VehicleTypeDependentRoadPricingCalculator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VehicleTypeDependentRoadPricingCalculator.java index 84adb4539a4..ed5d3694720 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/jsprit/VehicleTypeDependentRoadPricingCalculator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/VehicleTypeDependentRoadPricingCalculator.java @@ -1,26 +1,33 @@ -/******************************************************************************* - * Copyright (c) 2011 Stefan Schroeder. - * eMail: stefan.schroeder@kit.edu - *

    - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v2.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - *

    - * Contributors: - * Stefan Schroeder - initial API and implementation - ******************************************************************************/ -package org.matsim.contrib.freight.jsprit; - -import java.util.*; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; - import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.contrib.roadpricing.RoadPricingScheme; import org.matsim.contrib.roadpricing.RoadPricingSchemeImpl.Cost; +import java.util.*; + /** * Calculator that manages and calculates vehicle type dependent road pricing schemas. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/package-info.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/package-info.java similarity index 95% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/package-info.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/package-info.java index ea043d9c4b6..e5d676fe61b 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/package-info.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/package-info.java @@ -21,11 +21,10 @@ /** * Package that plugs freight algorithms (programmed in external package jsprit) into matsim. - * A good starting point for jsprit is + * A good starting point for jsprit is * https://github.com/graphhopper/jsprit. - * + * * @author (of documentation) nagel */ -package org.matsim.contrib.freight; +package org.matsim.freight.carriers; - \ No newline at end of file diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/analysis/CarrierScoreStats.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/CarrierScoreStats.java similarity index 85% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/analysis/CarrierScoreStats.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/CarrierScoreStats.java index 4f046a93987..5ea7fd329c9 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/analysis/CarrierScoreStats.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/CarrierScoreStats.java @@ -1,30 +1,28 @@ -/* *********************************************************************** * - * project: org.matsim.* - * ScoreStats.java - * * - * *********************************************************************** * - * * - * copyright : (C) 2007 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - -package org.matsim.contrib.freight.usecases.analysis; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.usecases.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.carrier.Carriers; import org.matsim.core.controler.events.IterationEndsEvent; import org.matsim.core.controler.events.ShutdownEvent; import org.matsim.core.controler.events.StartupEvent; @@ -34,6 +32,9 @@ import org.matsim.core.utils.charts.XYLineChart; import org.matsim.core.utils.io.IOUtils; import org.matsim.core.utils.io.UncheckedIOException; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.carrier.Carriers; import java.io.BufferedWriter; import java.io.IOException; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/analysis/LegHistogram.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/LegHistogram.java similarity index 90% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/analysis/LegHistogram.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/LegHistogram.java index b1c022cbb27..1db193121ec 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/analysis/LegHistogram.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/LegHistogram.java @@ -1,36 +1,27 @@ -/* *********************************************************************** * - * project: org.matsim.* - * LegHistogram.java - * * - * *********************************************************************** * - * * - * copyright : (C) 2007 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - -package org.matsim.contrib.freight.usecases.analysis; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Font; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintStream; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.usecases.analysis; +import jakarta.inject.Inject; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtils; import org.jfree.chart.JFreeChart; @@ -51,7 +42,14 @@ import org.matsim.api.core.v01.population.Population; import org.matsim.core.utils.misc.Time; -import jakarta.inject.Inject; +import java.awt.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.PrintStream; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; /** * It is a copy of {@link org.matsim.analysis.LegHistogram}. It is modified to include or exclude persons. diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java similarity index 96% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java index 7cc71f79006..bc208538d56 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; @@ -31,14 +31,14 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Leg; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.controler.CarrierScoringFunctionFactory; -import org.matsim.contrib.freight.controler.FreightActivity; -import org.matsim.contrib.freight.jsprit.VehicleTypeDependentRoadPricingCalculator; import org.matsim.core.gbl.Gbl; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.scoring.ScoringFunction; import org.matsim.core.scoring.SumScoringFunction; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; +import org.matsim.freight.carriers.controler.FreightActivity; +import org.matsim.freight.carriers.jsprit.VehicleTypeDependentRoadPricingCalculator; import org.matsim.vehicles.Vehicle; import java.util.HashSet; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/CarrierTravelDisutilities.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierTravelDisutilities.java similarity index 94% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/CarrierTravelDisutilities.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierTravelDisutilities.java index 37c45b7e8a8..059b8ec326f 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/CarrierTravelDisutilities.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierTravelDisutilities.java @@ -19,20 +19,20 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypes; -import org.matsim.contrib.freight.jsprit.VehicleTypeDependentRoadPricingCalculator; import org.matsim.core.router.util.TravelDisutility; import org.matsim.core.router.util.TravelTime; +import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.jsprit.VehicleTypeDependentRoadPricingCalculator; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; public final class CarrierTravelDisutilities{ - + public static TravelDisutility createBaseDisutility(final CarrierVehicleTypes vehicleTypes, final TravelTime travelTime){ return new TravelDisutility() { @@ -79,7 +79,7 @@ public double getLinkMinimumTravelDisutility(Link link) { }; } - + } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/FreightScenarioCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/FreightScenarioCreator.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/FreightScenarioCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/FreightScenarioCreator.java index 80c5ac16f39..59b4347aff0 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/FreightScenarioCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/FreightScenarioCreator.java @@ -19,17 +19,17 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; import org.matsim.core.config.Config; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/InitialCarrierPlanCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InitialCarrierPlanCreator.java similarity index 96% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/InitialCarrierPlanCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InitialCarrierPlanCreator.java index 609aa8586b1..997f5b02c7c 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/InitialCarrierPlanCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InitialCarrierPlanCreator.java @@ -19,9 +19,7 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; - -import java.util.Collection; +package org.matsim.freight.carriers.usecases.chessboard; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.state.StateManager; @@ -36,16 +34,17 @@ import com.graphhopper.jsprit.io.algorithm.AlgorithmConfig; import com.graphhopper.jsprit.io.algorithm.AlgorithmConfigXmlReader; import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms; - import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; -import org.matsim.contrib.freight.jsprit.NetworkRouter; import org.matsim.core.config.Config; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.NetworkRouter; + +import java.util.Collection; final class InitialCarrierPlanCreator { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/InnerOuterCityScenarioCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InnerOuterCityScenarioCreator.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/InnerOuterCityScenarioCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InnerOuterCityScenarioCreator.java index ffe602c1368..d5b48f1df69 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/InnerOuterCityScenarioCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InnerOuterCityScenarioCreator.java @@ -19,15 +19,15 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; + +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.network.Link; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.matsim.api.core.v01.Id; -import org.matsim.api.core.v01.network.Link; - final class InnerOuterCityScenarioCreator { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/PassengerScenarioCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PassengerScenarioCreator.java similarity index 93% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/PassengerScenarioCreator.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PassengerScenarioCreator.java index dc77dd1f8ef..e19d4b506bb 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/PassengerScenarioCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PassengerScenarioCreator.java @@ -19,22 +19,13 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; - -import java.util.ArrayList; -import java.util.List; +package org.matsim.freight.carriers.usecases.chessboard; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.network.Link; -import org.matsim.api.core.v01.population.Activity; -import org.matsim.api.core.v01.population.Leg; -import org.matsim.api.core.v01.population.Person; -import org.matsim.api.core.v01.population.Plan; -import org.matsim.api.core.v01.population.Population; -import org.matsim.api.core.v01.population.PopulationFactory; -import org.matsim.api.core.v01.population.PopulationWriter; +import org.matsim.api.core.v01.population.*; import org.matsim.core.config.Config; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.population.routes.NetworkRoute; @@ -45,6 +36,9 @@ import org.matsim.core.router.util.LeastCostPathCalculator.Path; import org.matsim.core.scenario.ScenarioUtils; +import java.util.ArrayList; +import java.util.List; + final class PassengerScenarioCreator { static int agentCounter = 1; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/PlotPlans.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PlotPlans.java similarity index 86% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/PlotPlans.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PlotPlans.java index dbbe3ca8804..104519cfbfe 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/PlotPlans.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PlotPlans.java @@ -19,24 +19,18 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; - import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlanXmlReader; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypeLoader; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypeReader; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypes; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; import org.matsim.core.config.Config; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; final class PlotPlans { diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunChessboard.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java similarity index 93% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunChessboard.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java index bf3d2682ef1..9409ebfea27 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunChessboard.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java @@ -19,18 +19,13 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; import com.google.inject.Provider; +import jakarta.inject.Inject; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.controler.*; -import org.matsim.contrib.freight.usecases.analysis.CarrierScoreStats; -import org.matsim.contrib.freight.usecases.analysis.LegHistogram; -import org.matsim.contrib.freight.usecases.chessboard.CarrierScoringFunctionFactoryImpl.SimpleVehicleEmploymentScoring; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.AbstractModule; @@ -50,8 +45,12 @@ import org.matsim.core.scoring.SumScoringFunction; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.*; +import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; +import org.matsim.freight.carriers.usecases.analysis.LegHistogram; -import jakarta.inject.Inject; import java.util.Map; public final class RunChessboard { @@ -124,7 +123,7 @@ private static class MyCarrierScoringFunctionFactory implements CarrierScoringFu @Override public ScoringFunction createScoringFunction(Carrier carrier) { SumScoringFunction sf = new SumScoringFunction(); sf.addScoringFunction( new CarrierScoringFunctionFactoryImpl.SimpleDriversLegScoring(carrier, network) ); - sf.addScoringFunction( new SimpleVehicleEmploymentScoring(carrier) ); + sf.addScoringFunction( new CarrierScoringFunctionFactoryImpl.SimpleVehicleEmploymentScoring(carrier) ); sf.addScoringFunction( new CarrierScoringFunctionFactoryImpl.SimpleDriversActivityScoring() ); return sf; } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerAlongWithCarriers.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java similarity index 89% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerAlongWithCarriers.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java index 542c3add849..1ef48e6fed1 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerAlongWithCarriers.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java @@ -19,19 +19,13 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; import com.google.inject.Provider; +import jakarta.inject.Inject; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.controler.*; -import org.matsim.contrib.freight.usecases.analysis.CarrierScoreStats; -import org.matsim.contrib.freight.usecases.analysis.LegHistogram; -import org.matsim.contrib.freight.usecases.chessboard.CarrierScoringFunctionFactoryImpl.SimpleDriversActivityScoring; -import org.matsim.contrib.freight.usecases.chessboard.CarrierScoringFunctionFactoryImpl.SimpleDriversLegScoring; -import org.matsim.contrib.freight.usecases.chessboard.CarrierScoringFunctionFactoryImpl.SimpleVehicleEmploymentScoring; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -52,8 +46,11 @@ import org.matsim.core.scoring.SumScoringFunction; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.*; +import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; +import org.matsim.freight.carriers.usecases.analysis.LegHistogram; -import jakarta.inject.Inject; import java.net.URL; import java.util.Map; @@ -83,11 +80,11 @@ public void run() { controler.addOverridingModule( new AbstractModule(){ @Override public void install(){ this.bind( CarrierStrategyManager.class ).toProvider( new MyCarrierPlanStrategyManagerFactory(types) ); - this.bind( CarrierScoringFunctionFactory.class ).toInstance( carrier -> { + this.bind( CarrierScoringFunctionFactory.class ).toInstance(carrier -> { SumScoringFunction sf = new SumScoringFunction(); - sf.addScoringFunction( new SimpleDriversLegScoring( carrier, scenario.getNetwork() ) ); - sf.addScoringFunction( new SimpleVehicleEmploymentScoring( carrier ) ); - sf.addScoringFunction( new SimpleDriversActivityScoring() ); + sf.addScoringFunction( new CarrierScoringFunctionFactoryImpl.SimpleDriversLegScoring( carrier, scenario.getNetwork() ) ); + sf.addScoringFunction( new CarrierScoringFunctionFactoryImpl.SimpleVehicleEmploymentScoring( carrier ) ); + sf.addScoringFunction( new CarrierScoringFunctionFactoryImpl.SimpleDriversActivityScoring() ); return sf; } ); } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerPlansFromConfig.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerPlansFromConfig.java similarity index 96% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerPlansFromConfig.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerPlansFromConfig.java index a8f38ac7adc..e2541d937bb 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerPlansFromConfig.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerPlansFromConfig.java @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; import org.matsim.core.controler.Controler; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerPlansFromScratch.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerPlansFromScratch.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerPlansFromScratch.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerPlansFromScratch.java index 33b0e6d89d0..4e376f29d57 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerPlansFromScratch.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerPlansFromScratch.java @@ -19,11 +19,11 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; +package org.matsim.freight.carriers.usecases.chessboard; import org.matsim.core.config.Config; -import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams; import org.matsim.core.config.groups.ReplanningConfigGroup.StrategySettings; +import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams; import org.matsim.core.controler.Controler; import org.matsim.core.controler.OutputDirectoryHierarchy; diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java similarity index 94% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java index b04a3d526a2..fb1c8addc31 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java @@ -19,10 +19,7 @@ * */ -package org.matsim.contrib.freight.usecases.chessboard; - -import java.net.URL; -import java.util.Collection; +package org.matsim.freight.carriers.usecases.chessboard; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; @@ -33,14 +30,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; import com.graphhopper.jsprit.core.util.Solutions; import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms; - import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypes; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; -import org.matsim.contrib.freight.jsprit.NetworkRouter; import org.matsim.core.replanning.GenericPlanStrategy; import org.matsim.core.replanning.GenericPlanStrategyImpl; import org.matsim.core.replanning.ReplanningContext; @@ -49,6 +39,15 @@ import org.matsim.core.router.util.TravelTime; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.NetworkRouter; + +import java.net.URL; +import java.util.Collection; final class SelectBestPlanAndOptimizeItsVehicleRouteFactory { diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1Test.java b/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1Test.java deleted file mode 100644 index 10d1d752c7d..00000000000 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1Test.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * *********************************************************************** * - * * project: org.matsim.* - * * ${file_name} - * * * - * * *********************************************************************** * - * * * - * * copyright : (C) ${year} by the members listed in the COPYING, * - * * LICENSE and WARRANTY file. * - * * email : info at matsim dot org * - * * * - * * *********************************************************************** * - * * * - * * This program is free software; you can redistribute it and/or modify * - * * it under the terms of the GNU General Public License as published by * - * * the Free Software Foundation; either version 2 of the License, or * - * * (at your option) any later version. * - * * See also COPYING, LICENSE and WARRANTY file * - * * * - * * *********************************************************************** - * - * ${filecomment} - * ${package_declaration} - * - * ${typecomment} - * ${type_declaration} - */ - -package org.matsim.contrib.freight.carrier; - -import org.junit.Rule; -import org.junit.Test; -import org.matsim.api.core.v01.Id; -import org.matsim.testcases.MatsimTestUtils; -import org.matsim.vehicles.VehicleType; -import org.matsim.vehicles.VehicleUtils; - -/** - */ -public class CarrierPlanXmlWriterV1Test { - - @Rule - public MatsimTestUtils testUtils = new MatsimTestUtils(); - - @Test - public void testCarrierPlanWriterWrites() { - - CarrierVehicleTypes carrierVehicleTypes = new CarrierVehicleTypes(); - new CarrierVehicleTypeReader( carrierVehicleTypes ).readFile( testUtils.getPackageInputDirectory() + "vehicleTypes_v2.xml" ); - VehicleType defaultVehicleType = VehicleUtils.getFactory().createVehicleType( Id.create("default", VehicleType.class ) ); - carrierVehicleTypes.getVehicleTypes().put( defaultVehicleType.getId(), defaultVehicleType ); - - Carriers carriers = new Carriers(); - CarrierPlanReaderV1 carrierPlanReaderV1 = new CarrierPlanReaderV1(carriers, carrierVehicleTypes ); - carrierPlanReaderV1.readFile(testUtils.getClassInputDirectory() + "carrierPlansEquils.xml"); - CarrierPlanXmlWriterV1 planWriter = new CarrierPlanXmlWriterV1(carriers.getCarriers().values()); - planWriter.write(testUtils.getOutputDirectory() + "carrierPlansEquilsWritten.xml"); - } - - -} diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterTest.java b/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterTest.java deleted file mode 100644 index 32e53807caf..00000000000 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.matsim.contrib.freight.carrier; - -import org.junit.Rule; -import org.junit.Test; -import org.matsim.testcases.MatsimTestUtils; - -public class CarrierVehicleTypeWriterTest { - - @Rule - public MatsimTestUtils utils = new MatsimTestUtils() ; - - @Test - public void testTypeWriter(){ - CarrierVehicleTypes types = new CarrierVehicleTypes(); - new CarrierVehicleTypeReader(types).readFile(utils.getClassInputDirectory()+ "vehicleTypes.xml"); - final String outputVehTypeFile = utils.getOutputDirectory()+ "vehicleTypesWritten.xml"; - new CarrierVehicleTypeWriter(types).write(outputVehTypeFile); - types.getVehicleTypes().clear(); - new CarrierVehicleTypeReader(types).readFile(outputVehTypeFile); - } -} diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerAlongWithCarriersIT.java b/contribs/freight/src/test/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerAlongWithCarriersIT.java deleted file mode 100644 index 062ceb5a5d4..00000000000 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/usecases/chessboard/RunPassengerAlongWithCarriersIT.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.matsim.contrib.freight.usecases.chessboard; - -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.matsim.core.config.Config; -import org.matsim.testcases.MatsimTestUtils; - -public class RunPassengerAlongWithCarriersIT { - - @Rule - public MatsimTestUtils utils = new MatsimTestUtils() ; - - @Test - public void runChessboard() { - try{ - RunPassengerAlongWithCarriers abc = new RunPassengerAlongWithCarriers(); - // --- - Config config = abc.prepareConfig(); - config.controller().setLastIteration( 1 ); - config.controller().setOutputDirectory( utils.getOutputDirectory() ); - // --- - abc.run(); - } catch (Exception ee ) { - ee.printStackTrace(); - Assert.fail("something went wrong: " + ee.getMessage()); - } - } - -} diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/FreightConfigGroupTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/FreightConfigGroupTest.java similarity index 63% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/FreightConfigGroupTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/FreightConfigGroupTest.java index 6dccd19f6b3..f6207d38b87 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/FreightConfigGroupTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/FreightConfigGroupTest.java @@ -1,11 +1,32 @@ -package org.matsim.contrib.freight; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers; import org.junit.Assert; import org.junit.Test; -import org.matsim.contrib.freight.FreightConfigGroup.UseDistanceConstraintForTourPlanning; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigReader; import org.matsim.core.config.ConfigUtils; +import org.matsim.freight.carriers.FreightConfigGroup.UseDistanceConstraintForTourPlanning; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -57,4 +78,4 @@ public void test_configXmlCanBeParsed() { Assert.assertEquals(UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption, freight.getUseDistanceConstraintForTourPlanning()); } -} \ No newline at end of file +} diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierModuleTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java similarity index 73% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierModuleTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java index 0602fa8d545..8060ab9d81f 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierModuleTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java @@ -1,34 +1,30 @@ -/* *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2007 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.controler.CarrierModule; -import org.matsim.contrib.freight.controler.CarrierStrategyManager; -import org.matsim.contrib.freight.mobsim.DistanceScoringFunctionFactoryForTests; -import org.matsim.contrib.freight.mobsim.StrategyManagerFactoryForTests; -import org.matsim.contrib.freight.controler.CarrierScoringFunctionFactory; -import org.matsim.contrib.freight.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ScoringConfigGroup; @@ -36,6 +32,13 @@ import org.matsim.core.controler.Controler; import org.matsim.core.controler.OutputDirectoryHierarchy; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.controler.CarrierModule; +import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; +import org.matsim.freight.carriers.controler.CarrierStrategyManager; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.mobsim.DistanceScoringFunctionFactoryForTests; +import org.matsim.freight.carriers.mobsim.StrategyManagerFactoryForTests; import org.matsim.testcases.MatsimTestUtils; public class CarrierModuleTest { diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test.java similarity index 75% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test.java index 43b8b89c8a3..4c6e9eeb70e 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test.java @@ -1,34 +1,32 @@ /* - * *********************************************************************** * - * * project: org.matsim.* - * * CarrierPlanReaderV1Test.java - * * * - * * *********************************************************************** * - * * * - * * copyright : (C) ${year} by the members listed in the COPYING, * - * * LICENSE and WARRANTY file. * - * * email : info at matsim dot org * - * * * - * * *********************************************************************** * - * * * - * * This program is free software; you can redistribute it and/or modify * - * * it under the terms of the GNU General Public License as published by * - * * the Free Software Foundation; either version 2 of the License, or * - * * (at your option) any later version. * - * * See also COPYING, LICENSE and WARRANTY file * - * * * - * * *********************************************************************** + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** * */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; -import org.matsim.contrib.freight.carrier.Tour.Leg; import org.matsim.core.population.routes.NetworkRoute; +import org.matsim.freight.carriers.carrier.Tour.Leg; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java similarity index 82% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java index 6b2a8192004..85a69c33fb6 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java @@ -1,23 +1,47 @@ -package org.matsim.contrib.freight.carrier; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.*; - -import org.junit.*; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.gbl.Gbl; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.*; + public class CarrierPlanXmlReaderV2Test { @Rule diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2WithDtdTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest.java similarity index 78% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2WithDtdTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest.java index 1df7bfc15a0..642f81238a4 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2WithDtdTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest.java @@ -1,13 +1,30 @@ -package org.matsim.contrib.freight.carrier; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; + +import org.junit.*; import org.matsim.api.core.v01.Id; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; import org.matsim.core.gbl.Gbl; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test.java new file mode 100644 index 00000000000..9c6124dc0bf --- /dev/null +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test.java @@ -0,0 +1,54 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; + +import org.junit.Rule; +import org.junit.Test; +import org.matsim.api.core.v01.Id; +import org.matsim.testcases.MatsimTestUtils; +import org.matsim.vehicles.VehicleType; +import org.matsim.vehicles.VehicleUtils; + +/** + */ +public class CarrierPlanXmlWriterV1Test { + + @Rule + public MatsimTestUtils testUtils = new MatsimTestUtils(); + + @Test + public void testCarrierPlanWriterWrites() { + + CarrierVehicleTypes carrierVehicleTypes = new CarrierVehicleTypes(); + new CarrierVehicleTypeReader( carrierVehicleTypes ).readFile( testUtils.getPackageInputDirectory() + "vehicleTypes_v2.xml" ); + VehicleType defaultVehicleType = VehicleUtils.getFactory().createVehicleType( Id.create("default", VehicleType.class ) ); + carrierVehicleTypes.getVehicleTypes().put( defaultVehicleType.getId(), defaultVehicleType ); + + Carriers carriers = new Carriers(); + CarrierPlanReaderV1 carrierPlanReaderV1 = new CarrierPlanReaderV1(carriers, carrierVehicleTypes ); + carrierPlanReaderV1.readFile(testUtils.getClassInputDirectory() + "carrierPlansEquils.xml"); + CarrierPlanXmlWriterV1 planWriter = new CarrierPlanXmlWriterV1(carriers.getCarriers().values()); + planWriter.write(testUtils.getOutputDirectory() + "carrierPlansEquilsWritten.xml"); + } + + +} diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test.java similarity index 79% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test.java index 34bb84d4b0d..71e055eb503 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test.java @@ -1,11 +1,32 @@ -package org.matsim.contrib.freight.carrier; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.TransportMode; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2_1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java similarity index 81% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2_1Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java index ca23da29f27..b6912413ae2 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2_1Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java @@ -1,12 +1,33 @@ -package org.matsim.contrib.freight.carrier; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.TransportMode; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierReadWriteV2_1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test.java similarity index 63% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierReadWriteV2_1Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test.java index 6e2d521fc40..af53fe2c683 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierReadWriteV2_1Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.carrier; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; import org.junit.Rule; import org.junit.Test; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierUtilsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierUtilsTest.java similarity index 72% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierUtilsTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierUtilsTest.java index fa847124348..1aa8faf75ad 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierUtilsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierUtilsTest.java @@ -1,32 +1,25 @@ /* - * *********************************************************************** * - * * project: org.matsim.* - * * ${file_name} - * * * - * * *********************************************************************** * - * * * - * * copyright : (C) ${year} by the members listed in the COPYING, * - * * LICENSE and WARRANTY file. * - * * email : info at matsim dot org * - * * * - * * *********************************************************************** * - * * * - * * This program is free software; you can redistribute it and/or modify * - * * it under the terms of the GNU General Public License as published by * - * * the Free Software Foundation; either version 2 of the License, or * - * * (at your option) any later version. * - * * See also COPYING, LICENSE and WARRANTY file * - * * * - * * *********************************************************************** + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** * - * ${filecomment} - * ${package_declaration} - * - * ${typecomment} - * ${type_declaration} */ -package org.matsim.contrib.freight.carrier; +package org.matsim.freight.carriers.carrier; import org.junit.Assert; import org.junit.Rule; @@ -118,5 +111,5 @@ public void testGetSetJspritIteration(){ CarrierUtils.setJspritIterations(carrier, 125); Assert.assertEquals(125, CarrierUtils.getJspritIterations(carrier) ); } - + } diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoaderTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest.java similarity index 69% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoaderTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest.java index cc2866cb29f..2801321b3a7 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoaderTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.carrier; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; import org.junit.Assert; import org.junit.Before; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest.java similarity index 73% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest.java index 6de7487a28f..c48994ce0e3 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.carrier; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeTest.java similarity index 85% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeTest.java index fd016cb0331..5eaa67786b3 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carrier/CarrierVehicleTypeTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeTest.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.carrier; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; import org.junit.Assert; import org.junit.Before; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest.java new file mode 100644 index 00000000000..0f2101b31c8 --- /dev/null +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest.java @@ -0,0 +1,42 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.carrier; + +import org.junit.Rule; +import org.junit.Test; +import org.matsim.testcases.MatsimTestUtils; + +public class CarrierVehicleTypeWriterTest { + + @Rule + public MatsimTestUtils utils = new MatsimTestUtils() ; + + @Test + public void testTypeWriter(){ + CarrierVehicleTypes types = new CarrierVehicleTypes(); + new CarrierVehicleTypeReader(types).readFile(utils.getClassInputDirectory()+ "vehicleTypes.xml"); + final String outputVehTypeFile = utils.getOutputDirectory()+ "vehicleTypesWritten.xml"; + new CarrierVehicleTypeWriter(types).write(outputVehTypeFile); + types.getVehicleTypes().clear(); + new CarrierVehicleTypeReader(types).readFile(outputVehTypeFile); + } +} diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java similarity index 72% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java index 4741b7de8fa..8b76445b96c 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java @@ -1,24 +1,25 @@ -/* *********************************************************************** * - * project: org.matsim.* - * EquilWithCarrierTest.java - * * - * *********************************************************************** * - * * - * copyright : (C) 2011 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - -package org.matsim.contrib.freight.controler; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.controler; import org.junit.Assert; import org.junit.Before; @@ -26,16 +27,16 @@ import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.mobsim.DistanceScoringFunctionFactoryForTests; -import org.matsim.contrib.freight.mobsim.StrategyManagerFactoryForTests; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; -import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams; import org.matsim.core.config.groups.ReplanningConfigGroup.StrategySettings; +import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams; import org.matsim.core.controler.AbstractModule; import org.matsim.core.controler.Controler; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.mobsim.DistanceScoringFunctionFactoryForTests; +import org.matsim.freight.carriers.mobsim.StrategyManagerFactoryForTests; import org.matsim.testcases.MatsimTestUtils; public class EquilWithCarrierWithPersonsIT { diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java similarity index 83% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java index b14d8a8b9df..b3c9d4ba29e 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java @@ -1,41 +1,42 @@ -/* *********************************************************************** * - * project: org.matsim.* - * EquilWithCarrierTest.java - * * - * *********************************************************************** * - * * - * copyright : (C) 2011 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - -package org.matsim.contrib.freight.controler; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.controler; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour; -import org.matsim.contrib.freight.mobsim.DistanceScoringFunctionFactoryForTests; -import org.matsim.contrib.freight.mobsim.StrategyManagerFactoryForTests; -import org.matsim.contrib.freight.mobsim.TimeScoringFunctionFactoryForTests; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.AbstractModule; import org.matsim.core.controler.Controler; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.mobsim.DistanceScoringFunctionFactoryForTests; +import org.matsim.freight.carriers.mobsim.StrategyManagerFactoryForTests; +import org.matsim.freight.carriers.mobsim.TimeScoringFunctionFactoryForTests; import org.matsim.testcases.MatsimTestUtils; public class EquilWithCarrierWithoutPersonsIT { diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/DistanceConstraintFromVehiclesFileTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java similarity index 97% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/DistanceConstraintFromVehiclesFileTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java index acd6613d0c4..f5023a03fc6 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/DistanceConstraintFromVehiclesFileTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2020 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.jsprit; +package org.matsim.freight.carriers.jsprit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,11 +28,6 @@ import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.FreightConfigGroup.UseDistanceConstraintForTourPlanning; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ControllerConfigGroup.CompressionType; @@ -43,6 +38,11 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightConfigGroup.UseDistanceConstraintForTourPlanning; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/DistanceConstraintTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java similarity index 98% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/DistanceConstraintTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java index fd47350bfb5..af8ed931927 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/DistanceConstraintTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2020 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.jsprit; +package org.matsim.freight.carriers.jsprit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,11 +28,6 @@ import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.FreightConfigGroup.UseDistanceConstraintForTourPlanning; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ControllerConfigGroup.CompressionType; @@ -43,6 +38,11 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightConfigGroup.UseDistanceConstraintForTourPlanning; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/FixedCostsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/FixedCostsTest.java similarity index 87% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/FixedCostsTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/FixedCostsTest.java index ddb57fda7bf..fced3431ab7 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/FixedCostsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/FixedCostsTest.java @@ -1,30 +1,34 @@ -/* *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2019 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - - -package org.matsim.contrib.freight.jsprit; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + + +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.util.Solutions; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; @@ -32,17 +36,18 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.*; import org.matsim.core.network.NetworkUtils; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.utils.io.IOUtils; +import org.matsim.freight.carriers.carrier.*; import org.matsim.testcases.MatsimTestUtils; -import org.matsim.vehicles.*; +import org.matsim.vehicles.EngineInformation; +import org.matsim.vehicles.Vehicle; +import org.matsim.vehicles.VehicleType; +import org.matsim.vehicles.VehicleUtils; import java.net.URL; import java.util.Collection; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; /** diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/IntegrationIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java similarity index 72% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/IntegrationIT.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java index 63f9a6a3bdf..2ba76434464 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/IntegrationIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.jsprit; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; @@ -11,14 +32,14 @@ import org.junit.Test; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts.Builder; -import org.matsim.contrib.freight.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; import org.matsim.testcases.MatsimTestUtils; import java.util.concurrent.ExecutionException; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/MatsimTransformerTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/MatsimTransformerTest.java similarity index 93% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/MatsimTransformerTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/MatsimTransformerTest.java index c552a2af778..3b1d20bc402 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/MatsimTransformerTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/MatsimTransformerTest.java @@ -1,15 +1,25 @@ -package org.matsim.contrib.freight.jsprit; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; @@ -21,18 +31,26 @@ import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; - import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; import org.matsim.core.network.NetworkUtils; import org.matsim.core.network.io.MatsimNetworkReader; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; -import org.matsim.vehicles.*; +import org.matsim.vehicles.VehicleType; +import org.matsim.vehicles.VehicleUtils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.*; public class MatsimTransformerTest { @@ -214,9 +232,9 @@ private VehicleRoutingProblem getVehicleRoutingProblem(ScheduledTour sTour) { private Collection getJobsFrom(ScheduledTour sTour) { Collection services = new ArrayList(); for (Tour.TourElement e : sTour.getTour().getTourElements()) { - if (e instanceof org.matsim.contrib.freight.carrier.Tour.TourActivity) { - if (e instanceof org.matsim.contrib.freight.carrier.Tour.ServiceActivity) { - CarrierService carrierService = ((org.matsim.contrib.freight.carrier.Tour.ServiceActivity) e) + if (e instanceof Tour.TourActivity) { + if (e instanceof Tour.ServiceActivity) { + CarrierService carrierService = ((Tour.ServiceActivity) e) .getService(); Service service = Service.Builder.newInstance(carrierService.getId().toString()) .setLocation(Location.newInstance(carrierService.getLocationLinkId().toString())).build(); diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCostsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsTest.java similarity index 83% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCostsTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsTest.java index 89766d95521..e85cb3ce9a1 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCostsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsTest.java @@ -1,14 +1,29 @@ -package org.matsim.contrib.freight.jsprit; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Arrays; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.driver.Driver; import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; - import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -23,6 +38,11 @@ import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; +import java.util.Arrays; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + public class NetworkBasedTransportCostsTest { diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/SkillsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java similarity index 88% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/SkillsIT.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java index a0fe40c3b50..f1204001698 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/jsprit/SkillsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java @@ -1,21 +1,24 @@ -/* *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2019 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ -package org.matsim.contrib.freight.jsprit; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ +package org.matsim.freight.carriers.jsprit; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; @@ -29,12 +32,12 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.controler.FreightUtils; import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.misc.Time; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/DistanceScoringFunctionFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/DistanceScoringFunctionFactoryForTests.java similarity index 76% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/DistanceScoringFunctionFactoryForTests.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/DistanceScoringFunctionFactoryForTests.java index 1aa2c0765aa..2afebf0bbf7 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/DistanceScoringFunctionFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/DistanceScoringFunctionFactoryForTests.java @@ -1,8 +1,27 @@ -package org.matsim.contrib.freight.mobsim; - -import java.util.HashSet; -import java.util.Set; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.mobsim; +import jakarta.inject.Inject; import org.junit.Ignore; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; @@ -10,11 +29,6 @@ import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Leg; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierUtils; -import org.matsim.contrib.freight.carrier.CarrierVehicle; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.controler.CarrierScoringFunctionFactory; import org.matsim.core.gbl.Gbl; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.scoring.ScoringFunction; @@ -22,9 +36,15 @@ import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.ActivityScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.BasicScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.LegScoring; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.vehicles.Vehicle; -import jakarta.inject.Inject; +import java.util.HashSet; +import java.util.Set; @Ignore public class DistanceScoringFunctionFactoryForTests implements CarrierScoringFunctionFactory{ diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/ScoringFunctionFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/ScoringFunctionFactoryForTests.java similarity index 74% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/ScoringFunctionFactoryForTests.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/ScoringFunctionFactoryForTests.java index 50e4779092b..2280388ccc4 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/ScoringFunctionFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/ScoringFunctionFactoryForTests.java @@ -1,7 +1,25 @@ -package org.matsim.contrib.freight.mobsim; - -import java.util.HashSet; -import java.util.Set; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.mobsim; import org.junit.Ignore; import org.matsim.api.core.v01.Id; @@ -10,11 +28,6 @@ import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Leg; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierUtils; -import org.matsim.contrib.freight.carrier.CarrierVehicle; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.controler.CarrierScoringFunctionFactory; import org.matsim.core.gbl.Gbl; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.scoring.ScoringFunction; @@ -22,8 +35,16 @@ import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.ActivityScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.BasicScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.LegScoring; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.vehicles.Vehicle; +import java.util.HashSet; +import java.util.Set; + @Ignore public class ScoringFunctionFactoryForTests implements CarrierScoringFunctionFactory{ diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/StrategyManagerFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java similarity index 60% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/StrategyManagerFactoryForTests.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java index e7c4e9c88ee..0f5cb34fedd 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/StrategyManagerFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java @@ -1,25 +1,46 @@ -package org.matsim.contrib.freight.mobsim; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.mobsim; import com.google.inject.Provider; +import jakarta.inject.Inject; import org.junit.Ignore; import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierPlan; -import org.matsim.contrib.freight.controler.CarrierReRouteVehicles; -import org.matsim.contrib.freight.controler.CarrierStrategyManager; -import org.matsim.contrib.freight.controler.FreightUtils; import org.matsim.core.replanning.GenericPlanStrategyImpl; import org.matsim.core.replanning.selectors.BestPlanSelector; import org.matsim.core.router.speedy.SpeedyALTFactory; import org.matsim.core.router.util.LeastCostPathCalculator; import org.matsim.core.router.util.TravelDisutility; import org.matsim.core.router.util.TravelTime; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.controler.CarrierReRouteVehicles; +import org.matsim.freight.carriers.controler.CarrierStrategyManager; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.vehicles.Vehicle; -import jakarta.inject.Inject; import java.util.Map; @Ignore diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/TimeScoringFunctionFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/TimeScoringFunctionFactoryForTests.java similarity index 77% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/TimeScoringFunctionFactoryForTests.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/TimeScoringFunctionFactoryForTests.java index a7ec4c15612..d4bc990052d 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/mobsim/TimeScoringFunctionFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/TimeScoringFunctionFactoryForTests.java @@ -1,10 +1,27 @@ -package org.matsim.contrib.freight.mobsim; - -import java.util.HashSet; -import java.util.Set; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.mobsim; import jakarta.inject.Inject; - import org.junit.Ignore; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; @@ -12,11 +29,6 @@ import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Leg; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierUtils; -import org.matsim.contrib.freight.carrier.CarrierVehicle; -import org.matsim.contrib.freight.carrier.CarrierConstants; -import org.matsim.contrib.freight.controler.CarrierScoringFunctionFactory; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.scoring.ScoringFunction; import org.matsim.core.utils.misc.Time; @@ -24,8 +36,16 @@ import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.ActivityScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.BasicScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.LegScoring; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.vehicles.Vehicle; +import java.util.HashSet; +import java.util.Set; + @Ignore public class TimeScoringFunctionFactoryForTests implements CarrierScoringFunctionFactory{ diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/usecases/chessboard/RunChessboardIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboardIT.java similarity index 58% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/usecases/chessboard/RunChessboardIT.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboardIT.java index 6bc1155ae7f..593b7786a62 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/usecases/chessboard/RunChessboardIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboardIT.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.usecases.chessboard; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.usecases.chessboard; import org.junit.Assert; import org.junit.Rule; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriersIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriersIT.java new file mode 100644 index 00000000000..0749341e978 --- /dev/null +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriersIT.java @@ -0,0 +1,51 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.usecases.chessboard; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.matsim.core.config.Config; +import org.matsim.testcases.MatsimTestUtils; + +public class RunPassengerAlongWithCarriersIT { + + @Rule + public MatsimTestUtils utils = new MatsimTestUtils() ; + + @Test + public void runChessboard() { + try{ + RunPassengerAlongWithCarriers abc = new RunPassengerAlongWithCarriers(); + // --- + Config config = abc.prepareConfig(); + config.controller().setLastIteration( 1 ); + config.controller().setOutputDirectory( utils.getOutputDirectory() ); + // --- + abc.run(); + } catch (Exception ee ) { + ee.printStackTrace(); + Assert.fail("something went wrong: " + ee.getMessage()); + } + } + +} diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/utils/FreightUtilsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsIT.java similarity index 89% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/utils/FreightUtilsIT.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsIT.java index 6f9c44c6258..5bcf8fdf72c 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/utils/FreightUtilsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsIT.java @@ -1,51 +1,52 @@ -/* *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2018 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - -package org.matsim.contrib.freight.utils; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ -import java.util.Collection; +package org.matsim.freight.carriers.utils; +import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; +import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; +import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import com.graphhopper.jsprit.core.util.Solutions; +import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; -import org.matsim.contrib.freight.jsprit.NetworkRouter; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts.Builder; import org.matsim.core.network.NetworkUtils; import org.matsim.core.network.io.MatsimNetworkReader; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; +import org.matsim.freight.carriers.jsprit.NetworkRouter; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.*; import org.matsim.vehicles.EngineInformation.FuelType; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.util.Solutions; - -import org.junit.Assert; +import java.util.Collection; //TODO: length of routes (legs) AND end time of route are missing. diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/utils/FreightUtilsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsTest.java similarity index 93% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/utils/FreightUtilsTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsTest.java index fd09806762e..2f697f4a754 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/utils/FreightUtilsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsTest.java @@ -1,29 +1,34 @@ -/* *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2018 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ - -package org.matsim.contrib.freight.utils; - -import java.net.URL; -import java.util.Collection; -import java.util.concurrent.ExecutionException; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.utils; +import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; +import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; +import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import com.graphhopper.jsprit.core.util.Solutions; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -31,14 +36,6 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts.Builder; -import org.matsim.contrib.freight.jsprit.NetworkRouter; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.PlansConfigGroup; @@ -48,15 +45,20 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; +import org.matsim.freight.carriers.jsprit.NetworkRouter; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.*; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.util.Solutions; -import org.junit.Assert; +import java.net.URL; +import java.util.Collection; +import java.util.concurrent.ExecutionException; public class FreightUtilsTest { diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/algorithms/SetupSimpleFreightScenarioTest/testSetupScenario/grid10.xml b/contribs/freight/test/input/org/matsim/freight/carriers/algorithms/SetupSimpleFreightScenarioTest/testSetupScenario/grid10.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/algorithms/SetupSimpleFreightScenarioTest/testSetupScenario/grid10.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/algorithms/SetupSimpleFreightScenarioTest/testSetupScenario/grid10.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierModuleTest/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierModuleTest/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierModuleTest/network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierModuleTest/network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/network.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierModuleTest/plans100.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/plans100.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierModuleTest/plans100.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/plans100.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierModuleTest/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierModuleTest/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierReadWriteV2_1Test/carriers.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test/carriers.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierReadWriteV2_1Test/carriers.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test/carriers.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierReadWriteV2_1Test/vehicles.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test/vehicles.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierReadWriteV2_1Test/vehicles.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test/vehicles.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoaderTest/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeLoaderTest/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderTest/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderTest/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterTest/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/CarrierVehicleTypeWriterTest/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/carrier/vehicleTypes_v2.xml b/contribs/freight/test/input/org/matsim/freight/carriers/carrier/vehicleTypes_v2.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/carrier/vehicleTypes_v2.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/carrier/vehicleTypes_v2.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT/network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT/network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT/network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT/network.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT/plans100.xml b/contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT/plans100.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithPersonsIT/plans100.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT/plans100.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT/network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT/network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT/network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT/network.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT/output_events.xml.gz b/contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT/output_events.xml.gz similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/controler/EquilWithCarrierWithoutPersonsIT/output_events.xml.gz rename to contribs/freight/test/input/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT/output_events.xml.gz diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/controler/vehicleTypes_v2.xml b/contribs/freight/test/input/org/matsim/freight/carriers/controler/vehicleTypes_v2.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/controler/vehicleTypes_v2.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/controler/vehicleTypes_v2.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/jsprit/IntegrationIT/carrier.xml b/contribs/freight/test/input/org/matsim/freight/carriers/jsprit/IntegrationIT/carrier.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/jsprit/IntegrationIT/carrier.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/jsprit/IntegrationIT/carrier.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/jsprit/IntegrationIT/merged-network-simplified.xml.gz b/contribs/freight/test/input/org/matsim/freight/carriers/jsprit/IntegrationIT/merged-network-simplified.xml.gz similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/jsprit/IntegrationIT/merged-network-simplified.xml.gz rename to contribs/freight/test/input/org/matsim/freight/carriers/jsprit/IntegrationIT/merged-network-simplified.xml.gz diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/jsprit/IntegrationIT/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/jsprit/IntegrationIT/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/jsprit/IntegrationIT/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/jsprit/IntegrationIT/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/jsprit/MatsimTransformerTest/grid-network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/jsprit/MatsimTransformerTest/grid-network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/jsprit/MatsimTransformerTest/grid-network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/jsprit/MatsimTransformerTest/grid-network.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCostsTest/network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsTest/network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/jsprit/NetworkBasedTransportCostsTest/network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsTest/network.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/jsprit/SkillsIT/grid-network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/jsprit/SkillsIT/grid-network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/jsprit/SkillsIT/grid-network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/jsprit/SkillsIT/grid-network.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/jsprit/vehicleTypesForDCTest.xml b/contribs/freight/test/input/org/matsim/freight/carriers/jsprit/vehicleTypesForDCTest.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/jsprit/vehicleTypesForDCTest.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/jsprit/vehicleTypesForDCTest.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/mobsim/CarrierAgentTest/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/mobsim/CarrierAgentTest/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/mobsim/CarrierAgentTest/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/mobsim/CarrierAgentTest/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/mobsim/CarrierAgentTest/network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/mobsim/CarrierAgentTest/network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/mobsim/CarrierAgentTest/network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/mobsim/CarrierAgentTest/network.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/usecases/chessboard/RunChessboardIT/runChessboard/output_events.xml.gz b/contribs/freight/test/input/org/matsim/freight/carriers/usecases/chessboard/RunChessboardIT/runChessboard/output_events.xml.gz similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/usecases/chessboard/RunChessboardIT/runChessboard/output_events.xml.gz rename to contribs/freight/test/input/org/matsim/freight/carriers/usecases/chessboard/RunChessboardIT/runChessboard/output_events.xml.gz diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/usecases/chessboard/RunChessboardIT/runChessboard/output_plans.xml.gz b/contribs/freight/test/input/org/matsim/freight/carriers/usecases/chessboard/RunChessboardIT/runChessboard/output_plans.xml.gz similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/usecases/chessboard/RunChessboardIT/runChessboard/output_plans.xml.gz rename to contribs/freight/test/input/org/matsim/freight/carriers/usecases/chessboard/RunChessboardIT/runChessboard/output_plans.xml.gz diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/utils/grid-network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/utils/grid-network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/utils/grid-network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/utils/grid-network.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/vrp/Matsim2VrpUtilsTest/testCreateTours/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/vrp/Matsim2VrpUtilsTest/testCreateTours/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/vrp/Matsim2VrpUtilsTest/testCreateTours/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/vrp/Matsim2VrpUtilsTest/testCreateTours/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/vrp/Matsim2VrpUtilsTest/testCreateVehicleRoutes/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/vrp/Matsim2VrpUtilsTest/testCreateVehicleRoutes/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/vrp/Matsim2VrpUtilsTest/testCreateVehicleRoutes/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/vrp/Matsim2VrpUtilsTest/testCreateVehicleRoutes/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/contrib/freight/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/contrib/freight/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/vrp/MatsimVrpSolverImplTest/testSelectedPlanIsInitialSolution/network.xml diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java index cf9fc8839dd..da260ed005d 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java @@ -22,9 +22,9 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.scoring.ScoringFunction; import java.util.ArrayList; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java index dc3d95d4a82..ec7a6b95cb3 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java @@ -25,10 +25,10 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.HasPlansAndId; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.ScheduledTour; -import org.matsim.contrib.freight.carrier.Tour; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.contrib.freightreceiver.replanning.ReceiverStrategyManager; import org.matsim.core.config.ConfigUtils; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocation.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocation.java index c7b7ae3e141..4fd8d03c841 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocation.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocation.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; public interface ReceiverCostAllocation { double getScore(Carrier carrier, Receiver receiver); diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationEqualProportion.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationEqualProportion.java index a2905150735..f59248e8d46 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationEqualProportion.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationEqualProportion.java @@ -23,7 +23,7 @@ import com.google.inject.Inject; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; import java.util.*; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationFixed.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationFixed.java index 2e12e2cc4f5..b719aeed717 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationFixed.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationFixed.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; import org.apache.logging.log4j.LogManager; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; /** * A simple implementation where the cost allocated by the {@link Carrier} to diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverModule.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverModule.java index eadce5c1518..3681654b8f4 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverModule.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverModule.java @@ -20,7 +20,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.contrib.freightreceiver.replanning.*; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.AbstractModule; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverOrder.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverOrder.java index 0ce8984c076..e56c34ed9dc 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverOrder.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverOrder.java @@ -22,7 +22,7 @@ import org.apache.logging.log4j.LogManager; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.BasicPlan; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; import java.util.ArrayList; import java.util.Collection; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverPlan.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverPlan.java index abbb8821a25..ed8f9bc257e 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverPlan.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverPlan.java @@ -23,8 +23,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.BasicPlan; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.utils.objectattributes.attributable.Attributable; import org.matsim.utils.objectattributes.attributable.Attributes; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java index d6e806c3f24..4ecd92b3c14 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java @@ -4,7 +4,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.events.IterationEndsEvent; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java index ada89ad47ed..87c24304e4e 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java @@ -25,11 +25,14 @@ import org.apache.logging.log4j.LogManager; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.jsprit.MatsimJspritFactory; -import org.matsim.contrib.freight.jsprit.NetworkBasedTransportCosts; -import org.matsim.contrib.freight.jsprit.NetworkRouter; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.carrier.CarrierPlanWriter; +import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.NetworkRouter; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.events.IterationStartsEvent; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java index 47bad03c44c..7ad0b6796e0 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java @@ -5,7 +5,7 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversReaderV2.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversReaderV2.java index b0c5de62e52..976ec89ffe5 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversReaderV2.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversReaderV2.java @@ -22,8 +22,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.api.internal.MatsimReader; import org.matsim.core.utils.io.MatsimXmlParser; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriter.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriter.java index e8573765c22..aa1f45de263 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriter.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriter.java @@ -22,7 +22,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.core.api.internal.MatsimWriter; import org.matsim.core.utils.io.MatsimXmlWriter; import org.matsim.core.utils.io.UncheckedIOException; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandler.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandler.java index 40e036b6775..bfdc735236d 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandler.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandler.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.TimeWindow; import java.io.BufferedWriter; import java.io.IOException; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV1.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV1.java index cdf7ee41b7a..470edc810b4 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV1.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV1.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.core.utils.misc.Time; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesXmlWriterDelegate; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV2.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV2.java index c2f4e8f55db..5fb7c0addd5 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV2.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV2.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.core.utils.misc.Time; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesXmlWriterDelegate; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/UsecasesCarrierScoringFunctionFactory.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/UsecasesCarrierScoringFunctionFactory.java index 7ef7064e495..4fca3ed3a9b 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/UsecasesCarrierScoringFunctionFactory.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/UsecasesCarrierScoringFunctionFactory.java @@ -7,9 +7,9 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Leg; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.controler.CarrierScoringFunctionFactory; -import org.matsim.contrib.freight.controler.FreightActivity; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; +import org.matsim.freight.carriers.controler.FreightActivity; import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.scoring.ScoringFunction; import org.matsim.core.scoring.SumScoringFunction; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/Coalition.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/Coalition.java index e267baa3b3b..5a7666ed6a0 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/Coalition.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/Coalition.java @@ -1,6 +1,6 @@ package org.matsim.contrib.freightreceiver.collaboration; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.contrib.freightreceiver.Receiver; import org.matsim.utils.objectattributes.attributable.Attributable; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java index 1142c4ea589..939993439e6 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java @@ -4,9 +4,9 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.contrib.freightreceiver.*; public class CollaborationUtils{ diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtilsNew.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtilsNew.java index 12a273d7f61..e0f3e180802 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtilsNew.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtilsNew.java @@ -1,6 +1,6 @@ package org.matsim.contrib.freightreceiver.collaboration; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.contrib.freightreceiver.*; /** diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/MutableCoalition.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/MutableCoalition.java index 7e797b57341..99e7792e8fe 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/MutableCoalition.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/MutableCoalition.java @@ -1,7 +1,7 @@ package org.matsim.contrib.freightreceiver.collaboration; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.contrib.freightreceiver.Receiver; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesImpl; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/TimeWindowMutator.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/TimeWindowMutator.java index fa92790ba3f..9ac36f526bf 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/TimeWindowMutator.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/TimeWindowMutator.java @@ -21,7 +21,7 @@ */ package org.matsim.contrib.freightreceiver.collaboration; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.contrib.freightreceiver.ReceiverPlan; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.replanning.ReplanningContext; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/ReceiverStrategyManager.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/ReceiverStrategyManager.java index db66d80f006..0ef128e441a 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/ReceiverStrategyManager.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/ReceiverStrategyManager.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver.replanning; -import org.matsim.contrib.freight.controler.CarrierStrategyManager; +import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.contrib.freightreceiver.Receiver; import org.matsim.contrib.freightreceiver.ReceiverPlan; import org.matsim.core.replanning.GenericStrategyManager; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/TimeWindowUpperBoundMutator.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/TimeWindowUpperBoundMutator.java index 681a00c0524..6b5689046fd 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/TimeWindowUpperBoundMutator.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/TimeWindowUpperBoundMutator.java @@ -18,7 +18,7 @@ package org.matsim.contrib.freightreceiver.replanning; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.contrib.freightreceiver.ReceiverPlan; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.replanning.ReplanningContext; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java index 11b083243b1..1e2b914d10a 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java @@ -27,9 +27,9 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.network.NetworkWriter; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.carrier.CarrierCapabilities.FleetSize; -import org.matsim.contrib.freight.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.contrib.freightreceiver.*; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.config.Config; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java index cc1baca9beb..8645015d8b9 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java @@ -23,9 +23,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.usecases.analysis.CarrierScoreStats; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; import org.matsim.contrib.freightreceiver.ReceiverModule; import org.matsim.contrib.freightreceiver.ReceiverReplanningType; import org.matsim.contrib.freightreceiver.ReceiverUtils; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java index 1b2098b2c29..d799e337355 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java @@ -23,9 +23,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.usecases.analysis.CarrierScoreStats; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; import org.matsim.contrib.freightreceiver.ReceiverModule; import org.matsim.contrib.freightreceiver.ReceiverReplanningType; import org.matsim.contrib.freightreceiver.ReceiverUtils; diff --git a/contribs/freightreceiver/src/test/java/org/matsim/contrib/freightreceiver/ReceiversReaderTest.java b/contribs/freightreceiver/src/test/java/org/matsim/contrib/freightreceiver/ReceiversReaderTest.java index 77e2ab92753..71c15dac476 100644 --- a/contribs/freightreceiver/src/test/java/org/matsim/contrib/freightreceiver/ReceiversReaderTest.java +++ b/contribs/freightreceiver/src/test/java/org/matsim/contrib/freightreceiver/ReceiversReaderTest.java @@ -24,8 +24,8 @@ import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.TimeWindow; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.TimeWindow; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.utils.misc.Time; import org.matsim.testcases.MatsimTestUtils; diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierLoadAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java similarity index 64% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierLoadAnalysis.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java index 7a4d89cdfb3..6b5de62f91a 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierLoadAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java @@ -1,13 +1,34 @@ -package org.matsim.contrib.freight.analysis; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.events.Event; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.events.CarrierShipmentDeliveryStartEvent; -import org.matsim.contrib.freight.events.CarrierShipmentPickupStartEvent; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.events.CarrierShipmentDeliveryStartEvent; +import org.matsim.freight.carriers.events.CarrierShipmentPickupStartEvent; import org.matsim.core.events.handler.BasicEventHandler; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -21,7 +42,7 @@ import java.util.LinkedList; import java.util.Map; -import static org.matsim.contrib.freight.events.CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND; +import static org.matsim.freight.carriers.events.CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND; /** * @author Kai Martins-Turner (kturner) diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierPlanAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java similarity index 56% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierPlanAnalysis.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java index 8de996a9bf0..7921f693095 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierPlanAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java @@ -1,10 +1,31 @@ -package org.matsim.contrib.freight.analysis; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carriers; import java.io.BufferedWriter; import java.io.FileWriter; diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java similarity index 95% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventHandler.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java index 15a0dd00702..a3652d63944 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2021 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.analysis; +package org.matsim.freight.carriers.analysis.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,18 +28,18 @@ import org.matsim.api.core.v01.events.handler.*; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierService; -import org.matsim.contrib.freight.carrier.CarrierShipment; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.events.CarrierServiceEndEvent; -import org.matsim.contrib.freight.events.CarrierServiceStartEvent; -import org.matsim.contrib.freight.events.CarrierShipmentDeliveryEndEvent; -import org.matsim.contrib.freight.events.CarrierShipmentPickupEndEvent; -import org.matsim.contrib.freight.events.eventhandler.FreightServiceEndEventHandler; -import org.matsim.contrib.freight.events.eventhandler.FreightServiceStartEventHandler; -import org.matsim.contrib.freight.events.eventhandler.FreightShipmentDeliveryEventHandler; -import org.matsim.contrib.freight.events.eventhandler.FreightShipmentPickupEventHandler; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierService; +import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.events.CarrierServiceEndEvent; +import org.matsim.freight.carriers.events.CarrierServiceStartEvent; +import org.matsim.freight.carriers.events.CarrierShipmentDeliveryEndEvent; +import org.matsim.freight.carriers.events.CarrierShipmentPickupEndEvent; +import org.matsim.freight.carriers.events.eventhandler.FreightServiceEndEventHandler; +import org.matsim.freight.carriers.events.eventhandler.FreightServiceStartEventHandler; +import org.matsim.freight.carriers.events.eventhandler.FreightShipmentDeliveryEventHandler; +import org.matsim.freight.carriers.events.eventhandler.FreightShipmentPickupEventHandler; import org.matsim.core.network.NetworkUtils; import org.matsim.core.utils.io.UncheckedIOException; import org.matsim.vehicles.Vehicle; diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisServiceTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java similarity index 96% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisServiceTracking.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java index 1c0edb4d814..a34e4ed83af 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisServiceTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2021 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,13 +19,13 @@ * */ -package org.matsim.contrib.freight.analysis; +package org.matsim.freight.carriers.analysis.analysis; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.*; -import org.matsim.contrib.freight.events.CarrierServiceEndEvent; -import org.matsim.contrib.freight.events.CarrierServiceStartEvent; +import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.events.CarrierServiceEndEvent; +import org.matsim.freight.carriers.events.CarrierServiceStartEvent; import java.util.LinkedHashMap; diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisShipmentTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java similarity index 93% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisShipmentTracking.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java index beb8d66f846..6153a897169 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisShipmentTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2021 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,15 +19,15 @@ * */ -package org.matsim.contrib.freight.analysis; +package org.matsim.freight.carriers.analysis.analysis; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierShipment; -import org.matsim.contrib.freight.events.CarrierShipmentDeliveryEndEvent; -import org.matsim.contrib.freight.events.CarrierShipmentPickupEndEvent; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.events.CarrierShipmentDeliveryEndEvent; +import org.matsim.freight.carriers.events.CarrierShipmentPickupEndEvent; import java.util.LinkedHashMap; import java.util.LinkedHashSet; diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisVehicleTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java similarity index 97% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisVehicleTracking.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java index 8130eaa4ffb..69075e0203d 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightAnalysisVehicleTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2021 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,7 +19,7 @@ * */ -package org.matsim.contrib.freight.analysis; +package org.matsim.freight.carriers.analysis.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,7 +28,7 @@ import org.matsim.api.core.v01.events.LinkLeaveEvent; import org.matsim.api.core.v01.events.PersonLeavesVehicleEvent; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java similarity index 83% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index bfd229df7ed..21d160d7a32 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.analysis; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -6,11 +27,11 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.events.LinkEnterEvent; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.Tour; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.events.CarrierTourEndEvent; -import org.matsim.contrib.freight.events.CarrierTourStartEvent; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.events.CarrierTourEndEvent; +import org.matsim.freight.carriers.events.CarrierTourStartEvent; import org.matsim.core.events.handler.BasicEventHandler; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/Readme.md b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/Readme.md similarity index 100% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/Readme.md rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/Readme.md diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java similarity index 92% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysis.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java index 709511ad323..1938d02ac85 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2021 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,12 +19,12 @@ * */ -package org.matsim.contrib.freight.analysis; +package org.matsim.freight.carriers.analysis.analysis; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.CarrierPlanXmlReader; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypes; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.CarrierPlanXmlReader; +import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.events.EventsUtils; import org.matsim.core.events.MatsimEventsReader; diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java similarity index 94% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java index f63240e6e7d..c390f466f9a 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2021 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,14 +19,14 @@ * */ -package org.matsim.contrib.freight.analysis; +package org.matsim.freight.carriers.analysis.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.contrib.freight.FreightConfigGroup; -import org.matsim.contrib.freight.controler.FreightUtils; -import org.matsim.contrib.freight.events.CarrierEventsReaders; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.events.CarrierEventsReaders; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; diff --git a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest.java b/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest.java deleted file mode 100644 index 4974a90d130..00000000000 --- a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.matsim.contrib.freight.analysis; - -import org.junit.Rule; -import org.junit.Test; -import org.matsim.testcases.MatsimTestUtils; - -import java.io.IOException; - -public class FreightAnalysisEventBasedTest { - - @Rule - public MatsimTestUtils testUtils = new MatsimTestUtils(); - - @Test - public void runFreightAnalysisEventBasedTest() throws IOException { - - RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased(testUtils.getClassInputDirectory(), testUtils.getOutputDirectory(),null); - analysisEventBased.runAnalysis(); - - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Carrier_stats.tsv", testUtils.getOutputDirectory() + "Carrier_stats.tsv"); - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); - } -} diff --git a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyServiceTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyServiceTrackerEventHandler.java deleted file mode 100644 index ed20e653f1f..00000000000 --- a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyServiceTrackerEventHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.matsim.contrib.freight.analysis; - -import org.matsim.api.core.v01.events.ActivityStartEvent; -import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; -import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierService; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.events.CarrierServiceEndEvent; -import org.matsim.contrib.freight.events.CarrierServiceStartEvent; -import org.matsim.contrib.freight.events.eventhandler.FreightServiceEndEventHandler; -import org.matsim.contrib.freight.events.eventhandler.FreightServiceStartEventHandler; -import org.matsim.vehicles.Vehicles; - - class MyServiceTrackerEventHandler implements ActivityStartEventHandler, FreightServiceStartEventHandler, FreightServiceEndEventHandler { - private final Vehicles vehicles; - private final Network network; - private final Carriers carriers; - - private FreightAnalysisServiceTracking serviceTracking = new FreightAnalysisServiceTracking(); - - MyServiceTrackerEventHandler(Vehicles vehicles, Network network, Carriers carriers) { - this.network = network; - this.carriers = carriers; - this.vehicles = vehicles; - this.init(); - } - - private void init() { - for (Carrier carrier : carriers.getCarriers().values()) { - - for (CarrierService service : carrier.getServices().values()) { - serviceTracking.addTracker(service, carrier.getId()); - } - } - serviceTracking.estimateArrivalTimes(carriers); - } - - @Override - public void handleEvent(CarrierServiceEndEvent event) { - serviceTracking.handleEndEvent(event); - } - - @Override - public void handleEvent(CarrierServiceStartEvent event) { - serviceTracking.handleStartEvent(event); - } - - @Override - public void handleEvent(ActivityStartEvent activityStartEvent) { - if (activityStartEvent.getActType().equals("service")) { - serviceTracking.trackServiceActivityStart(activityStartEvent); - } - } - - public FreightAnalysisServiceTracking getServiceTracking() { - return serviceTracking; - } -} diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventBasedTest.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventBasedTest.java new file mode 100644 index 00000000000..4c7ef6d5678 --- /dev/null +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventBasedTest.java @@ -0,0 +1,47 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis.analysis; + +import org.junit.Rule; +import org.junit.Test; +import org.matsim.freight.carriers.analysis.analysis.RunFreightAnalysisEventBased; +import org.matsim.testcases.MatsimTestUtils; + +import java.io.IOException; + +public class FreightAnalysisEventBasedTest { + + @Rule + public MatsimTestUtils testUtils = new MatsimTestUtils(); + + @Test + public void runFreightAnalysisEventBasedTest() throws IOException { + + RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased(testUtils.getClassInputDirectory(), testUtils.getOutputDirectory(),null); + analysisEventBased.runAnalysis(); + + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Carrier_stats.tsv", testUtils.getOutputDirectory() + "Carrier_stats.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); + } +} diff --git a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyFreightVehicleTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java similarity index 92% rename from contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyFreightVehicleTrackerEventHandler.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java index 3f28c73967d..8634a6a15f9 100644 --- a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyFreightVehicleTrackerEventHandler.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2021 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,12 +19,13 @@ * */ -package org.matsim.contrib.freight.analysis; +package org.matsim.freight.carriers.analysis.analysis; import org.matsim.api.core.v01.events.*; import org.matsim.api.core.v01.events.handler.*; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.analysis.analysis.FreightAnalysisVehicleTracking; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.Vehicles; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java new file mode 100644 index 00000000000..c23d9a18cd9 --- /dev/null +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java @@ -0,0 +1,81 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis.analysis; + +import org.matsim.api.core.v01.events.ActivityStartEvent; +import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; +import org.matsim.api.core.v01.network.Network; +import org.matsim.freight.carriers.analysis.analysis.FreightAnalysisServiceTracking; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierService; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.events.CarrierServiceEndEvent; +import org.matsim.freight.carriers.events.CarrierServiceStartEvent; +import org.matsim.freight.carriers.events.eventhandler.FreightServiceEndEventHandler; +import org.matsim.freight.carriers.events.eventhandler.FreightServiceStartEventHandler; +import org.matsim.vehicles.Vehicles; + + class MyServiceTrackerEventHandler implements ActivityStartEventHandler, FreightServiceStartEventHandler, FreightServiceEndEventHandler { + private final Vehicles vehicles; + private final Network network; + private final Carriers carriers; + + private FreightAnalysisServiceTracking serviceTracking = new FreightAnalysisServiceTracking(); + + MyServiceTrackerEventHandler(Vehicles vehicles, Network network, Carriers carriers) { + this.network = network; + this.carriers = carriers; + this.vehicles = vehicles; + this.init(); + } + + private void init() { + for (Carrier carrier : carriers.getCarriers().values()) { + + for (CarrierService service : carrier.getServices().values()) { + serviceTracking.addTracker(service, carrier.getId()); + } + } + serviceTracking.estimateArrivalTimes(carriers); + } + + @Override + public void handleEvent(CarrierServiceEndEvent event) { + serviceTracking.handleEndEvent(event); + } + + @Override + public void handleEvent(CarrierServiceStartEvent event) { + serviceTracking.handleStartEvent(event); + } + + @Override + public void handleEvent(ActivityStartEvent activityStartEvent) { + if (activityStartEvent.getActType().equals("service")) { + serviceTracking.trackServiceActivityStart(activityStartEvent); + } + } + + public FreightAnalysisServiceTracking getServiceTracking() { + return serviceTracking; + } +} diff --git a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyShipmentTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java similarity index 51% rename from contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyShipmentTrackerEventHandler.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java index 6b2409d7e3d..b44036eed60 100644 --- a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/MyShipmentTrackerEventHandler.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java @@ -1,15 +1,37 @@ -package org.matsim.contrib.freight.analysis; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis.analysis; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.Carrier; -import org.matsim.contrib.freight.carrier.CarrierShipment; -import org.matsim.contrib.freight.carrier.Carriers; -import org.matsim.contrib.freight.events.CarrierShipmentDeliveryEndEvent; -import org.matsim.contrib.freight.events.CarrierShipmentPickupEndEvent; -import org.matsim.contrib.freight.events.eventhandler.FreightShipmentDeliveryEventHandler; -import org.matsim.contrib.freight.events.eventhandler.FreightShipmentPickupEventHandler; +import org.matsim.freight.carriers.analysis.analysis.FreightAnalysisShipmentTracking; +import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.events.CarrierShipmentDeliveryEndEvent; +import org.matsim.freight.carriers.events.CarrierShipmentPickupEndEvent; +import org.matsim.freight.carriers.events.eventhandler.FreightShipmentDeliveryEventHandler; +import org.matsim.freight.carriers.events.eventhandler.FreightShipmentPickupEventHandler; import org.matsim.vehicles.Vehicles; public class MyShipmentTrackerEventHandler implements ActivityStartEventHandler, FreightShipmentPickupEventHandler, FreightShipmentDeliveryEventHandler { diff --git a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java similarity index 99% rename from contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java index 4eb53f186bd..40cf13debd1 100644 --- a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java @@ -3,7 +3,7 @@ * project: org.matsim.* * *********************************************************************** * * * - * copyright : (C) 2021 by the members listed in the COPYING, * + * copyright : (C) by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -19,17 +19,17 @@ * */ -package org.matsim.contrib.freight.analysis; +package org.matsim.freight.carriers.analysis.analysis; import org.junit.*; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.freight.carrier.*; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.events.EventsUtils; import org.matsim.core.events.MatsimEventsReader; import org.matsim.core.network.NetworkUtils; +import org.matsim.freight.carriers.carrier.*; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.*; diff --git a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java similarity index 73% rename from contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java index 77cef7e441a..f092d11c6af 100644 --- a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java @@ -1,4 +1,25 @@ -package org.matsim.contrib.freight.analysis; +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis.analysis; import org.junit.Assert; import org.junit.Rule; @@ -6,10 +27,10 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.contrib.freight.carrier.CarrierPlanXmlReader; -import org.matsim.contrib.freight.carrier.CarrierShipment; -import org.matsim.contrib.freight.carrier.CarrierVehicleTypes; -import org.matsim.contrib.freight.carrier.Carriers; +import org.matsim.freight.carriers.carrier.CarrierPlanXmlReader; +import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.events.EventsUtils; import org.matsim.core.events.MatsimEventsReader; @@ -20,7 +41,6 @@ import java.io.File; import java.util.Iterator; import java.util.LinkedHashMap; -import java.util.Set; public class RunFreightAnalysisWithShipmentTest { diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/output_carriers.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_carriers.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/output_carriers.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_carriers.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/output_events.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_events.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/output_events.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_events.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/output_network.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_network.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisIT/output_network.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_network.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz b/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/contrib/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz From 85ec355fbb7f962ac7cc7e350b5fcbe7c35627f7 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Thu, 12 Oct 2023 23:05:45 +0200 Subject: [PATCH 2/8] move stuff from FreightUtils to CarrierUtils and rename FreightUtils to CarrierControlerUtils afterwards. --- .../CarrierReaderFromCSV.java | 9 +- .../DemandReaderFromCSV.java | 25 +- .../FreightDemandGeneration.java | 10 +- .../FreightDemandGenerationUtils.java | 4 +- ...rateSmallScaleCommercialTrafficDemand.java | 44 +- .../SmallScaleCommercialTrafficUtils.java | 7 +- .../TrafficVolumeGeneration.java | 3 +- .../CarrierReaderFromCSVTest.java | 15 +- .../DemandReaderFromCSVTest.java | 20 +- ...nerateSmallScaleCommercialTrafficTest.java | 12 +- .../TrafficVolumeGenerationTest.java | 29 +- .../jointDemand/JointDemandModule.java | 4 +- .../RunJointDemandCarToggleJspritExample.java | 6 +- .../examples/RunJointDemandCarExample.java | 6 +- .../examples/RunJointDemandDRTExample.java | 6 +- .../CommercialTrafficIntegrationTest.java | 4 +- .../IsTheRightCustomerScoredTest.java | 7 +- .../freight/carriers/carrier/CarrierPlan.java | 5 +- .../carriers/carrier/CarrierUtils.java | 475 +++++++++++++++- .../carriers/controler/CarrierAgent.java | 2 +- .../controler/CarrierControlerListener.java | 3 +- .../controler/CarrierControlerUtils.java | 36 ++ .../carriers/controler/CarrierModule.java | 4 +- .../controler/FreightAgentSource.java | 7 +- .../carriers/controler/FreightUtils.java | 521 ------------------ .../carriers/jsprit/MatsimJspritFactory.java | 19 +- .../usecases/chessboard/RunChessboard.java | 8 +- .../RunPassengerAlongWithCarriers.java | 4 +- .../carriers/carrier/CarrierModuleTest.java | 3 +- .../carrier/CarrierPlanXmlReaderV2Test.java | 3 +- .../carrier/CarrierPlanXmlWriterV2_1Test.java | 7 +- .../EquilWithCarrierWithPersonsIT.java | 2 +- .../EquilWithCarrierWithoutPersonsIT.java | 17 +- ...istanceConstraintFromVehiclesFileTest.java | 9 +- .../jsprit/DistanceConstraintTest.java | 13 +- .../carriers/jsprit/IntegrationIT.java | 11 +- .../freight/carriers/jsprit/SkillsIT.java | 25 +- .../StrategyManagerFactoryForTests.java | 4 +- ...lsIT.java => CarrierControlerUtilsIT.java} | 5 +- ...st.java => CarrierControlerUtilsTest.java} | 57 +- .../freightreceiver/ReceiverAgent.java | 4 +- .../ReceiverControlerListener.java | 4 +- .../freightreceiver/ReceiverScoreStats.java | 4 +- ...iverTriggersCarrierReplanningListener.java | 12 +- .../freightreceiver/ReceiverUtils.java | 2 +- .../collaboration/CollaborationUtils.java | 4 +- .../ReceiverChessboardScenario.java | 11 +- ...iverChessboardWithEqualProportionCost.java | 4 +- ...eceiverChessboardWithFixedCarrierCost.java | 4 +- ...tTimeAndDistanceAnalysisEventsHandler.java | 4 +- .../RunFreightAnalysisEventBased.java | 8 +- 51 files changed, 737 insertions(+), 775 deletions(-) create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerUtils.java delete mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightUtils.java rename contribs/freight/src/test/java/org/matsim/freight/carriers/utils/{FreightUtilsIT.java => CarrierControlerUtilsIT.java} (98%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/utils/{FreightUtilsTest.java => CarrierControlerUtilsTest.java} (93%) diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java index a499851f09f..f6a5931e786 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java @@ -30,7 +30,6 @@ import org.matsim.freight.carriers.FreightConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -315,9 +314,9 @@ else if (!record.get("fleetSize").isBlank()) static void checkNewCarrier(Set allNewCarrierInformation, FreightConfigGroup freightConfigGroup, Scenario scenario, Collection polygonsInShape, String shapeCategory) { - FreightUtils.addOrGetCarriers(scenario); + CarrierUtils.addOrGetCarriers(scenario); for (CarrierInformationElement carrierElement : allNewCarrierInformation) { - if (FreightUtils.getCarriers(scenario).getCarriers() + if (CarrierUtils.getCarriers(scenario).getCarriers() .containsKey(Id.create(carrierElement.getName(), Carrier.class))) throw new RuntimeException("The Carrier " + carrierElement.getName() + " being loaded from the csv is already in the given Carrier file. It is not possible to add to an existing Carrier. Please check!"); @@ -420,9 +419,9 @@ static void createNewCarrierAndAddVehicleTypes(Scenario scenario, Collection polygonsInShape, int defaultJspritIterations, CoordinateTransformation crsTransformationNetworkAndShape) { - Carriers carriers = FreightUtils.addOrGetCarriers(scenario); + Carriers carriers = CarrierUtils.addOrGetCarriers(scenario); CarrierVehicleTypes carrierVehicleTypes = new CarrierVehicleTypes(); - CarrierVehicleTypes usedCarrierVehicleTypes = FreightUtils.getCarrierVehicleTypes(scenario); + CarrierVehicleTypes usedCarrierVehicleTypes = CarrierUtils.getCarrierVehicleTypes(scenario); new CarrierVehicleTypeReader(carrierVehicleTypes).readFile(freightConfigGroup.getCarriersVehicleTypesFile()); for (CarrierInformationElement singleNewCarrier : allNewCarrierInformation) { diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java index f8243d5d4d4..e56dc00acb7 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java @@ -32,7 +32,6 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.network.NetworkUtils; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.core.utils.geometry.geotools.MGC; @@ -648,7 +647,7 @@ else if (samplingOption.equals("changeDemandOnLocation")) { .setCapacityDemand(demandForThisLink).setServiceDuration(serviceTime) .setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow()) .build(); - FreightUtils.getCarriers(scenario).getCarriers() + CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices() .put(thisService.getId(), thisService); } @@ -688,7 +687,7 @@ else if (samplingOption.equals("changeDemandOnLocation")) { .setCapacityDemand(demandForThisLink).setServiceDuration(serviceTime) .setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow()) .build(); - FreightUtils.getCarriers(scenario).getCarriers().values().iterator().next().getServices() + CarrierUtils.getCarriers(scenario).getCarriers().values().iterator().next().getServices() .put(thisService.getId(), thisService); } distributedDemand = distributedDemand + demandForThisLink; @@ -740,7 +739,7 @@ else if (samplingOption.equals("changeDemandOnLocation")) { .setCapacityDemand(demandForThisLink).setServiceDuration(serviceTime) .setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow()) .build(); - FreightUtils.getCarriers(scenario).getCarriers() + CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices() .put(thisService.getId(), thisService); } @@ -919,7 +918,7 @@ else if (population == null) .setPickupServiceTime(serviceTimePickup).setPickupTimeWindow(timeWindowPickup) .setDeliveryServiceTime(serviceTimeDelivery).setDeliveryTimeWindow(timeWindowDelivery) .build(); - FreightUtils.getCarriers(scenario).getCarriers() + CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getShipments() .put(thisShipment.getId(), thisShipment); } @@ -1021,7 +1020,7 @@ else if (numberOfPickupLocations != null) { .setPickupServiceTime(serviceTimePickup).setPickupTimeWindow(timeWindowPickup) .setDeliveryServiceTime(serviceTimeDelivery).setDeliveryTimeWindow(timeWindowDelivery) .build(); - FreightUtils.getCarriers(scenario).getCarriers() + CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)) .getShipments().put(thisShipment.getId(), thisShipment); } @@ -1078,7 +1077,7 @@ else if (numberOfPickupLocations != null) { .newInstance(idNewShipment, linkPickup.getId(), linkDelivery.getId(), demandForThisLink) .setPickupServiceTime(serviceTimePickup).setPickupTimeWindow(timeWindowPickup) .setDeliveryServiceTime(serviceTimeDelivery).setDeliveryTimeWindow(timeWindowDelivery).build(); - FreightUtils.getCarriers(scenario).getCarriers() + CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getShipments() .put(thisShipment.getId(), thisShipment); distributedDemand = distributedDemand + demandForThisLink; @@ -1103,10 +1102,10 @@ private static String createJobId(Scenario scenario, DemandInformationElement ne String newJobId; if (linkDelivery != null) { newJobId = "Shipment_" + linkPickup + "_" + linkDelivery; - if (FreightUtils.getCarriers(scenario).getCarriers() + if (CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getShipments() .containsKey(Id.create(newJobId, CarrierShipment.class))) { - for (int x = 1; FreightUtils.getCarriers(scenario).getCarriers() + for (int x = 1; CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getShipments() .containsKey(Id.create(newJobId, CarrierShipment.class)); x++) { newJobId = "Shipment_" + linkPickup + "_" + linkDelivery + "_" + x; @@ -1114,10 +1113,10 @@ private static String createJobId(Scenario scenario, DemandInformationElement ne } } else { newJobId = "Service_" + linkPickup; - if (FreightUtils.getCarriers(scenario).getCarriers() + if (CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices() .containsKey(Id.create(newJobId, CarrierShipment.class))) { - for (int x = 1; FreightUtils.getCarriers(scenario).getCarriers() + for (int x = 1; CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices() .containsKey(Id.create(newJobId, CarrierShipment.class)); x++) { newJobId = "Service_" + linkPickup + "_" + x; @@ -1143,7 +1142,7 @@ private static void reduceNumberOfJobsIfSameCharacteristics(Scenario scenario, if (newDemandInformationElement.getTypeOfDemand().equals("shipment")) { HashMap, CarrierShipment> shipmentsToRemove = new HashMap, CarrierShipment>(); ArrayList shipmentsToAdd = new ArrayList(); - Carrier thisCarrier = FreightUtils.getCarriers(scenario).getCarriers() + Carrier thisCarrier = CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)); for (Id baseShipmentId : thisCarrier.getShipments().keySet()) { if (!shipmentsToRemove.containsKey(baseShipmentId)) { @@ -1194,7 +1193,7 @@ private static void reduceNumberOfJobsIfSameCharacteristics(Scenario scenario, if (newDemandInformationElement.getTypeOfDemand().equals("service")) { HashMap, CarrierService> servicesToRemove = new HashMap, CarrierService>(); ArrayList servicesToAdd = new ArrayList(); - Carrier thisCarrier = FreightUtils.getCarriers(scenario).getCarriers() + Carrier thisCarrier = CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)); for (Id baseServiceId : thisCarrier.getServices().keySet()) { if (!servicesToRemove.containsKey(baseServiceId)) { diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java index 58653204d18..c794c846c74 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java @@ -29,10 +29,10 @@ import org.matsim.freight.carriers.FreightConfigGroup; import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.freight.carriers.carrier.CarrierPlanWriter; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.freight.carriers.controler.CarrierModule; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.usecases.chessboard.CarrierScoringFunctionFactoryImpl; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -316,7 +316,7 @@ private void createCarrier(Scenario scenario, CarrierInputOptions selectedCarrie throw new RuntimeException("No path to the carrier file selected"); else { freightConfigGroup.setCarriersFile(carriersFileLocation); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); log.info("Load carriers from: " + carriersFileLocation); CarrierReaderFromCSV.readAndCreateCarrierFromCSV(scenario, freightConfigGroup, csvLocationCarrier, polygonsInShape, defaultJspritIterations, crsTransformationNetworkAndShape, shapeCategory); @@ -328,7 +328,7 @@ private void createCarrier(Scenario scenario, CarrierInputOptions selectedCarrie throw new RuntimeException("No path to the carrier file selected"); else { freightConfigGroup.setCarriersFile(carriersFileLocation); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); log.info("Load carriers from: " + carriersFileLocation); } } @@ -415,7 +415,7 @@ private void createDemand(DemandGenerationOptions selectedDemandGenerationOption case useDemandFromCarrierFile -> { // use only the given demand of the read carrier file boolean oneCarrierHasJobs = false; - for (Carrier carrier : FreightUtils.getCarriers(scenario).getCarriers().values()) + for (Carrier carrier : CarrierUtils.getCarriers(scenario).getCarriers().values()) if (carrier.getServices().isEmpty() && carrier.getShipments().isEmpty()) log.warn(carrier.getId().toString() + " has no jobs which can be used"); else { @@ -529,6 +529,6 @@ private static void runJsprit(Controler controler, boolean usingRangeRestriction if (usingRangeRestriction) freightConfigGroup.setUseDistanceConstraintForTourPlanning( FreightConfigGroup.UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption); - FreightUtils.runJsprit(controler.getScenario()); + CarrierUtils.runJsprit(controler.getScenario()); } } diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java index 5b54115b3af..ec1aa7f3b83 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java @@ -32,7 +32,7 @@ import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.freight.carriers.carrier.CarrierService; import org.matsim.freight.carriers.carrier.CarrierShipment; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.controler.Controler; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.core.utils.geometry.geotools.MGC; @@ -103,7 +103,7 @@ static void createDemandLocationsFile(Controler controler) { try (FileWriter writer = new FileWriter(file, true)) { writer.write("id x y type ServiceLocation pickupLocation deliveryLocation\n"); - for (Carrier thisCarrier : FreightUtils.getCarriers(controler.getScenario()).getCarriers().values()) { + for (Carrier thisCarrier : CarrierUtils.getCarriers(controler.getScenario()).getCarriers().values()) { for (CarrierService thisService : thisCarrier.getServices().values()) { Coord coord = FreightDemandGenerationUtils .getCoordOfMiddlePointOfLink(network.getLinks().get(thisService.getLocationLinkId())); diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index a5e51cb8346..b1ff889e89d 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -188,7 +188,7 @@ public Integer call() throws Exception { if (config.vehicles() != null && freightConfigGroup.getCarriersVehicleTypesFile() == null) freightConfigGroup.setCarriersVehicleTypesFile(config.vehicles().getVehiclesFile()); log.info("Load carriers from: " + freightConfigGroup.getCarriersFile()); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); } case useExistingCarrierFileWithoutSolution -> { log.info("Existing carriers (including carrier vehicle types ) should be set in the freight config group"); @@ -199,7 +199,7 @@ public Integer call() throws Exception { if (config.vehicles() != null && freightConfigGroup.getCarriersVehicleTypesFile() == null) freightConfigGroup.setCarriersVehicleTypesFile(config.vehicles().getVehiclesFile()); log.info("Load carriers from: " + freightConfigGroup.getCarriersFile()); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); solveSeparatedVRPs(scenario, null); } default -> { @@ -237,20 +237,20 @@ public Integer call() throws Exception { default -> throw new RuntimeException("No traffic type selected."); } if (config.controller().getRunId() == null) - new CarrierPlanWriter(FreightUtils.addOrGetCarriers(scenario)) + new CarrierPlanWriter(CarrierUtils.addOrGetCarriers(scenario)) .write(scenario.getConfig().controller().getOutputDirectory() + "/output_CarrierDemand.xml"); else - new CarrierPlanWriter(FreightUtils.addOrGetCarriers(scenario)) + new CarrierPlanWriter(CarrierUtils.addOrGetCarriers(scenario)) .write(scenario.getConfig().controller().getOutputDirectory() + "/" + scenario.getConfig().controller().getRunId() + ".output_CarrierDemand.xml"); solveSeparatedVRPs(scenario, regionLinksMap); } } if (config.controller().getRunId() == null) - new CarrierPlanWriter(FreightUtils.addOrGetCarriers(scenario)).write( + new CarrierPlanWriter(CarrierUtils.addOrGetCarriers(scenario)).write( scenario.getConfig().controller().getOutputDirectory() + "/output_CarrierDemandWithPlans.xml"); else - new CarrierPlanWriter(FreightUtils.addOrGetCarriers(scenario)) + new CarrierPlanWriter(CarrierUtils.addOrGetCarriers(scenario)) .write( scenario.getConfig().controller().getOutputDirectory() + "/" + scenario.getConfig().controller().getRunId() + ".output_CarrierDemandWithPlans.xml"); Controler controler = prepareControler(scenario); @@ -270,10 +270,10 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map, Carrier> allCarriers = new HashMap<>( - FreightUtils.getCarriers(originalScenario).getCarriers()); + CarrierUtils.getCarriers(originalScenario).getCarriers()); Map, Carrier> solvedCarriers = new HashMap<>(); List> keyList = new ArrayList<>(allCarriers.keySet()); - FreightUtils.getCarriers(originalScenario).getCarriers().values().forEach(carrier -> { + CarrierUtils.getCarriers(originalScenario).getCarriers().values().forEach(carrier -> { if (CarrierUtils.getJspritIterations(carrier) == 0) { allCarriers.remove(carrier.getId()); solvedCarriers.put(carrier.getId(), carrier); @@ -369,18 +369,18 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map { + CarrierUtils.getCarriers(originalScenario).getCarriers().putAll(solvedCarriers); + CarrierUtils.getCarriers(originalScenario).getCarriers().values().forEach(carrier -> { if (regionLinksMap != null && !carrier.getAttributes().getAsMap().containsKey("tourStartArea")) { List startAreas = new ArrayList<>(); for (ScheduledTour tour : carrier.getSelectedPlan().getScheduledTours()) { @@ -466,7 +466,7 @@ private Controler prepareControler(Scenario scenario) { @Override public void install() { bind(CarrierStrategyManager.class).toProvider( - new MyCarrierPlanStrategyManagerFactory(FreightUtils.getCarrierVehicleTypes(scenario))); + new MyCarrierPlanStrategyManagerFactory(CarrierUtils.getCarrierVehicleTypes(scenario))); bind(CarrierScoringFunctionFactory.class).toInstance(new MyCarrierScoringFunctionFactory()); } }); @@ -490,7 +490,7 @@ private void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, Map stopDurationTimeSelector = createStopDurationTimeDistributionPerCategory( smallScaleCommercialTrafficType); - CarrierVehicleTypes carrierVehicleTypes = FreightUtils.getCarrierVehicleTypes(scenario); + CarrierVehicleTypes carrierVehicleTypes = CarrierUtils.getCarrierVehicleTypes(scenario); Map, VehicleType> additionalCarrierVehicleTypes = scenario.getVehicles().getVehicleTypes(); additionalCarrierVehicleTypes.values().forEach( vehicleType -> carrierVehicleTypes.getVehicleTypes().putIfAbsent(vehicleType.getId(), vehicleType)); @@ -583,7 +583,7 @@ private void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, assert possibleVehicleTypes != null; for (String possibleVehicleType : possibleVehicleTypes) { - if (FreightUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( + if (CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( Id.create(possibleVehicleType, VehicleType.class))) vehicleTypes.add(possibleVehicleType); } @@ -675,7 +675,7 @@ private void createServices(Scenario scenario, ArrayList noPossibleLinks CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); - FreightUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() + CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() .put(thisService.getId(), thisService); } @@ -693,8 +693,8 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpo ValueSelectorUnderGivenProbability tourStartTimeSelector, ValueSelectorUnderGivenProbability tourDurationTimeSelector) { - Carriers carriers = FreightUtils.addOrGetCarriers(scenario); - CarrierVehicleTypes carrierVehicleTypes = FreightUtils.getCarrierVehicleTypes(scenario); + Carriers carriers = CarrierUtils.addOrGetCarriers(scenario); + CarrierVehicleTypes carrierVehicleTypes = CarrierUtils.getCarrierVehicleTypes(scenario); CarrierCapabilities carrierCapabilities; @@ -971,7 +971,7 @@ public CarrierStrategyManager get() { travelDisutility, modeTravelTimes.get(TransportMode.car)); // final GenericStrategyManager strategyManager = new GenericStrategyManager<>(); - final CarrierStrategyManager strategyManager = FreightUtils.createDefaultCarrierStrategyManager(); + final CarrierStrategyManager strategyManager = CarrierControlerUtils.createDefaultCarrierStrategyManager(); strategyManager.setMaxPlansPerAgent(5); { GenericPlanStrategyImpl strategy = new GenericPlanStrategyImpl<>( diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java index 294b5c8ab0b..39d3baff696 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java @@ -45,7 +45,6 @@ import org.matsim.freight.carriers.carrier.Tour.Pickup; import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; import org.matsim.freight.carriers.carrier.Tour.TourElement; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.network.NetworkUtils; @@ -191,7 +190,7 @@ static void createPlansBasedOnCarrierPlans(Scenario scenario, String smallScaleC Plan plan = popFactory.createPlan(); String carrierName = person.getId().toString().split("freight_")[1].split("_veh_")[0]; - Carrier relatedCarrier = FreightUtils.addOrGetCarriers(scenario).getCarriers() + Carrier relatedCarrier = CarrierUtils.addOrGetCarriers(scenario).getCarriers() .get(Id.create(carrierName, Carrier.class)); String subpopulation = relatedCarrier.getAttributes().getAttribute("subpopulation").toString(); final String mode; @@ -460,7 +459,7 @@ static void readExistingModels(Scenario scenario, double sampleScenario, } } carrierToRemove.forEach(carrier -> carriers.getCarriers().remove(carrier.getId())); - FreightUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().putAll(usedVehicleTypes.getVehicleTypes()); + CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().putAll(usedVehicleTypes.getVehicleTypes()); carriers.getCarriers().values().forEach(carrier -> { Carrier newCarrier = CarrierUtils @@ -503,7 +502,7 @@ else if (!carrier.getShipments().isEmpty()) CarrierUtils.setJspritIterations(newCarrier, CarrierUtils.getJspritIterations(carrier)); newCarrier.getCarrierCapabilities().setFleetSize(carrier.getCarrierCapabilities().getFleetSize()); } - FreightUtils.addOrGetCarriers(scenario).getCarriers().put(newCarrier.getId(), newCarrier); + CarrierUtils.addOrGetCarriers(scenario).getCarriers().put(newCarrier.getId(), newCarrier); }); } } diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java index 301f14decca..2c07198f9ff 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java @@ -31,7 +31,6 @@ import org.matsim.freight.carriers.carrier.Tour.Pickup; import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; import org.matsim.freight.carriers.carrier.Tour.TourElement; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.utils.io.IOUtils; @@ -278,7 +277,7 @@ static void reduceDemandBasedOnExistingCarriers(Scenario scenario, HashMap> trafficVolumePerTypeAndZone_start, HashMap> trafficVolumePerTypeAndZone_stop) { - for (Carrier carrier : FreightUtils.addOrGetCarriers(scenario).getCarriers().values()) { + for (Carrier carrier : CarrierUtils.addOrGetCarriers(scenario).getCarriers().values()) { if (!carrier.getAttributes().getAsMap().containsKey("subpopulation") || !carrier.getAttributes().getAttribute("subpopulation").equals(smallScaleCommercialTrafficType)) continue; diff --git a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java index 11097157601..601339c14f0 100644 --- a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java +++ b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java @@ -18,7 +18,6 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.application.options.ShpOptions; import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.freight.carriers.carrier.CarrierUtils; @@ -62,16 +61,16 @@ public void carrierCreation() throws IOException { CarrierReaderFromCSV.checkNewCarrier(allNewCarrierInformation, freightConfigGroup, scenario, polygonsInShape, shapeCategory); CarrierReaderFromCSV.createNewCarrierAndAddVehicleTypes(scenario, allNewCarrierInformation, freightConfigGroup, polygonsInShape, 1, null); - Assert.assertEquals(3, FreightUtils.getCarriers(scenario).getCarriers().size()); + Assert.assertEquals(3, CarrierUtils.getCarriers(scenario).getCarriers().size()); Assert.assertTrue( - FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier1", Carrier.class))); + CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier1", Carrier.class))); Assert.assertTrue( - FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier2", Carrier.class))); + CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier2", Carrier.class))); Assert.assertTrue( - FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier3", Carrier.class))); + CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier3", Carrier.class))); // check carrier 1 - Carrier testCarrier1 = FreightUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier1 = CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier1", Carrier.class)); Assert.assertEquals(FleetSize.INFINITE, testCarrier1.getCarrierCapabilities().getFleetSize()); Assert.assertEquals(10, CarrierUtils.getJspritIterations(testCarrier1)); @@ -101,7 +100,7 @@ public void carrierCreation() throws IOException { Assert.assertTrue(typesPerDepot.get("j(2,4)R").contains("testVehicle2")); // check carrier 2 - Carrier testCarrier2 = FreightUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier2 = CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier2", Carrier.class)); Assert.assertEquals(FleetSize.FINITE, testCarrier2.getCarrierCapabilities().getFleetSize()); Assert.assertEquals(15, CarrierUtils.getJspritIterations(testCarrier2)); @@ -126,7 +125,7 @@ public void carrierCreation() throws IOException { // check carrier 3 Network network = NetworkUtils.readNetwork( "https://raw.githubusercontent.com/matsim-org/matsim-libs/master/examples/scenarios/freight-chessboard-9x9/grid9x9.xml"); - Carrier testCarrier3 = FreightUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier3 = CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier3", Carrier.class)); Assert.assertEquals(FleetSize.INFINITE, testCarrier3.getCarrierCapabilities().getFleetSize()); Assert.assertEquals(1, CarrierUtils.getJspritIterations(testCarrier3)); diff --git a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java index 10d7118b0c1..1a7f1c826e9 100644 --- a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java +++ b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java @@ -19,11 +19,7 @@ import org.matsim.api.core.v01.population.Population; import org.matsim.application.options.ShpOptions; import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierService; -import org.matsim.freight.carriers.carrier.CarrierShipment; -import org.matsim.freight.carriers.carrier.TimeWindow; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.*; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.NetworkUtils; @@ -100,18 +96,18 @@ public void demandCreation() throws IOException { DemandReaderFromCSV.checkNewDemand(scenario, demandInformation, polygonsInShape, shapeCategory); DemandReaderFromCSV.createDemandForCarriers(scenario, polygonsInShape, demandInformation, population, false, null); - Assert.assertEquals(3, FreightUtils.getCarriers(scenario).getCarriers().size()); + Assert.assertEquals(3, CarrierUtils.getCarriers(scenario).getCarriers().size()); Assert.assertTrue( - FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier1", Carrier.class))); + CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier1", Carrier.class))); Assert.assertTrue( - FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier2", Carrier.class))); + CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier2", Carrier.class))); Assert.assertTrue( - FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier3", Carrier.class))); + CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier3", Carrier.class))); // check carrier 1 Network network = NetworkUtils.readNetwork( "https://raw.githubusercontent.com/matsim-org/matsim-libs/master/examples/scenarios/freight-chessboard-9x9/grid9x9.xml"); - Carrier testCarrier1 = FreightUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier1 = CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier1", Carrier.class)); Assert.assertEquals(14, testCarrier1.getServices().size()); Assert.assertEquals(0, testCarrier1.getShipments().size()); @@ -157,7 +153,7 @@ public void demandCreation() throws IOException { Assert.assertTrue(locationsPerServiceElement.get("serviceElement2").contains("i(2,0)")); // check carrier 2 - Carrier testCarrier2 = FreightUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier2 = CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier2", Carrier.class)); Assert.assertEquals(0, testCarrier2.getServices().size()); Assert.assertEquals(11, testCarrier2.getShipments().size()); @@ -208,7 +204,7 @@ public void demandCreation() throws IOException { Assert.assertEquals(2, locationsPerShipmentElement.get("ShipmenElement2_delivery").size()); // check carrier 3 - Carrier testCarrier3 = FreightUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier3 = CarrierUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier3", Carrier.class)); Assert.assertEquals(0, testCarrier3.getServices().size()); Assert.assertEquals(4, testCarrier3.getShipments().size()); diff --git a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java index c1e44d96aaf..57dcb85040d 100644 --- a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java +++ b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java @@ -27,7 +27,7 @@ import org.matsim.api.core.v01.population.Population; import org.matsim.freight.carriers.FreightConfigGroup; import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.population.PopulationUtils; @@ -96,9 +96,9 @@ public void testMainRunAndResults() { } freightConfigGroup.setCarriersFile(carriersWOSolutionFileLocation); - FreightUtils.loadCarriersAccordingToFreightConfig(scenarioWOSolution); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenarioWOSolution); freightConfigGroup.setCarriersFile(carriersWSolutionFileLocation); - FreightUtils.loadCarriersAccordingToFreightConfig(scenarioWSolution); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenarioWSolution); assert population != null; for (Person person : population.getPersons().values()) { @@ -109,10 +109,10 @@ public void testMainRunAndResults() { Assert.assertTrue(person.getAttributes().getAsMap().containsKey("purpose")); } - Assert.assertEquals(FreightUtils.addOrGetCarriers(scenarioWSolution).getCarriers().size(), - FreightUtils.addOrGetCarriers(scenarioWOSolution).getCarriers().size(), 0); + Assert.assertEquals(CarrierUtils.addOrGetCarriers(scenarioWSolution).getCarriers().size(), + CarrierUtils.addOrGetCarriers(scenarioWOSolution).getCarriers().size(), 0); int countedTours = 0; - for (Carrier carrier_withSolution : FreightUtils.addOrGetCarriers(scenarioWSolution).getCarriers().values()) { + for (Carrier carrier_withSolution : CarrierUtils.addOrGetCarriers(scenarioWSolution).getCarriers().values()) { countedTours += carrier_withSolution.getSelectedPlan().getScheduledTours().size(); } Assert.assertEquals(population.getPersons().size(), countedTours, 0); diff --git a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java index 5833eadb4dd..f5e3ddbe380 100644 --- a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java +++ b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java @@ -30,7 +30,6 @@ import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.scenario.ScenarioUtils; @@ -407,13 +406,13 @@ public void testAddingExistingScenarios() throws Exception { SmallScaleCommercialTrafficUtils.readExistingModels(scenario, sample, regionLinksMap); - Assert.assertEquals(3, FreightUtils.getCarriers(scenario).getCarriers().size(), MatsimTestUtils.EPSILON); - Assert.assertEquals(1, FreightUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().size(), MatsimTestUtils.EPSILON); - Assert.assertTrue(FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier1", Carrier.class))); - Assert.assertTrue(FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier2", Carrier.class))); - Assert.assertTrue(FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleShipmentCarrier_carrier1", Carrier.class))); + Assert.assertEquals(3, CarrierUtils.getCarriers(scenario).getCarriers().size(), MatsimTestUtils.EPSILON); + Assert.assertEquals(1, CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().size(), MatsimTestUtils.EPSILON); + Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier1", Carrier.class))); + Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier2", Carrier.class))); + Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleShipmentCarrier_carrier1", Carrier.class))); - Carrier addedCarrier1 = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier1", Carrier.class)); + Carrier addedCarrier1 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier1", Carrier.class)); Assert.assertNotNull(addedCarrier1.getSelectedPlan()); Assert.assertEquals(0, CarrierUtils.getJspritIterations(addedCarrier1), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier1.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); @@ -428,7 +427,7 @@ public void testAddingExistingScenarios() throws Exception { Assert.assertNull(addedCarrier1.getAttributes().getAttribute("vehicleType")); Assert.assertEquals("testArea2_area3", addedCarrier1.getAttributes().getAttribute("tourStartArea")); - Carrier addedCarrier2 = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier2", Carrier.class)); + Carrier addedCarrier2 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier2", Carrier.class)); Assert.assertNotNull(addedCarrier2.getSelectedPlan()); Assert.assertEquals(0, CarrierUtils.getJspritIterations(addedCarrier2), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier2.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); @@ -442,7 +441,7 @@ public void testAddingExistingScenarios() throws Exception { Assert.assertNull(addedCarrier2.getAttributes().getAttribute("vehicleType")); Assert.assertEquals("testArea2_area3", addedCarrier2.getAttributes().getAttribute("tourStartArea")); - Carrier addedCarrier3 = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleShipmentCarrier_carrier1", Carrier.class)); + Carrier addedCarrier3 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleShipmentCarrier_carrier1", Carrier.class)); Assert.assertNull(addedCarrier3.getSelectedPlan()); Assert.assertEquals(50, CarrierUtils.getJspritIterations(addedCarrier3), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier3.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); @@ -473,12 +472,12 @@ public void testAddingExistingScenariosWithSample() throws Exception { SmallScaleCommercialTrafficUtils.readExistingModels(scenario, sample, regionLinksMap); - Assert.assertEquals(2, FreightUtils.getCarriers(scenario).getCarriers().size(), MatsimTestUtils.EPSILON); - Assert.assertEquals(1, FreightUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().size(), MatsimTestUtils.EPSILON); - Assert.assertTrue(FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier1", Carrier.class))); - Assert.assertTrue(FreightUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleShipmentCarrier_carrier1", Carrier.class))); + Assert.assertEquals(2, CarrierUtils.getCarriers(scenario).getCarriers().size(), MatsimTestUtils.EPSILON); + Assert.assertEquals(1, CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().size(), MatsimTestUtils.EPSILON); + Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier1", Carrier.class))); + Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleShipmentCarrier_carrier1", Carrier.class))); - Carrier addedCarrier1 = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier1", Carrier.class)); + Carrier addedCarrier1 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier1", Carrier.class)); Assert.assertNotNull(addedCarrier1.getSelectedPlan()); Assert.assertEquals(0, CarrierUtils.getJspritIterations(addedCarrier1), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier1.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); @@ -493,7 +492,7 @@ public void testAddingExistingScenariosWithSample() throws Exception { Assert.assertNull(addedCarrier1.getAttributes().getAttribute("vehicleType")); Assert.assertEquals("testArea2_area3", addedCarrier1.getAttributes().getAttribute("tourStartArea")); - Carrier addedCarrier3 = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleShipmentCarrier_carrier1", Carrier.class)); + Carrier addedCarrier3 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleShipmentCarrier_carrier1", Carrier.class)); Assert.assertNull(addedCarrier3.getSelectedPlan()); Assert.assertEquals(50, CarrierUtils.getJspritIterations(addedCarrier3), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier3.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java index 87977da1288..df7b4305658 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java @@ -27,10 +27,10 @@ import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; import org.matsim.contrib.drt.run.MultiModeDrtModule; import org.matsim.contrib.dvrp.run.DvrpModule; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCostsFactory; import org.matsim.freight.carriers.jsprit.VRPTransportCostsFactory; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.controler.AbstractModule; import org.matsim.core.replanning.PlanStrategy; @@ -92,7 +92,7 @@ private CarrierProvider() { } public Carriers get() { - return FreightUtils.getCarriers(this.scenario); + return CarrierUtils.getCarriers(this.scenario); } } diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java index 6c4da322185..54307fdb599 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java @@ -23,7 +23,7 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ScoringConfigGroup; @@ -78,9 +78,9 @@ public void run(URL configUrl){ prepareConfig(config); Scenario scenario = loadScenario(config); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use - //FreightUtils.getCarriers(scenario) and FreightUtils.getCarrierVehicleTypes(scenario) + //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) Controler controler = new Controler(scenario); controler.addOverridingModule(new JointDemandModule() ); diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java index dc8324f75ab..15055c3fdf8 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java @@ -26,7 +26,7 @@ import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandConfigGroup; import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandModule; import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ReplanningConfigGroup; @@ -80,9 +80,9 @@ public void run(URL configUrl){ prepareConfig(config); Scenario scenario = loadScenario(config); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use - //FreightUtils.getCarriers(scenario) and FreightUtils.getCarrierVehicleTypes(scenario) + //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) Controler controler = new Controler(scenario); controler.addOverridingModule(new JointDemandModule() ); diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java index dcb0cbb0cc3..52c79f771b2 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java @@ -37,7 +37,7 @@ import org.matsim.contrib.dvrp.run.DvrpConfigGroup; import org.matsim.contrib.dvrp.run.DvrpQSimComponents; import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ScoringConfigGroup; @@ -85,9 +85,9 @@ public void run(URL configURL){ Scenario scenario = DrtControlerCreator.createScenarioWithDrtRouteFactory(config); ScenarioUtils.loadScenario(scenario); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use - //FreightUtils.getCarriers(scenario) and FreightUtils.getCarrierVehicleTypes(scenario) + //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) Controler controler = new Controler(scenario); controler.addOverridingModule(new JointDemandModule()); diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java index 14880b6a7a5..32c99abac38 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java @@ -3,7 +3,7 @@ import org.junit.Test; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.Controler; @@ -21,7 +21,7 @@ public void runCommercialTrafficIT() { freightConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); freightConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); Scenario scenario = ScenarioUtils.loadScenario(config); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); Controler controler = new Controler(scenario); controler.addOverridingModule(new JointDemandModule()); controler.run(); diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java index 98d4b90baf6..3a829739ddc 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java @@ -29,7 +29,6 @@ import org.matsim.api.core.v01.population.PopulationFactory; import org.matsim.freight.carriers.FreightConfigGroup; import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.Controler; @@ -55,10 +54,10 @@ public void setUp() { freightConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); freightConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); scenario = ScenarioUtils.loadScenario(config); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //limit the fleet size of carrier pizza_1 so that it can handly only one order/job - FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("salamiPizza", Carrier.class)).getCarrierCapabilities().setFleetSize(CarrierCapabilities.FleetSize.FINITE); + CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("salamiPizza", Carrier.class)).getCarrierCapabilities().setFleetSize(CarrierCapabilities.FleetSize.FINITE); preparePopulation(scenario); @@ -107,7 +106,7 @@ public void testIfTheRightPersonIsScoredForReceivingAJob() { Plan nonCustomerPlan = scenario.getPopulation().getPersons().get(Id.createPersonId("nonCustomer")).getSelectedPlan(); //derive the service activity from the carrier plan and compare the service id (which should contain the customer id) with the person id of the expected customer - Carrier pizzaCarrier = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("salamiPizza", Carrier.class)); + Carrier pizzaCarrier = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("salamiPizza", Carrier.class)); ScheduledTour tour = (ScheduledTour) pizzaCarrier.getSelectedPlan().getScheduledTours().toArray()[0]; Id serviceActivity = tour.getTour().getTourElements().stream() .filter(tourElement -> tourElement instanceof Tour.ServiceActivity) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java index 77c1c43d2a0..3a4236e36a6 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java @@ -22,7 +22,6 @@ package org.matsim.freight.carriers.carrier; import org.matsim.api.core.v01.population.BasicPlan; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.utils.objectattributes.attributable.Attributable; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesImpl; @@ -84,7 +83,7 @@ public void setScore(Double score) { * @return score from jsprit. */ public Double getJspritScore(){ - return FreightUtils.getJspritScore(this); + return CarrierUtils.getJspritScore(this); } /** @@ -92,7 +91,7 @@ public Double getJspritScore(){ * This is _not_ the score from the MATSim simulation. */ public void setJspritScore(Double score){ - FreightUtils.setJspritScore(this, score); + CarrierUtils.setJspritScore(this, score); } public Collection getScheduledTours() { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java index 37aed64d38b..d298fa28881 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java @@ -21,19 +21,49 @@ package org.matsim.freight.carriers.carrier; +import com.graphhopper.jsprit.analysis.toolbox.StopWatch; +import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; +import com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; +import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import com.graphhopper.jsprit.core.util.Solutions; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; +import org.matsim.api.core.v01.network.Link; +import org.matsim.api.core.v01.population.Plan; +import org.matsim.core.config.ConfigUtils; +import org.matsim.core.utils.io.IOUtils; +import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; +import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; +import org.matsim.freight.carriers.jsprit.NetworkRouter; +import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.vehicles.Vehicle; +import org.matsim.vehicles.VehicleType; -import java.util.ArrayList; -import java.util.List; +import javax.management.InvalidAttributeValueException; +import java.util.*; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ForkJoinPool; +import java.util.stream.Collectors; public class CarrierUtils{ + static final String CARRIER_VEHICLE = "carrierVehicle"; @SuppressWarnings("unused") private static final Logger log = LogManager.getLogger(CarrierUtils.class); + /** + * From the outside, rather use {@link CarrierUtils#getCarriers(Scenario)} . + * This string constant will eventually become private. + */ + private static final String CARRIERS = "carriers"; + private static final String CARRIER_VEHICLE_TYPES = "carrierVehicleTypes"; + + private static final String ATTR_SKILLS = "skills"; + private static final String ATTR_JSPRIT_SCORE = "jspritScore"; public static Carrier createCarrier( Id id ){ return new CarrierImpl(id); @@ -139,4 +169,445 @@ public static void setJspritIterations( Carrier carrier, int jspritIterations ) } + /** + * Runs jsprit and so solves the VehicleRoutingProblem (VRP) for all {@link Carriers}, doing the following steps: + * - creating NetbasedCosts based on the network + * - building and solving the VRP for all carriers using jsprit + * - take the (best) solution, route and add it as {@link CarrierPlan} to the {@link Carrier}. + *

    + * + * @param scenario + * @throws ExecutionException, InterruptedException + */ + public static void runJsprit(Scenario scenario) throws ExecutionException, InterruptedException{ + FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( scenario.getConfig(), FreightConfigGroup.class ); + + final NetworkBasedTransportCosts netBasedCosts = NetworkBasedTransportCosts.Builder.newInstance( + scenario.getNetwork(), getCarrierVehicleTypes(scenario).getVehicleTypes().values() ).build() ; + + Carriers carriers = getCarriers(scenario); + + HashMap, Integer> carrierActivityCounterMap = new HashMap<>(); + + // Fill carrierActivityCounterMap -> basis for sorting the carriers by number of activities before solving in parallel + for (Carrier carrier : carriers.getCarriers().values()) { + carrierActivityCounterMap.put(carrier.getId(), carrierActivityCounterMap.getOrDefault(carrier.getId(), 0) + carrier.getServices().size()); + carrierActivityCounterMap.put(carrier.getId(), carrierActivityCounterMap.getOrDefault(carrier.getId(), 0) + carrier.getShipments().size()); + } + + HashMap, Integer> sortedMap = carrierActivityCounterMap.entrySet().stream() + .sorted(Collections.reverseOrder(Map.Entry.comparingByValue())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new)); + + ArrayList> tempList = new ArrayList<>(sortedMap.keySet()); + ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors()); + forkJoinPool.submit(() -> tempList.parallelStream().forEach(carrierId -> { + Carrier carrier = carriers.getCarriers().get(carrierId); + + double start = System.currentTimeMillis(); + int serviceCount = carrier.getServices().size(); + log.info("Start tour planning for " + carrier.getId() + " which has " + serviceCount + " services"); + + VehicleRoutingProblem problem = MatsimJspritFactory.createRoutingProblemBuilder(carrier, scenario.getNetwork()).setRoutingCost(netBasedCosts).build(); + VehicleRoutingAlgorithm algorithm = MatsimJspritFactory.loadOrCreateVehicleRoutingAlgorithm(scenario, freightConfigGroup, netBasedCosts, problem); + + algorithm.getAlgorithmListeners().addListener(new StopWatch(), VehicleRoutingAlgorithmListeners.Priority.HIGH); + int jspritIterations = getJspritIterations(carrier); + try { + if (jspritIterations > 0) { + algorithm.setMaxIterations(jspritIterations); + } else { + throw new InvalidAttributeValueException( + "Carrier has invalid number of jsprit iterations. They must be positive! Carrier id: " + + carrier.getId().toString());} + } catch (Exception e) { + throw new RuntimeException(e); +// e.printStackTrace(); + } + + VehicleRoutingProblemSolution solution = Solutions.bestOf(algorithm.searchSolutions()); + + log.info("tour planning for carrier " + carrier.getId() + " took " + (System.currentTimeMillis() - start) / 1000 + " seconds."); + + CarrierPlan newPlan = MatsimJspritFactory.createPlan(carrier, solution); + // yy In principle, the carrier should know the vehicle types that it can deploy. + + log.info("routing plan for carrier " + carrier.getId()); + NetworkRouter.routePlan(newPlan, netBasedCosts); + log.info("routing for carrier " + carrier.getId() + " finished. Tour planning plus routing took " + (System.currentTimeMillis() - start) / 1000 + " seconds."); + + carrier.setSelectedPlan(newPlan); + })).get(); + + } + + /** + * Creates a new {@link Carriers} container only with {@link CarrierShipment}s + * for creating a new VRP. As consequence of the transformation of + * {@link CarrierService}s to {@link CarrierShipment}s the solution of the VRP + * can have tours with vehicles returning to the depot and load for another tour + * instead of creating another vehicle with additional (fix) costs.
    + * The method is meant for multi-depot problems. Here, the original "services" + * input does not have an assignment of services to depots. The solution to the + * problem, however, does. So the assignment is taken from that solution, and + * each returned {@link Carrier} has that depot as pickup location in each + * shipment. + * + * @param carriers carriers with a Solution (result of solving the VRP). + * @return Carriers carriersWithShipments + */ + public static Carriers createShipmentVRPCarrierFromServiceVRPSolution(Carriers carriers) { + Carriers carriersWithShipments = new Carriers(); + for (Carrier carrier : carriers.getCarriers().values()) { + Carrier carrierWS = createCarrier(carrier.getId()); + if (carrier.getShipments().size() > 0) { + copyShipments(carrierWS, carrier); + } + if (carrier.getServices().size() > 0) { + createShipmentsFromServices(carrierWS, carrier); + } + carrierWS.setCarrierCapabilities(carrier.getCarrierCapabilities()); // vehicles and other carrierCapabilities + carriersWithShipments.addCarrier(carrierWS); + } + return carriersWithShipments; + } + + /** + * @deprecated -- please inline. Reason: move syntax closer to how it is done in {@link ConfigUtils}. + */ + @Deprecated + public static Carriers getOrCreateCarriers(Scenario scenario){ + return addOrGetCarriers( scenario ); + } + + public static Carriers addOrGetCarriers(Scenario scenario ) { + // I have separated getOrCreateCarriers and getCarriers, since when the + // controler is started, it is better to fail if the carriers are not found. + // kai, oct'19 + Carriers carriers = (Carriers) scenario.getScenarioElement(CARRIERS); + if (carriers == null) { + carriers = new Carriers(); + scenario.addScenarioElement(CARRIERS, carriers); + } + return carriers; + } + + public static Carriers getCarriers(Scenario scenario) { + // I have separated getOrCreateCarriers and getCarriers, since when the controler is started, it is better to fail if the carriers are + // not found. kai, oct'19 + if ( scenario.getScenarioElement( CARRIERS ) == null ) { + throw new RuntimeException( "cannot retrieve carriers from scenario; typical ways to resolve that problem are to call " + + "CarrierControlerUtils.getOrCreateCarriers(...) or CarrierControlerUtils.loadCarriersAccordingToFreightConfig(...) early enough\n") ; + } + return (Carriers) scenario.getScenarioElement(CARRIERS); + } + + public static CarrierVehicleTypes getCarrierVehicleTypes(Scenario scenario) { + CarrierVehicleTypes types = (CarrierVehicleTypes) scenario.getScenarioElement(CARRIER_VEHICLE_TYPES); + if (types == null) { + types = new CarrierVehicleTypes(); + scenario.addScenarioElement(CARRIER_VEHICLE_TYPES, types); + } + return types; + } + + /** + * Use if carriers and carrierVehicleTypes are set by input file + * + * @param scenario + */ + public static void loadCarriersAccordingToFreightConfig(Scenario scenario) { + FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), FreightConfigGroup.class); + + CarrierVehicleTypes vehTypes = getCarrierVehicleTypes(scenario); + new CarrierVehicleTypeReader( vehTypes ).readURL( IOUtils.extendUrl(scenario.getConfig().getContext(), freightConfigGroup.getCarriersVehicleTypesFile()) ); + + Carriers carriers = addOrGetCarriers( scenario ); // also registers with scenario + new CarrierPlanXmlReader( carriers, vehTypes ).readURL( IOUtils.extendUrl(scenario.getConfig().getContext(), freightConfigGroup.getCarriersFile() ) ); + +// new CarrierVehicleTypeLoader( carriers ).loadVehicleTypes( vehTypes ); + } + + /** + * Copy all shipments from the existing carrier to the new carrier with + * shipments. + * + * @param carrierWS the "new" carrier with Shipments + * @param carrier the already existing carrier + */ + private static void copyShipments(Carrier carrierWS, Carrier carrier) { + for (CarrierShipment carrierShipment : carrier.getShipments().values()) { + log.debug("Copy CarrierShipment: " + carrierShipment.toString()); + addShipment(carrierWS, carrierShipment); + } + } + + /** + * Transform all services from the existing carrier to the new carrier with + * shipments. The location of the depot from which the "old" carrier starts the + * tour to the service is used as fromLocation for the new Shipment. + * + * @param carrierWS the "new" carrier with Shipments + * @param carrier the already existing carrier + */ + private static void createShipmentsFromServices(Carrier carrierWS, Carrier carrier) { + TreeMap, Id> depotServiceIsDeliveredFrom = new TreeMap<>(); + try { + carrier.getSelectedPlan(); + } catch (Exception e) { + throw new RuntimeException("Carrier " + carrier.getId() + " has NO selectedPlan. --> CanNOT create a new carrier from solution"); + } + Collection tours; + try { + tours = carrier.getSelectedPlan().getScheduledTours(); + } catch (Exception e) { + throw new RuntimeException("Carrier " + carrier.getId() + " has NO ScheduledTours. --> CanNOT create a new carrier from solution"); + } + for (ScheduledTour tour : tours) { + Id depotForTour = tour.getVehicle().getLinkId(); + for (Tour.TourElement te : tour.getTour().getTourElements()) { + if (te instanceof Tour.ServiceActivity act) { + depotServiceIsDeliveredFrom.put(act.getService().getId(), depotForTour); + } + } + } + for (CarrierService carrierService : carrier.getServices().values()) { + log.debug("Converting CarrierService to CarrierShipment: " + carrierService.getId()); + CarrierShipment carrierShipment = CarrierShipment.Builder + .newInstance(Id.create(carrierService.getId().toString(), CarrierShipment.class), + depotServiceIsDeliveredFrom.get(carrierService.getId()), carrierService.getLocationLinkId(), + carrierService.getCapacityDemand()) + .setDeliveryServiceTime(carrierService.getServiceDuration()) + // .setPickupServiceTime(pickupServiceTime) //Not set yet, because in service we + // have now time for that. Maybe change it later, kmt sep18 + .setDeliveryTimeWindow(carrierService.getServiceStartTimeWindow()) + // Limited to end of delivery timeWindow (pickup later than the latest delivery is not useful). + .setPickupTimeWindow(TimeWindow.newInstance(0.0, carrierService.getServiceStartTimeWindow().getEnd())) + .build(); + addShipment(carrierWS, carrierShipment); + } + } + + /** + * Adds a skill to the vehicle's {@link org.matsim.vehicles.VehicleType}. + * + * @param vehicleType the vehicle type to change; + * @param skill the skill. + */ + public static void addSkill(VehicleType vehicleType, String skill) { + addSkill(vehicleType.getAttributes(), skill); + } + + /** + * Checks if a given skill is available in the given attributes. + * + * @param type the {@link VehicleType}; + * @param skill the free-form type skill. + * @return true if the skill is in the skill set; or + * false if the skill is not in the skill set, or there is + * no skill set available/set. + */ + public static boolean hasSkill(VehicleType type, String skill) { + return hasSkill(type.getAttributes(), skill); + } + + /** + * Sets the given skills as an attribute. If prior skills were set, they will be + * overwritten. + * + * @param type for which skills are set; + * @param skills that are converted to an attribute. + */ + public static void setSkills(VehicleType type, Set skills) { + setSkills(type.getAttributes(), skills); + } + + /** + * Get all the skills in the argument's {@link Attributes}. You should not try + * and modify the returned list. If you want to add a skill, use the method + * {@link #addSkill(VehicleType, String)}. + * + * @param type for which skills are sought; + * @return an unmodifiable {@link List} of the skills. + */ + public static List getSkills(VehicleType type) { + return Collections.unmodifiableList(convertSkillsAttributeToList(type.getAttributes())); + } + + /** + * Adds a skill to the {@link com.graphhopper.jsprit.core.problem.job.Shipment}. + * + * @param shipment the vehicle type to change; + * @param skill the skill. + */ + public static void addSkill(CarrierShipment shipment, String skill) { + addSkill(shipment.getAttributes(), skill); + } + + /** + * Checks if a given skill is available in the given attributes. + * + * @param shipment the {@link CarrierShipment}; + * @param skill the free-form type skill. + * @return true if the skill is in the skill set; or + * false if the skill is not in the skill set, or there is + * no skill set available/set. + */ + public static boolean hasSkill(CarrierShipment shipment, String skill) { + return hasSkill(shipment.getAttributes(), skill); + } + + /** + * Sets the given skills as an attribute. If prior skills were set, they will be + * overwritten. + * + * @param shipment for which skills are set; + * @param skills that are converted to an attribute. + */ + public static void setSkills(CarrierShipment shipment, Set skills) { + setSkills(shipment.getAttributes(), skills); + } + + /** + * Get all the skills in the argument's {@link Attributes}. You should not try + * and modify the returned list. If you want to add a skill, use the method + * {@link #addSkill(CarrierShipment, String)}. + * + * @param shipment for which skills are sought; + * @return an unmodifiable {@link List} of the skills. + */ + public static List getSkills(CarrierShipment shipment) { + return Collections.unmodifiableList(convertSkillsAttributeToList(shipment.getAttributes())); + } + + /** + * Adds a skill to the {@link CarrierService}. + * + * @param service the vehicle type to change; + * @param skill the skill. + */ + public static void addSkill(CarrierService service, String skill) { + addSkill(service.getAttributes(), skill); + } + + /** + * Checks if a given skill is available in the given attributes. + * + * @param service the {@link CarrierService}; + * @param skill the free-form type skill. + * @return true if the skill is in the skill set; or + * false if the skill is not in the skill set, or there is + * no skill set available/set. + */ + public static boolean hasSkill(CarrierService service, String skill) { + return hasSkill(service.getAttributes(), skill); + } + + /** + * Sets the given skills as an attribute. If prior skills were set, they will be + * overwritten. + * + * @param service for which skills are set; + * @param skills that are converted to an attribute. + */ + public static void setSkills(CarrierService service, Set skills) { + setSkills(service.getAttributes(), skills); + } + + /** + * Get all the skills in the argument's {@link Attributes}. You should not try + * and modify the returned list. If you want to add a skill, use the method + * {@link #addSkill(CarrierService, String)}. + * + * @param service for which skills are sought; + * @return an unmodifiable {@link List} of the skills. + */ + public static List getSkills(CarrierService service) { + return Collections.unmodifiableList(convertSkillsAttributeToList(service.getAttributes())); + } + + /** + * A general method to add a skill to any {@link Attributes} object. + * + * @param attributes where skill is added, if it doesn't already exist; + * @param skill to be added. + */ + private static void addSkill(Attributes attributes, String skill) { + List skills = convertSkillsAttributeToList(attributes); + if (!skills.contains(skill)) { + String skillString; + if (skills.size() == 0) { + skillString = skill; + } else { + skillString = attributes.getAttribute(ATTR_SKILLS) + "," + skill; + } + attributes.putAttribute(ATTR_SKILLS, skillString); + } + } + + /** + * Checks if a given skill is available in the given attributes. + * + * @param attributes the {@link Attributes} container to check for the skill; + * @param skill the free-form type skill. + * @return true if the skill is in the skill set; or + * false if the skill is not in the skill set, or there is + * no skill set available/set. + */ + private static boolean hasSkill(Attributes attributes, String skill) { + if (attributes.getAttribute(ATTR_SKILLS) == null) { + return false; + } + List skills = convertSkillsAttributeToList(attributes); + return skills.contains(skill); + } + + /** + * Converts the 'skills' attribute to a list of strings. + * + * @param attributes the {@link Attributes} container that is checked for the + * skill(s) to be converted. + * @return the {@link List} of skills, possibly empty, as parsed from the + * attribute. + */ + private static List convertSkillsAttributeToList(Attributes attributes) { + if (attributes.getAttribute(ATTR_SKILLS) == null) { + return new ArrayList<>(); + } else { + return Arrays.asList(Objects.requireNonNull(attributes.getAttribute(ATTR_SKILLS)).toString().split(",")); + } + } + + private static void setSkills(Attributes attributes, Set skills) { + if (skills.size() != 0) { + Iterator skillIterator = skills.iterator(); + StringBuilder skillString = new StringBuilder(skillIterator.next()); + while (skillIterator.hasNext()) { + skillString.append(","); + skillString.append(skillIterator.next()); + } + attributes.putAttribute(ATTR_SKILLS, skillString.toString()); + } + } + + public static Vehicle getVehicle(Plan plan ) { + return (Vehicle) plan.getAttributes().getAttribute( CARRIER_VEHICLE ); + } + + public static void putVehicle(Plan plan, Vehicle vehicle ){ + plan.getAttributes().putAttribute( CARRIER_VEHICLE, vehicle ); + } + + public static void setJspritScore(CarrierPlan plan, Double jspritScore){ + plan.getAttributes().putAttribute(ATTR_JSPRIT_SCORE, jspritScore); + } + + public static Double getJspritScore (CarrierPlan plan) { + return (Double) plan.getAttributes().getAttribute(ATTR_JSPRIT_SCORE); + } + + public static void writeCarriers(Carriers carriers, String filename ) { + new CarrierPlanWriter( carriers ).write( filename ); + } + } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java index ebb5c165865..911a6544c8e 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java @@ -136,7 +136,7 @@ List createFreightDriverPlans() { plan.addActivity(endActivity); driverPerson.addPlan(plan); plan.setPerson(driverPerson); - FreightUtils.putVehicle( plan, vehicle ); + CarrierUtils.putVehicle( plan, vehicle ); routes.add(plan); carrierDriverAgents.put(driverId, carrierDriverAgent); } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java index 156c3fe4fe2..0d4e59ed8f8 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java @@ -29,6 +29,7 @@ import org.matsim.core.controler.events.ScoringEvent; import org.matsim.core.controler.listener.ReplanningListener; import org.matsim.core.controler.listener.ScoringListener; +import org.matsim.freight.carriers.carrier.CarrierUtils; import javax.annotation.Nullable; @@ -77,7 +78,7 @@ public class CarrierControlerListener implements ScoringListener, ReplanningList if ( strategyManager==null ) { throw new RuntimeException( "You need to set CarrierStrategyManager to something meaningful to run iterations." ); } - strategyManager.run( FreightUtils.getCarriers( scenario ).getCarriers().values() , event.getIteration(), event.getReplanningContext() ); + strategyManager.run( CarrierUtils.getCarriers( scenario ).getCarriers().values() , event.getIteration(), event.getReplanningContext() ); } } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerUtils.java new file mode 100644 index 00000000000..26da0775b19 --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerUtils.java @@ -0,0 +1,36 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.controler; + +/** + * Utils for the work with the freight contrib + * + * @author kturner + * + */ +public class CarrierControlerUtils { + + + public static CarrierStrategyManager createDefaultCarrierStrategyManager() { + return new CarrierStrategyManagerImpl(); + } +} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java index 4ed43f82baa..f70f0ed7529 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java @@ -98,7 +98,7 @@ public final class CarrierModule extends AbstractModule { bind( CarrierStrategyManager.class ).toProvider( () -> null ); // (the null binding means that a zeroth iteration will run. kai, jul'22) - this.addControlerListenerBinding().toInstance((ShutdownListener) event -> writeAdditionalRunOutput( event.getServices().getControlerIO(), event.getServices().getConfig(), FreightUtils.getCarriers( event.getServices().getScenario() ) )); + this.addControlerListenerBinding().toInstance((ShutdownListener) event -> writeAdditionalRunOutput( event.getServices().getControlerIO(), event.getServices().getConfig(), CarrierUtils.getCarriers( event.getServices().getScenario() ) )); } @@ -146,7 +146,7 @@ private static void writeAdditionalRunOutput( OutputDirectoryHierarchy controlle private static class CarrierProvider implements Provider { @Inject Scenario scenario; @Override public Carriers get() { - return FreightUtils.getCarriers(scenario); + return CarrierUtils.getCarriers(scenario); } } } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java index 02da4e926b6..e1aaa651b49 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java @@ -31,6 +31,7 @@ import org.matsim.core.mobsim.qsim.QSim; import org.matsim.core.mobsim.qsim.agents.AgentFactory; import org.matsim.core.mobsim.qsim.qnetsimengine.QVehicleImpl; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleUtils; @@ -72,14 +73,14 @@ public final class FreightAgentSource implements AgentSource { MobsimAgent agent = this.agentFactory.createMobsimAgentFromPerson( freightDriverPlan.getPerson() ); Vehicle vehicle; - if( FreightUtils.getVehicle( freightDriverPlan ) == null ){ + if( CarrierUtils.getVehicle( freightDriverPlan ) == null ){ vehicle = VehicleUtils.getFactory().createVehicle( Id.create( agent.getId(), Vehicle.class ), VehicleUtils.getDefaultVehicleType() ); log.warn( "vehicle for agent " + freightDriverPlan.getPerson().getId() + " is missing. set default vehicle where maxVelocity is solely defined by link.speed." ); - } else if( FreightUtils.getVehicle( freightDriverPlan ).getType() == null ){ + } else if( CarrierUtils.getVehicle( freightDriverPlan ).getType() == null ){ vehicle = VehicleUtils.getFactory().createVehicle( Id.create( agent.getId(), Vehicle.class ), VehicleUtils.getDefaultVehicleType() ); log.warn( "vehicleType for agent " + freightDriverPlan.getPerson().getId() + " is missing. set default vehicleType where maxVelocity is solely defined by link.speed." ); } else { - vehicle = FreightUtils.getVehicle( freightDriverPlan ); + vehicle = CarrierUtils.getVehicle( freightDriverPlan ); } log.warn( "inserting vehicleId=" + vehicle.getId() + " into mobsim." ); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightUtils.java deleted file mode 100644 index 10e0b481547..00000000000 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightUtils.java +++ /dev/null @@ -1,521 +0,0 @@ -/* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** - * - */ - -package org.matsim.freight.carriers.controler; - -import com.graphhopper.jsprit.analysis.toolbox.StopWatch; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.util.Solutions; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.matsim.api.core.v01.Id; -import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.network.Link; -import org.matsim.api.core.v01.population.Plan; -import org.matsim.core.config.ConfigUtils; -import org.matsim.core.utils.io.IOUtils; -import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; -import org.matsim.freight.carriers.carrier.Tour.TourElement; -import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; -import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; -import org.matsim.freight.carriers.jsprit.NetworkRouter; -import org.matsim.utils.objectattributes.attributable.Attributes; -import org.matsim.vehicles.Vehicle; -import org.matsim.vehicles.VehicleType; - -import javax.management.InvalidAttributeValueException; -import java.util.*; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; -import java.util.stream.Collectors; - -/** - * Utils for the work with the freight contrib - * - * @author kturner - * - */ -public class FreightUtils { - - static final String CARRIER_VEHICLE = "carrierVehicle"; - /** - * From the outside, rather use {@link FreightUtils#getCarriers(Scenario)} . - * This string constant will eventually become private. - */ - private static final String CARRIERS = "carriers"; - private static final String CARRIER_VEHICLE_TYPES = "carrierVehicleTypes"; - private static final Logger log = LogManager.getLogger(FreightUtils.class); - - private static final String ATTR_SKILLS = "skills"; - private static final String ATTR_JSPRIT_SCORE = "jspritScore"; - - /** - * Runs jsprit and so solves the VehicleRoutingProblem (VRP) for all {@link Carriers}, doing the following steps: - * - creating NetbasedCosts based on the network - * - building and solving the VRP for all carriers using jsprit - * - take the (best) solution, route and add it as {@link CarrierPlan} to the {@link Carrier}. - *

    - * - * @param scenario - * @throws ExecutionException, InterruptedException - */ - public static void runJsprit(Scenario scenario) throws ExecutionException, InterruptedException{ - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( scenario.getConfig(), FreightConfigGroup.class ); - - final NetworkBasedTransportCosts netBasedCosts = NetworkBasedTransportCosts.Builder.newInstance( - scenario.getNetwork(), FreightUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().values() ).build() ; - - Carriers carriers = FreightUtils.getCarriers(scenario); - - HashMap, Integer> carrierActivityCounterMap = new HashMap<>(); - - // Fill carrierActivityCounterMap -> basis for sorting the carriers by number of activities before solving in parallel - for (Carrier carrier : carriers.getCarriers().values()) { - carrierActivityCounterMap.put(carrier.getId(), carrierActivityCounterMap.getOrDefault(carrier.getId(), 0) + carrier.getServices().size()); - carrierActivityCounterMap.put(carrier.getId(), carrierActivityCounterMap.getOrDefault(carrier.getId(), 0) + carrier.getShipments().size()); - } - - HashMap, Integer> sortedMap = carrierActivityCounterMap.entrySet().stream() - .sorted(Collections.reverseOrder(Map.Entry.comparingByValue())) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new)); - - ArrayList> tempList = new ArrayList<>(sortedMap.keySet()); - ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors()); - forkJoinPool.submit(() -> tempList.parallelStream().forEach(carrierId -> { - Carrier carrier = carriers.getCarriers().get(carrierId); - - double start = System.currentTimeMillis(); - int serviceCount = carrier.getServices().size(); - log.info("Start tour planning for " + carrier.getId() + " which has " + serviceCount + " services"); - - VehicleRoutingProblem problem = MatsimJspritFactory.createRoutingProblemBuilder(carrier, scenario.getNetwork()).setRoutingCost(netBasedCosts).build(); - VehicleRoutingAlgorithm algorithm = MatsimJspritFactory.loadOrCreateVehicleRoutingAlgorithm(scenario, freightConfigGroup, netBasedCosts, problem); - - algorithm.getAlgorithmListeners().addListener(new StopWatch(), VehicleRoutingAlgorithmListeners.Priority.HIGH); - int jspritIterations = CarrierUtils.getJspritIterations(carrier); - try { - if (jspritIterations > 0) { - algorithm.setMaxIterations(jspritIterations); - } else { - throw new InvalidAttributeValueException( - "Carrier has invalid number of jsprit iterations. They must be positive! Carrier id: " - + carrier.getId().toString());} - } catch (Exception e) { - throw new RuntimeException(e); -// e.printStackTrace(); - } - - VehicleRoutingProblemSolution solution = Solutions.bestOf(algorithm.searchSolutions()); - - log.info("tour planning for carrier " + carrier.getId() + " took " + (System.currentTimeMillis() - start) / 1000 + " seconds."); - - CarrierPlan newPlan = MatsimJspritFactory.createPlan(carrier, solution); - // yy In principle, the carrier should know the vehicle types that it can deploy. - - log.info("routing plan for carrier " + carrier.getId()); - NetworkRouter.routePlan(newPlan, netBasedCosts); - log.info("routing for carrier " + carrier.getId() + " finished. Tour planning plus routing took " + (System.currentTimeMillis() - start) / 1000 + " seconds."); - - carrier.setSelectedPlan(newPlan); - })).get(); - - } - - /** - * Creates a new {@link Carriers} container only with {@link CarrierShipment}s - * for creating a new VRP. As consequence of the transformation of - * {@link CarrierService}s to {@link CarrierShipment}s the solution of the VRP - * can have tours with vehicles returning to the depot and load for another tour - * instead of creating another vehicle with additional (fix) costs.
    - * The method is meant for multi-depot problems. Here, the original "services" - * input does not have an assignment of services to depots. The solution to the - * problem, however, does. So the assignment is taken from that solution, and - * each returned {@link Carrier} has that depot as pickup location in each - * shipment. - * - * @param carriers carriers with a Solution (result of solving the VRP). - * @return Carriers carriersWithShipments - */ - public static Carriers createShipmentVRPCarrierFromServiceVRPSolution(Carriers carriers) { - Carriers carriersWithShipments = new Carriers(); - for (Carrier carrier : carriers.getCarriers().values()) { - Carrier carrierWS = CarrierUtils.createCarrier(carrier.getId()); - if (carrier.getShipments().size() > 0) { - copyShipments(carrierWS, carrier); - } - if (carrier.getServices().size() > 0) { - createShipmentsFromServices(carrierWS, carrier); - } - carrierWS.setCarrierCapabilities(carrier.getCarrierCapabilities()); // vehicles and other carrierCapabilities - carriersWithShipments.addCarrier(carrierWS); - } - return carriersWithShipments; - } - - /** - * @deprecated -- please inline. Reason: move syntax closer to how it is done in {@link ConfigUtils}. - */ - @Deprecated - public static Carriers getOrCreateCarriers(Scenario scenario){ - return addOrGetCarriers( scenario ); - } - - public static Carriers addOrGetCarriers( Scenario scenario ) { - // I have separated getOrCreateCarriers and getCarriers, since when the - // controler is started, it is better to fail if the carriers are not found. - // kai, oct'19 - Carriers carriers = (Carriers) scenario.getScenarioElement(CARRIERS); - if (carriers == null) { - carriers = new Carriers(); - scenario.addScenarioElement(CARRIERS, carriers); - } - return carriers; - } - - public static Carriers getCarriers(Scenario scenario) { - // I have separated getOrCreateCarriers and getCarriers, since when the controler is started, it is better to fail if the carriers are - // not found. kai, oct'19 - if ( scenario.getScenarioElement( CARRIERS ) == null ) { - throw new RuntimeException( "cannot retrieve carriers from scenario; typical ways to resolve that problem are to call " + - "FreightUtils.getOrCreateCarriers(...) or FreightUtils.loadCarriersAccordingToFreightConfig(...) early enough\n") ; - } - return (Carriers) scenario.getScenarioElement(CARRIERS); - } - - public static CarrierVehicleTypes getCarrierVehicleTypes(Scenario scenario) { - CarrierVehicleTypes types = (CarrierVehicleTypes) scenario.getScenarioElement(CARRIER_VEHICLE_TYPES); - if (types == null) { - types = new CarrierVehicleTypes(); - scenario.addScenarioElement(CARRIER_VEHICLE_TYPES, types); - } - return types; - } - - /** - * Use if carriers and carrierVehicleTypes are set by input file - * - * @param scenario - */ - public static void loadCarriersAccordingToFreightConfig(Scenario scenario) { - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), FreightConfigGroup.class); - - CarrierVehicleTypes vehTypes = getCarrierVehicleTypes(scenario); - new CarrierVehicleTypeReader( vehTypes ).readURL( IOUtils.extendUrl(scenario.getConfig().getContext(), freightConfigGroup.getCarriersVehicleTypesFile()) ); - - Carriers carriers = addOrGetCarriers( scenario ); // also registers with scenario - new CarrierPlanXmlReader( carriers, vehTypes ).readURL( IOUtils.extendUrl(scenario.getConfig().getContext(), freightConfigGroup.getCarriersFile() ) ); - -// new CarrierVehicleTypeLoader( carriers ).loadVehicleTypes( vehTypes ); - } - - - /** - * Copy all shipments from the existing carrier to the new carrier with - * shipments. - * - * @param carrierWS the "new" carrier with Shipments - * @param carrier the already existing carrier - */ - private static void copyShipments(Carrier carrierWS, Carrier carrier) { - for (CarrierShipment carrierShipment : carrier.getShipments().values()) { - log.debug("Copy CarrierShipment: " + carrierShipment.toString()); - CarrierUtils.addShipment(carrierWS, carrierShipment); - } - } - - /** - * Transform all services from the existing carrier to the new carrier with - * shipments. The location of the depot from which the "old" carrier starts the - * tour to the service is used as fromLocation for the new Shipment. - * - * @param carrierWS the "new" carrier with Shipments - * @param carrier the already existing carrier - */ - private static void createShipmentsFromServices(Carrier carrierWS, Carrier carrier) { - TreeMap, Id> depotServiceIsDeliveredFrom = new TreeMap<>(); - try { - carrier.getSelectedPlan(); - } catch (Exception e) { - throw new RuntimeException("Carrier " + carrier.getId() + " has NO selectedPlan. --> CanNOT create a new carrier from solution"); - } - Collection tours; - try { - tours = carrier.getSelectedPlan().getScheduledTours(); - } catch (Exception e) { - throw new RuntimeException("Carrier " + carrier.getId() + " has NO ScheduledTours. --> CanNOT create a new carrier from solution"); - } - for (ScheduledTour tour : tours) { - Id depotForTour = tour.getVehicle().getLinkId(); - for (TourElement te : tour.getTour().getTourElements()) { - if (te instanceof ServiceActivity act) { - depotServiceIsDeliveredFrom.put(act.getService().getId(), depotForTour); - } - } - } - for (CarrierService carrierService : carrier.getServices().values()) { - log.debug("Converting CarrierService to CarrierShipment: " + carrierService.getId()); - CarrierShipment carrierShipment = CarrierShipment.Builder - .newInstance(Id.create(carrierService.getId().toString(), CarrierShipment.class), - depotServiceIsDeliveredFrom.get(carrierService.getId()), carrierService.getLocationLinkId(), - carrierService.getCapacityDemand()) - .setDeliveryServiceTime(carrierService.getServiceDuration()) - // .setPickupServiceTime(pickupServiceTime) //Not set yet, because in service we - // have now time for that. Maybe change it later, kmt sep18 - .setDeliveryTimeWindow(carrierService.getServiceStartTimeWindow()) - // Limited to end of delivery timeWindow (pickup later than the latest delivery is not useful). - .setPickupTimeWindow(TimeWindow.newInstance(0.0, carrierService.getServiceStartTimeWindow().getEnd())) - .build(); - CarrierUtils.addShipment(carrierWS, carrierShipment); - } - } - - /** - * Adds a skill to the vehicle's {@link org.matsim.vehicles.VehicleType}. - * - * @param vehicleType the vehicle type to change; - * @param skill the skill. - */ - public static void addSkill(VehicleType vehicleType, String skill) { - addSkill(vehicleType.getAttributes(), skill); - } - - /** - * Checks if a given skill is available in the given attributes. - * - * @param type the {@link VehicleType}; - * @param skill the free-form type skill. - * @return true if the skill is in the skill set; or - * false if the skill is not in the skill set, or there is - * no skill set available/set. - */ - public static boolean hasSkill(VehicleType type, String skill) { - return hasSkill(type.getAttributes(), skill); - } - - /** - * Sets the given skills as an attribute. If prior skills were set, they will be - * overwritten. - * - * @param type for which skills are set; - * @param skills that are converted to an attribute. - */ - public static void setSkills(VehicleType type, Set skills) { - setSkills(type.getAttributes(), skills); - } - - /** - * Get all the skills in the argument's {@link Attributes}. You should not try - * and modify the returned list. If you want to add a skill, use the method - * {@link #addSkill(VehicleType, String)}. - * - * @param type for which skills are sought; - * @return an unmodifiable {@link List} of the skills. - */ - public static List getSkills(VehicleType type) { - return Collections.unmodifiableList(convertSkillsAttributeToList(type.getAttributes())); - } - - /** - * Adds a skill to the {@link com.graphhopper.jsprit.core.problem.job.Shipment}. - * - * @param shipment the vehicle type to change; - * @param skill the skill. - */ - public static void addSkill(CarrierShipment shipment, String skill) { - addSkill(shipment.getAttributes(), skill); - } - - /** - * Checks if a given skill is available in the given attributes. - * - * @param shipment the {@link CarrierShipment}; - * @param skill the free-form type skill. - * @return true if the skill is in the skill set; or - * false if the skill is not in the skill set, or there is - * no skill set available/set. - */ - public static boolean hasSkill(CarrierShipment shipment, String skill) { - return hasSkill(shipment.getAttributes(), skill); - } - - /** - * Sets the given skills as an attribute. If prior skills were set, they will be - * overwritten. - * - * @param shipment for which skills are set; - * @param skills that are converted to an attribute. - */ - public static void setSkills(CarrierShipment shipment, Set skills) { - setSkills(shipment.getAttributes(), skills); - } - - /** - * Get all the skills in the argument's {@link Attributes}. You should not try - * and modify the returned list. If you want to add a skill, use the method - * {@link #addSkill(CarrierShipment, String)}. - * - * @param shipment for which skills are sought; - * @return an unmodifiable {@link List} of the skills. - */ - public static List getSkills(CarrierShipment shipment) { - return Collections.unmodifiableList(convertSkillsAttributeToList(shipment.getAttributes())); - } - - - /** - * Adds a skill to the {@link CarrierService}. - * - * @param service the vehicle type to change; - * @param skill the skill. - */ - public static void addSkill(CarrierService service, String skill) { - addSkill(service.getAttributes(), skill); - } - - /** - * Checks if a given skill is available in the given attributes. - * - * @param service the {@link CarrierService}; - * @param skill the free-form type skill. - * @return true if the skill is in the skill set; or - * false if the skill is not in the skill set, or there is - * no skill set available/set. - */ - public static boolean hasSkill(CarrierService service, String skill) { - return hasSkill(service.getAttributes(), skill); - } - - /** - * Sets the given skills as an attribute. If prior skills were set, they will be - * overwritten. - * - * @param service for which skills are set; - * @param skills that are converted to an attribute. - */ - public static void setSkills(CarrierService service, Set skills) { - setSkills(service.getAttributes(), skills); - } - - /** - * Get all the skills in the argument's {@link Attributes}. You should not try - * and modify the returned list. If you want to add a skill, use the method - * {@link #addSkill(CarrierService, String)}. - * - * @param service for which skills are sought; - * @return an unmodifiable {@link List} of the skills. - */ - public static List getSkills(CarrierService service) { - return Collections.unmodifiableList(convertSkillsAttributeToList(service.getAttributes())); - } - - - - /** - * A general method to add a skill to any {@link Attributes} object. - * - * @param attributes where skill is added, if it doesn't already exist; - * @param skill to be added. - */ - private static void addSkill(Attributes attributes, String skill) { - List skills = convertSkillsAttributeToList(attributes); - if (!skills.contains(skill)) { - String skillString; - if (skills.size() == 0) { - skillString = skill; - } else { - skillString = attributes.getAttribute(ATTR_SKILLS) + "," + skill; - } - attributes.putAttribute(ATTR_SKILLS, skillString); - } - } - - /** - * Checks if a given skill is available in the given attributes. - * - * @param attributes the {@link Attributes} container to check for the skill; - * @param skill the free-form type skill. - * @return true if the skill is in the skill set; or - * false if the skill is not in the skill set, or there is - * no skill set available/set. - */ - private static boolean hasSkill(Attributes attributes, String skill) { - if (attributes.getAttribute(ATTR_SKILLS) == null) { - return false; - } - List skills = convertSkillsAttributeToList(attributes); - return skills.contains(skill); - } - - /** - * Converts the 'skills' attribute to a list of strings. - * - * @param attributes the {@link Attributes} container that is checked for the - * skill(s) to be converted. - * @return the {@link List} of skills, possibly empty, as parsed from the - * attribute. - */ - private static List convertSkillsAttributeToList(Attributes attributes) { - if (attributes.getAttribute(ATTR_SKILLS) == null) { - return new ArrayList<>(); - } else { - return Arrays.asList(Objects.requireNonNull(attributes.getAttribute(ATTR_SKILLS)).toString().split(",")); - } - } - - private static void setSkills(Attributes attributes, Set skills) { - if (skills.size() != 0) { - Iterator skillIterator = skills.iterator(); - StringBuilder skillString = new StringBuilder(skillIterator.next()); - while (skillIterator.hasNext()) { - skillString.append(","); - skillString.append(skillIterator.next()); - } - attributes.putAttribute(ATTR_SKILLS, skillString.toString()); - } - } - public static Vehicle getVehicle( Plan plan ) { - return (Vehicle) plan.getAttributes().getAttribute( CARRIER_VEHICLE ); - } - public static void putVehicle( Plan plan, Vehicle vehicle ){ - plan.getAttributes().putAttribute( CARRIER_VEHICLE, vehicle ); - } - - public static void setJspritScore(CarrierPlan plan, Double jspritScore){ - plan.getAttributes().putAttribute(ATTR_JSPRIT_SCORE, jspritScore); - } - - public static Double getJspritScore (CarrierPlan plan) { - return (Double) plan.getAttributes().getAttribute(ATTR_JSPRIT_SCORE); - } - - public static void writeCarriers( Carriers carriers, String filename ) { - new CarrierPlanWriter( carriers ).write( filename ); - } - - public static CarrierStrategyManager createDefaultCarrierStrategyManager() { - return new CarrierStrategyManagerImpl(); - } -} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java index 62e9e395601..90220dc3cba 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java @@ -54,7 +54,6 @@ import org.matsim.core.utils.io.IOUtils; import org.matsim.freight.carriers.FreightConfigGroup; import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -97,7 +96,7 @@ static CarrierShipment createCarrierShipment(Shipment jspritShipment) { .setPickupTimeWindow(org.matsim.freight.carriers.carrier.TimeWindow.newInstance(jspritShipment.getPickupTimeWindow().getStart(), jspritShipment.getPickupTimeWindow().getEnd())) .build(); - FreightUtils.setSkills(carrierShipment, jspritShipment.getRequiredSkills().values()); + CarrierUtils.setSkills(carrierShipment, jspritShipment.getRequiredSkills().values()); return carrierShipment; } @@ -121,7 +120,7 @@ static Shipment createJspritShipment(CarrierShipment carrierShipment) { carrierShipment.getPickupTimeWindow().getStart(), carrierShipment.getPickupTimeWindow().getEnd())) .addSizeDimension(0, carrierShipment.getSize()); - for (String skill : FreightUtils.getSkills(carrierShipment)) { + for (String skill : CarrierUtils.getSkills(carrierShipment)) { shipmentBuilder.addRequiredSkill(skill); } return shipmentBuilder.build(); @@ -152,7 +151,7 @@ static Shipment createJspritShipment(CarrierShipment carrierShipment, Coord from carrierShipment.getPickupTimeWindow().getStart(), carrierShipment.getPickupTimeWindow().getEnd())) .addSizeDimension(0, carrierShipment.getSize()); - for (String skill : FreightUtils.getSkills(carrierShipment)) { + for (String skill : CarrierUtils.getSkills(carrierShipment)) { shipmentBuilder.addRequiredSkill(skill); } return shipmentBuilder.build(); @@ -172,7 +171,7 @@ static Service createJspritService(CarrierService carrierService, Coord location .setTimeWindow(com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow.newInstance( carrierService.getServiceStartTimeWindow().getStart(), carrierService.getServiceStartTimeWindow().getEnd())); - for (String skill : FreightUtils.getSkills(carrierService)) { + for (String skill : CarrierUtils.getSkills(carrierService)) { serviceBuilder.addRequiredSkill(skill); } return serviceBuilder.build(); @@ -191,7 +190,7 @@ static CarrierService createCarrierService(Service jspritService) { serviceBuilder.setServiceStartTimeWindow( org.matsim.freight.carriers.carrier.TimeWindow.newInstance(jspritService.getTimeWindow().getStart(), jspritService.getTimeWindow().getEnd())); CarrierService carrierService = serviceBuilder.build(); - FreightUtils.setSkills(carrierService, jspritService.getRequiredSkills().values()); + CarrierUtils.setSkills(carrierService, jspritService.getRequiredSkills().values()); return carrierService; } @@ -216,7 +215,7 @@ static com.graphhopper.jsprit.core.problem.vehicle.Vehicle createJspritVehicle(C vehicleBuilder.setEarliestStart(carrierVehicle.getEarliestStartTime()) .setLatestArrival(carrierVehicle.getLatestEndTime()).setStartLocation(vehicleLocation) .setType(vehicleType); - for (String skill : FreightUtils.getSkills(carrierVehicle.getType())) { + for (String skill : CarrierUtils.getSkills(carrierVehicle.getType())) { vehicleBuilder.addSkill(skill); } @@ -261,7 +260,7 @@ static CarrierVehicle createCarrierVehicle(com.graphhopper.jsprit.core.problem.v CarrierVehicle carrierVehicle = carrierVehicleBuilder.build(); for (String skill : jspritVehicle.getSkills().values()) { - FreightUtils.addSkill(carrierVehicle.getType(), skill); + CarrierUtils.addSkill(carrierVehicle.getType(), skill); } if (jspritVehicle.getEarliestDeparture() != carrierVehicle.getEarliestStartTime()) @@ -754,7 +753,7 @@ public static VehicleRoutingAlgorithm loadOrCreateVehicleRoutingAlgorithm(Scenar ConstraintManager constraintManager = new ConstraintManager(problem, stateManager); constraintManager.addConstraint( new DistanceConstraint( - FreightUtils.getCarrierVehicleTypes(scenario), netBasedCosts), + CarrierUtils.getCarrierVehicleTypes(scenario), netBasedCosts), ConstraintManager.Priority.CRITICAL); AlgorithmConfig algorithmConfig = new AlgorithmConfig(); AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig); @@ -778,7 +777,7 @@ public static VehicleRoutingAlgorithm loadOrCreateVehicleRoutingAlgorithm(Scenar ConstraintManager constraintManager = new ConstraintManager(problem, stateManager); constraintManager.addConstraint( new DistanceConstraint( - FreightUtils.getCarrierVehicleTypes(scenario), netBasedCosts), + CarrierUtils.getCarrierVehicleTypes(scenario), netBasedCosts), ConstraintManager.Priority.CRITICAL); algorithm = Jsprit.Builder.newInstance(problem) .setStateAndConstraintManager(stateManager, constraintManager).buildAlgorithm(); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java index 9409ebfea27..a610bea12fc 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java @@ -70,10 +70,10 @@ public static void main(String[] args){ freightConfigGroup.setCarriersVehicleTypesFile("vehicleTypes.xml"); Scenario scenario = ScenarioUtils.loadScenario( config ) ; - FreightUtils.loadCarriersAccordingToFreightConfig( scenario ); + CarrierUtils.loadCarriersAccordingToFreightConfig( scenario ); - Carriers carriers = FreightUtils.addOrGetCarriers( scenario ); - CarrierVehicleTypes types = FreightUtils.getCarrierVehicleTypes( scenario ); + Carriers carriers = CarrierUtils.addOrGetCarriers( scenario ); + CarrierVehicleTypes types = CarrierUtils.getCarrierVehicleTypes( scenario ); Controler controler = new Controler( scenario); @@ -140,7 +140,7 @@ private static class MyCarrierPlanStrategyManagerProvider implements Provider strategy = new GenericPlanStrategyImpl<>( new ExpBetaPlanChanger.Factory().build() ); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java index 1ef48e6fed1..e68046e5146 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java @@ -108,7 +108,7 @@ public final Config prepareConfig() { public final Scenario prepareScenario(Config config) { Gbl.assertNotNull( config ); Scenario scenario = ScenarioUtils.loadScenario(config); - FreightUtils.addOrGetCarriers(scenario); + CarrierUtils.addOrGetCarriers(scenario); return scenario; } @@ -153,7 +153,7 @@ public MyCarrierPlanStrategyManagerFactory(CarrierVehicleTypes types) { final TravelDisutility travelDisutility = CarrierTravelDisutilities.createBaseDisutility(types, modeTravelTimes.get(TransportMode.car ) ); final LeastCostPathCalculator router = leastCostPathCalculatorFactory.createPathCalculator(network, travelDisutility, modeTravelTimes.get(TransportMode.car)); - final CarrierStrategyManager carrierStrategyManager = FreightUtils.createDefaultCarrierStrategyManager(); + final CarrierStrategyManager carrierStrategyManager = CarrierControlerUtils.createDefaultCarrierStrategyManager(); carrierStrategyManager.setMaxPlansPerAgent(5); carrierStrategyManager.addStrategy(new GenericPlanStrategyImpl<>(new BestPlanSelector<>()), null, 0.95); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java index 8060ab9d81f..72768af0df4 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java @@ -36,7 +36,6 @@ import org.matsim.freight.carriers.controler.CarrierModule; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.freight.carriers.controler.CarrierStrategyManager; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.mobsim.DistanceScoringFunctionFactoryForTests; import org.matsim.freight.carriers.mobsim.StrategyManagerFactoryForTests; import org.matsim.testcases.MatsimTestUtils; @@ -74,7 +73,7 @@ public void setUp(){ Scenario scenario = ScenarioUtils.loadScenario( config ); - FreightUtils.loadCarriersAccordingToFreightConfig( scenario ); + CarrierUtils.loadCarriersAccordingToFreightConfig( scenario ); controler = new Controler(scenario); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java index 85a69c33fb6..9c2859ef40d 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java @@ -33,7 +33,6 @@ import org.matsim.core.gbl.Gbl; import org.matsim.core.scenario.ScenarioUtils; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; @@ -181,7 +180,7 @@ public void test_ServicesAndShipmentsHaveAttributes(){ public void test_readStream() { Config config = ConfigUtils.createConfig(); Scenario scenario = ScenarioUtils.createScenario(config); - Carriers carriers = FreightUtils.addOrGetCarriers(scenario); + Carriers carriers = CarrierUtils.addOrGetCarriers(scenario); String xml = """ diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java index b6912413ae2..2ec4c309bf4 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java @@ -27,7 +27,6 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.TransportMode; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; @@ -139,7 +138,7 @@ public void test_whenReadingToursOfPlan1_SpritScoreIsCorrect(){ List plans = new ArrayList(testCarrier.getPlans()); CarrierPlan plan1 = plans.get(0); plan1.getAttributes().getAttribute("jspritScore"); - assertEquals(Double.NaN, FreightUtils.getJspritScore(plan1), testUtils.EPSILON); + assertEquals(Double.NaN, CarrierUtils.getJspritScore(plan1), testUtils.EPSILON); } @Test @@ -147,7 +146,7 @@ public void test_whenReadingToursOfPlan2_jSpritScoreIsCorrect(){ List plans = new ArrayList(testCarrier.getPlans()); CarrierPlan plan2 = plans.get(1); plan2.getAttributes().getAttribute("jspritScore"); - assertEquals(80.0, FreightUtils.getJspritScore(plan2), testUtils.EPSILON); + assertEquals(80.0, CarrierUtils.getJspritScore(plan2), testUtils.EPSILON); } @Test @@ -155,7 +154,7 @@ public void test_whenReadingToursOfPlan3_jSpritIsCorrect(){ List plans = new ArrayList(testCarrier.getPlans()); CarrierPlan plan3 = plans.get(2); plan3.getAttributes().getAttribute("jspritScore"); - assertEquals(105.0, FreightUtils.getJspritScore(plan3), testUtils.EPSILON); + assertEquals(105.0, CarrierUtils.getJspritScore(plan3), testUtils.EPSILON); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java index 8b76445b96c..9c157031a97 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java @@ -80,7 +80,7 @@ static Scenario commonScenario( Config config, MatsimTestUtils testUtils ){ CarrierVehicleTypes carrierVehicleTypes = new CarrierVehicleTypes(); new CarrierVehicleTypeReader( carrierVehicleTypes ).readFile( testUtils.getPackageInputDirectory() + "vehicleTypes_v2.xml" ); - Carriers carriers = FreightUtils.addOrGetCarriers(scenario ); + Carriers carriers = CarrierUtils.addOrGetCarriers(scenario ); new CarrierPlanXmlReader( carriers, carrierVehicleTypes ).readFile( testUtils.getClassInputDirectory() + "carrierPlansEquils.xml" ); return scenario; } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java index b3c9d4ba29e..23a9792f17d 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java @@ -32,6 +32,7 @@ import org.matsim.core.controler.Controler; import org.matsim.freight.carriers.FreightConfigGroup; import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.ScheduledTour; import org.matsim.freight.carriers.carrier.Tour; import org.matsim.freight.carriers.mobsim.DistanceScoringFunctionFactoryForTests; @@ -71,7 +72,7 @@ public void testWithoutCarrierRoutes() { Scenario scenario = EquilWithCarrierWithPersonsIT.commonScenario( config, testUtils ); // set the routes to null: - for( Carrier carrier : FreightUtils.getCarriers( scenario ).getCarriers().values() ){ + for( Carrier carrier : CarrierUtils.getCarriers( scenario ).getCarriers().values() ){ for( ScheduledTour tour : carrier.getSelectedPlan().getScheduledTours() ){ for( Tour.TourElement tourElement : tour.getTour().getTourElements() ){ if ( tourElement instanceof Tour.Leg ) { @@ -109,10 +110,10 @@ public void install() { }); controler.run(); - Carrier carrier1 = FreightUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); + Carrier carrier1 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); Assert.assertEquals(-170000.0, carrier1.getSelectedPlan().getScore(), 0.0 ); - Carrier carrier2 = FreightUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); + Carrier carrier2 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); Assert.assertEquals(-85000.0, carrier2.getSelectedPlan().getScore(), 0.0 ); } @@ -135,10 +136,10 @@ public void install() { }); controler.run(); - Carrier carrier1 = FreightUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); + Carrier carrier1 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); Assert.assertEquals(-240.0, carrier1.getSelectedPlan().getScore(), 2.0); - Carrier carrier2 = FreightUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); + Carrier carrier2 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); Assert.assertEquals(0.0, carrier2.getSelectedPlan().getScore(), 0.0 ); } @@ -163,10 +164,10 @@ public void install() { }); controler.run(); - Carrier carrier1 = FreightUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); + Carrier carrier1 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); Assert.assertEquals(-4873.0, carrier1.getSelectedPlan().getScore(), 2.0); - Carrier carrier2 = FreightUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); + Carrier carrier2 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); Assert.assertEquals(0.0, carrier2.getSelectedPlan().getScore(), 0.0 ); } @@ -191,7 +192,7 @@ public void install() { }); controler.run(); - Carrier carrier1 = FreightUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); + Carrier carrier1 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); Assert.assertEquals(-4871.0, carrier1.getSelectedPlan().getScore(), 2.0); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java index f5023a03fc6..072e4eaa88f 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java @@ -42,7 +42,6 @@ import org.matsim.freight.carriers.FreightConfigGroup.UseDistanceConstraintForTourPlanning; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -111,7 +110,7 @@ public final void CarrierSmallBatteryTest_Version1() throws ExecutionException, scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV1, 25); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 1, carrierV1.getSelectedPlan().getScheduledTours().size()); @@ -184,7 +183,7 @@ public final void CarrierLargeBatteryTest_Version2() throws ExecutionException, scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV2, 10); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 1, @@ -259,7 +258,7 @@ public final void Carrier2SmallBatteryTest_Version3() throws ExecutionException, scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV3, 10); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 2, carrierV3.getSelectedPlan().getScheduledTours().size()); @@ -341,7 +340,7 @@ public final void CarrierWithAdditionalDieselVehicleTest_Version4() throws Execu scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV4, 10); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amount of scheduled tours", 2, carrierV4.getSelectedPlan().getScheduledTours().size()); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java index af8ed931927..8e3cc739bfe 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java @@ -42,7 +42,6 @@ import org.matsim.freight.carriers.FreightConfigGroup.UseDistanceConstraintForTourPlanning; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -121,7 +120,7 @@ public final void CarrierSmallBatteryTest_Version1() throws ExecutionException, scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV1, 25); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 1, carrierV1.getSelectedPlan().getScheduledTours().size()); @@ -200,7 +199,7 @@ public final void CarrierLargeBatteryTest_Version2() throws ExecutionException, scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV2, 10); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 1, @@ -284,7 +283,7 @@ public final void Carrier2SmallBatteryTest_Version3() throws ExecutionException, scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV3, 10); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 2, carrierV3.getSelectedPlan().getScheduledTours().size()); @@ -379,7 +378,7 @@ public final void CarrierWithAdditionalDieselVehicleTest_Version4() throws Execu scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV4, 10); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 2, carrierV4.getSelectedPlan().getScheduledTours().size()); @@ -462,7 +461,7 @@ public final void CarrierWithShipmentsMidSizeBatteryTest_Version5() throws Execu scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV5, 10); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); //We need two tours, due to reloading both shipments must be transported one after the other Assert.assertEquals("Not the correct amout of scheduled tours", 2, @@ -541,7 +540,7 @@ public final void CarrierWithShipmentsLargeBatteryTest_Version6() throws Executi scenario.addScenarioElement("carriers", carriers); CarrierUtils.setJspritIterations(carrierV5, 10); - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); //We need two tours, due to reloading both shipments must be transported one after the other diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java index 2ba76434464..fc4fb97632f 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java @@ -38,7 +38,6 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.freight.carriers.FreightConfigGroup; import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; import org.matsim.testcases.MatsimTestUtils; @@ -67,18 +66,18 @@ public void testJsprit() throws ExecutionException, InterruptedException { Scenario scenario = ScenarioUtils.createScenario(config); new MatsimNetworkReader(scenario.getNetwork()).readFile(networkFilename); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); - for (Carrier carrier : FreightUtils.getCarriers(scenario).getCarriers().values()) { + for (Carrier carrier : CarrierUtils.getCarriers(scenario).getCarriers().values()) { CarrierUtils.setJspritIterations(carrier, 1); } - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); double scoreWithRunJsprit = 0; - for (Carrier carrier : FreightUtils.getCarriers(scenario).getCarriers().values()) { + for (Carrier carrier : CarrierUtils.getCarriers(scenario).getCarriers().values()) { scoreWithRunJsprit = scoreWithRunJsprit + carrier.getSelectedPlan().getJspritScore(); } - double scoreRunWithOldStructure = generateCarrierPlans(scenario.getNetwork(), FreightUtils.getCarriers(scenario), FreightUtils.getCarrierVehicleTypes(scenario)); + double scoreRunWithOldStructure = generateCarrierPlans(scenario.getNetwork(), CarrierUtils.getCarriers(scenario), CarrierUtils.getCarrierVehicleTypes(scenario)); Assert.assertEquals("The score of both runs are not the same", scoreWithRunJsprit, scoreRunWithOldStructure, MatsimTestUtils.EPSILON); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java index f1204001698..ddeaab619d4 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java @@ -37,7 +37,6 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.misc.Time; import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -79,7 +78,7 @@ public void testJspritWithSameSkillsRequired(){ } private VehicleRoutingProblemSolution generateCarrierPlans(Scenario scenario) { - Carrier carrier = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); NetworkBasedTransportCosts networkBasedTransportCosts = NetworkBasedTransportCosts.Builder.newInstance( scenario.getNetwork(), carrier.getCarrierCapabilities().getVehicleTypes()) .setTimeSliceWidth((int) Time.parseTime("00:30:00")) @@ -97,9 +96,9 @@ private VehicleRoutingProblemSolution generateCarrierPlans(Scenario scenario) { carrier.setSelectedPlan(newPlan); SolutionPrinter.print(problem, solution, SolutionPrinter.Print.VERBOSE); -// new CarrierPlanXmlWriterV3(FreightUtils.getCarriers(scenario)).write(utils.getOutputDirectory() + "carriers.xml"); +// new CarrierPlanXmlWriterV3(CarrierControlerUtils.getCarriers(scenario)).write(utils.getOutputDirectory() + "carriers.xml"); // Scenario scNew = ScenarioUtils.createScenario(ConfigUtils.createConfig()); -// new CarrierPlanXmlReaderV3(FreightUtils.getCarriers(scNew)).readFile(utils.getOutputDirectory() + "carriers.xml"); +// new CarrierPlanXmlReaderV3(CarrierControlerUtils.getCarriers(scNew)).readFile(utils.getOutputDirectory() + "carriers.xml"); return solution; } @@ -107,7 +106,7 @@ private Scenario setupTestScenario() { Scenario scenario = ScenarioUtils.createScenario(ConfigUtils.createConfig()); new MatsimNetworkReader(scenario.getNetwork()).readFile(utils.getClassInputDirectory() + "grid-network.xml"); - Carriers carriers = FreightUtils.addOrGetCarriers(scenario ); + Carriers carriers = CarrierUtils.addOrGetCarriers(scenario ); { Carrier carrier = CarrierUtils.createCarrier( Id.create("TestCarrier", Carrier.class)); { @@ -127,7 +126,7 @@ private Scenario setupTestScenario() { typeOne.getCostInformation().setFixedCost( 1000.0 ).setCostsPerMeter( 0.001 ).setCostsPerSecond( 0.001 ) ; // typeOne.setCapacity(vehicleCapacity); typeOne.getCapacity().setOther( 2.0 ); - FreightUtils.addSkill(typeOne, "skill 1"); + CarrierUtils.addSkill(typeOne, "skill 1"); capabilitiesBuilder.addType(typeOne); CarrierVehicle vehicleOne = CarrierVehicle.Builder.newInstance(Id.createVehicleId("1"), carrierLocation, typeOne ) .setEarliestStart(0.0) @@ -141,7 +140,7 @@ private Scenario setupTestScenario() { typeTwo.getCostInformation().setFixedCost( 1000.0 ).setCostsPerMeter( 0.001 ).setCostsPerSecond( 0.001 ) ; // typeTwo.setCapacity(vehicleCapacity); typeTwo.getCapacity().setOther( 2.0 ); - FreightUtils.addSkill(typeTwo, "skill 2"); + CarrierUtils.addSkill(typeTwo, "skill 2"); capabilitiesBuilder.addType(typeTwo); CarrierVehicle vehicleTwo = CarrierVehicle.Builder.newInstance(Id.createVehicleId("2"), carrierLocation, typeTwo ) .setEarliestStart(0.0) @@ -158,7 +157,7 @@ private Scenario setupTestScenario() { } private void addShipmentsRequiringDifferentSkills(Scenario scenario) { - Carrier carrier = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); CarrierShipment shipmentOne = CarrierShipment.Builder.newInstance( Id.create("1", CarrierShipment.class), carrierLocation, @@ -169,7 +168,7 @@ private void addShipmentsRequiringDifferentSkills(Scenario scenario) { .setDeliveryTimeWindow(TimeWindow.newInstance(0.0, Time.parseTime("24:00:00"))) .setDeliveryServiceTime(Time.parseTime("00:05:00")) .build(); - FreightUtils.addSkill(shipmentOne, "skill 1"); + CarrierUtils.addSkill(shipmentOne, "skill 1"); CarrierUtils.addShipment(carrier, shipmentOne); CarrierShipment shipmentTwo = CarrierShipment.Builder.newInstance( @@ -182,12 +181,12 @@ private void addShipmentsRequiringDifferentSkills(Scenario scenario) { .setDeliveryTimeWindow(TimeWindow.newInstance(0.0, Time.parseTime("24:00:00"))) .setDeliveryServiceTime(Time.parseTime("00:05:00")) .build(); - FreightUtils.addSkill(shipmentTwo, "skill 2"); + CarrierUtils.addSkill(shipmentTwo, "skill 2"); CarrierUtils.addShipment(carrier, shipmentTwo); } private void addShipmentsRequiringSameSkills(Scenario scenario) { - Carrier carrier = FreightUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); CarrierShipment shipmentOne = CarrierShipment.Builder.newInstance( Id.create("1", CarrierShipment.class), carrierLocation, @@ -198,7 +197,7 @@ private void addShipmentsRequiringSameSkills(Scenario scenario) { .setDeliveryTimeWindow(TimeWindow.newInstance(0.0, Time.parseTime("24:00:00"))) .setDeliveryServiceTime(Time.parseTime("00:05:00")) .build(); - FreightUtils.addSkill(shipmentOne, "skill 1"); + CarrierUtils.addSkill(shipmentOne, "skill 1"); CarrierUtils.addShipment(carrier, shipmentOne); CarrierShipment shipmentTwo = CarrierShipment.Builder.newInstance( @@ -211,7 +210,7 @@ private void addShipmentsRequiringSameSkills(Scenario scenario) { .setDeliveryTimeWindow(TimeWindow.newInstance(0.0, Time.parseTime("24:00:00"))) .setDeliveryServiceTime(Time.parseTime("00:05:00")) .build(); - FreightUtils.addSkill(shipmentTwo, "skill 1"); + CarrierUtils.addSkill(shipmentTwo, "skill 1"); CarrierUtils.addShipment(carrier, shipmentTwo); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java index 0f5cb34fedd..77aa54cbd28 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java @@ -38,7 +38,7 @@ import org.matsim.freight.carriers.carrier.CarrierPlan; import org.matsim.freight.carriers.controler.CarrierReRouteVehicles; import org.matsim.freight.carriers.controler.CarrierStrategyManager; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.controler.CarrierControlerUtils; import org.matsim.vehicles.Vehicle; import java.util.Map; @@ -83,7 +83,7 @@ public CarrierStrategyManager get() { GenericPlanStrategyImpl planStrat_reRoutePlan = new GenericPlanStrategyImpl<>( new BestPlanSelector<>() ); planStrat_reRoutePlan.addStrategyModule(new CarrierReRouteVehicles.Factory(router, network, travelTimes.get(TransportMode.car )).build() ); - CarrierStrategyManager stratManager = FreightUtils.createDefaultCarrierStrategyManager(); + CarrierStrategyManager stratManager = CarrierControlerUtils.createDefaultCarrierStrategyManager(); stratManager.addStrategy(planStrat_reRoutePlan, null, 1.0); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsIT.java similarity index 98% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsIT.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsIT.java index 5bcf8fdf72c..764fb52d25a 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsIT.java @@ -37,7 +37,6 @@ import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; @@ -54,7 +53,7 @@ * @author kturner * */ -public class FreightUtilsIT { +public class CarrierControlerUtilsIT { private final Id CARRIER_SERVICES_ID = Id.create("CarrierWServices", Carrier.class); private final Id CARRIER_SHIPMENTS_ID = Id.create("CarrierWShipments", Carrier.class); @@ -149,7 +148,7 @@ public void setUp() { */ //Convert to jsprit VRP - Carriers carriersWithShipmentsOnly = FreightUtils.createShipmentVRPCarrierFromServiceVRPSolution( + Carriers carriersWithShipmentsOnly = CarrierUtils.createShipmentVRPCarrierFromServiceVRPSolution( carriersWithServicesAndShpiments ); // assign vehicle types to the carriers diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java similarity index 93% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java index 2f697f4a754..d36d266a853 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/FreightUtilsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java @@ -48,7 +48,6 @@ import org.matsim.freight.carriers.FreightConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; @@ -60,12 +59,12 @@ import java.util.Collection; import java.util.concurrent.ExecutionException; -public class FreightUtilsTest { +public class CarrierControlerUtilsTest { @Rule public MatsimTestUtils utils = new MatsimTestUtils(); - private static final Logger log = LogManager.getLogger(FreightUtilsTest.class); + private static final Logger log = LogManager.getLogger(CarrierControlerUtilsTest.class); private final Id CARRIER_SERVICES_ID = Id.create("CarrierWServices", Carrier.class); private final Id CARRIER_SHIPMENTS_ID = Id.create("CarrierWShipments", Carrier.class); @@ -157,7 +156,7 @@ public void setUp() { */ //Convert to jsprit VRP - Carriers carriersWithShipmentsOnly = FreightUtils.createShipmentVRPCarrierFromServiceVRPSolution(carriersWithServicesAndShpiments); + Carriers carriersWithShipmentsOnly = CarrierUtils.createShipmentVRPCarrierFromServiceVRPSolution(carriersWithServicesAndShpiments); carrierWShipmentsOnlyFromCarrierWServices = carriersWithShipmentsOnly.getCarriers().get(CARRIER_SERVICES_ID); //with converted Service carrierWShipmentsOnlyFromCarrierWShipments = carriersWithShipmentsOnly.getCarriers().get(CARRIER_SHIPMENTS_ID); //with copied Shipments @@ -366,15 +365,15 @@ private static CarrierService createMatsimService(String id, String to, int size public void testAddVehicleTypeSkill(){ VehiclesFactory factory = ScenarioUtils.createScenario(ConfigUtils.createConfig()).getVehicles().getFactory(); VehicleType type = factory.createVehicleType(Id.create("test", VehicleType.class)); - Assert.assertFalse("Should not have skill.", FreightUtils.hasSkill(type, "testSkill")); + Assert.assertFalse("Should not have skill.", CarrierUtils.hasSkill(type, "testSkill")); - FreightUtils.addSkill(type, "testSkillOne"); - Assert.assertTrue("Should have skill 'testSkillOne'.", FreightUtils.hasSkill(type, "testSkillOne")); + CarrierUtils.addSkill(type, "testSkillOne"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(type, "testSkillOne")); - FreightUtils.addSkill(type, "testSkillTwo"); - Assert.assertTrue("Should have skill 'testSkillOne'.", FreightUtils.hasSkill(type, "testSkillOne")); - Assert.assertTrue("Should have skill 'testSkillTwo'.", FreightUtils.hasSkill(type, "testSkillTwo")); + CarrierUtils.addSkill(type, "testSkillTwo"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(type, "testSkillOne")); + Assert.assertTrue("Should have skill 'testSkillTwo'.", CarrierUtils.hasSkill(type, "testSkillTwo")); } @Test @@ -382,15 +381,15 @@ public void testAddShipmentSkill(){ CarrierShipment shipment = CarrierShipment.Builder.newInstance( Id.create("testShipment", CarrierShipment.class), Id.createLinkId("1"), Id.createLinkId("2"), 1) .build(); - Assert.assertFalse("Should not have skill.", FreightUtils.hasSkill(shipment, "testSkill")); + Assert.assertFalse("Should not have skill.", CarrierUtils.hasSkill(shipment, "testSkill")); - FreightUtils.addSkill(shipment, "testSkillOne"); - Assert.assertTrue("Should have skill 'testSkillOne'.", FreightUtils.hasSkill(shipment, "testSkillOne")); + CarrierUtils.addSkill(shipment, "testSkillOne"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(shipment, "testSkillOne")); - FreightUtils.addSkill(shipment, "testSkillTwo"); - Assert.assertTrue("Should have skill 'testSkillOne'.", FreightUtils.hasSkill(shipment, "testSkillOne")); - Assert.assertTrue("Should have skill 'testSkillTwo'.", FreightUtils.hasSkill(shipment, "testSkillTwo")); + CarrierUtils.addSkill(shipment, "testSkillTwo"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(shipment, "testSkillOne")); + Assert.assertTrue("Should have skill 'testSkillTwo'.", CarrierUtils.hasSkill(shipment, "testSkillTwo")); } @Test @@ -398,15 +397,15 @@ public void testAddServiceSkill(){ CarrierService service = CarrierService.Builder.newInstance( Id.create("testShipment", CarrierService.class), Id.createLinkId("2")) .build(); - Assert.assertFalse("Should not have skill.", FreightUtils.hasSkill(service, "testSkill")); + Assert.assertFalse("Should not have skill.", CarrierUtils.hasSkill(service, "testSkill")); - FreightUtils.addSkill(service, "testSkillOne"); - Assert.assertTrue("Should have skill 'testSkillOne'.", FreightUtils.hasSkill(service, "testSkillOne")); + CarrierUtils.addSkill(service, "testSkillOne"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(service, "testSkillOne")); - FreightUtils.addSkill(service, "testSkillTwo"); - Assert.assertTrue("Should have skill 'testSkillOne'.", FreightUtils.hasSkill(service, "testSkillOne")); - Assert.assertTrue("Should have skill 'testSkillTwo'.", FreightUtils.hasSkill(service, "testSkillTwo")); + CarrierUtils.addSkill(service, "testSkillTwo"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(service, "testSkillOne")); + Assert.assertTrue("Should have skill 'testSkillTwo'.", CarrierUtils.hasSkill(service, "testSkillTwo")); } @Test @@ -422,11 +421,11 @@ public void testRunJsprit_allInformationGiven(){ Scenario scenario = ScenarioUtils.loadScenario(config); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario ); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario ); Controler controler = new Controler(scenario); try { - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); } catch (Exception e) { e.printStackTrace(); Assert.fail(); @@ -444,15 +443,15 @@ public void testRunJsprit_NoOfJspritIterationsMissing() throws ExecutionExceptio config.controller().setOutputDirectory(utils.getOutputDirectory()); Scenario scenario = ScenarioUtils.loadScenario(config); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //remove all attributes --> remove the NumberOfJspritIterations attribute to trigger exception - Carriers carriers = FreightUtils.getCarriers(scenario); + Carriers carriers = CarrierUtils.getCarriers(scenario); for (Carrier carrier : carriers.getCarriers().values()) { carrier.getAttributes().clear(); } - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); } /** @@ -463,10 +462,10 @@ public void testRunJsprit_NoAlgortihmFileGiven(){ Config config = prepareConfig(); config.controller().setOutputDirectory(utils.getOutputDirectory()); Scenario scenario = ScenarioUtils.loadScenario(config); - FreightUtils.loadCarriersAccordingToFreightConfig(scenario); + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); try { - FreightUtils.runJsprit(scenario); + CarrierUtils.runJsprit(scenario); } catch (Exception e) { Assert.fail(); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java index da260ed005d..f3ad36c69ef 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java @@ -23,8 +23,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.Carriers; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.core.scoring.ScoringFunction; import java.util.ArrayList; @@ -70,7 +70,7 @@ public void scoreSelectedPlan(Scenario scenario, ReceiverCostAllocation costAllo return; } - Carriers carriers = FreightUtils.getCarriers(scenario); + Carriers carriers = CarrierUtils.getCarriers(scenario); double score = 0.0; List> carrierIds = new ArrayList<>(); diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java index ec7a6b95cb3..09bc3798dad 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java @@ -26,9 +26,9 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.HasPlansAndId; import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.ScheduledTour; import org.matsim.freight.carriers.carrier.Tour; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.contrib.freightreceiver.replanning.ReceiverStrategyManager; import org.matsim.core.config.ConfigUtils; @@ -169,7 +169,7 @@ private void linkReceiverTimeWindowToCarrierTourPosition() throws IOException { bw.write("receiverId,twStart,twEnd,twDuration,positionInTour,product,deliveryStart,deliveryEnd"); bw.newLine(); - for (Carrier carrier : FreightUtils.getCarriers(this.sc).getCarriers().values()) { + for (Carrier carrier : CarrierUtils.getCarriers(this.sc).getCarriers().values()) { Collection scheduledTours = carrier.getSelectedPlan().getScheduledTours(); for (ScheduledTour tour : scheduledTours) { for (int i = 0; i < tour.getTour().getTourElements().size(); i++) { diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java index 4ecd92b3c14..9190766f59d 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java @@ -4,7 +4,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.events.IterationEndsEvent; @@ -92,7 +92,7 @@ public void notifyIterationEnds(final IterationEndsEvent event) { if ((event.getIteration() + 1) % (ConfigUtils.addOrGetModule(sc.getConfig(), ReceiverConfigGroup.class).getReceiverReplanningInterval()) != 0) return; String dir = event.getServices().getControlerIO().getIterationPath(event.getIteration()); - FreightUtils.writeCarriers(FreightUtils.getCarriers(sc), dir + File.separator + event.getIteration() + CARRIER_PLANS_XML); + CarrierUtils.writeCarriers(CarrierUtils.getCarriers(sc), dir + File.separator + event.getIteration() + CARRIER_PLANS_XML); new ReceiversWriter(ReceiverUtils.getReceivers(sc)).write(dir + File.separator + event.getIteration() + RECEIVER_PLANS_XML); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java index 87c24304e4e..3b53c146af6 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java @@ -25,11 +25,7 @@ import org.apache.logging.log4j.LogManager; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlan; -import org.matsim.freight.carriers.carrier.CarrierPlanWriter; -import org.matsim.freight.carriers.carrier.CarrierShipment; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkRouter; @@ -64,7 +60,7 @@ public void notifyIterationStarts(IterationStartsEvent event) { CollaborationUtils.setCoalitionFromReceiverAttributes( sc ); // clean out plans, services, shipments from carriers: - Map, Carrier> carriers = FreightUtils.getCarriers(sc).getCarriers(); + Map, Carrier> carriers = CarrierUtils.getCarriers(sc).getCarriers(); for( Carrier carrier : carriers.values() ){ carrier.clearPlans(); carrier.getShipments().clear(); @@ -124,8 +120,8 @@ public void notifyIterationStarts(IterationStartsEvent event) { } String outputdirectory = sc.getConfig().controller().getOutputDirectory(); outputdirectory += outputdirectory.endsWith("/") ? "" : "/"; -// new CarrierPlanWriter(FreightUtils.getCarriers(sc)).write(outputdirectory + ReceiverConfigGroup.CARRIERS_FILE); - new CarrierPlanWriter(FreightUtils.getCarriers(sc)).write(outputdirectory +receiverConfig.getCarriersFile() ); +// new CarrierPlanWriter(CarrierControlerUtils.getCarriers(sc)).write(outputdirectory + ReceiverConfigGroup.CARRIERS_FILE); + new CarrierPlanWriter(CarrierUtils.getCarriers(sc)).write(outputdirectory +receiverConfig.getCarriersFile() ); // new ReceiversWriter( ReceiverUtils.getReceivers( sc ) ).write(outputdirectory + ReceiverConfigGroup.RECEIVERS_FILE); new ReceiversWriter( ReceiverUtils.getReceivers( sc ) ).write(outputdirectory + receiverConfig.getReceiversFile()); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java index 7ad0b6796e0..23af52bbdf8 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java @@ -19,7 +19,7 @@ private ReceiverUtils() { public static final String ATTR_RECEIVER_SCORE = "score"; public static final String ATTR_RECEIVER_TW_COST = "twCost"; - //Now using the MATSim-infrastructure to avoid problems if this element is named differently beetween (MATSim) FreightUtils and here. + //Now using the MATSim-infrastructure to avoid problems if this element is named differently beetween (MATSim) CarrierControlerUtils and here. // I also replaced the usage here by the current MATSim syntax KMT'jan21 // private static final String CARRIERS_SCENARIO_ELEMENT = "carriers"; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java index 939993439e6..fa3dc041954 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java @@ -5,8 +5,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.Carriers; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.contrib.freightreceiver.*; public class CollaborationUtils{ @@ -42,7 +42,7 @@ public static void createCoalitionWithCarriersAndAddCollaboratingReceivers(Scena /* Add carrier and receivers to coalition */ Coalition coalition = CollaborationUtils.createCoalition(); - for (Carrier carrier : FreightUtils.getCarriers(sc).getCarriers().values()){ + for (Carrier carrier : CarrierUtils.getCarriers(sc).getCarriers().values()){ if (!coalition.getCarrierCoalitionMembers().contains(carrier)){ coalition.addCarrierCoalitionMember(carrier); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java index 1e2b914d10a..9c2bea27fd0 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java @@ -29,7 +29,6 @@ import org.matsim.api.core.v01.network.NetworkWriter; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.contrib.freightreceiver.*; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.config.Config; @@ -86,7 +85,7 @@ public static Scenario createChessboardScenario(long seed, int numberOfReceivers } /* Link the carriers to the receivers. */ - CollaborationUtils.linkReceiverOrdersToCarriers(ReceiverUtils.getReceivers(sc), FreightUtils.getCarriers(sc)); + CollaborationUtils.linkReceiverOrdersToCarriers(ReceiverUtils.getReceivers(sc), CarrierUtils.getCarriers(sc)); CollaborationUtils.createCoalitionWithCarriersAndAddCollaboratingReceivers(sc); return sc; } @@ -128,13 +127,13 @@ public static void writeFreightScenario(Scenario sc) { new NetworkWriter(sc.getNetwork()).write(outputFolder + "network.xml"); new ConfigWriter(sc.getConfig()).write(outputFolder + "config.xml"); - FreightUtils.writeCarriers(FreightUtils.getCarriers(sc),outputFolder + "carriers.xml"); + CarrierUtils.writeCarriers(CarrierUtils.getCarriers(sc),outputFolder + "carriers.xml"); new ReceiversWriter(ReceiverUtils.getReceivers(sc)).write(outputFolder + "receivers.xml"); /* Write the vehicle types. FIXME This will have to change so that vehicle * types lie at the Carriers level, and not per Carrier. In this scenario * there luckily is only a single Carrier. */ - new CarrierVehicleTypeWriter(CarrierVehicleTypes.getVehicleTypes(FreightUtils.getCarriers(sc))).write(outputFolder + "carrierVehicleTypes.xml"); + new CarrierVehicleTypeWriter(CarrierVehicleTypes.getVehicleTypes(CarrierUtils.getCarriers(sc))).write(outputFolder + "carrierVehicleTypes.xml"); } @@ -143,7 +142,7 @@ public static void writeFreightScenario(Scenario sc) { * for experiments, but this must be adapted in the future to accept other parameters as inputs to enable different orders per receiver. */ private static void createReceiverOrders(Scenario sc) { - Carriers carriers = FreightUtils.getCarriers(sc); + Carriers carriers = CarrierUtils.getCarriers(sc); Receivers receivers = ReceiverUtils.getReceivers(sc); Carrier carrierOne = carriers.getCarriers().get(Id.create("Carrier1", Carrier.class)); @@ -317,7 +316,7 @@ private static void createChessboardCarriersAndAddToScenario(Scenario sc) { types.getVehicleTypes().put(typeLight.getId(), typeLight); types.getVehicleTypes().put(typeHeavy.getId(), typeHeavy); - Carriers carriers = FreightUtils.addOrGetCarriers(sc); + Carriers carriers = CarrierUtils.addOrGetCarriers(sc); carriers.addCarrier(carrier); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java index 8645015d8b9..2e2d95f2e59 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java @@ -23,8 +23,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.Carriers; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; import org.matsim.contrib.freightreceiver.ReceiverModule; import org.matsim.contrib.freightreceiver.ReceiverReplanningType; @@ -83,7 +83,7 @@ static void run(int run) { * TODO This is less elegant than the embedded score stats for the receiver. */ static void prepareFreightOutputDataAndStats(MatsimServices controler) { - CarrierScoreStats scoreStats = new CarrierScoreStats(FreightUtils.getCarriers(controler.getScenario()), controler.getScenario().getConfig().controller().getOutputDirectory() + "/carrier_scores", true); + CarrierScoreStats scoreStats = new CarrierScoreStats(CarrierUtils.getCarriers(controler.getScenario()), controler.getScenario().getConfig().controller().getOutputDirectory() + "/carrier_scores", true); controler.addControlerListener(scoreStats); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java index d799e337355..2fe4973e49e 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java @@ -23,8 +23,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.Carriers; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; import org.matsim.contrib.freightreceiver.ReceiverModule; import org.matsim.contrib.freightreceiver.ReceiverReplanningType; @@ -85,7 +85,7 @@ static void run(int run) { * TODO This is less elegant than the embedded score stats for the receiver. */ static void prepareFreightOutputDataAndStats(MatsimServices controler) { - CarrierScoreStats scoreStats = new CarrierScoreStats(FreightUtils.getCarriers(controler.getScenario()), controler.getScenario().getConfig().controller().getOutputDirectory() + "/carrier_scores", true); + CarrierScoreStats scoreStats = new CarrierScoreStats(CarrierUtils.getCarriers(controler.getScenario()), controler.getScenario().getConfig().controller().getOutputDirectory() + "/carrier_scores", true); controler.addControlerListener(scoreStats); } diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index 21d160d7a32..731d742e5dc 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -28,8 +28,8 @@ import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.events.LinkEnterEvent; import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.Tour; -import org.matsim.freight.carriers.controler.FreightUtils; import org.matsim.freight.carriers.events.CarrierTourEndEvent; import org.matsim.freight.carriers.events.CarrierTourStartEvent; import org.matsim.core.events.handler.BasicEventHandler; @@ -162,7 +162,7 @@ void writeTravelTimeAndDistancePerVehicleType(String analysisOutputDirectory, Sc //----- All VehicleTypes in CarriervehicleTypes container. Used so that even unused vehTypes appear in the output - TreeMap, VehicleType> vehicleTypesMap = new TreeMap<>(FreightUtils.getCarrierVehicleTypes(scenario).getVehicleTypes()); + TreeMap, VehicleType> vehicleTypesMap = new TreeMap<>(CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes()); //For the case that there are additional vehicle types found in the events. for (VehicleType vehicleType : vehicleId2VehicleType.values()) { vehicleTypesMap.putIfAbsent(vehicleType.getId(), vehicleType); diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java index c390f466f9a..600516537e4 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java @@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.controler.FreightUtils; +import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.events.CarrierEventsReaders; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.config.Config; @@ -96,11 +96,11 @@ public void runAnalysis() throws IOException { Scenario scenario = ScenarioUtils.loadScenario(config); //load carriers according to freight config - FreightUtils.loadCarriersAccordingToFreightConfig( scenario ); + CarrierUtils.loadCarriersAccordingToFreightConfig( scenario ); // CarrierPlanAnalysis - CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(FreightUtils.getCarriers(scenario)); + CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(CarrierUtils.getCarriers(scenario)); carrierPlanAnalysis.runAnalysisAndWriteStats(analysisOutputDirectory); // Prepare eventsManager - start of event based Analysis; @@ -109,7 +109,7 @@ public void runAnalysis() throws IOException { FreightTimeAndDistanceAnalysisEventsHandler freightTimeAndDistanceAnalysisEventsHandler = new FreightTimeAndDistanceAnalysisEventsHandler(scenario); eventsManager.addHandler(freightTimeAndDistanceAnalysisEventsHandler); - CarrierLoadAnalysis carrierLoadAnalysis = new CarrierLoadAnalysis(FreightUtils.getCarriers(scenario)); + CarrierLoadAnalysis carrierLoadAnalysis = new CarrierLoadAnalysis(CarrierUtils.getCarriers(scenario)); eventsManager.addHandler(carrierLoadAnalysis); eventsManager.initProcessing(); From 727b35d84690c47022c3604c54b0957c6eb22830 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Thu, 12 Oct 2023 23:08:32 +0200 Subject: [PATCH 3/8] rename FreightConfigGroup.java to FreightCarriersConfigGroup --- .../CarrierReaderFromCSV.java | 22 ++++++------- .../FreightDemandGeneration.java | 32 +++++++++---------- ...rateSmallScaleCommercialTrafficDemand.java | 20 ++++++------ .../CarrierReaderFromCSVTest.java | 12 +++---- .../DemandReaderFromCSVTest.java | 10 +++--- ...nerateSmallScaleCommercialTrafficTest.java | 10 +++--- .../RunJointDemandCarToggleJspritExample.java | 12 +++---- .../examples/RunJointDemandCarExample.java | 12 +++---- .../examples/RunJointDemandDRTExample.java | 10 +++--- .../CommercialTrafficIntegrationTest.java | 8 ++--- .../IsTheRightCustomerScoredTest.java | 8 ++--- ...p.java => FreightCarriersConfigGroup.java} | 6 ++-- .../carriers/carrier/CarrierUtils.java | 12 +++---- .../carriers/controler/CarrierModule.java | 4 +-- .../carriers/jsprit/MatsimJspritFactory.java | 4 +-- .../NetworkBasedTransportCostsFactory.java | 8 ++--- .../usecases/chessboard/RunChessboard.java | 8 ++--- ...va => FreightCarriersConfigGroupTest.java} | 18 +++++------ .../carriers/carrier/CarrierModuleTest.java | 10 +++--- .../EquilWithCarrierWithoutPersonsIT.java | 20 ++++++------ ...istanceConstraintFromVehiclesFileTest.java | 18 +++++------ .../jsprit/DistanceConstraintTest.java | 8 ++--- .../carriers/jsprit/IntegrationIT.java | 12 +++---- .../utils/CarrierControlerUtilsTest.java | 18 +++++------ .../RunFreightAnalysisEventBased.java | 8 ++--- .../org/matsim/core/config/ConfigAliases.java | 1 + 26 files changed, 156 insertions(+), 155 deletions(-) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{FreightConfigGroup.java => FreightCarriersConfigGroup.java} (97%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{FreightConfigGroupTest.java => FreightCarriersConfigGroupTest.java} (81%) diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java index f6a5931e786..2bf895c7417 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java @@ -27,7 +27,7 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.core.utils.geometry.CoordinateTransformation; @@ -235,7 +235,7 @@ public void setFixedNumberOfVehiclePerTypeAndLocation(int fixedNumberOfVehiclePe * Reads and create the carriers with reading the information from the csv file. * * @param scenario - * @param freightConfigGroup + * @param freightCarriersConfigGroup * @param csvLocationCarrier * @param polygonsInShape * @param defaultJspritIterations @@ -243,14 +243,14 @@ public void setFixedNumberOfVehiclePerTypeAndLocation(int fixedNumberOfVehiclePe * @param shapeCategory * @throws IOException */ - public static void readAndCreateCarrierFromCSV(Scenario scenario, FreightConfigGroup freightConfigGroup, + public static void readAndCreateCarrierFromCSV(Scenario scenario, FreightCarriersConfigGroup freightCarriersConfigGroup, Path csvLocationCarrier, Collection polygonsInShape, int defaultJspritIterations, CoordinateTransformation crsTransformationNetworkAndShape, String shapeCategory) throws IOException { Set allNewCarrierInformation = readCarrierInformation(csvLocationCarrier); - checkNewCarrier(allNewCarrierInformation, freightConfigGroup, scenario, polygonsInShape, shapeCategory); + checkNewCarrier(allNewCarrierInformation, freightCarriersConfigGroup, scenario, polygonsInShape, shapeCategory); log.info("The read carrier information from the csv are checked without errors."); - createNewCarrierAndAddVehicleTypes(scenario, allNewCarrierInformation, freightConfigGroup, polygonsInShape, + createNewCarrierAndAddVehicleTypes(scenario, allNewCarrierInformation, freightCarriersConfigGroup, polygonsInShape, defaultJspritIterations, crsTransformationNetworkAndShape); } @@ -306,13 +306,13 @@ else if (!record.get("fleetSize").isBlank()) * Checks if the read carrier information are consistent. * * @param allNewCarrierInformation - * @param freightConfigGroup + * @param freightCarriersConfigGroup * @param scenario * @param polygonsInShape * @param shapeCategory */ static void checkNewCarrier(Set allNewCarrierInformation, - FreightConfigGroup freightConfigGroup, Scenario scenario, Collection polygonsInShape, String shapeCategory) { + FreightCarriersConfigGroup freightCarriersConfigGroup, Scenario scenario, Collection polygonsInShape, String shapeCategory) { CarrierUtils.addOrGetCarriers(scenario); for (CarrierInformationElement carrierElement : allNewCarrierInformation) { @@ -322,7 +322,7 @@ static void checkNewCarrier(Set allNewCarrierInformat + " being loaded from the csv is already in the given Carrier file. It is not possible to add to an existing Carrier. Please check!"); CarrierVehicleTypes carrierVehicleTypes = new CarrierVehicleTypes(); new CarrierVehicleTypeReader(carrierVehicleTypes) - .readFile(freightConfigGroup.getCarriersVehicleTypesFile()); + .readFile(freightCarriersConfigGroup.getCarriersVehicleTypesFile()); if (carrierElement.getVehicleTypes() != null) for (String type : carrierElement.getVehicleTypes()) { if (!carrierVehicleTypes.getVehicleTypes().containsKey(Id.create(type, VehicleType.class))) @@ -409,20 +409,20 @@ static void checkNewCarrier(Set allNewCarrierInformat * * @param scenario * @param allNewCarrierInformation - * @param freightConfigGroup + * @param freightCarriersConfigGroup * @param polygonsInShape * @param defaultJspritIterations * @param crsTransformationNetworkAndShape */ static void createNewCarrierAndAddVehicleTypes(Scenario scenario, - Set allNewCarrierInformation, FreightConfigGroup freightConfigGroup, + Set allNewCarrierInformation, FreightCarriersConfigGroup freightCarriersConfigGroup, Collection polygonsInShape, int defaultJspritIterations, CoordinateTransformation crsTransformationNetworkAndShape) { Carriers carriers = CarrierUtils.addOrGetCarriers(scenario); CarrierVehicleTypes carrierVehicleTypes = new CarrierVehicleTypes(); CarrierVehicleTypes usedCarrierVehicleTypes = CarrierUtils.getCarrierVehicleTypes(scenario); - new CarrierVehicleTypeReader(carrierVehicleTypes).readFile(freightConfigGroup.getCarriersVehicleTypesFile()); + new CarrierVehicleTypeReader(carrierVehicleTypes).readFile(freightCarriersConfigGroup.getCarriersVehicleTypesFile()); for (CarrierInformationElement singleNewCarrier : allNewCarrierInformation) { if (singleNewCarrier.getVehicleTypes() == null) { diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java index c794c846c74..76b5e7d78ad 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java @@ -26,7 +26,7 @@ import org.matsim.api.core.v01.population.Population; import org.matsim.application.MATSimAppCommand; import org.matsim.application.options.ShpOptions; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.freight.carriers.carrier.CarrierPlanWriter; import org.matsim.freight.carriers.carrier.CarrierUtils; @@ -240,9 +240,9 @@ private Config prepareConfig(int lastMATSimIteration, String coordinateSystem) { config.controller().setLastIteration(lastMATSimIteration); config.global().setRandomSeed(4177); config.global().setCoordinateSystem(coordinateSystem); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setTravelTimeSliceWidth(1800); - freightConfigGroup.setTimeWindowHandling(FreightConfigGroup.TimeWindowHandling.enforceBeginnings); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setTravelTimeSliceWidth(1800); + freightCarriersConfigGroup.setTimeWindowHandling(FreightCarriersConfigGroup.TimeWindowHandling.enforceBeginnings); return config; } @@ -281,11 +281,11 @@ private static void setNetworkAndNetworkChangeEvents(Config config, String netwo */ private static void prepareVehicles(Config config, String vehicleTypesFileLocation) { - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); if (Objects.equals(vehicleTypesFileLocation, "")) throw new RuntimeException("No path to the vehicleTypes selected"); else { - freightConfigGroup.setCarriersVehicleTypesFile(vehicleTypesFileLocation); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(vehicleTypesFileLocation); log.info("Get vehicleTypes from: " + vehicleTypesFileLocation); } } @@ -306,8 +306,8 @@ private void createCarrier(Scenario scenario, CarrierInputOptions selectedCarrie String carriersFileLocation, Path csvLocationCarrier, Collection polygonsInShape, int defaultJspritIterations, CoordinateTransformation crsTransformationNetworkAndShape) throws IOException { - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), - FreightConfigGroup.class); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), + FreightCarriersConfigGroup.class); switch (selectedCarrierInputOption) { case addCSVDataToExistingCarrierFileData -> { // reads an existing carrier file and adds the information based on the read csv @@ -315,10 +315,10 @@ private void createCarrier(Scenario scenario, CarrierInputOptions selectedCarrie if (Objects.equals(carriersFileLocation, "")) throw new RuntimeException("No path to the carrier file selected"); else { - freightConfigGroup.setCarriersFile(carriersFileLocation); + freightCarriersConfigGroup.setCarriersFile(carriersFileLocation); CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); log.info("Load carriers from: " + carriersFileLocation); - CarrierReaderFromCSV.readAndCreateCarrierFromCSV(scenario, freightConfigGroup, csvLocationCarrier, + CarrierReaderFromCSV.readAndCreateCarrierFromCSV(scenario, freightCarriersConfigGroup, csvLocationCarrier, polygonsInShape, defaultJspritIterations, crsTransformationNetworkAndShape, shapeCategory); } } @@ -327,14 +327,14 @@ private void createCarrier(Scenario scenario, CarrierInputOptions selectedCarrie if (Objects.equals(carriersFileLocation, "")) throw new RuntimeException("No path to the carrier file selected"); else { - freightConfigGroup.setCarriersFile(carriersFileLocation); + freightCarriersConfigGroup.setCarriersFile(carriersFileLocation); CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); log.info("Load carriers from: " + carriersFileLocation); } } case createCarriersFromCSV -> // creates all carriers based on the given information in the read carrier csv - CarrierReaderFromCSV.readAndCreateCarrierFromCSV(scenario, freightConfigGroup, csvLocationCarrier, + CarrierReaderFromCSV.readAndCreateCarrierFromCSV(scenario, freightCarriersConfigGroup, csvLocationCarrier, polygonsInShape, defaultJspritIterations, crsTransformationNetworkAndShape, shapeCategory); default -> throw new RuntimeException("no method to create or read carrier selected."); } @@ -524,11 +524,11 @@ private static void solveSelectedSolution(OptionsOfVRPSolutions selectedSolution */ private static void runJsprit(Controler controler, boolean usingRangeRestriction) throws ExecutionException, InterruptedException { - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(controler.getConfig(), - FreightConfigGroup.class); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(controler.getConfig(), + FreightCarriersConfigGroup.class); if (usingRangeRestriction) - freightConfigGroup.setUseDistanceConstraintForTourPlanning( - FreightConfigGroup.UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption); + freightCarriersConfigGroup.setUseDistanceConstraintForTourPlanning( + FreightCarriersConfigGroup.UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption); CarrierUtils.runJsprit(controler.getScenario()); } } diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index b1ff889e89d..1ad20820155 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -38,7 +38,7 @@ import org.matsim.application.MATSimAppCommand; import org.matsim.application.options.ShpOptions; import org.matsim.application.options.ShpOptions.Index; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.controler.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; @@ -177,17 +177,17 @@ public Integer call() throws Exception { Scenario scenario = ScenarioUtils.loadScenario(config); NetworkUtils.runNetworkCleaner(scenario.getNetwork()); // e.g. for vulkaneifel network - FreightConfigGroup freightConfigGroup; + FreightCarriersConfigGroup freightCarriersConfigGroup; switch (usedCreationOption) { case useExistingCarrierFileWithSolution -> { log.info("Existing carriers (including carrier vehicle types ) should be set in the freight config group"); if (includeExistingModels) throw new Exception( "You set that existing models should included to the new model. This is only possible for a creation of the new carrier file and not by using an existing."); - freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - if (config.vehicles() != null && freightConfigGroup.getCarriersVehicleTypesFile() == null) - freightConfigGroup.setCarriersVehicleTypesFile(config.vehicles().getVehiclesFile()); - log.info("Load carriers from: " + freightConfigGroup.getCarriersFile()); + freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + if (config.vehicles() != null && freightCarriersConfigGroup.getCarriersVehicleTypesFile() == null) + freightCarriersConfigGroup.setCarriersVehicleTypesFile(config.vehicles().getVehiclesFile()); + log.info("Load carriers from: " + freightCarriersConfigGroup.getCarriersFile()); CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); } case useExistingCarrierFileWithoutSolution -> { @@ -195,10 +195,10 @@ public Integer call() throws Exception { if (includeExistingModels) throw new Exception( "You set that existing models should included to the new model. This is only possible for a creation of the new carrier file and not by using an existing."); - freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - if (config.vehicles() != null && freightConfigGroup.getCarriersVehicleTypesFile() == null) - freightConfigGroup.setCarriersVehicleTypesFile(config.vehicles().getVehiclesFile()); - log.info("Load carriers from: " + freightConfigGroup.getCarriersFile()); + freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + if (config.vehicles() != null && freightCarriersConfigGroup.getCarriersVehicleTypesFile() == null) + freightCarriersConfigGroup.setCarriersVehicleTypesFile(config.vehicles().getVehiclesFile()); + log.info("Load carriers from: " + freightCarriersConfigGroup.getCarriersFile()); CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); solveSeparatedVRPs(scenario, null); } diff --git a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java index 601339c14f0..7ac9c8b96ff 100644 --- a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java +++ b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java @@ -17,7 +17,7 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.application.options.ShpOptions; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.freight.carriers.carrier.CarrierUtils; @@ -48,9 +48,9 @@ public void carrierCreation() throws IOException { config.network().setInputFile( "https://raw.githubusercontent.com/matsim-org/matsim/master/examples/scenarios/freight-chessboard-9x9/grid9x9.xml"); Scenario scenario = ScenarioUtils.loadScenario(config); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), - FreightConfigGroup.class); - freightConfigGroup.setCarriersVehicleTypesFile(utils.getPackageInputDirectory() + "testVehicleTypes.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), + FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(utils.getPackageInputDirectory() + "testVehicleTypes.xml"); Path carrierCSVLocation = Path.of(utils.getPackageInputDirectory() + "testCarrierCSV.csv"); Path shapeFilePath = Path.of(utils.getPackageInputDirectory() + "testShape/testShape.shp"); ShpOptions shp = new ShpOptions(shapeFilePath, "WGS84", null); @@ -58,8 +58,8 @@ public void carrierCreation() throws IOException { Set allNewCarrierInformation = CarrierReaderFromCSV .readCarrierInformation(carrierCSVLocation); String shapeCategory = "Ortsteil"; - CarrierReaderFromCSV.checkNewCarrier(allNewCarrierInformation, freightConfigGroup, scenario, polygonsInShape, shapeCategory); - CarrierReaderFromCSV.createNewCarrierAndAddVehicleTypes(scenario, allNewCarrierInformation, freightConfigGroup, + CarrierReaderFromCSV.checkNewCarrier(allNewCarrierInformation, freightCarriersConfigGroup, scenario, polygonsInShape, shapeCategory); + CarrierReaderFromCSV.createNewCarrierAndAddVehicleTypes(scenario, allNewCarrierInformation, freightCarriersConfigGroup, polygonsInShape, 1, null); Assert.assertEquals(3, CarrierUtils.getCarriers(scenario).getCarriers().size()); Assert.assertTrue( diff --git a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java index 1a7f1c826e9..aaae423fdad 100644 --- a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java +++ b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java @@ -18,7 +18,7 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; import org.matsim.application.options.ShpOptions; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -74,9 +74,9 @@ public void demandCreation() throws IOException { config.network().setInputFile( "https://raw.githubusercontent.com/matsim-org/matsim-libs/master/examples/scenarios/freight-chessboard-9x9/grid9x9.xml"); Scenario scenario = ScenarioUtils.loadScenario(config); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), - FreightConfigGroup.class); - freightConfigGroup.setCarriersVehicleTypesFile(utils.getPackageInputDirectory() + "testVehicleTypes.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), + FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(utils.getPackageInputDirectory() + "testVehicleTypes.xml"); Path carrierCSVLocation = Path.of(utils.getPackageInputDirectory() + "testCarrierCSV.csv"); Path demandCSVLocation = Path.of(utils.getPackageInputDirectory() + "testDemandCSV.csv"); String shapeCategory = "Ortsteil"; @@ -90,7 +90,7 @@ public void demandCreation() throws IOException { // run methods Set allNewCarrierInformation = CarrierReaderFromCSV .readCarrierInformation(carrierCSVLocation); - CarrierReaderFromCSV.createNewCarrierAndAddVehicleTypes(scenario, allNewCarrierInformation, freightConfigGroup, + CarrierReaderFromCSV.createNewCarrierAndAddVehicleTypes(scenario, allNewCarrierInformation, freightCarriersConfigGroup, polygonsInShape, 1, null); Set demandInformation = DemandReaderFromCSV.readDemandInformation(demandCSVLocation); DemandReaderFromCSV.checkNewDemand(scenario, demandInformation, polygonsInShape, shapeCategory); diff --git a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java index 57dcb85040d..d0df6b80df3 100644 --- a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java +++ b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java @@ -25,7 +25,7 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; @@ -81,7 +81,7 @@ public void testMainRunAndResults() { Population population = null; String carriersWOSolutionFileLocation = null; String carriersWSolutionFileLocation = null; - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); for (File outputFiles : Objects.requireNonNull(Objects.requireNonNull(outputFolder.listFiles())[0].listFiles())) { @@ -92,12 +92,12 @@ public void testMainRunAndResults() { if (outputFiles.getName().contains("output_CarrierDemandWithPlans.xml")) carriersWSolutionFileLocation = outputFiles.getPath(); if (outputFiles.getName().contains("output_carriersVehicleTypes.xml.gz")) - freightConfigGroup.setCarriersVehicleTypesFile(outputFiles.getPath()); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(outputFiles.getPath()); } - freightConfigGroup.setCarriersFile(carriersWOSolutionFileLocation); + freightCarriersConfigGroup.setCarriersFile(carriersWOSolutionFileLocation); CarrierUtils.loadCarriersAccordingToFreightConfig(scenarioWOSolution); - freightConfigGroup.setCarriersFile(carriersWSolutionFileLocation); + freightCarriersConfigGroup.setCarriersFile(carriersWSolutionFileLocation); CarrierUtils.loadCarriersAccordingToFreightConfig(scenarioWSolution); assert population != null; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java index 54307fdb599..597b60800dd 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java @@ -22,7 +22,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -70,15 +70,15 @@ public void run(URL configUrl){ jointDemandConfigGroup.setFirstLegTraveltimeBufferFactor(1.5); jointDemandConfigGroup.setChangeCommercialJobOperatorInterval(2); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setTravelTimeSliceWidth(3600); - freightConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); - freightConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setTravelTimeSliceWidth(3600); + freightCarriersConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); + freightCarriersConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); prepareConfig(config); Scenario scenario = loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java index 15055c3fdf8..51c9cca832a 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java @@ -25,7 +25,7 @@ import org.matsim.contrib.commercialTrafficApplications.jointDemand.ChangeCommercialJobOperator; import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandConfigGroup; import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandModule; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -72,15 +72,15 @@ public void run(URL configUrl){ JointDemandConfigGroup jointDemandConfigGroup = ConfigUtils.addOrGetModule(config, JointDemandConfigGroup.class); jointDemandConfigGroup.setFirstLegTraveltimeBufferFactor(1.5); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setTravelTimeSliceWidth(3600); - freightConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); - freightConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setTravelTimeSliceWidth(3600); + freightCarriersConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); + freightCarriersConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); prepareConfig(config); Scenario scenario = loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java index 52c79f771b2..e5427252353 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java @@ -36,7 +36,7 @@ import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; import org.matsim.contrib.dvrp.run.DvrpConfigGroup; import org.matsim.contrib.dvrp.run.DvrpQSimComponents; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -85,7 +85,7 @@ public void run(URL configURL){ Scenario scenario = DrtControlerCreator.createScenarioWithDrtRouteFactory(config); ScenarioUtils.loadScenario(scenario); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightConfigGroup + CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) @@ -147,8 +147,8 @@ private static void loadConfigGroups(Config config) { JointDemandConfigGroup jointDemandConfigGroup = ConfigUtils.addOrGetModule(config, JointDemandConfigGroup.class); jointDemandConfigGroup.setFirstLegTraveltimeBufferFactor(1.5); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setCarriersFile("jointDemand_carriers_drt.xml"); - freightConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersFile("jointDemand_carriers_drt.xml"); + freightCarriersConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); } } diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java index 32c99abac38..c59c987d8a4 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java @@ -2,7 +2,7 @@ import org.junit.Test; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -17,9 +17,9 @@ public void runCommercialTrafficIT() { Config config = ConfigUtils.loadConfig("./scenarios/grid/jointDemand_config.xml"); config.controller().setLastIteration(5); ConfigUtils.addOrGetModule(config, JointDemandConfigGroup.class); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); - freightConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); + freightCarriersConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); Scenario scenario = ScenarioUtils.loadScenario(config); CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); Controler controler = new Controler(scenario); diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java index 3a829739ddc..323a7ac4ad3 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java @@ -27,7 +27,7 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Plan; import org.matsim.api.core.v01.population.PopulationFactory; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -50,9 +50,9 @@ public void setUp() { config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles); JointDemandConfigGroup jointDemandConfigGroup = ConfigUtils.addOrGetModule(config, JointDemandConfigGroup.class); jointDemandConfigGroup.setMaxJobScore(MAX_JOB_SCORE); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); - freightConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); + freightCarriersConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); scenario = ScenarioUtils.loadScenario(config); CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/FreightConfigGroup.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/FreightCarriersConfigGroup.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/FreightConfigGroup.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/FreightCarriersConfigGroup.java index 7c5da781595..1aed1a936f2 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/FreightConfigGroup.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/FreightCarriersConfigGroup.java @@ -28,9 +28,9 @@ import java.net.URL; import java.util.Map; -public class FreightConfigGroup extends ReflectiveConfigGroup { +public class FreightCarriersConfigGroup extends ReflectiveConfigGroup { - public static final String GROUPNAME="freight" ; + public static final String GROUPNAME="freightCarriers" ; private String carriersFile; static final String CARRIERS_FILE = "carriersFile"; @@ -58,7 +58,7 @@ public enum UseDistanceConstraintForTourPlanning {noDistanceConstraint, basedOnE private UseDistanceConstraintForTourPlanning useDistanceConstraintForTourPlanning = UseDistanceConstraintForTourPlanning.noDistanceConstraint; private static final String USE_DISTANCE_CONSTRAINT_DESC = "Use distance constraint within the tour planning phase. This does NOT ensure that the tours in MATSim will respect this limitation"; - public FreightConfigGroup() { + public FreightCarriersConfigGroup() { super(GROUPNAME); } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java index d298fa28881..6ff020fa015 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java @@ -36,7 +36,7 @@ import org.matsim.api.core.v01.population.Plan; import org.matsim.core.config.ConfigUtils; import org.matsim.core.utils.io.IOUtils; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkRouter; @@ -180,7 +180,7 @@ public static void setJspritIterations( Carrier carrier, int jspritIterations ) * @throws ExecutionException, InterruptedException */ public static void runJsprit(Scenario scenario) throws ExecutionException, InterruptedException{ - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( scenario.getConfig(), FreightConfigGroup.class ); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule( scenario.getConfig(), FreightCarriersConfigGroup.class ); final NetworkBasedTransportCosts netBasedCosts = NetworkBasedTransportCosts.Builder.newInstance( scenario.getNetwork(), getCarrierVehicleTypes(scenario).getVehicleTypes().values() ).build() ; @@ -209,7 +209,7 @@ public static void runJsprit(Scenario scenario) throws ExecutionException, Inter log.info("Start tour planning for " + carrier.getId() + " which has " + serviceCount + " services"); VehicleRoutingProblem problem = MatsimJspritFactory.createRoutingProblemBuilder(carrier, scenario.getNetwork()).setRoutingCost(netBasedCosts).build(); - VehicleRoutingAlgorithm algorithm = MatsimJspritFactory.loadOrCreateVehicleRoutingAlgorithm(scenario, freightConfigGroup, netBasedCosts, problem); + VehicleRoutingAlgorithm algorithm = MatsimJspritFactory.loadOrCreateVehicleRoutingAlgorithm(scenario, freightCarriersConfigGroup, netBasedCosts, problem); algorithm.getAlgorithmListeners().addListener(new StopWatch(), VehicleRoutingAlgorithmListeners.Priority.HIGH); int jspritIterations = getJspritIterations(carrier); @@ -317,13 +317,13 @@ public static CarrierVehicleTypes getCarrierVehicleTypes(Scenario scenario) { * @param scenario */ public static void loadCarriersAccordingToFreightConfig(Scenario scenario) { - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), FreightConfigGroup.class); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), FreightCarriersConfigGroup.class); CarrierVehicleTypes vehTypes = getCarrierVehicleTypes(scenario); - new CarrierVehicleTypeReader( vehTypes ).readURL( IOUtils.extendUrl(scenario.getConfig().getContext(), freightConfigGroup.getCarriersVehicleTypesFile()) ); + new CarrierVehicleTypeReader( vehTypes ).readURL( IOUtils.extendUrl(scenario.getConfig().getContext(), freightCarriersConfigGroup.getCarriersVehicleTypesFile()) ); Carriers carriers = addOrGetCarriers( scenario ); // also registers with scenario - new CarrierPlanXmlReader( carriers, vehTypes ).readURL( IOUtils.extendUrl(scenario.getConfig().getContext(), freightConfigGroup.getCarriersFile() ) ); + new CarrierPlanXmlReader( carriers, vehTypes ).readURL( IOUtils.extendUrl(scenario.getConfig().getContext(), freightCarriersConfigGroup.getCarriersFile() ) ); // new CarrierVehicleTypeLoader( carriers ).loadVehicleTypes( vehTypes ); } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java index f70f0ed7529..6835c4907af 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java @@ -36,7 +36,7 @@ import org.matsim.core.mobsim.qsim.AbstractQSimModule; import org.matsim.core.mobsim.qsim.components.QSimComponentsConfigGroup; import org.matsim.core.scoring.ScoringFunction; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import java.util.List; @@ -45,7 +45,7 @@ public final class CarrierModule extends AbstractModule { @Override public void install() { - FreightConfigGroup freightConfig = ConfigUtils.addOrGetModule( getConfig(), FreightConfigGroup.class ) ; + FreightCarriersConfigGroup freightConfig = ConfigUtils.addOrGetModule( getConfig(), FreightCarriersConfigGroup.class ) ; bind(Carriers.class).toProvider( new CarrierProvider() ).asEagerSingleton(); // needs to be eager since it is still scenario construction. kai, oct'19 // this is probably ok diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java index 90220dc3cba..57ebd6ecde0 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java @@ -52,7 +52,7 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.core.utils.io.IOUtils; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -731,7 +731,7 @@ public static CarrierPlan createPlan(Carrier carrier, VehicleRoutingProblemSolut * set in the freightConfigGroup. */ public static VehicleRoutingAlgorithm loadOrCreateVehicleRoutingAlgorithm(Scenario scenario, - FreightConfigGroup freightConfig, NetworkBasedTransportCosts netBasedCosts, VehicleRoutingProblem problem) { + FreightCarriersConfigGroup freightConfig, NetworkBasedTransportCosts netBasedCosts, VehicleRoutingProblem problem) { VehicleRoutingAlgorithm algorithm; final String vehicleRoutingAlgorithmFile = freightConfig.getVehicleRoutingAlgorithmFile(); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java index 3cb414f29d6..7e2c4f18cf6 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java @@ -26,7 +26,7 @@ import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.router.util.TravelTime; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.Carriers; import org.matsim.vehicles.VehicleType; @@ -53,8 +53,8 @@ public NetworkBasedTransportCostsFactory(Scenario scenario, Carriers carriers, M @Override public VRPTransportCosts createVRPTransportCosts() { - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, - FreightConfigGroup.class); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, + FreightCarriersConfigGroup.class); Set vehicleTypes = new HashSet<>(); carriers.getCarriers().values().forEach( @@ -63,7 +63,7 @@ public VRPTransportCosts createVRPTransportCosts() { NetworkBasedTransportCosts.Builder netBuilder = NetworkBasedTransportCosts.Builder .newInstance(scenario.getNetwork(), vehicleTypes); - netBuilder.setTimeSliceWidth(freightConfigGroup.getTravelTimeSliceWidth()); + netBuilder.setTimeSliceWidth(freightCarriersConfigGroup.getTravelTimeSliceWidth()); netBuilder.setTravelTime(travelTimes.get(TransportMode.car)); return netBuilder.build(); } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java index a610bea12fc..c7aef595ed1 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java @@ -45,7 +45,7 @@ import org.matsim.core.scoring.SumScoringFunction; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.controler.*; import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; @@ -65,9 +65,9 @@ public static void main(String[] args){ config = ConfigUtils.loadConfig( args ); } - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( config, FreightConfigGroup.class ); - freightConfigGroup.setCarriersFile("carrierPlans.xml"); - freightConfigGroup.setCarriersVehicleTypesFile("vehicleTypes.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule( config, FreightCarriersConfigGroup.class ); + freightCarriersConfigGroup.setCarriersFile("carrierPlans.xml"); + freightCarriersConfigGroup.setCarriersVehicleTypesFile("vehicleTypes.xml"); Scenario scenario = ScenarioUtils.loadScenario( config ) ; CarrierUtils.loadCarriersAccordingToFreightConfig( scenario ); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/FreightConfigGroupTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/FreightCarriersConfigGroupTest.java similarity index 81% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/FreightConfigGroupTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/FreightCarriersConfigGroupTest.java index f6207d38b87..9310bf5716c 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/FreightConfigGroupTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/FreightCarriersConfigGroupTest.java @@ -26,7 +26,7 @@ import org.matsim.core.config.Config; import org.matsim.core.config.ConfigReader; import org.matsim.core.config.ConfigUtils; -import org.matsim.freight.carriers.FreightConfigGroup.UseDistanceConstraintForTourPlanning; +import org.matsim.freight.carriers.FreightCarriersConfigGroup.UseDistanceConstraintForTourPlanning; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -36,23 +36,23 @@ /** * @author mrieser / Simunto */ -public class FreightConfigGroupTest { +public class FreightCarriersConfigGroupTest { @Test public void test_allParametersAreWrittenToXml() { - FreightConfigGroup freight = new FreightConfigGroup(); + FreightCarriersConfigGroup freight = new FreightCarriersConfigGroup(); Map params = freight.getParams(); - Assert.assertTrue(params.containsKey(FreightConfigGroup.CARRIERS_FILE)); - Assert.assertTrue(params.containsKey(FreightConfigGroup.CARRIERS_VEHICLE_TYPE)); - Assert.assertTrue(params.containsKey(FreightConfigGroup.VEHICLE_ROUTING_ALGORITHM)); - Assert.assertTrue(params.containsKey(FreightConfigGroup.TRAVEL_TIME_SLICE_WIDTH)); - Assert.assertTrue(params.containsKey(FreightConfigGroup.USE_DISTANCE_CONSTRAINT)); + Assert.assertTrue(params.containsKey(FreightCarriersConfigGroup.CARRIERS_FILE)); + Assert.assertTrue(params.containsKey(FreightCarriersConfigGroup.CARRIERS_VEHICLE_TYPE)); + Assert.assertTrue(params.containsKey(FreightCarriersConfigGroup.VEHICLE_ROUTING_ALGORITHM)); + Assert.assertTrue(params.containsKey(FreightCarriersConfigGroup.TRAVEL_TIME_SLICE_WIDTH)); + Assert.assertTrue(params.containsKey(FreightCarriersConfigGroup.USE_DISTANCE_CONSTRAINT)); } @Test public void test_configXmlCanBeParsed() { - FreightConfigGroup freight = new FreightConfigGroup(); + FreightCarriersConfigGroup freight = new FreightCarriersConfigGroup(); Config config = ConfigUtils.createConfig(freight); String xml = "\n" + diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java index 72768af0df4..d9eb1f9249d 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java @@ -32,7 +32,7 @@ import org.matsim.core.controler.Controler; import org.matsim.core.controler.OutputDirectoryHierarchy; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.controler.CarrierModule; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.freight.carriers.controler.CarrierStrategyManager; @@ -44,7 +44,7 @@ public class CarrierModuleTest { Controler controler; - FreightConfigGroup freightConfigGroup; + FreightCarriersConfigGroup freightCarriersConfigGroup; @Rule public MatsimTestUtils testUtils = new MatsimTestUtils(); @@ -67,9 +67,9 @@ public void setUp(){ config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles); config.controller().setWritePlansInterval(1); config.controller().setCreateGraphs(false); - freightConfigGroup = ConfigUtils.addOrGetModule( config, FreightConfigGroup.class ) ; - freightConfigGroup.setCarriersFile( testUtils.getClassInputDirectory() + "carrierPlansEquils.xml"); - freightConfigGroup.setCarriersVehicleTypesFile( testUtils.getClassInputDirectory() + "vehicleTypes.xml"); + freightCarriersConfigGroup = ConfigUtils.addOrGetModule( config, FreightCarriersConfigGroup.class ) ; + freightCarriersConfigGroup.setCarriersFile( testUtils.getClassInputDirectory() + "carrierPlansEquils.xml"); + freightCarriersConfigGroup.setCarriersVehicleTypesFile( testUtils.getClassInputDirectory() + "vehicleTypes.xml"); Scenario scenario = ScenarioUtils.loadScenario( config ); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java index 23a9792f17d..2f2241a3811 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java @@ -30,7 +30,7 @@ import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.AbstractModule; import org.matsim.core.controler.Controler; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.Carrier; import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.carrier.ScheduledTour; @@ -120,11 +120,11 @@ public void install() { @Test public void testScoringInSecondsWoTimeWindowEnforcement(){ setUp(); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( controler.getConfig(), FreightConfigGroup.class ); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule( controler.getConfig(), FreightCarriersConfigGroup.class ); if ( false ){ - freightConfigGroup.setTimeWindowHandling( FreightConfigGroup.TimeWindowHandling.enforceBeginnings ); + freightCarriersConfigGroup.setTimeWindowHandling( FreightCarriersConfigGroup.TimeWindowHandling.enforceBeginnings ); } else{ - freightConfigGroup.setTimeWindowHandling( FreightConfigGroup.TimeWindowHandling.ignore ); + freightCarriersConfigGroup.setTimeWindowHandling( FreightCarriersConfigGroup.TimeWindowHandling.ignore ); } controler.addOverridingModule( new CarrierModule( ) ); controler.addOverridingModule(new AbstractModule() { @@ -147,11 +147,11 @@ public void install() { @Test public void testScoringInSecondsWTimeWindowEnforcement(){ setUp(); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( controler.getConfig(), FreightConfigGroup.class ); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule( controler.getConfig(), FreightCarriersConfigGroup.class ); if ( true ){ - freightConfigGroup.setTimeWindowHandling( FreightConfigGroup.TimeWindowHandling.enforceBeginnings ); + freightCarriersConfigGroup.setTimeWindowHandling( FreightCarriersConfigGroup.TimeWindowHandling.enforceBeginnings ); } else{ - freightConfigGroup.setTimeWindowHandling( FreightConfigGroup.TimeWindowHandling.ignore ); + freightCarriersConfigGroup.setTimeWindowHandling( FreightCarriersConfigGroup.TimeWindowHandling.ignore ); } final CarrierModule carrierModule = new CarrierModule( ); controler.addOverridingModule( carrierModule ); @@ -175,11 +175,11 @@ public void install() { @Test public void testScoringInSecondsWithWithinDayRescheduling(){ setUp(); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( controler.getConfig(), FreightConfigGroup.class ); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule( controler.getConfig(), FreightCarriersConfigGroup.class ); if ( true ){ - freightConfigGroup.setTimeWindowHandling( FreightConfigGroup.TimeWindowHandling.enforceBeginnings ); + freightCarriersConfigGroup.setTimeWindowHandling( FreightCarriersConfigGroup.TimeWindowHandling.enforceBeginnings ); } else{ - freightConfigGroup.setTimeWindowHandling( FreightConfigGroup.TimeWindowHandling.ignore ); + freightCarriersConfigGroup.setTimeWindowHandling( FreightCarriersConfigGroup.TimeWindowHandling.ignore ); } CarrierModule carrierControler = new CarrierModule(); controler.addOverridingModule(carrierControler); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java index 072e4eaa88f..d0ee832e676 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java @@ -38,8 +38,8 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.FreightConfigGroup.UseDistanceConstraintForTourPlanning; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup.UseDistanceConstraintForTourPlanning; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; @@ -90,7 +90,7 @@ public final void CarrierSmallBatteryTest_Version1() throws ExecutionException, CarrierVehicleTypes allVehicleTypes = new CarrierVehicleTypes(); CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes(); - new CarrierVehicleTypeReader(allVehicleTypes).readFile(ConfigUtils.addOrGetModule(config, FreightConfigGroup.class).getCarriersVehicleTypesFile()); + new CarrierVehicleTypeReader(allVehicleTypes).readFile(ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class).getCarriersVehicleTypesFile()); //Filter for V1 vehicleTypes. for (VehicleType vehicleType : allVehicleTypes.getVehicleTypes().values()) { @@ -163,7 +163,7 @@ public final void CarrierLargeBatteryTest_Version2() throws ExecutionException, CarrierVehicleTypes allVehicleTypes = new CarrierVehicleTypes(); CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes(); - new CarrierVehicleTypeReader(allVehicleTypes).readFile(ConfigUtils.addOrGetModule(config, FreightConfigGroup.class).getCarriersVehicleTypesFile()); + new CarrierVehicleTypeReader(allVehicleTypes).readFile(ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class).getCarriersVehicleTypesFile()); //Filter for V1 vehicleTypes. for (VehicleType vehicleType : allVehicleTypes.getVehicleTypes().values()) { @@ -239,7 +239,7 @@ public final void Carrier2SmallBatteryTest_Version3() throws ExecutionException, CarrierVehicleTypes allVehicleTypes = new CarrierVehicleTypes(); CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes(); - new CarrierVehicleTypeReader(allVehicleTypes).readFile(ConfigUtils.addOrGetModule(config, FreightConfigGroup.class).getCarriersVehicleTypesFile()); + new CarrierVehicleTypeReader(allVehicleTypes).readFile(ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class).getCarriersVehicleTypesFile()); //Filter for V3 vehicleTypes. for (VehicleType vehicleType : allVehicleTypes.getVehicleTypes().values()) { @@ -320,7 +320,7 @@ public final void CarrierWithAdditionalDieselVehicleTest_Version4() throws Execu CarrierVehicleTypes allVehicleTypes = new CarrierVehicleTypes(); CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes(); - new CarrierVehicleTypeReader(allVehicleTypes).readFile(ConfigUtils.addOrGetModule(config, FreightConfigGroup.class).getCarriersVehicleTypesFile()); + new CarrierVehicleTypeReader(allVehicleTypes).readFile(ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class).getCarriersVehicleTypesFile()); //Filter for V4 vehicleTypes including diesel. for (VehicleType vehicleType : allVehicleTypes.getVehicleTypes().values()) { @@ -399,9 +399,9 @@ private void prepareConfig(Config config) { config.global().setRandomSeed(4177); config.controller().setOverwriteFileSetting(OverwriteFileSetting.overwriteExistingFiles); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setUseDistanceConstraintForTourPlanning(UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption); - freightConfigGroup.setCarriersVehicleTypesFile(testUtils.getPackageInputDirectory()+"/vehicleTypesForDCTest.xml"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setUseDistanceConstraintForTourPlanning(UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(testUtils.getPackageInputDirectory()+"/vehicleTypesForDCTest.xml"); } private static Carrier addTwoServicesToCarrier(Carrier carrier) { diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java index 8e3cc739bfe..36cc259e55b 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java @@ -38,8 +38,8 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.FreightConfigGroup; -import org.matsim.freight.carriers.FreightConfigGroup.UseDistanceConstraintForTourPlanning; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup.UseDistanceConstraintForTourPlanning; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; @@ -591,8 +591,8 @@ static void prepareConfig(Config config) { config.global().setRandomSeed(4177); config.controller().setOverwriteFileSetting(OverwriteFileSetting.overwriteExistingFiles); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setUseDistanceConstraintForTourPlanning(UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setUseDistanceConstraintForTourPlanning(UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption); } private static Carrier addTwoServicesToCarrier(Carrier carrier) { diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java index fc4fb97632f..dd4c763cbd2 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java @@ -36,7 +36,7 @@ import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; import org.matsim.testcases.MatsimTestUtils; @@ -57,11 +57,11 @@ public void testJsprit() throws ExecutionException, InterruptedException { Config config = ConfigUtils.createConfig(); config.global().setRandomSeed(4177); - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setCarriersFile(carrierFilename); - freightConfigGroup.setCarriersVehicleTypesFile(vehicleTypeFilename); - freightConfigGroup.setTravelTimeSliceWidth(24*3600); - freightConfigGroup.setTimeWindowHandling(FreightConfigGroup.TimeWindowHandling.enforceBeginnings); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersFile(carrierFilename); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(vehicleTypeFilename); + freightCarriersConfigGroup.setTravelTimeSliceWidth(24*3600); + freightCarriersConfigGroup.setTimeWindowHandling(FreightCarriersConfigGroup.TimeWindowHandling.enforceBeginnings); Scenario scenario = ScenarioUtils.createScenario(config); new MatsimNetworkReader(scenario.getNetwork()).readFile(networkFilename); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java index d36d266a853..afcfea39bcd 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java @@ -45,7 +45,7 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.*; import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; @@ -416,7 +416,7 @@ public void testRunJsprit_allInformationGiven(){ URL scenarioUrl = ExamplesUtils.getTestScenarioURL( "freight-chessboard-9x9" ) ; String vraFile= IOUtils.extendUrl(scenarioUrl, "algorithm_v2.xml" ).toString(); - FreightConfigGroup freightConfig = ConfigUtils.addOrGetModule( config, FreightConfigGroup.class ) ; + FreightCarriersConfigGroup freightConfig = ConfigUtils.addOrGetModule( config, FreightCarriersConfigGroup.class ) ; freightConfig.setVehicleRoutingAlgorithmFileFile(vraFile); Scenario scenario = ScenarioUtils.loadScenario(config); @@ -431,7 +431,7 @@ public void testRunJsprit_allInformationGiven(){ Assert.fail(); } - Assert.assertEquals(vraFile, ConfigUtils.addOrGetModule( controler.getConfig(), FreightConfigGroup.class ).getVehicleRoutingAlgorithmFile()); + Assert.assertEquals(vraFile, ConfigUtils.addOrGetModule( controler.getConfig(), FreightCarriersConfigGroup.class ).getVehicleRoutingAlgorithmFile()); } /** @@ -469,7 +469,7 @@ public void testRunJsprit_NoAlgortihmFileGiven(){ } catch (Exception e) { Assert.fail(); } - Assert.assertNull(ConfigUtils.addOrGetModule(scenario.getConfig(), FreightConfigGroup.class).getVehicleRoutingAlgorithmFile()); + Assert.assertNull(ConfigUtils.addOrGetModule(scenario.getConfig(), FreightCarriersConfigGroup.class).getVehicleRoutingAlgorithmFile()); } private Config prepareConfig(){ @@ -478,11 +478,11 @@ private Config prepareConfig(){ config.controller().setLastIteration(0); config.plans().setActivityDurationInterpretation(PlansConfigGroup.ActivityDurationInterpretation.tryEndTimeThenDuration ); //freight configstuff - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule(config, FreightConfigGroup.class); - freightConfigGroup.setCarriersFile(IOUtils.extendUrl(scenarioUrl, "singleCarrierFiveActivitiesWithoutRoutes.xml" ).toString() ); - freightConfigGroup.setCarriersVehicleTypesFile(IOUtils.extendUrl(scenarioUrl, "vehicleTypes.xml" ).toString() ); - freightConfigGroup.setTravelTimeSliceWidth(24*3600); - freightConfigGroup.setTimeWindowHandling(FreightConfigGroup.TimeWindowHandling.enforceBeginnings); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersFile(IOUtils.extendUrl(scenarioUrl, "singleCarrierFiveActivitiesWithoutRoutes.xml" ).toString() ); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(IOUtils.extendUrl(scenarioUrl, "vehicleTypes.xml" ).toString() ); + freightCarriersConfigGroup.setTravelTimeSliceWidth(24*3600); + freightCarriersConfigGroup.setTimeWindowHandling(FreightCarriersConfigGroup.TimeWindowHandling.enforceBeginnings); return config; } diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java index 600516537e4..b084710f861 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java @@ -24,7 +24,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.FreightConfigGroup; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.carrier.CarrierUtils; import org.matsim.freight.carriers.events.CarrierEventsReaders; import org.matsim.core.api.experimental.events.EventsManager; @@ -79,9 +79,9 @@ public void runAnalysis() throws IOException { config.eventsManager().setEstimatedNumberOfEvents(null); config.global().setNumberOfThreads(1); //freight settings - FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( config, FreightConfigGroup.class ) ; - freightConfigGroup.setCarriersFile( SIM_OUTPUT_PATH + "output_carriers.xml.gz"); - freightConfigGroup.setCarriersVehicleTypesFile(SIM_OUTPUT_PATH + "output_allVehicles.xml.gz"); + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule( config, FreightCarriersConfigGroup.class ) ; + freightCarriersConfigGroup.setCarriersFile( SIM_OUTPUT_PATH + "output_carriers.xml.gz"); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(SIM_OUTPUT_PATH + "output_allVehicles.xml.gz"); //Were to store the analysis output? String analysisOutputDirectory = ANALYSIS_OUTPUT_PATH; diff --git a/matsim/src/main/java/org/matsim/core/config/ConfigAliases.java b/matsim/src/main/java/org/matsim/core/config/ConfigAliases.java index cf5e449e302..a95ce30372e 100644 --- a/matsim/src/main/java/org/matsim/core/config/ConfigAliases.java +++ b/matsim/src/main/java/org/matsim/core/config/ConfigAliases.java @@ -31,6 +31,7 @@ public void addDefaultAliases() { this.addAlias("planscalcroute", "routing"); this.addAlias("strategy", "replanning"); this.addAlias("parallelEventHandling", "eventsManager"); + this.addAlias("freight", "freightCarriers"); this.addAlias("BrainExpBeta", "brainExpBeta", "scoring"); this.addAlias("PathSizeLogitBeta", "pathSizeLogitBeta", "scoring"); From a0cbda28e6b7a125c4e8bdc1a2fc9f2f090c7f8a Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Thu, 12 Oct 2023 23:13:31 +0200 Subject: [PATCH 4/8] move stuff from carriers.carrier package one level up --- .../CarrierReaderFromCSV.java | 23 +++-- .../DemandReaderFromCSV.java | 26 +++--- .../FreightDemandGeneration.java | 16 ++-- .../FreightDemandGenerationUtils.java | 10 +-- ...rateSmallScaleCommercialTrafficDemand.java | 59 +++++++------ .../SmallScaleCommercialTrafficUtils.java | 22 ++--- .../TrafficVolumeGeneration.java | 10 +-- .../CarrierReaderFromCSVTest.java | 28 +++--- .../DemandReaderFromCSVTest.java | 17 ++-- ...nerateSmallScaleCommercialTrafficTest.java | 14 +-- .../TrafficVolumeGenerationTest.java | 44 +++++----- .../ChangeCommercialJobOperator.java | 4 +- .../jointDemand/CommercialJobGenerator.java | 2 +- .../CommercialTrafficAnalysisListener.java | 4 +- .../jointDemand/CommercialTrafficChecker.java | 4 +- .../DefaultCommercialJobGenerator.java | 16 +--- .../jointDemand/JointDemandModule.java | 6 +- .../jointDemand/JointDemandUtils.java | 6 +- .../RunJointDemandCarToggleJspritExample.java | 4 +- .../jointDemand/ScoreCommercialJobs.java | 8 +- .../jointDemand/TourLengthAnalyzer.java | 2 +- .../jointDemand/TourPlanning.java | 10 +-- .../examples/RunJointDemandCarExample.java | 4 +- .../examples/RunJointDemandDRTExample.java | 4 +- .../ChangeCommercialJobOperatorTest.java | 4 +- .../CommercialTrafficIntegrationTest.java | 4 +- .../IsTheRightCustomerScoredTest.java | 9 +- .../jointDemand/TestScenarioGeneration.java | 14 +-- .../carriers/{carrier => }/Carrier.java | 2 +- .../{carrier => }/CarrierCapabilities.java | 2 +- .../{carrier => }/CarrierConstants.java | 2 +- .../carriers/{carrier => }/CarrierImpl.java | 6 +- .../carriers/{carrier => }/CarrierPlan.java | 6 +- .../{carrier => }/CarrierPlanReaderV1.java | 8 +- .../{carrier => }/CarrierPlanWriter.java | 2 +- .../{carrier => }/CarrierPlanXmlParserV2.java | 14 +-- .../CarrierPlanXmlParserV2_1.java | 14 +-- .../{carrier => }/CarrierPlanXmlReader.java | 2 +- .../{carrier => }/CarrierPlanXmlWriterV1.java | 2 +- .../{carrier => }/CarrierPlanXmlWriterV2.java | 10 +-- .../CarrierPlanXmlWriterV2_1.java | 4 +- .../{carrier => }/CarrierService.java | 2 +- .../{carrier => }/CarrierShipment.java | 2 +- .../{carrier => }/CarrierVehicle.java | 2 +- .../{carrier => }/CarrierVehicleType.java | 4 +- .../CarrierVehicleTypeLoader.java | 2 +- .../CarrierVehicleTypeReader.java | 2 +- .../CarrierVehicleTypeReaderV1.java | 2 +- .../CarrierVehicleTypeWriter.java | 2 +- .../CarrierVehicleTypeWriterV1.java | 2 +- .../{carrier => }/CarrierVehicleTypes.java | 2 +- .../carriers/{carrier => }/Carriers.java | 2 +- .../CarrierUtils.java => CarriersUtils.java} | 9 +- .../carriers/{carrier => }/ScheduledTour.java | 2 +- .../carriers/{carrier => }/TimeWindow.java | 2 +- .../freight/carriers/{carrier => }/Tour.java | 2 +- .../carriers/controler/CarrierAgent.java | 10 +-- .../controler/CarrierAgentTracker.java | 4 +- .../controler/CarrierControlerListener.java | 4 +- .../controler/CarrierDriverAgent.java | 2 +- .../carriers/controler/CarrierModule.java | 7 +- .../controler/CarrierReRouteVehicles.java | 4 +- .../CarrierScoringFunctionFactory.java | 2 +- .../controler/CarrierStrategyManager.java | 4 +- .../controler/CarrierStrategyManagerImpl.java | 4 +- .../CarrierTimeAllocationMutator.java | 4 +- .../CarrierTimeAndSpaceTourRouter.java | 10 +-- .../controler/CarrierVehicleReRouter.java | 6 +- .../carriers/controler/FreightActivity.java | 2 +- .../controler/FreightAgentSource.java | 8 +- .../WithinDayActivityReScheduling.java | 4 +- .../carriers/events/AbstractCarrierEvent.java | 2 +- .../carriers/events/CarrierEventCreator.java | 4 +- .../events/CarrierServiceEndEvent.java | 4 +- .../events/CarrierServiceEndEventCreator.java | 8 +- .../events/CarrierServiceStartEvent.java | 4 +- .../CarrierServiceStartEventCreator.java | 8 +- .../CarrierShipmentDeliveryEndEvent.java | 4 +- ...arrierShipmentDeliveryEndEventCreator.java | 8 +- .../CarrierShipmentDeliveryStartEvent.java | 4 +- ...rierShipmentDeliveryStartEventCreator.java | 8 +- .../events/CarrierShipmentPickupEndEvent.java | 4 +- .../CarrierShipmentPickupEndEventCreator.java | 8 +- .../CarrierShipmentPickupStartEvent.java | 4 +- ...arrierShipmentPickupStartEventCreator.java | 8 +- .../carriers/events/CarrierTourEndEvent.java | 4 +- .../events/CarrierTourEndEventCreator.java | 6 +- .../events/CarrierTourStartEvent.java | 4 +- .../events/CarrierTourStartEventCreator.java | 6 +- .../freight/carriers/events/HasCarrierId.java | 2 +- .../Vehicle2CarrierEventHandler.java | 2 +- .../carriers/jsprit/DistanceConstraint.java | 2 +- .../carriers/jsprit/MatsimJspritFactory.java | 29 +++---- .../jsprit/NetworkBasedTransportCosts.java | 2 +- .../NetworkBasedTransportCostsFactory.java | 2 +- .../carriers/jsprit/NetworkRouter.java | 4 +- .../usecases/analysis/CarrierScoreStats.java | 6 +- .../CarrierScoringFunctionFactoryImpl.java | 6 +- .../chessboard/CarrierTravelDisutilities.java | 2 +- .../chessboard/FreightScenarioCreator.java | 22 ++--- .../chessboard/InitialCarrierPlanCreator.java | 2 +- .../usecases/chessboard/PlotPlans.java | 2 +- .../usecases/chessboard/RunChessboard.java | 9 +- .../RunPassengerAlongWithCarriers.java | 4 +- ...PlanAndOptimizeItsVehicleRouteFactory.java | 6 +- .../{carrier => }/CarrierModuleTest.java | 5 +- .../CarrierPlanReaderV1Test.java | 5 +- .../CarrierPlanXmlReaderV2Test.java | 19 +++-- .../CarrierPlanXmlReaderV2WithDtdTest.java | 11 +-- .../CarrierPlanXmlWriterV1Test.java | 3 +- .../CarrierPlanXmlWriterV2Test.java | 15 ++-- .../CarrierPlanXmlWriterV2_1Test.java | 21 ++--- .../CarrierReadWriteV2_1Test.java | 3 +- .../CarrierVehicleTypeLoaderTest.java | 7 +- .../CarrierVehicleTypeReaderTest.java | 2 +- .../{carrier => }/CarrierVehicleTypeTest.java | 5 +- .../CarrierVehicleTypeWriterTest.java | 5 +- ...rUtilsTest.java => CarriersUtilsTest.java} | 23 ++--- .../EquilWithCarrierWithPersonsIT.java | 4 +- .../EquilWithCarrierWithoutPersonsIT.java | 24 +++--- ...istanceConstraintFromVehiclesFileTest.java | 37 ++++---- .../jsprit/DistanceConstraintTest.java | 53 ++++++------ .../carriers/jsprit/FixedCostsTest.java | 20 ++--- .../carriers/jsprit/IntegrationIT.java | 15 ++-- .../jsprit/MatsimTransformerTest.java | 20 ++--- .../freight/carriers/jsprit/SkillsIT.java | 32 +++---- ...istanceScoringFunctionFactoryForTests.java | 10 +-- .../ScoringFunctionFactoryForTests.java | 10 +-- .../StrategyManagerFactoryForTests.java | 4 +- .../TimeScoringFunctionFactoryForTests.java | 10 +-- .../utils/CarrierControlerUtilsIT.java | 20 ++--- .../utils/CarrierControlerUtilsTest.java | 85 +++++++++---------- .../CarrierModuleTest/carrierPlansEquils.xml | 0 .../CarrierModuleTest/network.xml | 0 .../CarrierModuleTest/plans100.xml | 0 .../CarrierModuleTest/vehicleTypes.xml | 0 .../carrierPlansEquils.xml | 0 ...carrierPlansEquils_unscored_unselected.xml | 0 .../carrierPlansEquils.xml | 0 .../carrierPlansEquilsFiniteFleet.xml | 0 .../carrierPlansEquilsFiniteFleetWithDtd.xml | 0 .../carrierPlansEquilsWithDtd.xml | 0 .../carrierPlansEquils.xml | 0 .../carrierPlansEquils.xml | 0 .../carrierPlansEquilsWritten.xml | 0 .../carrierPlansEquils.xml | 0 .../CarrierReadWriteV2_1Test/carriers.xml | 0 .../CarrierReadWriteV2_1Test/vehicles.xml | 0 .../carrierPlansEquils.xml | 0 .../vehicleTypes.xml | 0 .../vehicleTypes.xml | 0 .../vehicleTypes_v2.xml | 0 .../carrierVehicleTypes_v1.xsd | 0 .../carrierVehicleTypes_v2.xsd | 0 .../vehicleTypes.xml | 0 .../{carrier => }/vehicleTypes_v2.xml | 0 .../freightreceiver/ReceiverAgent.java | 8 +- .../ReceiverControlerListener.java | 10 +-- .../ReceiverCostAllocation.java | 2 +- ...ReceiverCostAllocationEqualProportion.java | 2 +- .../ReceiverCostAllocationFixed.java | 2 +- .../freightreceiver/ReceiverModule.java | 2 +- .../freightreceiver/ReceiverOrder.java | 2 +- .../contrib/freightreceiver/ReceiverPlan.java | 4 +- .../freightreceiver/ReceiverScoreStats.java | 4 +- ...iverTriggersCarrierReplanningListener.java | 6 +- .../freightreceiver/ReceiverUtils.java | 2 +- .../freightreceiver/ReceiversReaderV2.java | 4 +- .../freightreceiver/ReceiversWriter.java | 2 +- .../ReceiversWriterHandler.java | 2 +- .../ReceiversWriterHandlerImplV1.java | 2 +- .../ReceiversWriterHandlerImplV2.java | 2 +- ...UsecasesCarrierScoringFunctionFactory.java | 2 +- .../collaboration/Coalition.java | 2 +- .../collaboration/CollaborationUtils.java | 8 +- .../collaboration/CollaborationUtilsNew.java | 2 +- .../collaboration/MutableCoalition.java | 2 +- .../collaboration/TimeWindowMutator.java | 2 +- .../TimeWindowUpperBoundMutator.java | 2 +- .../ReceiverChessboardScenario.java | 16 ++-- ...iverChessboardWithEqualProportionCost.java | 6 +- ...eceiverChessboardWithFixedCarrierCost.java | 6 +- .../freightreceiver/ReceiversReaderTest.java | 4 +- .../analysis/CarrierLoadAnalysis.java | 2 +- .../analysis/CarrierPlanAnalysis.java | 4 +- .../analysis/FreightAnalysisEventHandler.java | 8 +- .../FreightAnalysisServiceTracking.java | 2 +- .../FreightAnalysisShipmentTracking.java | 4 +- .../FreightAnalysisVehicleTracking.java | 2 +- ...tTimeAndDistanceAnalysisEventsHandler.java | 8 +- .../analysis/analysis/RunFreightAnalysis.java | 6 +- .../RunFreightAnalysisEventBased.java | 8 +- .../MyFreightVehicleTrackerEventHandler.java | 3 +- .../MyServiceTrackerEventHandler.java | 7 +- .../MyShipmentTrackerEventHandler.java | 7 +- .../analysis/RunFreightAnalysisIT.java | 2 +- .../RunFreightAnalysisWithShipmentTest.java | 8 +- 197 files changed, 699 insertions(+), 710 deletions(-) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/Carrier.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierCapabilities.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierConstants.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierImpl.java (96%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlan.java (96%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanReaderV1.java (97%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanWriter.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlParserV2.java (97%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlParserV2_1.java (97%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlReader.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV1.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV2.java (97%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV2_1.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierService.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierShipment.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicle.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleType.java (97%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeLoader.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeReader.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeReaderV1.java (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeWriter.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeWriterV1.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypes.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/Carriers.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier/CarrierUtils.java => CarriersUtils.java} (99%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/ScheduledTour.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/TimeWindow.java (98%) rename contribs/freight/src/main/java/org/matsim/freight/carriers/{carrier => }/Tour.java (99%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierModuleTest.java (97%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanReaderV1Test.java (98%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlReaderV2Test.java (91%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlReaderV2WithDtdTest.java (92%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV1Test.java (97%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV2Test.java (91%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV2_1Test.java (89%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierReadWriteV2_1Test.java (97%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeLoaderTest.java (93%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeReaderTest.java (99%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeTest.java (97%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeWriterTest.java (90%) rename contribs/freight/src/test/java/org/matsim/freight/carriers/{carrier/CarrierUtilsTest.java => CarriersUtilsTest.java} (86%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierModuleTest/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierModuleTest/network.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierModuleTest/plans100.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierModuleTest/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanReaderV1Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierReadWriteV2_1Test/carriers.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierReadWriteV2_1Test/vehicles.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeLoaderTest/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeReaderTest/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/CarrierVehicleTypeWriterTest/vehicleTypes.xml (100%) rename contribs/freight/test/input/org/matsim/freight/carriers/{carrier => }/vehicleTypes_v2.xml (100%) diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java index 2bf895c7417..b8dc592921e 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSV.java @@ -27,9 +27,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -314,9 +313,9 @@ else if (!record.get("fleetSize").isBlank()) static void checkNewCarrier(Set allNewCarrierInformation, FreightCarriersConfigGroup freightCarriersConfigGroup, Scenario scenario, Collection polygonsInShape, String shapeCategory) { - CarrierUtils.addOrGetCarriers(scenario); + CarriersUtils.addOrGetCarriers(scenario); for (CarrierInformationElement carrierElement : allNewCarrierInformation) { - if (CarrierUtils.getCarriers(scenario).getCarriers() + if (CarriersUtils.getCarriers(scenario).getCarriers() .containsKey(Id.create(carrierElement.getName(), Carrier.class))) throw new RuntimeException("The Carrier " + carrierElement.getName() + " being loaded from the csv is already in the given Carrier file. It is not possible to add to an existing Carrier. Please check!"); @@ -419,9 +418,9 @@ static void createNewCarrierAndAddVehicleTypes(Scenario scenario, Collection polygonsInShape, int defaultJspritIterations, CoordinateTransformation crsTransformationNetworkAndShape) { - Carriers carriers = CarrierUtils.addOrGetCarriers(scenario); + Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); CarrierVehicleTypes carrierVehicleTypes = new CarrierVehicleTypes(); - CarrierVehicleTypes usedCarrierVehicleTypes = CarrierUtils.getCarrierVehicleTypes(scenario); + CarrierVehicleTypes usedCarrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); new CarrierVehicleTypeReader(carrierVehicleTypes).readFile(freightCarriersConfigGroup.getCarriersVehicleTypesFile()); for (CarrierInformationElement singleNewCarrier : allNewCarrierInformation) { @@ -436,11 +435,11 @@ static void createNewCarrierAndAddVehicleTypes(Scenario scenario, if (carrierCapabilities.getFleetSize() == null && singleNewCarrier.getFleetSize() != null) carrierCapabilities.setFleetSize(singleNewCarrier.getFleetSize()); if (singleNewCarrier.getJspritIterations() > 0) - CarrierUtils.setJspritIterations(thisCarrier, singleNewCarrier.getJspritIterations()); + CarriersUtils.setJspritIterations(thisCarrier, singleNewCarrier.getJspritIterations()); } else { - thisCarrier = CarrierUtils.createCarrier(Id.create(singleNewCarrier.getName(), Carrier.class)); + thisCarrier = CarriersUtils.createCarrier(Id.create(singleNewCarrier.getName(), Carrier.class)); if (singleNewCarrier.getJspritIterations() > 0) - CarrierUtils.setJspritIterations(thisCarrier, singleNewCarrier.getJspritIterations()); + CarriersUtils.setJspritIterations(thisCarrier, singleNewCarrier.getJspritIterations()); carrierCapabilities = CarrierCapabilities.Builder.newInstance() .setFleetSize(singleNewCarrier.getFleetSize()).build(); carriers.addCarrier(thisCarrier); @@ -496,8 +495,8 @@ static void createNewCarrierAndAddVehicleTypes(Scenario scenario, thisCarrier.setCarrierCapabilities(carrierCapabilities); } for (Carrier carrier : carriers.getCarriers().values()) { - if (CarrierUtils.getJspritIterations(carrier) == Integer.MIN_VALUE) { - CarrierUtils.setJspritIterations(carrier, defaultJspritIterations); + if (CarriersUtils.getJspritIterations(carrier) == Integer.MIN_VALUE) { + CarriersUtils.setJspritIterations(carrier, defaultJspritIterations); log.warn("The jspritIterations are now set to the default value of " + defaultJspritIterations + " in this simulation!"); } diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java index e56dc00acb7..8c1f113a6d0 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java @@ -31,7 +31,7 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.core.network.NetworkUtils; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.core.utils.geometry.geotools.MGC; @@ -647,7 +647,7 @@ else if (samplingOption.equals("changeDemandOnLocation")) { .setCapacityDemand(demandForThisLink).setServiceDuration(serviceTime) .setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow()) .build(); - CarrierUtils.getCarriers(scenario).getCarriers() + CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices() .put(thisService.getId(), thisService); } @@ -687,7 +687,7 @@ else if (samplingOption.equals("changeDemandOnLocation")) { .setCapacityDemand(demandForThisLink).setServiceDuration(serviceTime) .setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow()) .build(); - CarrierUtils.getCarriers(scenario).getCarriers().values().iterator().next().getServices() + CarriersUtils.getCarriers(scenario).getCarriers().values().iterator().next().getServices() .put(thisService.getId(), thisService); } distributedDemand = distributedDemand + demandForThisLink; @@ -739,7 +739,7 @@ else if (samplingOption.equals("changeDemandOnLocation")) { .setCapacityDemand(demandForThisLink).setServiceDuration(serviceTime) .setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow()) .build(); - CarrierUtils.getCarriers(scenario).getCarriers() + CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices() .put(thisService.getId(), thisService); } @@ -918,7 +918,7 @@ else if (population == null) .setPickupServiceTime(serviceTimePickup).setPickupTimeWindow(timeWindowPickup) .setDeliveryServiceTime(serviceTimeDelivery).setDeliveryTimeWindow(timeWindowDelivery) .build(); - CarrierUtils.getCarriers(scenario).getCarriers() + CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getShipments() .put(thisShipment.getId(), thisShipment); } @@ -1020,7 +1020,7 @@ else if (numberOfPickupLocations != null) { .setPickupServiceTime(serviceTimePickup).setPickupTimeWindow(timeWindowPickup) .setDeliveryServiceTime(serviceTimeDelivery).setDeliveryTimeWindow(timeWindowDelivery) .build(); - CarrierUtils.getCarriers(scenario).getCarriers() + CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)) .getShipments().put(thisShipment.getId(), thisShipment); } @@ -1077,7 +1077,7 @@ else if (numberOfPickupLocations != null) { .newInstance(idNewShipment, linkPickup.getId(), linkDelivery.getId(), demandForThisLink) .setPickupServiceTime(serviceTimePickup).setPickupTimeWindow(timeWindowPickup) .setDeliveryServiceTime(serviceTimeDelivery).setDeliveryTimeWindow(timeWindowDelivery).build(); - CarrierUtils.getCarriers(scenario).getCarriers() + CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getShipments() .put(thisShipment.getId(), thisShipment); distributedDemand = distributedDemand + demandForThisLink; @@ -1102,10 +1102,10 @@ private static String createJobId(Scenario scenario, DemandInformationElement ne String newJobId; if (linkDelivery != null) { newJobId = "Shipment_" + linkPickup + "_" + linkDelivery; - if (CarrierUtils.getCarriers(scenario).getCarriers() + if (CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getShipments() .containsKey(Id.create(newJobId, CarrierShipment.class))) { - for (int x = 1; CarrierUtils.getCarriers(scenario).getCarriers() + for (int x = 1; CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getShipments() .containsKey(Id.create(newJobId, CarrierShipment.class)); x++) { newJobId = "Shipment_" + linkPickup + "_" + linkDelivery + "_" + x; @@ -1113,10 +1113,10 @@ private static String createJobId(Scenario scenario, DemandInformationElement ne } } else { newJobId = "Service_" + linkPickup; - if (CarrierUtils.getCarriers(scenario).getCarriers() + if (CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices() .containsKey(Id.create(newJobId, CarrierShipment.class))) { - for (int x = 1; CarrierUtils.getCarriers(scenario).getCarriers() + for (int x = 1; CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices() .containsKey(Id.create(newJobId, CarrierShipment.class)); x++) { newJobId = "Service_" + linkPickup + "_" + x; @@ -1142,7 +1142,7 @@ private static void reduceNumberOfJobsIfSameCharacteristics(Scenario scenario, if (newDemandInformationElement.getTypeOfDemand().equals("shipment")) { HashMap, CarrierShipment> shipmentsToRemove = new HashMap, CarrierShipment>(); ArrayList shipmentsToAdd = new ArrayList(); - Carrier thisCarrier = CarrierUtils.getCarriers(scenario).getCarriers() + Carrier thisCarrier = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)); for (Id baseShipmentId : thisCarrier.getShipments().keySet()) { if (!shipmentsToRemove.containsKey(baseShipmentId)) { @@ -1193,7 +1193,7 @@ private static void reduceNumberOfJobsIfSameCharacteristics(Scenario scenario, if (newDemandInformationElement.getTypeOfDemand().equals("service")) { HashMap, CarrierService> servicesToRemove = new HashMap, CarrierService>(); ArrayList servicesToAdd = new ArrayList(); - Carrier thisCarrier = CarrierUtils.getCarriers(scenario).getCarriers() + Carrier thisCarrier = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)); for (Id baseServiceId : thisCarrier.getServices().keySet()) { if (!servicesToRemove.containsKey(baseServiceId)) { diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java index 76b5e7d78ad..2f52ac86d17 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGeneration.java @@ -27,10 +27,10 @@ import org.matsim.application.MATSimAppCommand; import org.matsim.application.options.ShpOptions; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlanWriter; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierPlanWriter; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.controler.CarrierModule; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.freight.carriers.usecases.chessboard.CarrierScoringFunctionFactoryImpl; @@ -316,7 +316,7 @@ private void createCarrier(Scenario scenario, CarrierInputOptions selectedCarrie throw new RuntimeException("No path to the carrier file selected"); else { freightCarriersConfigGroup.setCarriersFile(carriersFileLocation); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); log.info("Load carriers from: " + carriersFileLocation); CarrierReaderFromCSV.readAndCreateCarrierFromCSV(scenario, freightCarriersConfigGroup, csvLocationCarrier, polygonsInShape, defaultJspritIterations, crsTransformationNetworkAndShape, shapeCategory); @@ -328,7 +328,7 @@ private void createCarrier(Scenario scenario, CarrierInputOptions selectedCarrie throw new RuntimeException("No path to the carrier file selected"); else { freightCarriersConfigGroup.setCarriersFile(carriersFileLocation); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); log.info("Load carriers from: " + carriersFileLocation); } } @@ -415,7 +415,7 @@ private void createDemand(DemandGenerationOptions selectedDemandGenerationOption case useDemandFromCarrierFile -> { // use only the given demand of the read carrier file boolean oneCarrierHasJobs = false; - for (Carrier carrier : CarrierUtils.getCarriers(scenario).getCarriers().values()) + for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) if (carrier.getServices().isEmpty() && carrier.getShipments().isEmpty()) log.warn(carrier.getId().toString() + " has no jobs which can be used"); else { @@ -529,6 +529,6 @@ private static void runJsprit(Controler controler, boolean usingRangeRestriction if (usingRangeRestriction) freightCarriersConfigGroup.setUseDistanceConstraintForTourPlanning( FreightCarriersConfigGroup.UseDistanceConstraintForTourPlanning.basedOnEnergyConsumption); - CarrierUtils.runJsprit(controler.getScenario()); + CarriersUtils.runJsprit(controler.getScenario()); } } diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java index ec1aa7f3b83..b2d70951be8 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/FreightDemandGenerationUtils.java @@ -29,10 +29,10 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.*; import org.matsim.application.options.ShpOptions; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierService; -import org.matsim.freight.carriers.carrier.CarrierShipment; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierService; +import org.matsim.freight.carriers.CarrierShipment; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.core.controler.Controler; import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.core.utils.geometry.geotools.MGC; @@ -103,7 +103,7 @@ static void createDemandLocationsFile(Controler controler) { try (FileWriter writer = new FileWriter(file, true)) { writer.write("id x y type ServiceLocation pickupLocation deliveryLocation\n"); - for (Carrier thisCarrier : CarrierUtils.getCarriers(controler.getScenario()).getCarriers().values()) { + for (Carrier thisCarrier : CarriersUtils.getCarriers(controler.getScenario()).getCarriers().values()) { for (CarrierService thisService : thisCarrier.getServices().values()) { Coord coord = FreightDemandGenerationUtils .getCoordOfMiddlePointOfLink(network.getLinks().get(thisService.getLocationLinkId())); diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 1ad20820155..0f788f5f9d6 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -38,10 +38,9 @@ import org.matsim.application.MATSimAppCommand; import org.matsim.application.options.ShpOptions; import org.matsim.application.options.ShpOptions.Index; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.controler.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.carriers.usecases.chessboard.CarrierTravelDisutilities; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -188,7 +187,7 @@ public Integer call() throws Exception { if (config.vehicles() != null && freightCarriersConfigGroup.getCarriersVehicleTypesFile() == null) freightCarriersConfigGroup.setCarriersVehicleTypesFile(config.vehicles().getVehiclesFile()); log.info("Load carriers from: " + freightCarriersConfigGroup.getCarriersFile()); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); } case useExistingCarrierFileWithoutSolution -> { log.info("Existing carriers (including carrier vehicle types ) should be set in the freight config group"); @@ -199,7 +198,7 @@ public Integer call() throws Exception { if (config.vehicles() != null && freightCarriersConfigGroup.getCarriersVehicleTypesFile() == null) freightCarriersConfigGroup.setCarriersVehicleTypesFile(config.vehicles().getVehiclesFile()); log.info("Load carriers from: " + freightCarriersConfigGroup.getCarriersFile()); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); solveSeparatedVRPs(scenario, null); } default -> { @@ -237,20 +236,20 @@ public Integer call() throws Exception { default -> throw new RuntimeException("No traffic type selected."); } if (config.controller().getRunId() == null) - new CarrierPlanWriter(CarrierUtils.addOrGetCarriers(scenario)) + new CarrierPlanWriter(CarriersUtils.addOrGetCarriers(scenario)) .write(scenario.getConfig().controller().getOutputDirectory() + "/output_CarrierDemand.xml"); else - new CarrierPlanWriter(CarrierUtils.addOrGetCarriers(scenario)) + new CarrierPlanWriter(CarriersUtils.addOrGetCarriers(scenario)) .write(scenario.getConfig().controller().getOutputDirectory() + "/" + scenario.getConfig().controller().getRunId() + ".output_CarrierDemand.xml"); solveSeparatedVRPs(scenario, regionLinksMap); } } if (config.controller().getRunId() == null) - new CarrierPlanWriter(CarrierUtils.addOrGetCarriers(scenario)).write( + new CarrierPlanWriter(CarriersUtils.addOrGetCarriers(scenario)).write( scenario.getConfig().controller().getOutputDirectory() + "/output_CarrierDemandWithPlans.xml"); else - new CarrierPlanWriter(CarrierUtils.addOrGetCarriers(scenario)) + new CarrierPlanWriter(CarriersUtils.addOrGetCarriers(scenario)) .write( scenario.getConfig().controller().getOutputDirectory() + "/" + scenario.getConfig().controller().getRunId() + ".output_CarrierDemandWithPlans.xml"); Controler controler = prepareControler(scenario); @@ -270,11 +269,11 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map, Carrier> allCarriers = new HashMap<>( - CarrierUtils.getCarriers(originalScenario).getCarriers()); + CarriersUtils.getCarriers(originalScenario).getCarriers()); Map, Carrier> solvedCarriers = new HashMap<>(); List> keyList = new ArrayList<>(allCarriers.keySet()); - CarrierUtils.getCarriers(originalScenario).getCarriers().values().forEach(carrier -> { - if (CarrierUtils.getJspritIterations(carrier) == 0) { + CarriersUtils.getCarriers(originalScenario).getCarriers().values().forEach(carrier -> { + if (CarriersUtils.getJspritIterations(carrier) == 0) { allCarriers.remove(carrier.getId()); solvedCarriers.put(carrier.getId(), carrier); } @@ -320,7 +319,7 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map newCarrier.getAttributes() .putAttribute(attribute, carrier.getAttributes().getAttribute(attribute))); @@ -369,18 +368,18 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map { + CarriersUtils.getCarriers(originalScenario).getCarriers().putAll(solvedCarriers); + CarriersUtils.getCarriers(originalScenario).getCarriers().values().forEach(carrier -> { if (regionLinksMap != null && !carrier.getAttributes().getAsMap().containsKey("tourStartArea")) { List startAreas = new ArrayList<>(); for (ScheduledTour tour : carrier.getSelectedPlan().getScheduledTours()) { @@ -466,7 +465,7 @@ private Controler prepareControler(Scenario scenario) { @Override public void install() { bind(CarrierStrategyManager.class).toProvider( - new MyCarrierPlanStrategyManagerFactory(CarrierUtils.getCarrierVehicleTypes(scenario))); + new MyCarrierPlanStrategyManagerFactory(CarriersUtils.getCarrierVehicleTypes(scenario))); bind(CarrierScoringFunctionFactory.class).toInstance(new MyCarrierScoringFunctionFactory()); } }); @@ -490,7 +489,7 @@ private void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, Map stopDurationTimeSelector = createStopDurationTimeDistributionPerCategory( smallScaleCommercialTrafficType); - CarrierVehicleTypes carrierVehicleTypes = CarrierUtils.getCarrierVehicleTypes(scenario); + CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); Map, VehicleType> additionalCarrierVehicleTypes = scenario.getVehicles().getVehicleTypes(); additionalCarrierVehicleTypes.values().forEach( vehicleType -> carrierVehicleTypes.getVehicleTypes().putIfAbsent(vehicleType.getId(), vehicleType)); @@ -583,7 +582,7 @@ private void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, assert possibleVehicleTypes != null; for (String possibleVehicleType : possibleVehicleTypes) { - if (CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( + if (CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( Id.create(possibleVehicleType, VehicleType.class))) vehicleTypes.add(possibleVehicleType); } @@ -675,7 +674,7 @@ private void createServices(Scenario scenario, ArrayList noPossibleLinks CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); - CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() + CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() .put(thisService.getId(), thisService); } @@ -693,12 +692,12 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpo ValueSelectorUnderGivenProbability tourStartTimeSelector, ValueSelectorUnderGivenProbability tourDurationTimeSelector) { - Carriers carriers = CarrierUtils.addOrGetCarriers(scenario); - CarrierVehicleTypes carrierVehicleTypes = CarrierUtils.getCarrierVehicleTypes(scenario); + Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); + CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); CarrierCapabilities carrierCapabilities; - Carrier thisCarrier = CarrierUtils.createCarrier(Id.create(carrierName, Carrier.class)); + Carrier thisCarrier = CarriersUtils.createCarrier(Id.create(carrierName, Carrier.class)); if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic") && purpose == 3) thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType + "_service"); else @@ -707,7 +706,7 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpo thisCarrier.getAttributes().putAttribute("purpose", purpose); thisCarrier.getAttributes().putAttribute("tourStartArea", startZone); if (jspritIterations > 0) - CarrierUtils.setJspritIterations(thisCarrier, jspritIterations); + CarriersUtils.setJspritIterations(thisCarrier, jspritIterations); carrierCapabilities = CarrierCapabilities.Builder.newInstance().setFleetSize(fleetSize).build(); carriers.addCarrier(thisCarrier); @@ -1085,7 +1084,7 @@ private double getDistanceParameter(CarrierVehicle vehicle) { public void handleLeg(Leg leg) { if (leg.getRoute() instanceof NetworkRoute nRoute) { Id vehicleId = nRoute.getVehicleId(); - CarrierVehicle vehicle = CarrierUtils.getCarrierVehicle(carrier, vehicleId); + CarrierVehicle vehicle = CarriersUtils.getCarrierVehicle(carrier, vehicleId); Gbl.assertNotNull(vehicle); employedVehicles.add(vehicle); double distance = 0.0; diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java index 39d3baff696..0387c0d7873 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/SmallScaleCommercialTrafficUtils.java @@ -40,11 +40,11 @@ import org.matsim.api.core.v01.population.*; import org.matsim.application.options.ShpOptions; import org.matsim.application.options.ShpOptions.Index; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.carrier.Tour.Pickup; -import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; -import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.Tour.Pickup; +import org.matsim.freight.carriers.Tour.ServiceActivity; +import org.matsim.freight.carriers.Tour.TourElement; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.network.NetworkUtils; @@ -190,7 +190,7 @@ static void createPlansBasedOnCarrierPlans(Scenario scenario, String smallScaleC Plan plan = popFactory.createPlan(); String carrierName = person.getId().toString().split("freight_")[1].split("_veh_")[0]; - Carrier relatedCarrier = CarrierUtils.addOrGetCarriers(scenario).getCarriers() + Carrier relatedCarrier = CarriersUtils.addOrGetCarriers(scenario).getCarriers() .get(Id.create(carrierName, Carrier.class)); String subpopulation = relatedCarrier.getAttributes().getAttribute("subpopulation").toString(); final String mode; @@ -459,10 +459,10 @@ static void readExistingModels(Scenario scenario, double sampleScenario, } } carrierToRemove.forEach(carrier -> carriers.getCarriers().remove(carrier.getId())); - CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().putAll(usedVehicleTypes.getVehicleTypes()); + CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().putAll(usedVehicleTypes.getVehicleTypes()); carriers.getCarriers().values().forEach(carrier -> { - Carrier newCarrier = CarrierUtils + Carrier newCarrier = CarriersUtils .createCarrier(Id.create(modelName + "_" + carrier.getId().toString(), Carrier.class)); newCarrier.getAttributes().putAttribute("subpopulation", modelTrafficType); if (modelPurpose != null) @@ -489,7 +489,7 @@ else if (!carrier.getShipments().isEmpty()) newCarrier.getAttributes().putAttribute("tourStartArea", String.join(";", startAreas)); - CarrierUtils.setJspritIterations(newCarrier, 0); + CarriersUtils.setJspritIterations(newCarrier, 0); // recalculate score for selectedPlan VehicleRoutingProblem vrp = MatsimJspritFactory .createRoutingProblemBuilder(carrier, scenario.getNetwork()).build(); @@ -499,10 +499,10 @@ else if (!carrier.getShipments().isEmpty()) double costs = solutionCostsCalculator.getCosts(solution) * (-1); carrier.getSelectedPlan().setScore(costs); } else { - CarrierUtils.setJspritIterations(newCarrier, CarrierUtils.getJspritIterations(carrier)); + CarriersUtils.setJspritIterations(newCarrier, CarriersUtils.getJspritIterations(carrier)); newCarrier.getCarrierCapabilities().setFleetSize(carrier.getCarrierCapabilities().getFleetSize()); } - CarrierUtils.addOrGetCarriers(scenario).getCarriers().put(newCarrier.getId(), newCarrier); + CarriersUtils.addOrGetCarriers(scenario).getCarriers().put(newCarrier.getId(), newCarrier); }); } } diff --git a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java index 2c07198f9ff..ada637b06d7 100644 --- a/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java +++ b/contribs/application/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java @@ -27,10 +27,10 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.Tour.Pickup; -import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; -import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.Tour.Pickup; +import org.matsim.freight.carriers.Tour.ServiceActivity; +import org.matsim.freight.carriers.Tour.TourElement; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.utils.io.IOUtils; @@ -277,7 +277,7 @@ static void reduceDemandBasedOnExistingCarriers(Scenario scenario, HashMap> trafficVolumePerTypeAndZone_start, HashMap> trafficVolumePerTypeAndZone_stop) { - for (Carrier carrier : CarrierUtils.addOrGetCarriers(scenario).getCarriers().values()) { + for (Carrier carrier : CarriersUtils.addOrGetCarriers(scenario).getCarriers().values()) { if (!carrier.getAttributes().getAsMap().containsKey("subpopulation") || !carrier.getAttributes().getAttribute("subpopulation").equals(smallScaleCommercialTrafficType)) continue; diff --git a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java index 7ac9c8b96ff..9d2ec63b41c 100644 --- a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java +++ b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/CarrierReaderFromCSVTest.java @@ -18,10 +18,10 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.application.options.ShpOptions; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.CarrierVehicle; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.NetworkUtils; @@ -61,19 +61,19 @@ public void carrierCreation() throws IOException { CarrierReaderFromCSV.checkNewCarrier(allNewCarrierInformation, freightCarriersConfigGroup, scenario, polygonsInShape, shapeCategory); CarrierReaderFromCSV.createNewCarrierAndAddVehicleTypes(scenario, allNewCarrierInformation, freightCarriersConfigGroup, polygonsInShape, 1, null); - Assert.assertEquals(3, CarrierUtils.getCarriers(scenario).getCarriers().size()); + Assert.assertEquals(3, CarriersUtils.getCarriers(scenario).getCarriers().size()); Assert.assertTrue( - CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier1", Carrier.class))); + CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier1", Carrier.class))); Assert.assertTrue( - CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier2", Carrier.class))); + CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier2", Carrier.class))); Assert.assertTrue( - CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier3", Carrier.class))); + CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier3", Carrier.class))); // check carrier 1 - Carrier testCarrier1 = CarrierUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier1 = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier1", Carrier.class)); Assert.assertEquals(FleetSize.INFINITE, testCarrier1.getCarrierCapabilities().getFleetSize()); - Assert.assertEquals(10, CarrierUtils.getJspritIterations(testCarrier1)); + Assert.assertEquals(10, CarriersUtils.getJspritIterations(testCarrier1)); Assert.assertEquals(4, testCarrier1.getCarrierCapabilities().getCarrierVehicles().size()); Object2IntMap depotSums = new Object2IntOpenHashMap<>(); Map> typesPerDepot = new HashMap<>(); @@ -100,10 +100,10 @@ public void carrierCreation() throws IOException { Assert.assertTrue(typesPerDepot.get("j(2,4)R").contains("testVehicle2")); // check carrier 2 - Carrier testCarrier2 = CarrierUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier2 = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier2", Carrier.class)); Assert.assertEquals(FleetSize.FINITE, testCarrier2.getCarrierCapabilities().getFleetSize()); - Assert.assertEquals(15, CarrierUtils.getJspritIterations(testCarrier2)); + Assert.assertEquals(15, CarriersUtils.getJspritIterations(testCarrier2)); Assert.assertEquals(9, testCarrier2.getCarrierCapabilities().getCarrierVehicles().size()); depotSums = new Object2IntOpenHashMap<>(); typesPerDepot = new HashMap<>(); @@ -125,10 +125,10 @@ public void carrierCreation() throws IOException { // check carrier 3 Network network = NetworkUtils.readNetwork( "https://raw.githubusercontent.com/matsim-org/matsim-libs/master/examples/scenarios/freight-chessboard-9x9/grid9x9.xml"); - Carrier testCarrier3 = CarrierUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier3 = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier3", Carrier.class)); Assert.assertEquals(FleetSize.INFINITE, testCarrier3.getCarrierCapabilities().getFleetSize()); - Assert.assertEquals(1, CarrierUtils.getJspritIterations(testCarrier3)); + Assert.assertEquals(1, CarriersUtils.getJspritIterations(testCarrier3)); Assert.assertEquals(2, testCarrier3.getCarrierCapabilities().getCarrierVehicles().size()); depotSums = new Object2IntOpenHashMap<>(); typesPerDepot = new HashMap<>(); diff --git a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java index aaae423fdad..d9ff39a695c 100644 --- a/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java +++ b/contribs/application/src/test/java/org/matsim/freightDemandGeneration/DemandReaderFromCSVTest.java @@ -18,8 +18,7 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; import org.matsim.application.options.ShpOptions; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.NetworkUtils; @@ -96,18 +95,18 @@ public void demandCreation() throws IOException { DemandReaderFromCSV.checkNewDemand(scenario, demandInformation, polygonsInShape, shapeCategory); DemandReaderFromCSV.createDemandForCarriers(scenario, polygonsInShape, demandInformation, population, false, null); - Assert.assertEquals(3, CarrierUtils.getCarriers(scenario).getCarriers().size()); + Assert.assertEquals(3, CarriersUtils.getCarriers(scenario).getCarriers().size()); Assert.assertTrue( - CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier1", Carrier.class))); + CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier1", Carrier.class))); Assert.assertTrue( - CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier2", Carrier.class))); + CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier2", Carrier.class))); Assert.assertTrue( - CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier3", Carrier.class))); + CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("testCarrier3", Carrier.class))); // check carrier 1 Network network = NetworkUtils.readNetwork( "https://raw.githubusercontent.com/matsim-org/matsim-libs/master/examples/scenarios/freight-chessboard-9x9/grid9x9.xml"); - Carrier testCarrier1 = CarrierUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier1 = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier1", Carrier.class)); Assert.assertEquals(14, testCarrier1.getServices().size()); Assert.assertEquals(0, testCarrier1.getShipments().size()); @@ -153,7 +152,7 @@ public void demandCreation() throws IOException { Assert.assertTrue(locationsPerServiceElement.get("serviceElement2").contains("i(2,0)")); // check carrier 2 - Carrier testCarrier2 = CarrierUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier2 = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier2", Carrier.class)); Assert.assertEquals(0, testCarrier2.getServices().size()); Assert.assertEquals(11, testCarrier2.getShipments().size()); @@ -204,7 +203,7 @@ public void demandCreation() throws IOException { Assert.assertEquals(2, locationsPerShipmentElement.get("ShipmenElement2_delivery").size()); // check carrier 3 - Carrier testCarrier3 = CarrierUtils.getCarriers(scenario).getCarriers() + Carrier testCarrier3 = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create("testCarrier3", Carrier.class)); Assert.assertEquals(0, testCarrier3.getServices().size()); Assert.assertEquals(4, testCarrier3.getShipments().size()); diff --git a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java index d0df6b80df3..d0f4620ac71 100644 --- a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java +++ b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/RunGenerateSmallScaleCommercialTrafficTest.java @@ -26,8 +26,8 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Population; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.population.PopulationUtils; @@ -96,9 +96,9 @@ public void testMainRunAndResults() { } freightCarriersConfigGroup.setCarriersFile(carriersWOSolutionFileLocation); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenarioWOSolution); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenarioWOSolution); freightCarriersConfigGroup.setCarriersFile(carriersWSolutionFileLocation); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenarioWSolution); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenarioWSolution); assert population != null; for (Person person : population.getPersons().values()) { @@ -109,10 +109,10 @@ public void testMainRunAndResults() { Assert.assertTrue(person.getAttributes().getAsMap().containsKey("purpose")); } - Assert.assertEquals(CarrierUtils.addOrGetCarriers(scenarioWSolution).getCarriers().size(), - CarrierUtils.addOrGetCarriers(scenarioWOSolution).getCarriers().size(), 0); + Assert.assertEquals(CarriersUtils.addOrGetCarriers(scenarioWSolution).getCarriers().size(), + CarriersUtils.addOrGetCarriers(scenarioWOSolution).getCarriers().size(), 0); int countedTours = 0; - for (Carrier carrier_withSolution : CarrierUtils.addOrGetCarriers(scenarioWSolution).getCarriers().values()) { + for (Carrier carrier_withSolution : CarriersUtils.addOrGetCarriers(scenarioWSolution).getCarriers().values()) { countedTours += carrier_withSolution.getSelectedPlan().getScheduledTours().size(); } Assert.assertEquals(population.getPersons().size(), countedTours, 0); diff --git a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java index f5e3ddbe380..fe522f7462d 100644 --- a/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java +++ b/contribs/application/src/test/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGenerationTest.java @@ -27,9 +27,9 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; import org.matsim.application.options.ShpOptions; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.scenario.ScenarioUtils; @@ -406,15 +406,15 @@ public void testAddingExistingScenarios() throws Exception { SmallScaleCommercialTrafficUtils.readExistingModels(scenario, sample, regionLinksMap); - Assert.assertEquals(3, CarrierUtils.getCarriers(scenario).getCarriers().size(), MatsimTestUtils.EPSILON); - Assert.assertEquals(1, CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().size(), MatsimTestUtils.EPSILON); - Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier1", Carrier.class))); - Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier2", Carrier.class))); - Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleShipmentCarrier_carrier1", Carrier.class))); + Assert.assertEquals(3, CarriersUtils.getCarriers(scenario).getCarriers().size(), MatsimTestUtils.EPSILON); + Assert.assertEquals(1, CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().size(), MatsimTestUtils.EPSILON); + Assert.assertTrue(CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier1", Carrier.class))); + Assert.assertTrue(CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier2", Carrier.class))); + Assert.assertTrue(CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleShipmentCarrier_carrier1", Carrier.class))); - Carrier addedCarrier1 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier1", Carrier.class)); + Carrier addedCarrier1 = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier1", Carrier.class)); Assert.assertNotNull(addedCarrier1.getSelectedPlan()); - Assert.assertEquals(0, CarrierUtils.getJspritIterations(addedCarrier1), MatsimTestUtils.EPSILON); + Assert.assertEquals(0, CarriersUtils.getJspritIterations(addedCarrier1), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier1.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier1.getCarrierCapabilities().getVehicleTypes().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(3, addedCarrier1.getSelectedPlan().getScheduledTours().size(), MatsimTestUtils.EPSILON); @@ -427,9 +427,9 @@ public void testAddingExistingScenarios() throws Exception { Assert.assertNull(addedCarrier1.getAttributes().getAttribute("vehicleType")); Assert.assertEquals("testArea2_area3", addedCarrier1.getAttributes().getAttribute("tourStartArea")); - Carrier addedCarrier2 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier2", Carrier.class)); + Carrier addedCarrier2 = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier2", Carrier.class)); Assert.assertNotNull(addedCarrier2.getSelectedPlan()); - Assert.assertEquals(0, CarrierUtils.getJspritIterations(addedCarrier2), MatsimTestUtils.EPSILON); + Assert.assertEquals(0, CarriersUtils.getJspritIterations(addedCarrier2), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier2.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier2.getCarrierCapabilities().getVehicleTypes().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(2, addedCarrier2.getSelectedPlan().getScheduledTours().size(), MatsimTestUtils.EPSILON); @@ -441,9 +441,9 @@ public void testAddingExistingScenarios() throws Exception { Assert.assertNull(addedCarrier2.getAttributes().getAttribute("vehicleType")); Assert.assertEquals("testArea2_area3", addedCarrier2.getAttributes().getAttribute("tourStartArea")); - Carrier addedCarrier3 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleShipmentCarrier_carrier1", Carrier.class)); + Carrier addedCarrier3 = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleShipmentCarrier_carrier1", Carrier.class)); Assert.assertNull(addedCarrier3.getSelectedPlan()); - Assert.assertEquals(50, CarrierUtils.getJspritIterations(addedCarrier3), MatsimTestUtils.EPSILON); + Assert.assertEquals(50, CarriersUtils.getJspritIterations(addedCarrier3), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier3.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier3.getCarrierCapabilities().getVehicleTypes().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(FleetSize.INFINITE, addedCarrier3.getCarrierCapabilities().getFleetSize()); @@ -472,14 +472,14 @@ public void testAddingExistingScenariosWithSample() throws Exception { SmallScaleCommercialTrafficUtils.readExistingModels(scenario, sample, regionLinksMap); - Assert.assertEquals(2, CarrierUtils.getCarriers(scenario).getCarriers().size(), MatsimTestUtils.EPSILON); - Assert.assertEquals(1, CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().size(), MatsimTestUtils.EPSILON); - Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier1", Carrier.class))); - Assert.assertTrue(CarrierUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleShipmentCarrier_carrier1", Carrier.class))); + Assert.assertEquals(2, CarriersUtils.getCarriers(scenario).getCarriers().size(), MatsimTestUtils.EPSILON); + Assert.assertEquals(1, CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().size(), MatsimTestUtils.EPSILON); + Assert.assertTrue(CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleServiceCarrier_carrier1", Carrier.class))); + Assert.assertTrue(CarriersUtils.getCarriers(scenario).getCarriers().containsKey(Id.create("exampleShipmentCarrier_carrier1", Carrier.class))); - Carrier addedCarrier1 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier1", Carrier.class)); + Carrier addedCarrier1 = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleServiceCarrier_carrier1", Carrier.class)); Assert.assertNotNull(addedCarrier1.getSelectedPlan()); - Assert.assertEquals(0, CarrierUtils.getJspritIterations(addedCarrier1), MatsimTestUtils.EPSILON); + Assert.assertEquals(0, CarriersUtils.getJspritIterations(addedCarrier1), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier1.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier1.getCarrierCapabilities().getVehicleTypes().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier1.getSelectedPlan().getScheduledTours().size(), MatsimTestUtils.EPSILON); @@ -492,9 +492,9 @@ public void testAddingExistingScenariosWithSample() throws Exception { Assert.assertNull(addedCarrier1.getAttributes().getAttribute("vehicleType")); Assert.assertEquals("testArea2_area3", addedCarrier1.getAttributes().getAttribute("tourStartArea")); - Carrier addedCarrier3 = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleShipmentCarrier_carrier1", Carrier.class)); + Carrier addedCarrier3 = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("exampleShipmentCarrier_carrier1", Carrier.class)); Assert.assertNull(addedCarrier3.getSelectedPlan()); - Assert.assertEquals(50, CarrierUtils.getJspritIterations(addedCarrier3), MatsimTestUtils.EPSILON); + Assert.assertEquals(50, CarriersUtils.getJspritIterations(addedCarrier3), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier3.getCarrierCapabilities().getCarrierVehicles().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(1, addedCarrier3.getCarrierCapabilities().getVehicleTypes().size(), MatsimTestUtils.EPSILON); Assert.assertEquals(FleetSize.INFINITE, addedCarrier3.getCarrierCapabilities().getFleetSize()); diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperator.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperator.java index 5d44ae94997..f1862ee3842 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperator.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperator.java @@ -23,8 +23,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Carriers; import org.matsim.core.config.groups.GlobalConfigGroup; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.population.algorithms.PlanAlgorithm; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialJobGenerator.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialJobGenerator.java index 4faafad6785..77b82e6208b 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialJobGenerator.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialJobGenerator.java @@ -21,7 +21,7 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.population.Population; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carriers; import org.matsim.core.controler.listener.AfterMobsimListener; import org.matsim.core.controler.listener.BeforeMobsimListener; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficAnalysisListener.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficAnalysisListener.java index 26091293d12..d41196496c1 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficAnalysisListener.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficAnalysisListener.java @@ -25,8 +25,8 @@ import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVPrinter; import org.matsim.api.core.v01.Id; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Carriers; import org.matsim.core.controler.MatsimServices; import org.matsim.core.controler.events.IterationEndsEvent; import org.matsim.core.controler.listener.IterationEndsListener; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficChecker.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficChecker.java index 471cdf9a84e..8c561e9217c 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficChecker.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficChecker.java @@ -27,8 +27,8 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Plan; import org.matsim.api.core.v01.population.Population; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Carriers; import java.util.Collection; import java.util.Map; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/DefaultCommercialJobGenerator.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/DefaultCommercialJobGenerator.java index 0d2c4e52661..3327f46292c 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/DefaultCommercialJobGenerator.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/DefaultCommercialJobGenerator.java @@ -36,17 +36,7 @@ import org.matsim.api.core.v01.population.Population; import org.matsim.api.core.v01.population.Route; import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlanWriter; -import org.matsim.freight.carriers.carrier.CarrierService; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.CarrierVehicle; -import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; -import org.matsim.freight.carriers.carrier.Carriers; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.TimeWindow; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.jsprit.VRPTransportCostsFactory; import org.matsim.core.config.Config; import org.matsim.core.config.groups.ReplanningConfigGroup.StrategySettings; @@ -127,7 +117,7 @@ private void buildVehicleAndDriver(Carrier carrier, Person driverPerson, Carrier if (!scenario.getVehicles().getVehicleTypes().containsKey(carrierVehicle.getType().getId())) scenario.getVehicles().addVehicleType(carrierVehicle.getType()); Id vid = Id.createVehicleId(driverPerson.getId()); - VehicleUtils.insertVehicleIdsIntoAttributes(driverPerson, Map.of(CarrierUtils.getCarrierMode(carrier), vid)); + VehicleUtils.insertVehicleIdsIntoAttributes(driverPerson, Map.of(CarriersUtils.getCarrierMode(carrier), vid)); scenario.getVehicles() .addVehicle(scenario.getVehicles().getFactory().createVehicle(vid, carrierVehicle.getType())); freightVehicles.add(vid); @@ -211,7 +201,7 @@ private void manageJspritDepartureTimes(Plan plan) { */ private Plan createPlainPlanFromTour(Carrier carrier, ScheduledTour scheduledTour) { - String carrierMode = CarrierUtils.getCarrierMode(carrier); + String carrierMode = CarriersUtils.getCarrierMode(carrier); // Create empty plan Plan plan = PopulationUtils.createPlan(); diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java index df7b4305658..a4f182cf17a 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandModule.java @@ -27,8 +27,8 @@ import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; import org.matsim.contrib.drt.run.MultiModeDrtModule; import org.matsim.contrib.dvrp.run.DvrpModule; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCostsFactory; import org.matsim.freight.carriers.jsprit.VRPTransportCostsFactory; import org.matsim.core.config.Config; @@ -92,7 +92,7 @@ private CarrierProvider() { } public Carriers get() { - return CarrierUtils.getCarriers(this.scenario); + return CarriersUtils.getCarriers(this.scenario); } } diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandUtils.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandUtils.java index 3ca98d6ade6..e433a3651e6 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandUtils.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/JointDemandUtils.java @@ -22,9 +22,9 @@ import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Plan; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierVehicle; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierVehicle; +import org.matsim.freight.carriers.Carriers; import javax.annotation.Nullable; import java.util.*; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java index 597b60800dd..905102b912c 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/RunJointDemandCarToggleJspritExample.java @@ -23,7 +23,7 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ScoringConfigGroup; @@ -78,7 +78,7 @@ public void run(URL configUrl){ prepareConfig(config); Scenario scenario = loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ScoreCommercialJobs.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ScoreCommercialJobs.java index 7baed018f31..c3a6a068701 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ScoreCommercialJobs.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ScoreCommercialJobs.java @@ -30,10 +30,10 @@ import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.*; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierService; -import org.matsim.freight.carriers.carrier.Carriers; -import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierService; +import org.matsim.freight.carriers.Carriers; +import org.matsim.freight.carriers.CarrierConstants; import org.matsim.core.api.experimental.events.EventsManager; import java.util.*; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourLengthAnalyzer.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourLengthAnalyzer.java index c448116ac5f..c1434c351b9 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourLengthAnalyzer.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourLengthAnalyzer.java @@ -33,7 +33,7 @@ import org.matsim.api.core.v01.events.handler.PersonLeavesVehicleEventHandler; import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Person; -import org.matsim.freight.carriers.carrier.CarrierConstants; +import org.matsim.freight.carriers.CarrierConstants; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.vehicles.Vehicle; diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourPlanning.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourPlanning.java index 314e11224fe..2c1e9d82e2e 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourPlanning.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TourPlanning.java @@ -31,10 +31,10 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlan; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierPlan; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.VRPTransportCosts; @@ -153,7 +153,7 @@ static void runTourPlanningForCarriers(Carriers carriers, Scenario scenario, VRP log.info("setting maxIterations=1 as carrier has no services"); algorithm.setMaxIterations(1); } else { - algorithm.setMaxIterations(CarrierUtils.getJspritIterations(carrier)); + algorithm.setMaxIterations(CarriersUtils.getJspritIterations(carrier)); } // variationCoefficient = stdDeviation/mean. so i set the threshold rather soft diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java index 51c9cca832a..62c6584a1de 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandCarExample.java @@ -26,7 +26,7 @@ import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandConfigGroup; import org.matsim.contrib.commercialTrafficApplications.jointDemand.JointDemandModule; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ReplanningConfigGroup; @@ -80,7 +80,7 @@ public void run(URL configUrl){ prepareConfig(config); Scenario scenario = loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java index e5427252353..68addb0a68a 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java @@ -37,7 +37,7 @@ import org.matsim.contrib.dvrp.run.DvrpConfigGroup; import org.matsim.contrib.dvrp.run.DvrpQSimComponents; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.config.groups.ScoringConfigGroup; @@ -85,7 +85,7 @@ public void run(URL configURL){ Scenario scenario = DrtControlerCreator.createScenarioWithDrtRouteFactory(config); ScenarioUtils.loadScenario(scenario); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); //assumes that input file paths are set in FreightCarriersConfigGroup //alternatively, one can read in the input Carriers and CarrierVehicleTypes manually and use //CarrierControlerUtils.getCarriers(scenario) and CarrierControlerUtils.getCarrierVehicleTypes(scenario) diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperatorTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperatorTest.java index ecf7813bd97..18de26d446d 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperatorTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/ChangeCommercialJobOperatorTest.java @@ -7,8 +7,8 @@ import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Plan; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Carriers; import org.matsim.core.router.util.TravelTime; import org.matsim.core.trafficmonitoring.FreeSpeedTravelTime; diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java index c59c987d8a4..27b59b0d621 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/CommercialTrafficIntegrationTest.java @@ -3,7 +3,7 @@ import org.junit.Test; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.Controler; @@ -21,7 +21,7 @@ public void runCommercialTrafficIT() { freightCarriersConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); freightCarriersConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); Scenario scenario = ScenarioUtils.loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); Controler controler = new Controler(scenario); controler.addOverridingModule(new JointDemandModule()); controler.run(); diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java index 323a7ac4ad3..b9f40a81c5d 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/IsTheRightCustomerScoredTest.java @@ -27,8 +27,7 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.api.core.v01.population.Plan; import org.matsim.api.core.v01.population.PopulationFactory; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.Controler; @@ -54,10 +53,10 @@ public void setUp() { freightCarriersConfigGroup.setCarriersFile("jointDemand_carriers_car.xml"); freightCarriersConfigGroup.setCarriersVehicleTypesFile("jointDemand_vehicleTypes.xml"); scenario = ScenarioUtils.loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); //limit the fleet size of carrier pizza_1 so that it can handly only one order/job - CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("salamiPizza", Carrier.class)).getCarrierCapabilities().setFleetSize(CarrierCapabilities.FleetSize.FINITE); + CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("salamiPizza", Carrier.class)).getCarrierCapabilities().setFleetSize(CarrierCapabilities.FleetSize.FINITE); preparePopulation(scenario); @@ -106,7 +105,7 @@ public void testIfTheRightPersonIsScoredForReceivingAJob() { Plan nonCustomerPlan = scenario.getPopulation().getPersons().get(Id.createPersonId("nonCustomer")).getSelectedPlan(); //derive the service activity from the carrier plan and compare the service id (which should contain the customer id) with the person id of the expected customer - Carrier pizzaCarrier = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("salamiPizza", Carrier.class)); + Carrier pizzaCarrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("salamiPizza", Carrier.class)); ScheduledTour tour = (ScheduledTour) pizzaCarrier.getSelectedPlan().getScheduledTours().toArray()[0]; Id serviceActivity = tour.getTour().getTourElements().stream() .filter(tourElement -> tourElement instanceof Tour.ServiceActivity) diff --git a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TestScenarioGeneration.java b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TestScenarioGeneration.java index b7092208fd6..1d6b845a665 100644 --- a/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TestScenarioGeneration.java +++ b/contribs/commercialTrafficApplications/src/test/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/TestScenarioGeneration.java @@ -28,7 +28,7 @@ import org.matsim.api.core.v01.population.Plan; import org.matsim.core.config.Config; import org.matsim.core.population.PopulationUtils; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -54,18 +54,18 @@ public static Carriers generateCarriers() { Carriers carriers = new Carriers(); Carrier italianPizzaPlace = CarrierImpl.newInstance(Id.create("pizza_italian", Carrier.class)); - CarrierUtils.setCarrierMode(italianPizzaPlace, TransportMode.car); - CarrierUtils.setJspritIterations(italianPizzaPlace, 20); + CarriersUtils.setCarrierMode(italianPizzaPlace, TransportMode.car); + CarriersUtils.setJspritIterations(italianPizzaPlace, 20); italianPizzaPlace.getAttributes().putAttribute(JointDemandUtils.CARRIER_MARKET_ATTRIBUTE_NAME, "pizza"); Carrier americanPizzaPlace = CarrierImpl.newInstance(Id.create("pizza_american", Carrier.class)); - CarrierUtils.setCarrierMode(americanPizzaPlace, TransportMode.car); - CarrierUtils.setJspritIterations(americanPizzaPlace, 20); + CarriersUtils.setCarrierMode(americanPizzaPlace, TransportMode.car); + CarriersUtils.setJspritIterations(americanPizzaPlace, 20); americanPizzaPlace.getAttributes().putAttribute(JointDemandUtils.CARRIER_MARKET_ATTRIBUTE_NAME, "pizza"); Carrier shopping_1 = CarrierImpl.newInstance(Id.create("shopping_1", Carrier.class)); - CarrierUtils.setCarrierMode(shopping_1, TransportMode.car); - CarrierUtils.setJspritIterations(shopping_1, 20); + CarriersUtils.setCarrierMode(shopping_1, TransportMode.car); + CarriersUtils.setJspritIterations(shopping_1, 20); shopping_1.getAttributes().putAttribute(JointDemandUtils.CARRIER_MARKET_ATTRIBUTE_NAME, "shopping"); VehicleType type = createLightType(); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carrier.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/Carrier.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carrier.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/Carrier.java index 29ddead11a6..e4363accdf8 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carrier.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/Carrier.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.HasPlansAndId; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierCapabilities.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierCapabilities.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierCapabilities.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierCapabilities.java index e0078021f38..fa14ddfd9bb 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierCapabilities.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierCapabilities.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.Id; import org.matsim.vehicles.Vehicle; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierConstants.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierConstants.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierConstants.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierConstants.java index b7dc2e3a5f9..fac638f18bb 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierConstants.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierConstants.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; public class CarrierConstants { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierImpl.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierImpl.java similarity index 96% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierImpl.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierImpl.java index b51274fa1a9..9d8a439af32 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierImpl.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierImpl.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.Id; import org.matsim.utils.objectattributes.attributable.Attributes; @@ -40,7 +40,7 @@ public final class CarrierImpl implements Carrier { @Deprecated // refactoring device, please inline public static Carrier newInstance( Id carrierId ){ - return CarrierUtils.createCarrier( carrierId ) ; + return CarriersUtils.createCarrier( carrierId ) ; } private final Id id; @@ -116,7 +116,7 @@ public boolean addPlan(CarrierPlan p) { @Override public CarrierPlan createCopyOfSelectedPlanAndMakeSelected() { - CarrierPlan newPlan = CarrierUtils.copyPlan(this.selectedPlan ) ; + CarrierPlan newPlan = CarriersUtils.copyPlan(this.selectedPlan ) ; this.setSelectedPlan( newPlan ) ; return newPlan ; } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlan.java similarity index 96% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlan.java index 3a4236e36a6..9c51aac159e 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlan.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlan.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.population.BasicPlan; import org.matsim.utils.objectattributes.attributable.Attributable; @@ -83,7 +83,7 @@ public void setScore(Double score) { * @return score from jsprit. */ public Double getJspritScore(){ - return CarrierUtils.getJspritScore(this); + return CarriersUtils.getJspritScore(this); } /** @@ -91,7 +91,7 @@ public Double getJspritScore(){ * This is _not_ the score from the MATSim simulation. */ public void setJspritScore(Double score){ - CarrierUtils.setJspritScore(this, score); + CarriersUtils.setJspritScore(this, score); } public Collection getScheduledTours() { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanReaderV1.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanReaderV1.java index 7fa4ed91f4a..4e13ad599b6 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanReaderV1.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -96,7 +96,7 @@ public void startTag(String name, Attributes attributes, Stack context) switch( name ){ case CARRIER:{ String id = attributes.getValue( ID ); - currentCarrier = CarrierUtils.createCarrier( Id.create( id, Carrier.class ) ); + currentCarrier = CarriersUtils.createCarrier( Id.create( id, Carrier.class ) ); break; } case SHIPMENTS:{ @@ -132,7 +132,7 @@ public void startTag(String name, Attributes attributes, Stack context) if( deliveryServiceTime != null ) shipmentBuilder.setDeliveryServiceTime( getDouble( deliveryServiceTime ) ); CarrierShipment shipment = shipmentBuilder.build(); currentShipments.put( attributes.getValue( ID ), shipment ); - CarrierUtils.addShipment(currentCarrier, shipment); + CarriersUtils.addShipment(currentCarrier, shipment); // currentCarrier.getShipments().put( shipment.getId(), shipment ); break ; } @@ -163,7 +163,7 @@ public void startTag(String name, Attributes attributes, Stack context) if( startTime != null ) vehicleBuilder.setEarliestStart( getDouble( startTime ) ); if( endTime != null ) vehicleBuilder.setLatestEnd( getDouble( endTime ) ); CarrierVehicle vehicle = vehicleBuilder.build(); - CarrierUtils.addCarrierVehicle(currentCarrier, vehicle); + CarriersUtils.addCarrierVehicle(currentCarrier, vehicle); vehicles.put( vId, vehicle ); break; } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanWriter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanWriter.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanWriter.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanWriter.java index 87447a0d0a2..3d7922d9489 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanWriter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanWriter.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import com.google.inject.Inject; import org.matsim.utils.objectattributes.AttributeConverter; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlParserV2.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlParserV2.java index 38ab9e33745..fb921395d19 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlParserV2.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; @@ -32,8 +32,8 @@ import org.matsim.core.population.routes.RouteUtils; import org.matsim.core.utils.io.MatsimXmlParser; import org.matsim.core.utils.misc.Time; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.Builder; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.CarrierCapabilities.Builder; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.utils.objectattributes.AttributeConverter; import org.matsim.utils.objectattributes.attributable.AttributesXmlReaderDelegate; import org.matsim.vehicles.Vehicle; @@ -42,7 +42,7 @@ import java.util.*; -import static org.matsim.freight.carriers.carrier.CarrierConstants.*; +import static org.matsim.freight.carriers.CarrierConstants.*; class CarrierPlanXmlParserV2 extends MatsimXmlParser { @@ -101,7 +101,7 @@ public void startTag(String name, Attributes atts, Stack context) { case CARRIER: { String id = atts.getValue(ID); if (id == null) throw new IllegalStateException("carrierId is missing."); - currentCarrier = CarrierUtils.createCarrier(Id.create(id, Carrier.class)); + currentCarrier = CarriersUtils.createCarrier(Id.create(id, Carrier.class)); break; } @@ -129,7 +129,7 @@ public void startTag(String name, Attributes atts, Stack context) { if (serviceTimeString != null) serviceBuilder.setServiceDuration(parseTimeToDouble(serviceTimeString)); currentService = serviceBuilder.build(); serviceMap.put(currentService.getId(), currentService); - CarrierUtils.addService(currentCarrier, currentService); + CarriersUtils.addService(currentCarrier, currentService); break; } @@ -168,7 +168,7 @@ public void startTag(String name, Attributes atts, Stack context) { currentShipment = shipmentBuilder.build(); currentShipments.put(atts.getValue(ID), currentShipment); - CarrierUtils.addShipment(currentCarrier, currentShipment); + CarriersUtils.addShipment(currentCarrier, currentShipment); break; } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2_1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlParserV2_1.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2_1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlParserV2_1.java index 0007f6fa2f6..862123d3201 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlParserV2_1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlParserV2_1.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; @@ -32,8 +32,8 @@ import org.matsim.core.population.routes.RouteUtils; import org.matsim.core.utils.io.MatsimXmlParser; import org.matsim.core.utils.misc.Time; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.Builder; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.CarrierCapabilities.Builder; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.utils.objectattributes.AttributeConverter; import org.matsim.utils.objectattributes.attributable.AttributesXmlReaderDelegate; import org.matsim.vehicles.Vehicle; @@ -42,7 +42,7 @@ import java.util.*; -import static org.matsim.freight.carriers.carrier.CarrierConstants.*; +import static org.matsim.freight.carriers.CarrierConstants.*; class CarrierPlanXmlParserV2_1 extends MatsimXmlParser { @@ -100,7 +100,7 @@ public void startTag(String name, Attributes atts, Stack context) { case CARRIER: { String id = atts.getValue(ID); if (id == null) throw new IllegalStateException("carrierId is missing."); - currentCarrier = CarrierUtils.createCarrier(Id.create(id, Carrier.class)); + currentCarrier = CarriersUtils.createCarrier(Id.create(id, Carrier.class)); break; } //services @@ -127,7 +127,7 @@ public void startTag(String name, Attributes atts, Stack context) { if (serviceTimeString != null) serviceBuilder.setServiceDuration(parseTimeToDouble(serviceTimeString)); currentService = serviceBuilder.build(); serviceMap.put(currentService.getId(), currentService); - CarrierUtils.addService(currentCarrier, currentService); + CarriersUtils.addService(currentCarrier, currentService); break; } @@ -166,7 +166,7 @@ public void startTag(String name, Attributes atts, Stack context) { currentShipment = shipmentBuilder.build(); currentShipments.put(atts.getValue(ID), currentShipment); - CarrierUtils.addShipment(currentCarrier, currentShipment); + CarriersUtils.addShipment(currentCarrier, currentShipment); break; } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReader.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlReader.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReader.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlReader.java index cb5acfed7f5..5019604572d 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReader.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlReader.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV1.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV1.java index d4732408b46..510ea9b1ac3 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV1.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import com.graphhopper.jsprit.core.problem.job.Shipment; import org.apache.logging.log4j.LogManager; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2.java index 9478515fe9b..b78af8aa3e6 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; @@ -30,10 +30,10 @@ import org.matsim.core.utils.collections.Tuple; import org.matsim.core.utils.io.MatsimXmlWriter; import org.matsim.core.utils.misc.Time; -import org.matsim.freight.carriers.carrier.Tour.Leg; -import org.matsim.freight.carriers.carrier.Tour.ServiceActivity; -import org.matsim.freight.carriers.carrier.Tour.ShipmentBasedActivity; -import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.Tour.Leg; +import org.matsim.freight.carriers.Tour.ServiceActivity; +import org.matsim.freight.carriers.Tour.ShipmentBasedActivity; +import org.matsim.freight.carriers.Tour.TourElement; import org.matsim.utils.objectattributes.AttributeConverter; import org.matsim.utils.objectattributes.attributable.AttributesXmlWriterDelegate; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2_1.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2_1.java index a680b6d58cd..76e47da676c 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2_1.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import com.google.inject.Inject; import org.apache.logging.log4j.LogManager; @@ -42,7 +42,7 @@ import java.util.List; import java.util.Map; -import static org.matsim.freight.carriers.carrier.CarrierConstants.*; +import static org.matsim.freight.carriers.CarrierConstants.*; /** * A writer that writes carriers and their plans in a xml-file. diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierService.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierService.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierService.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierService.java index 4522869c2f3..b7106fa6de9 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierService.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierService.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierShipment.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierShipment.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierShipment.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierShipment.java index 516484b3015..1298f3eb5b2 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierShipment.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierShipment.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicle.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicle.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicle.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicle.java index d0288621dad..917052a65fe 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicle.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicle.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleType.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleType.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleType.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleType.java index 82600bb4b1f..8f5a5ea31e7 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleType.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleType.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.Id; import org.matsim.vehicles.VehicleType; @@ -36,7 +36,7 @@ */ public class CarrierVehicleType { // this is now really only a name space for the builder method. There are two options where this could go: - // (1) into CarrierUtils; then it could keep its freight specific syntax + // (1) into CarriersUtils; then it could keep its freight specific syntax // (2) into VehicleUtils; then it would need to lose its freight specific syntax // However, note that when moving it, the class here still needs to be available since otherwise a lot of outside code will break. // kai, sep'19 diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoader.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeLoader.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoader.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeLoader.java index 7aeaba2da3d..c9fbe45d4ad 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoader.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeLoader.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReader.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeReader.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReader.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeReader.java index be2ec4e3e07..ce87229d7ee 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReader.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeReader.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderV1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeReaderV1.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderV1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeReaderV1.java index aee8dfac36b..61718d49850 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderV1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeReaderV1.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeWriter.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriter.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeWriter.java index 6f423686b51..4fbd8d68bbb 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeWriter.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.Id; import org.matsim.core.api.internal.MatsimWriter; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterV1.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeWriterV1.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterV1.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeWriterV1.java index bec3b89dd37..823123e916a 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterV1.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypeWriterV1.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypes.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypes.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypes.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypes.java index 93d7028f6fd..e9900cdc6cb 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypes.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierVehicleTypes.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.api.core.v01.Id; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carriers.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/Carriers.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carriers.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/Carriers.java index 1268b09f18a..8746def11e9 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Carriers.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/Carriers.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarriersUtils.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/CarriersUtils.java index 6ff020fa015..4eb7bc7fabf 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/CarrierUtils.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarriersUtils.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import com.graphhopper.jsprit.analysis.toolbox.StopWatch; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; @@ -36,7 +36,6 @@ import org.matsim.api.core.v01.population.Plan; import org.matsim.core.config.ConfigUtils; import org.matsim.core.utils.io.IOUtils; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkRouter; @@ -50,13 +49,13 @@ import java.util.concurrent.ForkJoinPool; import java.util.stream.Collectors; -public class CarrierUtils{ +public class CarriersUtils { static final String CARRIER_VEHICLE = "carrierVehicle"; @SuppressWarnings("unused") - private static final Logger log = LogManager.getLogger(CarrierUtils.class); + private static final Logger log = LogManager.getLogger(CarriersUtils.class); /** - * From the outside, rather use {@link CarrierUtils#getCarriers(Scenario)} . + * From the outside, rather use {@link CarriersUtils#getCarriers(Scenario)} . * This string constant will eventually become private. */ private static final String CARRIERS = "carriers"; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/ScheduledTour.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/ScheduledTour.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/ScheduledTour.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/ScheduledTour.java index e8e2f4250e6..6a133ebc71c 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/ScheduledTour.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/ScheduledTour.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; /** diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/TimeWindow.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/TimeWindow.java similarity index 98% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/TimeWindow.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/TimeWindow.java index d835d3845c8..167dc424028 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/TimeWindow.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/TimeWindow.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.matsim.core.utils.misc.Time; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Tour.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/Tour.java similarity index 99% rename from contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Tour.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/Tour.java index 25fe3ee7894..9b0e9d91696 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/carrier/Tour.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/Tour.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java index 911a6544c8e..d3e08e9afbb 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgent.java @@ -31,9 +31,9 @@ import org.matsim.core.gbl.Gbl; import org.matsim.core.population.PopulationUtils; import org.matsim.core.scoring.ScoringFunction; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.Tour.TourActivity; -import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.Tour.TourActivity; +import org.matsim.freight.carriers.Tour.TourElement; import org.matsim.freight.carriers.events.CarrierEventCreator; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleUtils; @@ -114,7 +114,7 @@ List createFreightDriverPlans() { // to "prepareForSim" for carriers. Did not check any further. kai, jul'22 //this returns TransportMode.car if the attribute is null - Leg leg = PopulationUtils.createLeg(CarrierUtils.getCarrierMode(carrier)); + Leg leg = PopulationUtils.createLeg(CarriersUtils.getCarrierMode(carrier)); //TODO we might need to set the route to null if the mode is a drt mode leg.setRoute(route); @@ -136,7 +136,7 @@ List createFreightDriverPlans() { plan.addActivity(endActivity); driverPerson.addPlan(plan); plan.setPerson(driverPerson); - CarrierUtils.putVehicle( plan, vehicle ); + CarriersUtils.putVehicle( plan, vehicle ); routes.add(plan); carrierDriverAgents.put(driverId, carrierDriverAgent); } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgentTracker.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgentTracker.java index cfa6b18b59d..09c4036d92f 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgentTracker.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierAgentTracker.java @@ -30,8 +30,8 @@ import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.events.algorithms.Vehicle2DriverEventHandler; import org.matsim.core.events.handler.BasicEventHandler; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.events.CarrierEventCreator; import org.matsim.freight.carriers.events.CarrierEventCreatorUtils; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java index 0d4e59ed8f8..f8a103bcbe5 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerListener.java @@ -29,7 +29,7 @@ import org.matsim.core.controler.events.ScoringEvent; import org.matsim.core.controler.listener.ReplanningListener; import org.matsim.core.controler.listener.ScoringListener; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.CarriersUtils; import javax.annotation.Nullable; @@ -78,7 +78,7 @@ public class CarrierControlerListener implements ScoringListener, ReplanningList if ( strategyManager==null ) { throw new RuntimeException( "You need to set CarrierStrategyManager to something meaningful to run iterations." ); } - strategyManager.run( CarrierUtils.getCarriers( scenario ).getCarriers().values() , event.getIteration(), event.getReplanningContext() ); + strategyManager.run( CarriersUtils.getCarriers( scenario ).getCarriers().values() , event.getIteration(), event.getReplanningContext() ); } } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierDriverAgent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierDriverAgent.java index eb52fe3770c..5a0889c8dc2 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierDriverAgent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierDriverAgent.java @@ -37,7 +37,7 @@ import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.population.routes.RouteUtils; import org.matsim.core.scoring.ScoringFunction; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.events.CarrierEventCreator; import org.matsim.vehicles.Vehicle; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java index 6835c4907af..e2b9e1d8354 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierModule.java @@ -36,8 +36,7 @@ import org.matsim.core.mobsim.qsim.AbstractQSimModule; import org.matsim.core.mobsim.qsim.components.QSimComponentsConfigGroup; import org.matsim.core.scoring.ScoringFunction; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import java.util.List; @@ -98,7 +97,7 @@ public final class CarrierModule extends AbstractModule { bind( CarrierStrategyManager.class ).toProvider( () -> null ); // (the null binding means that a zeroth iteration will run. kai, jul'22) - this.addControlerListenerBinding().toInstance((ShutdownListener) event -> writeAdditionalRunOutput( event.getServices().getControlerIO(), event.getServices().getConfig(), CarrierUtils.getCarriers( event.getServices().getScenario() ) )); + this.addControlerListenerBinding().toInstance((ShutdownListener) event -> writeAdditionalRunOutput( event.getServices().getControlerIO(), event.getServices().getConfig(), CarriersUtils.getCarriers( event.getServices().getScenario() ) )); } @@ -146,7 +145,7 @@ private static void writeAdditionalRunOutput( OutputDirectoryHierarchy controlle private static class CarrierProvider implements Provider { @Inject Scenario scenario; @Override public Carriers get() { - return CarrierUtils.getCarriers(scenario); + return CarriersUtils.getCarriers(scenario); } } } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierReRouteVehicles.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierReRouteVehicles.java index 7a3e26e4263..f59ba81c930 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierReRouteVehicles.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierReRouteVehicles.java @@ -29,8 +29,8 @@ import org.matsim.core.replanning.modules.GenericPlanStrategyModule; import org.matsim.core.router.util.LeastCostPathCalculator; import org.matsim.core.router.util.TravelTime; -import org.matsim.freight.carriers.carrier.CarrierPlan; -import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.CarrierPlan; +import org.matsim.freight.carriers.ScheduledTour; /** * Strategy module to reRoute a carrierPlan. diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierScoringFunctionFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierScoringFunctionFactory.java index 24dc40548ae..c73a41b3008 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierScoringFunctionFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierScoringFunctionFactory.java @@ -22,7 +22,7 @@ package org.matsim.freight.carriers.controler; import org.matsim.core.scoring.ScoringFunction; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; public interface CarrierScoringFunctionFactory { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManager.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManager.java index 299fbb34ae7..f1d6d06e84e 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManager.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManager.java @@ -23,8 +23,8 @@ import com.google.inject.Provider; import org.matsim.core.replanning.GenericStrategyManager; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierPlan; /** * The current (jul'22) logic of this is:

      diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManagerImpl.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManagerImpl.java index bedc43262d6..5bcad45b183 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManagerImpl.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierStrategyManagerImpl.java @@ -27,8 +27,8 @@ import org.matsim.core.replanning.GenericStrategyManagerImpl; import org.matsim.core.replanning.ReplanningContext; import org.matsim.core.replanning.selectors.PlanSelector; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierPlan; import java.util.List; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAllocationMutator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAllocationMutator.java index 54f406baefc..3b7fc83af01 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAllocationMutator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAllocationMutator.java @@ -23,8 +23,8 @@ import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.replanning.ReplanningContext; import org.matsim.core.replanning.modules.GenericPlanStrategyModule; -import org.matsim.freight.carriers.carrier.CarrierPlan; -import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.CarrierPlan; +import org.matsim.freight.carriers.ScheduledTour; import java.util.ArrayList; import java.util.Collection; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAndSpaceTourRouter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAndSpaceTourRouter.java index 7d627ffa687..0a6a7399c9f 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAndSpaceTourRouter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierTimeAndSpaceTourRouter.java @@ -31,11 +31,11 @@ import org.matsim.core.router.util.LeastCostPathCalculator; import org.matsim.core.router.util.LeastCostPathCalculator.Path; import org.matsim.core.router.util.TravelTime; -import org.matsim.freight.carriers.carrier.CarrierVehicle; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour.Leg; -import org.matsim.freight.carriers.carrier.Tour.TourActivity; -import org.matsim.freight.carriers.carrier.Tour.TourElement; +import org.matsim.freight.carriers.CarrierVehicle; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour.Leg; +import org.matsim.freight.carriers.Tour.TourActivity; +import org.matsim.freight.carriers.Tour.TourElement; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesImpl; import org.matsim.vehicles.Vehicle; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierVehicleReRouter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierVehicleReRouter.java index 2034e447ac6..4a75e5c607d 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierVehicleReRouter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierVehicleReRouter.java @@ -39,9 +39,9 @@ import org.matsim.core.replanning.ReplanningContext; import org.matsim.core.replanning.modules.GenericPlanStrategyModule; import org.matsim.core.router.util.TravelTime; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlan; -import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierPlan; +import org.matsim.freight.carriers.CarrierVehicleTypes; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.VehicleTypeDependentRoadPricingCalculator; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightActivity.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightActivity.java index 8e02571389b..42cd58ae587 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightActivity.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightActivity.java @@ -27,7 +27,7 @@ import org.matsim.api.core.v01.population.Activity; import org.matsim.core.utils.misc.OptionalTime; import org.matsim.facilities.ActivityFacility; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.utils.objectattributes.attributable.Attributes; public class FreightActivity implements Activity { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java index e1aaa651b49..71a577d8200 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/FreightAgentSource.java @@ -31,7 +31,7 @@ import org.matsim.core.mobsim.qsim.QSim; import org.matsim.core.mobsim.qsim.agents.AgentFactory; import org.matsim.core.mobsim.qsim.qnetsimengine.QVehicleImpl; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleUtils; @@ -73,14 +73,14 @@ public final class FreightAgentSource implements AgentSource { MobsimAgent agent = this.agentFactory.createMobsimAgentFromPerson( freightDriverPlan.getPerson() ); Vehicle vehicle; - if( CarrierUtils.getVehicle( freightDriverPlan ) == null ){ + if( CarriersUtils.getVehicle( freightDriverPlan ) == null ){ vehicle = VehicleUtils.getFactory().createVehicle( Id.create( agent.getId(), Vehicle.class ), VehicleUtils.getDefaultVehicleType() ); log.warn( "vehicle for agent " + freightDriverPlan.getPerson().getId() + " is missing. set default vehicle where maxVelocity is solely defined by link.speed." ); - } else if( CarrierUtils.getVehicle( freightDriverPlan ).getType() == null ){ + } else if( CarriersUtils.getVehicle( freightDriverPlan ).getType() == null ){ vehicle = VehicleUtils.getFactory().createVehicle( Id.create( agent.getId(), Vehicle.class ), VehicleUtils.getDefaultVehicleType() ); log.warn( "vehicleType for agent " + freightDriverPlan.getPerson().getId() + " is missing. set default vehicleType where maxVelocity is solely defined by link.speed." ); } else { - vehicle = CarrierUtils.getVehicle( freightDriverPlan ); + vehicle = CarriersUtils.getVehicle( freightDriverPlan ); } log.warn( "inserting vehicleId=" + vehicle.getId() + " into mobsim." ); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/WithinDayActivityReScheduling.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/WithinDayActivityReScheduling.java index eff80d01698..285939a7174 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/WithinDayActivityReScheduling.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/WithinDayActivityReScheduling.java @@ -35,8 +35,8 @@ import org.matsim.core.mobsim.framework.listeners.MobsimBeforeSimStepListener; import org.matsim.core.mobsim.framework.listeners.MobsimListener; import org.matsim.core.mobsim.qsim.agents.WithinDayAgentUtils; -import org.matsim.freight.carriers.carrier.Tour.Start; -import org.matsim.freight.carriers.carrier.Tour.TourActivity; +import org.matsim.freight.carriers.Tour.Start; +import org.matsim.freight.carriers.Tour.TourActivity; import java.util.Collection; import java.util.HashSet; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/AbstractCarrierEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/AbstractCarrierEvent.java index 10e13752f07..1380144b9b4 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/AbstractCarrierEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/AbstractCarrierEvent.java @@ -26,7 +26,7 @@ import org.matsim.api.core.v01.events.HasLinkId; import org.matsim.api.core.v01.events.HasVehicleId; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreator.java index e4d03f78afb..06c2abff700 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierEventCreator.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.ScheduledTour; import org.matsim.vehicles.Vehicle; public interface CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEvent.java index 50b15c9afc5..bfd8ad7d68c 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEvent.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierService; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierService; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEventCreator.java index b2d682ca1e5..be6d484ceaf 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceEndEventCreator.java @@ -25,10 +25,10 @@ import org.matsim.api.core.v01.events.ActivityEndEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierServiceEndEventCreator implements CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEvent.java index a8b0567ee23..1b866d5ce5b 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEvent.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierService; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierService; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEventCreator.java index 7700d1d5e7f..78b3bf3a276 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierServiceStartEventCreator.java @@ -25,10 +25,10 @@ import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierServiceStartEventCreator implements CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEvent.java index 971062fe2a1..c49c04aa533 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEvent.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierShipment; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEventCreator.java index 2520b534f14..e1a9cfb643a 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryEndEventCreator.java @@ -25,10 +25,10 @@ import org.matsim.api.core.v01.events.ActivityEndEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierShipmentDeliveryEndEventCreator implements CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEvent.java index 7c1ee95782d..e12222973c1 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEvent.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierShipment; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEventCreator.java index bb7e650405a..5c008867117 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentDeliveryStartEventCreator.java @@ -25,10 +25,10 @@ import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierShipmentDeliveryStartEventCreator implements CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEvent.java index c1a44cd5479..90e1fd137b7 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEvent.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierShipment; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEventCreator.java index 7c9f2d96c76..9da464e5c66 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupEndEventCreator.java @@ -25,10 +25,10 @@ import org.matsim.api.core.v01.events.ActivityEndEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierShipmentPickupEndEventCreator implements CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEvent.java index 534a5750b4c..ab36e627190 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEvent.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierShipment; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEventCreator.java index 10f8aaddab0..c7e2604151b 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierShipmentPickupStartEventCreator.java @@ -25,10 +25,10 @@ import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierShipmentPickupStartEventCreator implements CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEvent.java index 5c2218ab802..82e133f2166 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEvent.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Tour; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEventCreator.java index 9c27b86033a..b0777fa7d86 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourEndEventCreator.java @@ -25,9 +25,9 @@ import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.population.Activity; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.ScheduledTour; import org.matsim.vehicles.Vehicle; /*package-private*/ final class CarrierTourEndEventCreator implements CarrierEventCreator { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEvent.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEvent.java index 2c6d5c42b33..9c64e8213b2 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEvent.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEvent.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.GenericEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Tour; import org.matsim.vehicles.Vehicle; import java.util.Map; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEventCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEventCreator.java index 368755ab0d2..eb015551dd0 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEventCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/CarrierTourStartEventCreator.java @@ -27,9 +27,9 @@ import org.matsim.api.core.v01.events.PersonEntersVehicleEvent; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Person; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.ScheduledTour; import org.matsim.vehicles.Vehicle; import java.util.TreeMap; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/HasCarrierId.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/HasCarrierId.java index 1b680fd34c4..556524ffe5b 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/HasCarrierId.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/HasCarrierId.java @@ -22,7 +22,7 @@ package org.matsim.freight.carriers.events; import org.matsim.api.core.v01.Id; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; /** * @author Kai Martins-Turner (kturner) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/Vehicle2CarrierEventHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/Vehicle2CarrierEventHandler.java index f0a06daecf9..e116ab1493e 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/Vehicle2CarrierEventHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/events/eventhandler/Vehicle2CarrierEventHandler.java @@ -21,7 +21,7 @@ package org.matsim.freight.carriers.events.eventhandler; import org.matsim.api.core.v01.Id; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import org.matsim.freight.carriers.events.CarrierTourEndEvent; import org.matsim.freight.carriers.events.CarrierTourStartEvent; import org.matsim.vehicles.Vehicle; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceConstraint.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceConstraint.java index da418a3e9d9..0d6c4725b97 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceConstraint.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/DistanceConstraint.java @@ -31,7 +31,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; -import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.CarrierVehicleTypes; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java index 57ebd6ecde0..0b16a1dbbed 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/MatsimJspritFactory.java @@ -52,8 +52,7 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.core.utils.io.IOUtils; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -90,13 +89,13 @@ static CarrierShipment createCarrierShipment(Shipment jspritShipment) { Id.createLinkId(jspritShipment.getPickupLocation().getId()), Id.createLinkId(jspritShipment.getDeliveryLocation().getId()), jspritShipment.getSize().get(0)) .setDeliveryServiceTime(jspritShipment.getDeliveryServiceTime()) - .setDeliveryTimeWindow(org.matsim.freight.carriers.carrier.TimeWindow.newInstance(jspritShipment.getDeliveryTimeWindow().getStart(), + .setDeliveryTimeWindow(org.matsim.freight.carriers.TimeWindow.newInstance(jspritShipment.getDeliveryTimeWindow().getStart(), jspritShipment.getDeliveryTimeWindow().getEnd())) .setPickupServiceTime(jspritShipment.getPickupServiceTime()) - .setPickupTimeWindow(org.matsim.freight.carriers.carrier.TimeWindow.newInstance(jspritShipment.getPickupTimeWindow().getStart(), + .setPickupTimeWindow(org.matsim.freight.carriers.TimeWindow.newInstance(jspritShipment.getPickupTimeWindow().getStart(), jspritShipment.getPickupTimeWindow().getEnd())) .build(); - CarrierUtils.setSkills(carrierShipment, jspritShipment.getRequiredSkills().values()); + CarriersUtils.setSkills(carrierShipment, jspritShipment.getRequiredSkills().values()); return carrierShipment; } @@ -120,7 +119,7 @@ static Shipment createJspritShipment(CarrierShipment carrierShipment) { carrierShipment.getPickupTimeWindow().getStart(), carrierShipment.getPickupTimeWindow().getEnd())) .addSizeDimension(0, carrierShipment.getSize()); - for (String skill : CarrierUtils.getSkills(carrierShipment)) { + for (String skill : CarriersUtils.getSkills(carrierShipment)) { shipmentBuilder.addRequiredSkill(skill); } return shipmentBuilder.build(); @@ -151,7 +150,7 @@ static Shipment createJspritShipment(CarrierShipment carrierShipment, Coord from carrierShipment.getPickupTimeWindow().getStart(), carrierShipment.getPickupTimeWindow().getEnd())) .addSizeDimension(0, carrierShipment.getSize()); - for (String skill : CarrierUtils.getSkills(carrierShipment)) { + for (String skill : CarriersUtils.getSkills(carrierShipment)) { shipmentBuilder.addRequiredSkill(skill); } return shipmentBuilder.build(); @@ -171,7 +170,7 @@ static Service createJspritService(CarrierService carrierService, Coord location .setTimeWindow(com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow.newInstance( carrierService.getServiceStartTimeWindow().getStart(), carrierService.getServiceStartTimeWindow().getEnd())); - for (String skill : CarrierUtils.getSkills(carrierService)) { + for (String skill : CarriersUtils.getSkills(carrierService)) { serviceBuilder.addRequiredSkill(skill); } return serviceBuilder.build(); @@ -188,9 +187,9 @@ static CarrierService createCarrierService(Service jspritService) { serviceBuilder.setCapacityDemand(jspritService.getSize().get(0)); serviceBuilder.setServiceDuration(jspritService.getServiceDuration()); serviceBuilder.setServiceStartTimeWindow( - org.matsim.freight.carriers.carrier.TimeWindow.newInstance(jspritService.getTimeWindow().getStart(), jspritService.getTimeWindow().getEnd())); + org.matsim.freight.carriers.TimeWindow.newInstance(jspritService.getTimeWindow().getStart(), jspritService.getTimeWindow().getEnd())); CarrierService carrierService = serviceBuilder.build(); - CarrierUtils.setSkills(carrierService, jspritService.getRequiredSkills().values()); + CarriersUtils.setSkills(carrierService, jspritService.getRequiredSkills().values()); return carrierService; } @@ -215,7 +214,7 @@ static com.graphhopper.jsprit.core.problem.vehicle.Vehicle createJspritVehicle(C vehicleBuilder.setEarliestStart(carrierVehicle.getEarliestStartTime()) .setLatestArrival(carrierVehicle.getLatestEndTime()).setStartLocation(vehicleLocation) .setType(vehicleType); - for (String skill : CarrierUtils.getSkills(carrierVehicle.getType())) { + for (String skill : CarriersUtils.getSkills(carrierVehicle.getType())) { vehicleBuilder.addSkill(skill); } @@ -260,7 +259,7 @@ static CarrierVehicle createCarrierVehicle(com.graphhopper.jsprit.core.problem.v CarrierVehicle carrierVehicle = carrierVehicleBuilder.build(); for (String skill : jspritVehicle.getSkills().values()) { - CarrierUtils.addSkill(carrierVehicle.getType(), skill); + CarriersUtils.addSkill(carrierVehicle.getType(), skill); } if (jspritVehicle.getEarliestDeparture() != carrierVehicle.getEarliestStartTime()) @@ -682,7 +681,7 @@ public static VehicleRoutingProblemSolution createSolution(CarrierPlan plan, */ public static Carrier createCarrier(String carrierId, VehicleRoutingProblem vrp) { Id id = Id.create(carrierId, Carrier.class); - Carrier carrier = CarrierUtils.createCarrier(id); + Carrier carrier = CarriersUtils.createCarrier(id); CarrierCapabilities.Builder capabilityBuilder = CarrierCapabilities.Builder.newInstance(); // fleet and vehicles @@ -753,7 +752,7 @@ public static VehicleRoutingAlgorithm loadOrCreateVehicleRoutingAlgorithm(Scenar ConstraintManager constraintManager = new ConstraintManager(problem, stateManager); constraintManager.addConstraint( new DistanceConstraint( - CarrierUtils.getCarrierVehicleTypes(scenario), netBasedCosts), + CarriersUtils.getCarrierVehicleTypes(scenario), netBasedCosts), ConstraintManager.Priority.CRITICAL); AlgorithmConfig algorithmConfig = new AlgorithmConfig(); AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig); @@ -777,7 +776,7 @@ public static VehicleRoutingAlgorithm loadOrCreateVehicleRoutingAlgorithm(Scenar ConstraintManager constraintManager = new ConstraintManager(problem, stateManager); constraintManager.addConstraint( new DistanceConstraint( - CarrierUtils.getCarrierVehicleTypes(scenario), netBasedCosts), + CarriersUtils.getCarrierVehicleTypes(scenario), netBasedCosts), ConstraintManager.Priority.CRITICAL); algorithm = Jsprit.Builder.newInstance(problem) .setStateAndConstraintManager(stateManager, constraintManager).buildAlgorithm(); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCosts.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCosts.java index d30ec1fb616..6ae0c93d705 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCosts.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCosts.java @@ -37,7 +37,7 @@ import org.matsim.core.router.util.TravelDisutility; import org.matsim.core.router.util.TravelTime; import org.matsim.core.utils.misc.Counter; -import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.CarrierVehicle; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesImpl; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java index 7e2c4f18cf6..3fcc5ca9868 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkBasedTransportCostsFactory.java @@ -27,7 +27,7 @@ import org.matsim.core.config.ConfigUtils; import org.matsim.core.router.util.TravelTime; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carriers; import org.matsim.vehicles.VehicleType; import java.util.HashSet; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkRouter.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkRouter.java index 26debecd9b4..7dac94a1c8c 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkRouter.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/jsprit/NetworkRouter.java @@ -20,8 +20,8 @@ */ package org.matsim.freight.carriers.jsprit; -import org.matsim.freight.carriers.carrier.CarrierPlan; -import org.matsim.freight.carriers.carrier.ScheduledTour; +import org.matsim.freight.carriers.CarrierPlan; +import org.matsim.freight.carriers.ScheduledTour; import org.matsim.freight.carriers.controler.CarrierTimeAndSpaceTourRouter; /** diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/CarrierScoreStats.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/CarrierScoreStats.java index 5ea7fd329c9..84195625eeb 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/CarrierScoreStats.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/analysis/CarrierScoreStats.java @@ -32,9 +32,9 @@ import org.matsim.core.utils.charts.XYLineChart; import org.matsim.core.utils.io.IOUtils; import org.matsim.core.utils.io.UncheckedIOException; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlan; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierPlan; +import org.matsim.freight.carriers.Carriers; import java.io.BufferedWriter; import java.io.IOException; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java index bc208538d56..6d137ce6f27 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierScoringFunctionFactoryImpl.java @@ -35,7 +35,7 @@ import org.matsim.core.population.routes.NetworkRoute; import org.matsim.core.scoring.ScoringFunction; import org.matsim.core.scoring.SumScoringFunction; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.freight.carriers.controler.FreightActivity; import org.matsim.freight.carriers.jsprit.VehicleTypeDependentRoadPricingCalculator; @@ -185,7 +185,7 @@ private double getDistanceParameter(CarrierVehicle vehicle) { public void handleLeg(Leg leg) { if(leg.getRoute() instanceof NetworkRoute nRoute){ Id vehicleId = nRoute.getVehicleId(); - CarrierVehicle vehicle = CarrierUtils.getCarrierVehicle(carrier, vehicleId); + CarrierVehicle vehicle = CarriersUtils.getCarrierVehicle(carrier, vehicleId); Gbl.assertNotNull(vehicle); if(!employedVehicles.contains(vehicle)){ employedVehicles.add(vehicle); @@ -234,7 +234,7 @@ public SimpleTollScoring( Carrier carrier, Network network, VehicleTypeDependent @Override public void handleEvent(Event event) { if(event instanceof LinkEnterEvent){ - CarrierVehicle carrierVehicle = CarrierUtils.getCarrierVehicle(carrier, ((LinkEnterEvent) event).getVehicleId()); + CarrierVehicle carrierVehicle = CarriersUtils.getCarrierVehicle(carrier, ((LinkEnterEvent) event).getVehicleId()); if(carrierVehicle == null) throw new IllegalStateException("carrier vehicle missing"); double toll = roadPricing.getTollAmount(carrierVehicle.getType().getId(),network.getLinks().get(((LinkEnterEvent) event).getLinkId() ),event.getTime() ); if(toll > 0.) System.out.println("bing: vehicle " + carrierVehicle.getId() + " paid toll " + toll + "" ); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierTravelDisutilities.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierTravelDisutilities.java index 059b8ec326f..6f5aa812cdc 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierTravelDisutilities.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/CarrierTravelDisutilities.java @@ -26,7 +26,7 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.core.router.util.TravelDisutility; import org.matsim.core.router.util.TravelTime; -import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.CarrierVehicleTypes; import org.matsim.freight.carriers.jsprit.VehicleTypeDependentRoadPricingCalculator; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/FreightScenarioCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/FreightScenarioCreator.java index 59b4347aff0..be215bd0d7e 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/FreightScenarioCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/FreightScenarioCreator.java @@ -28,8 +28,8 @@ import org.matsim.core.config.Config; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -63,14 +63,14 @@ public static void main(String[] args) { for(int i=1;i<10;i++){ Id homeId = Id.createLinkId("i("+i+",9)R"); - Carrier carrier = CarrierUtils.createCarrier(Id.create(agentCounter,Carrier.class ) ); + Carrier carrier = CarriersUtils.createCarrier(Id.create(agentCounter,Carrier.class ) ); createFleet(homeId, carrier); createCustomers(carrier,scenario.getNetwork()); agentCounter++; carriers.addCarrier(carrier); Id homeIdR = Id.createLinkId("i("+i+",0)"); - Carrier carrier_ = CarrierUtils.createCarrier(Id.create(agentCounter,Carrier.class ) ); + Carrier carrier_ = CarriersUtils.createCarrier(Id.create(agentCounter,Carrier.class ) ); createFleet(homeIdR, carrier_); createCustomers(carrier_,scenario.getNetwork()); agentCounter++; @@ -79,14 +79,14 @@ public static void main(String[] args) { for(int i=1;i<10;i++){ Id homeId = Id.createLinkId("j(0,"+i+")R"); - Carrier carrier = CarrierUtils.createCarrier(Id.create(agentCounter,Carrier.class ) ); + Carrier carrier = CarriersUtils.createCarrier(Id.create(agentCounter,Carrier.class ) ); createFleet(homeId, carrier); createCustomers(carrier,scenario.getNetwork()); agentCounter++; carriers.addCarrier(carrier); Id homeIdR = Id.createLinkId("j(9,"+i+")"); - Carrier carrier_ = CarrierUtils.createCarrier(Id.create(agentCounter,Carrier.class ) ); + Carrier carrier_ = CarriersUtils.createCarrier(Id.create(agentCounter,Carrier.class ) ); createFleet(homeIdR, carrier_); createCustomers(carrier_,scenario.getNetwork()); agentCounter++; @@ -106,7 +106,7 @@ private static void createCustomers(Carrier carrier, Network network) { serviceBuilder.setServiceDuration(5*60); serviceBuilder.setServiceStartTimeWindow(TimeWindow.newInstance(6*60*60, 15*60*60)); CarrierService carrierService = serviceBuilder.build(); - CarrierUtils.addService(carrier, carrierService); + CarriersUtils.addService(carrier, carrierService); } } @@ -150,15 +150,15 @@ private static void createFleet(Id homeId, Carrier carrier) { //light CarrierVehicle carrierVehicle_lightA = createLightVehicle(carrier.getId(), homeId, "a"); - CarrierUtils.addCarrierVehicle(carrier, carrierVehicle_lightA); + CarriersUtils.addCarrierVehicle(carrier, carrierVehicle_lightA); CarrierVehicle carrierVehicle_lightB = createLightVehicle(carrier.getId(), oppositeId, "b"); - CarrierUtils.addCarrierVehicle(carrier, carrierVehicle_lightB); + CarriersUtils.addCarrierVehicle(carrier, carrierVehicle_lightB); //heavy CarrierVehicle carrierVehicle_heavyA = createHeavyVehicle(carrier.getId(), homeId, "a"); - CarrierUtils.addCarrierVehicle(carrier, carrierVehicle_heavyA); + CarriersUtils.addCarrierVehicle(carrier, carrierVehicle_heavyA); CarrierVehicle carrierVehicle_heavyB = createHeavyVehicle(carrier.getId(), oppositeId, "b"); - CarrierUtils.addCarrierVehicle(carrier, carrierVehicle_heavyB); + CarriersUtils.addCarrierVehicle(carrier, carrierVehicle_heavyB); carrier.getCarrierCapabilities().setFleetSize(FleetSize.INFINITE); } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InitialCarrierPlanCreator.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InitialCarrierPlanCreator.java index 997f5b02c7c..cd2e07405f7 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InitialCarrierPlanCreator.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/InitialCarrierPlanCreator.java @@ -39,7 +39,7 @@ import org.matsim.core.config.Config; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkRouter; diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PlotPlans.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PlotPlans.java index 104519cfbfe..838ac5463ae 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PlotPlans.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/PlotPlans.java @@ -29,7 +29,7 @@ import org.matsim.core.config.Config; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; final class PlotPlans { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java index c7aef595ed1..e8f7887cfea 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunChessboard.java @@ -45,8 +45,7 @@ import org.matsim.core.scoring.SumScoringFunction; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.controler.*; import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; import org.matsim.freight.carriers.usecases.analysis.LegHistogram; @@ -70,10 +69,10 @@ public static void main(String[] args){ freightCarriersConfigGroup.setCarriersVehicleTypesFile("vehicleTypes.xml"); Scenario scenario = ScenarioUtils.loadScenario( config ) ; - CarrierUtils.loadCarriersAccordingToFreightConfig( scenario ); + CarriersUtils.loadCarriersAccordingToFreightConfig( scenario ); - Carriers carriers = CarrierUtils.addOrGetCarriers( scenario ); - CarrierVehicleTypes types = CarrierUtils.getCarrierVehicleTypes( scenario ); + Carriers carriers = CarriersUtils.addOrGetCarriers( scenario ); + CarrierVehicleTypes types = CarriersUtils.getCarrierVehicleTypes( scenario ); Controler controler = new Controler( scenario); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java index e68046e5146..36f76f30787 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java @@ -46,7 +46,7 @@ import org.matsim.core.scoring.SumScoringFunction; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.controler.*; import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; import org.matsim.freight.carriers.usecases.analysis.LegHistogram; @@ -108,7 +108,7 @@ public final Config prepareConfig() { public final Scenario prepareScenario(Config config) { Gbl.assertNotNull( config ); Scenario scenario = ScenarioUtils.loadScenario(config); - CarrierUtils.addOrGetCarriers(scenario); + CarriersUtils.addOrGetCarriers(scenario); return scenario; } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java index fb1c8addc31..0051af3de81 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/SelectBestPlanAndOptimizeItsVehicleRouteFactory.java @@ -39,9 +39,9 @@ import org.matsim.core.router.util.TravelTime; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlan; -import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierPlan; +import org.matsim.freight.carriers.CarrierVehicleTypes; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkRouter; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierModuleTest.java similarity index 97% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierModuleTest.java index d9eb1f9249d..69938d9c14d 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierModuleTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierModuleTest.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Before; import org.junit.Rule; @@ -32,6 +32,7 @@ import org.matsim.core.controler.Controler; import org.matsim.core.controler.OutputDirectoryHierarchy; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.freight.carriers.FreightCarriersConfigGroup; import org.matsim.freight.carriers.controler.CarrierModule; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; @@ -73,7 +74,7 @@ public void setUp(){ Scenario scenario = ScenarioUtils.loadScenario( config ); - CarrierUtils.loadCarriersAccordingToFreightConfig( scenario ); + CarriersUtils.loadCarriersAccordingToFreightConfig( scenario ); controler = new Controler(scenario); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanReaderV1Test.java similarity index 98% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanReaderV1Test.java index 4c6e9eeb70e..10f95ad59cc 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanReaderV1Test.java @@ -19,14 +19,15 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.core.population.routes.NetworkRoute; -import org.matsim.freight.carriers.carrier.Tour.Leg; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.Tour.Leg; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlReaderV2Test.java similarity index 91% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlReaderV2Test.java index 9c2859ef40d..29887701aa4 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlReaderV2Test.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Assert; import org.junit.Before; @@ -32,7 +32,8 @@ import org.matsim.core.config.ConfigUtils; import org.matsim.core.gbl.Gbl; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; @@ -67,15 +68,15 @@ public void test_whenReadingServices_nuOfServicesIsCorrect(){ @Test public void test_whenReadingCarrier_itReadsTypeIdsCorrectly(){ - CarrierVehicle light = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("lightVehicle")); + CarrierVehicle light = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("lightVehicle")); Gbl.assertNotNull(light); Assert.assertEquals("light",light.getVehicleTypeId().toString()); - CarrierVehicle medium = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("mediumVehicle")); + CarrierVehicle medium = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("mediumVehicle")); Gbl.assertNotNull(medium); Assert.assertEquals("medium",medium.getVehicleTypeId().toString()); - CarrierVehicle heavy = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("heavyVehicle")); + CarrierVehicle heavy = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("heavyVehicle")); Gbl.assertNotNull(heavy); Assert.assertEquals("heavy",heavy.getVehicleTypeId().toString()); } @@ -162,13 +163,13 @@ private boolean exactlyTheseVehiclesAreInVehicleCollection(List> asL @Test public void test_CarrierHasAttributes(){ - Assert.assertEquals((TransportMode.drt),CarrierUtils.getCarrierMode(testCarrier)); - Assert.assertEquals(50,CarrierUtils.getJspritIterations(testCarrier)); + Assert.assertEquals((TransportMode.drt), CarriersUtils.getCarrierMode(testCarrier)); + Assert.assertEquals(50, CarriersUtils.getJspritIterations(testCarrier)); } @Test public void test_ServicesAndShipmentsHaveAttributes(){ - Object serviceCustomerAtt = testCarrier.getServices().get(Id.create("serv1",CarrierService.class)).getAttributes().getAttribute("customer"); + Object serviceCustomerAtt = testCarrier.getServices().get(Id.create("serv1", CarrierService.class)).getAttributes().getAttribute("customer"); Assert.assertNotNull(serviceCustomerAtt); Assert.assertEquals("someRandomCustomer", serviceCustomerAtt); Object shipmentCustomerAtt = testCarrier.getShipments().get(Id.create("s1",CarrierShipment.class)).getAttributes().getAttribute("customer"); @@ -180,7 +181,7 @@ public void test_ServicesAndShipmentsHaveAttributes(){ public void test_readStream() { Config config = ConfigUtils.createConfig(); Scenario scenario = ScenarioUtils.createScenario(config); - Carriers carriers = CarrierUtils.addOrGetCarriers(scenario); + Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); String xml = """ diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlReaderV2WithDtdTest.java similarity index 92% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlReaderV2WithDtdTest.java index 642f81238a4..64a078eecb5 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlReaderV2WithDtdTest.java @@ -19,12 +19,13 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.*; import org.matsim.api.core.v01.Id; import org.matsim.core.gbl.Gbl; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; @@ -57,15 +58,15 @@ public void test_whenReadingServices_nuOfServicesIsCorrect(){ @Test public void test_whenReadingCarrier_itReadsTypeIdsCorrectly(){ - CarrierVehicle light = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("lightVehicle")); + CarrierVehicle light = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("lightVehicle")); Gbl.assertNotNull(light); Assert.assertEquals("light",light.getVehicleTypeId().toString()); - CarrierVehicle medium = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("mediumVehicle")); + CarrierVehicle medium = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("mediumVehicle")); Gbl.assertNotNull(medium); Assert.assertEquals("medium",medium.getVehicleTypeId().toString()); - CarrierVehicle heavy = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("heavyVehicle")); + CarrierVehicle heavy = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("heavyVehicle")); Gbl.assertNotNull(heavy); Assert.assertEquals("heavy",heavy.getVehicleTypeId().toString()); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV1Test.java similarity index 97% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV1Test.java index 9c6124dc0bf..21b0ba0ed8f 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV1Test.java @@ -19,11 +19,12 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; +import org.matsim.freight.carriers.*; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2Test.java similarity index 91% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2Test.java index 71e055eb503..f8b84d04382 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2Test.java @@ -19,14 +19,15 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.TransportMode; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; @@ -63,13 +64,13 @@ public void test_whenReadingServices_nuOfServicesIsCorrect(){ @Test public void test_whenReadingCarrier_itReadsTypeIdsCorrectly(){ - CarrierVehicle light = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("lightVehicle")); + CarrierVehicle light = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("lightVehicle")); assertEquals("light",light.getVehicleTypeId().toString()); - CarrierVehicle medium = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("mediumVehicle")); + CarrierVehicle medium = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("mediumVehicle")); assertEquals("medium",medium.getVehicleTypeId().toString()); - CarrierVehicle heavy = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("heavyVehicle")); + CarrierVehicle heavy = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("heavyVehicle")); assertEquals("heavy",heavy.getVehicleTypeId().toString()); } @@ -142,8 +143,8 @@ private boolean exactlyTheseVehiclesAreInVehicleCollection(List> asL @Test public void test_CarrierHasAttributes(){ - assertEquals((TransportMode.drt),CarrierUtils.getCarrierMode(testCarrier)); - assertEquals(50,CarrierUtils.getJspritIterations(testCarrier)); + assertEquals((TransportMode.drt), CarriersUtils.getCarrierMode(testCarrier)); + assertEquals(50, CarriersUtils.getJspritIterations(testCarrier)); } @Test diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2_1Test.java similarity index 89% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2_1Test.java index 2ec4c309bf4..268bae2dd71 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierPlanXmlWriterV2_1Test.java @@ -19,14 +19,15 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.TransportMode; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; @@ -63,13 +64,13 @@ public void test_whenReadingServices_nuOfServicesIsCorrect(){ @Test public void test_whenReadingCarrier_itReadsTypeIdsCorrectly(){ - CarrierVehicle light = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("lightVehicle")); + CarrierVehicle light = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("lightVehicle")); assertEquals("light",light.getVehicleTypeId().toString()); - CarrierVehicle medium = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("mediumVehicle")); + CarrierVehicle medium = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("mediumVehicle")); assertEquals("medium",medium.getVehicleTypeId().toString()); - CarrierVehicle heavy = CarrierUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("heavyVehicle")); + CarrierVehicle heavy = CarriersUtils.getCarrierVehicle(testCarrier, Id.createVehicleId("heavyVehicle")); assertEquals("heavy",heavy.getVehicleTypeId().toString()); } @@ -138,7 +139,7 @@ public void test_whenReadingToursOfPlan1_SpritScoreIsCorrect(){ List plans = new ArrayList(testCarrier.getPlans()); CarrierPlan plan1 = plans.get(0); plan1.getAttributes().getAttribute("jspritScore"); - assertEquals(Double.NaN, CarrierUtils.getJspritScore(plan1), testUtils.EPSILON); + assertEquals(Double.NaN, CarriersUtils.getJspritScore(plan1), testUtils.EPSILON); } @Test @@ -146,7 +147,7 @@ public void test_whenReadingToursOfPlan2_jSpritScoreIsCorrect(){ List plans = new ArrayList(testCarrier.getPlans()); CarrierPlan plan2 = plans.get(1); plan2.getAttributes().getAttribute("jspritScore"); - assertEquals(80.0, CarrierUtils.getJspritScore(plan2), testUtils.EPSILON); + assertEquals(80.0, CarriersUtils.getJspritScore(plan2), testUtils.EPSILON); } @Test @@ -154,7 +155,7 @@ public void test_whenReadingToursOfPlan3_jSpritIsCorrect(){ List plans = new ArrayList(testCarrier.getPlans()); CarrierPlan plan3 = plans.get(2); plan3.getAttributes().getAttribute("jspritScore"); - assertEquals(105.0, CarrierUtils.getJspritScore(plan3), testUtils.EPSILON); + assertEquals(105.0, CarriersUtils.getJspritScore(plan3), testUtils.EPSILON); } @@ -166,8 +167,8 @@ private boolean exactlyTheseVehiclesAreInVehicleCollection(List> asL @Test public void test_CarrierHasAttributes(){ - assertEquals((TransportMode.drt),CarrierUtils.getCarrierMode(testCarrier)); - assertEquals(50,CarrierUtils.getJspritIterations(testCarrier)); + assertEquals((TransportMode.drt), CarriersUtils.getCarrierMode(testCarrier)); + assertEquals(50, CarriersUtils.getJspritIterations(testCarrier)); } @Test diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierReadWriteV2_1Test.java similarity index 97% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierReadWriteV2_1Test.java index af53fe2c683..50453b95881 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierReadWriteV2_1Test.java @@ -19,10 +19,11 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Rule; import org.junit.Test; +import org.matsim.freight.carriers.*; import org.matsim.testcases.MatsimTestUtils; import java.io.FileNotFoundException; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeLoaderTest.java similarity index 93% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeLoaderTest.java index 2801321b3a7..aa0a0ec281a 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeLoaderTest.java @@ -19,13 +19,14 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; +import org.matsim.freight.carriers.*; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -50,7 +51,7 @@ public void setUp() throws Exception{ public void test_whenLoadingTypes_allAssignmentsInLightVehicleAreCorrectly(){ new CarrierVehicleTypeLoader(carriers).loadVehicleTypes(types); Carrier testCarrier = carriers.getCarriers().get(Id.create("testCarrier", Carrier.class)); - CarrierVehicle v = CarrierUtils.getCarrierVehicle(testCarrier,Id.createVehicleId("lightVehicle")); + CarrierVehicle v = CarriersUtils.getCarrierVehicle(testCarrier,Id.createVehicleId("lightVehicle")); VehicleType vehicleTypeLoaded = v.getType(); Assert.assertNotNull(vehicleTypeLoaded); @@ -69,7 +70,7 @@ public void test_whenLoadingTypes_allAssignmentsInLightVehicleAreCorrectly(){ public void test_whenLoadingTypes_allAssignmentsInMediumVehicleAreCorrectly(){ new CarrierVehicleTypeLoader(carriers).loadVehicleTypes(types); Carrier testCarrier = carriers.getCarriers().get(Id.create("testCarrier", Carrier.class)); - CarrierVehicle v = CarrierUtils.getCarrierVehicle(testCarrier,Id.createVehicleId("mediumVehicle")); + CarrierVehicle v = CarriersUtils.getCarrierVehicle(testCarrier,Id.createVehicleId("mediumVehicle")); VehicleType vehicleTypeLoaded = v.getType(); Assert.assertNotNull(vehicleTypeLoaded); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeReaderTest.java similarity index 99% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeReaderTest.java index c48994ce0e3..43c73857e44 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeReaderTest.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeTest.java similarity index 97% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeTest.java index 5eaa67786b3..6516c4933a8 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeTest.java @@ -19,13 +19,14 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; +import org.matsim.freight.carriers.CarrierVehicleTypes; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.*; import org.matsim.vehicles.EngineInformation.FuelType; @@ -76,7 +77,7 @@ public void setUp() throws Exception{ engineInformation.setFuelConsumption( 0.015 ); VehicleCapacity capacity = smallType.getCapacity() ; capacity.setWeightInTons( 16 ) ; -// VehicleType smallType = CarrierUtils.CarrierVehicleTypeBuilder.newInstance( smallTypeId, mediumType ) +// VehicleType smallType = CarriersUtils.CarrierVehicleTypeBuilder.newInstance( smallTypeId, mediumType ) smallType.setDescription( "Small Vehicle" ).setMaximumVelocity( 10.0 ) ; types.getVehicleTypes().put( smallType.getId(), smallType ); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeWriterTest.java similarity index 90% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeWriterTest.java index 0f2101b31c8..551c5b6eac8 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarrierVehicleTypeWriterTest.java @@ -19,10 +19,13 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Rule; import org.junit.Test; +import org.matsim.freight.carriers.CarrierVehicleTypeReader; +import org.matsim.freight.carriers.CarrierVehicleTypeWriter; +import org.matsim.freight.carriers.CarrierVehicleTypes; import org.matsim.testcases.MatsimTestUtils; public class CarrierVehicleTypeWriterTest { diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierUtilsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarriersUtilsTest.java similarity index 86% rename from contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierUtilsTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/CarriersUtilsTest.java index 1aa8faf75ad..e6224ced05c 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/carrier/CarrierUtilsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/CarriersUtilsTest.java @@ -19,12 +19,13 @@ * */ -package org.matsim.freight.carriers.carrier; +package org.matsim.freight.carriers; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; +import org.matsim.freight.carriers.*; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleUtils; @@ -33,7 +34,7 @@ /** */ -public class CarrierUtilsTest { +public class CarriersUtilsTest { @Rule public MatsimTestUtils testUtils = new MatsimTestUtils(); @@ -46,14 +47,14 @@ public void testAddAndGetVehicleToCarrier() { // carrierVehicle.setType(VehicleUtils.getDefaultVehicleType()); //add Vehicle - CarrierUtils.addCarrierVehicle(carrier, carrierVehicle); + CarriersUtils.addCarrierVehicle(carrier, carrierVehicle); Assert.assertEquals(1, carrier.getCarrierCapabilities().getCarrierVehicles().size()); CarrierVehicle cv = (CarrierVehicle) carrier.getCarrierCapabilities().getCarrierVehicles().values().toArray()[0]; Assert.assertEquals(VehicleUtils.getDefaultVehicleType(), cv.getType()); Assert.assertEquals(Id.createLinkId("link0"), cv.getLinkId() ); //get Vehicle - CarrierVehicle carrierVehicle1 = CarrierUtils.getCarrierVehicle(carrier, testVehicleId ); + CarrierVehicle carrierVehicle1 = CarriersUtils.getCarrierVehicle(carrier, testVehicleId ); Assert.assertEquals(testVehicleId, carrierVehicle1.getId()); Assert.assertEquals(VehicleUtils.getDefaultVehicleType(), carrierVehicle1.getType()); Assert.assertEquals(Id.createLinkId("link0"), carrierVehicle1.getLinkId() ); @@ -67,14 +68,14 @@ public void testAddAndGetServiceToCarrier() { .setName("service1").setCapacityDemand(15).setServiceDuration(30).build(); //add Service - CarrierUtils.addService(carrier, service1); + CarriersUtils.addService(carrier, service1); Assert.assertEquals(1, carrier.getServices().size()); CarrierService cs1a = (CarrierService) carrier.getServices().values().toArray()[0]; Assert.assertEquals(service1, cs1a); Assert.assertEquals(Id.createLinkId("link0"), cs1a.getLocationLinkId()); //get Service - CarrierService cs1b = CarrierUtils.getService(carrier, serviceId ); + CarrierService cs1b = CarriersUtils.getService(carrier, serviceId ); Assert.assertEquals(serviceId, cs1b.getId()); Assert.assertEquals(service1.getId(), cs1b.getId()); Assert.assertEquals(Id.createLinkId("link0"), cs1b.getLocationLinkId()); @@ -88,14 +89,14 @@ public void testAddAndGetShipmentToCarrier() { CarrierShipment service1 = CarrierShipment.Builder.newInstance(shipmentId,Id.createLinkId("link0"), Id.createLinkId("link1"), 20 ).build(); //add Shipment - CarrierUtils.addShipment(carrier, service1); + CarriersUtils.addShipment(carrier, service1); Assert.assertEquals(1, carrier.getShipments().size()); CarrierShipment carrierShipment1a = (CarrierShipment) carrier.getShipments().values().toArray()[0]; Assert.assertEquals(service1, carrierShipment1a); Assert.assertEquals(Id.createLinkId("link0"), carrierShipment1a.getFrom()); //get Shipment - CarrierShipment carrierShipment1b = CarrierUtils.getShipment(carrier, shipmentId ); + CarrierShipment carrierShipment1b = CarriersUtils.getShipment(carrier, shipmentId ); Assert.assertEquals(shipmentId, carrierShipment1b.getId()); Assert.assertEquals(service1.getId(), carrierShipment1b.getId()); Assert.assertEquals(Id.createLinkId("link0"), carrierShipment1b.getFrom()); @@ -106,10 +107,10 @@ public void testAddAndGetShipmentToCarrier() { public void testGetSetJspritIteration(){ Carrier carrier = new CarrierImpl(Id.create("carrier", Carrier.class)); //jspirtIterations is not set. should return Integer.Min_Value (null is not possible because returning (int) - Assert.assertEquals(Integer.MIN_VALUE, CarrierUtils.getJspritIterations(carrier) ); + Assert.assertEquals(Integer.MIN_VALUE, CarriersUtils.getJspritIterations(carrier) ); - CarrierUtils.setJspritIterations(carrier, 125); - Assert.assertEquals(125, CarrierUtils.getJspritIterations(carrier) ); + CarriersUtils.setJspritIterations(carrier, 125); + Assert.assertEquals(125, CarriersUtils.getJspritIterations(carrier) ); } } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java index 9c157031a97..648a61edff2 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithPersonsIT.java @@ -34,7 +34,7 @@ import org.matsim.core.controler.AbstractModule; import org.matsim.core.controler.Controler; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.mobsim.DistanceScoringFunctionFactoryForTests; import org.matsim.freight.carriers.mobsim.StrategyManagerFactoryForTests; import org.matsim.testcases.MatsimTestUtils; @@ -80,7 +80,7 @@ static Scenario commonScenario( Config config, MatsimTestUtils testUtils ){ CarrierVehicleTypes carrierVehicleTypes = new CarrierVehicleTypes(); new CarrierVehicleTypeReader( carrierVehicleTypes ).readFile( testUtils.getPackageInputDirectory() + "vehicleTypes_v2.xml" ); - Carriers carriers = CarrierUtils.addOrGetCarriers(scenario ); + Carriers carriers = CarriersUtils.addOrGetCarriers(scenario ); new CarrierPlanXmlReader( carriers, carrierVehicleTypes ).readFile( testUtils.getClassInputDirectory() + "carrierPlansEquils.xml" ); return scenario; } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java index 2f2241a3811..51a28a88ed0 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/controler/EquilWithCarrierWithoutPersonsIT.java @@ -31,10 +31,10 @@ import org.matsim.core.controler.AbstractModule; import org.matsim.core.controler.Controler; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour; import org.matsim.freight.carriers.mobsim.DistanceScoringFunctionFactoryForTests; import org.matsim.freight.carriers.mobsim.StrategyManagerFactoryForTests; import org.matsim.freight.carriers.mobsim.TimeScoringFunctionFactoryForTests; @@ -72,7 +72,7 @@ public void testWithoutCarrierRoutes() { Scenario scenario = EquilWithCarrierWithPersonsIT.commonScenario( config, testUtils ); // set the routes to null: - for( Carrier carrier : CarrierUtils.getCarriers( scenario ).getCarriers().values() ){ + for( Carrier carrier : CarriersUtils.getCarriers( scenario ).getCarriers().values() ){ for( ScheduledTour tour : carrier.getSelectedPlan().getScheduledTours() ){ for( Tour.TourElement tourElement : tour.getTour().getTourElements() ){ if ( tourElement instanceof Tour.Leg ) { @@ -110,10 +110,10 @@ public void install() { }); controler.run(); - Carrier carrier1 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); + Carrier carrier1 = CarriersUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); Assert.assertEquals(-170000.0, carrier1.getSelectedPlan().getScore(), 0.0 ); - Carrier carrier2 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); + Carrier carrier2 = CarriersUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); Assert.assertEquals(-85000.0, carrier2.getSelectedPlan().getScore(), 0.0 ); } @@ -136,10 +136,10 @@ public void install() { }); controler.run(); - Carrier carrier1 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); + Carrier carrier1 = CarriersUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); Assert.assertEquals(-240.0, carrier1.getSelectedPlan().getScore(), 2.0); - Carrier carrier2 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); + Carrier carrier2 = CarriersUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); Assert.assertEquals(0.0, carrier2.getSelectedPlan().getScore(), 0.0 ); } @@ -164,10 +164,10 @@ public void install() { }); controler.run(); - Carrier carrier1 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); + Carrier carrier1 = CarriersUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); Assert.assertEquals(-4873.0, carrier1.getSelectedPlan().getScore(), 2.0); - Carrier carrier2 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); + Carrier carrier2 = CarriersUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier2", Carrier.class)); Assert.assertEquals(0.0, carrier2.getSelectedPlan().getScore(), 0.0 ); } @@ -192,7 +192,7 @@ public void install() { }); controler.run(); - Carrier carrier1 = CarrierUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); + Carrier carrier1 = CarriersUtils.getCarriers(controler.getScenario()).getCarriers().get(Id.create("carrier1", Carrier.class)); Assert.assertEquals(-4871.0, carrier1.getSelectedPlan().getScore(), 2.0); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java index d0ee832e676..71b63d36035 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintFromVehiclesFileTest.java @@ -38,10 +38,9 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.FreightCarriersConfigGroup.UseDistanceConstraintForTourPlanning; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -101,16 +100,16 @@ public final void CarrierSmallBatteryTest_Version1() throws ExecutionException, FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV1 = CarrierUtils.createCarrier(Id.create("Carrier_Version1", Carrier.class)); + Carrier carrierV1 = CarriersUtils.createCarrier(Id.create("Carrier_Version1", Carrier.class)); carriers.addCarrier(addTwoServicesToCarrier(carrierV1)); createCarriers(carriers, fleetSize, carrierV1, vehicleTypes); scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV1, 25); + CarriersUtils.setJspritIterations(carrierV1, 25); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 1, carrierV1.getSelectedPlan().getScheduledTours().size()); @@ -174,16 +173,16 @@ public final void CarrierLargeBatteryTest_Version2() throws ExecutionException, FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV2 = CarrierUtils.createCarrier(Id.create("Carrier_Version2", Carrier.class)); + Carrier carrierV2 = CarriersUtils.createCarrier(Id.create("Carrier_Version2", Carrier.class)); carriers.addCarrier(addTwoServicesToCarrier(carrierV2)); createCarriers(carriers, fleetSize, carrierV2, vehicleTypes); scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV2, 10); + CarriersUtils.setJspritIterations(carrierV2, 10); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 1, @@ -249,16 +248,16 @@ public final void Carrier2SmallBatteryTest_Version3() throws ExecutionException, } FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV3 = CarrierUtils.createCarrier(Id.create("Carrier_Version3", Carrier.class)); + Carrier carrierV3 = CarriersUtils.createCarrier(Id.create("Carrier_Version3", Carrier.class)); carriers.addCarrier(addTwoServicesToCarrier(carrierV3)); createCarriers(carriers, fleetSize, carrierV3, vehicleTypes); scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV3, 10); + CarriersUtils.setJspritIterations(carrierV3, 10); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 2, carrierV3.getSelectedPlan().getScheduledTours().size()); @@ -331,16 +330,16 @@ public final void CarrierWithAdditionalDieselVehicleTest_Version4() throws Execu } FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV4 = CarrierUtils.createCarrier(Id.create("Carrier_Version4", Carrier.class)); + Carrier carrierV4 = CarriersUtils.createCarrier(Id.create("Carrier_Version4", Carrier.class)); carriers.addCarrier(addThreeServicesToCarrier(carrierV4)); createCarriers(carriers, fleetSize, carrierV4, vehicleTypes); scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV4, 10); + CarriersUtils.setJspritIterations(carrierV4, 10); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amount of scheduled tours", 2, carrierV4.getSelectedPlan().getScheduledTours().size()); @@ -410,14 +409,14 @@ private static Carrier addTwoServicesToCarrier(Carrier carrier) { .newInstance(Id.create("Service1", CarrierService.class), Id.createLinkId("j(3,8)")) .setServiceDuration(20).setServiceStartTimeWindow(TimeWindow.newInstance(8 * 3600, 10 * 3600)) .setCapacityDemand(40).build(); - CarrierUtils.addService(carrier, service1); + CarriersUtils.addService(carrier, service1); // Service 2 CarrierService service2 = CarrierService.Builder .newInstance(Id.create("Service2", CarrierService.class), Id.createLinkId("j(0,3)R")) .setServiceDuration(20).setServiceStartTimeWindow(TimeWindow.newInstance(8 * 3600, 10 * 3600)) .setCapacityDemand(40).build(); - CarrierUtils.addService(carrier, service2); + CarriersUtils.addService(carrier, service2); return carrier; } @@ -431,7 +430,7 @@ private static Carrier addThreeServicesToCarrier(Carrier carrier) { .newInstance(Id.create("Service3", CarrierService.class), Id.createLinkId("j(9,2)")) .setServiceDuration(20).setServiceStartTimeWindow(TimeWindow.newInstance(8 * 3600, 10 * 3600)) .setCapacityDemand(40).build(); - CarrierUtils.addService(carrier, service3); + CarriersUtils.addService(carrier, service3); return carrier; } @@ -484,7 +483,7 @@ private static void defineCarriers(Carriers carriers, FleetSize fleetSize, Carri singleCarrier.setCarrierCapabilities(CarrierCapabilities.Builder.newInstance().setFleetSize(fleetSize).build()); for (CarrierVehicle carrierVehicle : vehicles) { - CarrierUtils.addCarrierVehicle(singleCarrier, carrierVehicle); + CarriersUtils.addCarrierVehicle(singleCarrier, carrierVehicle); } singleCarrier.getCarrierCapabilities().getVehicleTypes().addAll(vehicleTypes.getVehicleTypes().values()); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java index 36cc259e55b..cff10f42763 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/DistanceConstraintTest.java @@ -38,10 +38,9 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.FreightCarriersConfigGroup.UseDistanceConstraintForTourPlanning; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -93,7 +92,7 @@ public final void CarrierSmallBatteryTest_Version1() throws ExecutionException, FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV1 = CarrierUtils.createCarrier(Id.create("Carrier_Version1", Carrier.class)); + Carrier carrierV1 = CarriersUtils.createCarrier(Id.create("Carrier_Version1", Carrier.class)); VehicleType vehicleType_LargeV1 = VehicleUtils.createVehicleType(Id.create("LargeBattery_V1", VehicleType.class)); vehicleType_LargeV1.getCostInformation().setCostsPerMeter(0.00055).setCostsPerSecond(0.008).setFixedCost(100.); VehicleUtils.setHbefaTechnology(vehicleType_LargeV1.getEngineInformation(), "electricity"); @@ -118,9 +117,9 @@ public final void CarrierSmallBatteryTest_Version1() throws ExecutionException, scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV1, 25); + CarriersUtils.setJspritIterations(carrierV1, 25); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 1, carrierV1.getSelectedPlan().getScheduledTours().size()); @@ -171,7 +170,7 @@ public final void CarrierLargeBatteryTest_Version2() throws ExecutionException, FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV2 = CarrierUtils.createCarrier(Id.create("Carrier_Version2", Carrier.class)); + Carrier carrierV2 = CarriersUtils.createCarrier(Id.create("Carrier_Version2", Carrier.class)); VehicleType vehicleType_LargeV2 = VehicleUtils.createVehicleType(Id.create("LargeBattery_V2", VehicleType.class)); vehicleType_LargeV2.getCostInformation().setCostsPerMeter(0.00055).setCostsPerSecond(0.008).setFixedCost(100.); @@ -197,9 +196,9 @@ public final void CarrierLargeBatteryTest_Version2() throws ExecutionException, scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV2, 10); + CarriersUtils.setJspritIterations(carrierV2, 10); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 1, @@ -252,7 +251,7 @@ public final void Carrier2SmallBatteryTest_Version3() throws ExecutionException, CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes(); FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV3 = CarrierUtils.createCarrier(Id.create("Carrier_Version3", Carrier.class)); + Carrier carrierV3 = CarriersUtils.createCarrier(Id.create("Carrier_Version3", Carrier.class)); VehicleType vehicleType_LargeV3 = VehicleUtils.createVehicleType(Id.create("LargeBattery_V3", VehicleType.class)); vehicleType_LargeV3.getCostInformation().setCostsPerMeter(0.00055).setCostsPerSecond(0.008).setFixedCost(100.); @@ -281,9 +280,9 @@ public final void Carrier2SmallBatteryTest_Version3() throws ExecutionException, scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV3, 10); + CarriersUtils.setJspritIterations(carrierV3, 10); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 2, carrierV3.getSelectedPlan().getScheduledTours().size()); @@ -342,7 +341,7 @@ public final void CarrierWithAdditionalDieselVehicleTest_Version4() throws Execu CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes(); FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV4 = CarrierUtils.createCarrier(Id.create("Carrier_Version4", Carrier.class)); + Carrier carrierV4 = CarriersUtils.createCarrier(Id.create("Carrier_Version4", Carrier.class)); VehicleType vehicleType_LargeV4 = VehicleUtils.createVehicleType(Id.create("LargeBattery_V4", VehicleType.class)); vehicleType_LargeV4.getCostInformation().setCostsPerMeter(0.00055).setCostsPerSecond(0.008).setFixedCost(100.); @@ -376,9 +375,9 @@ public final void CarrierWithAdditionalDieselVehicleTest_Version4() throws Execu scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV4, 10); + CarriersUtils.setJspritIterations(carrierV4, 10); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); Assert.assertEquals("Not the correct amout of scheduled tours", 2, carrierV4.getSelectedPlan().getScheduledTours().size()); @@ -442,7 +441,7 @@ public final void CarrierWithShipmentsMidSizeBatteryTest_Version5() throws Execu FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV5 = CarrierUtils.createCarrier(Id.create("Carrier_Version5", Carrier.class)); + Carrier carrierV5 = CarriersUtils.createCarrier(Id.create("Carrier_Version5", Carrier.class)); VehicleType vehicleType_MidSizeV5 = VehicleUtils.createVehicleType(Id.create("MidSizeBattery_V5", VehicleType.class)); vehicleType_MidSizeV5.getCostInformation().setCostsPerMeter(0.00055).setCostsPerSecond(0.008).setFixedCost(100.); @@ -459,9 +458,9 @@ public final void CarrierWithShipmentsMidSizeBatteryTest_Version5() throws Execu scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV5, 10); + CarriersUtils.setJspritIterations(carrierV5, 10); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); //We need two tours, due to reloading both shipments must be transported one after the other Assert.assertEquals("Not the correct amout of scheduled tours", 2, @@ -521,7 +520,7 @@ public final void CarrierWithShipmentsLargeBatteryTest_Version6() throws Executi FleetSize fleetSize = FleetSize.INFINITE; - Carrier carrierV5 = CarrierUtils.createCarrier(Id.create("Carrier_Version5", Carrier.class)); + Carrier carrierV5 = CarriersUtils.createCarrier(Id.create("Carrier_Version5", Carrier.class)); VehicleType vehicleType_LargeV5 = VehicleUtils.createVehicleType(Id.create("LargeBattery_V5", VehicleType.class)); vehicleType_LargeV5.getCostInformation().setCostsPerMeter(0.00055).setCostsPerSecond(0.008).setFixedCost(100.); @@ -538,9 +537,9 @@ public final void CarrierWithShipmentsLargeBatteryTest_Version6() throws Executi scenario.addScenarioElement("carrierVehicleTypes", vehicleTypes); scenario.addScenarioElement("carriers", carriers); - CarrierUtils.setJspritIterations(carrierV5, 10); + CarriersUtils.setJspritIterations(carrierV5, 10); - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); //We need two tours, due to reloading both shipments must be transported one after the other @@ -601,14 +600,14 @@ private static Carrier addTwoServicesToCarrier(Carrier carrier) { .newInstance(Id.create("Service1", CarrierService.class), Id.createLinkId("j(3,8)")) .setServiceDuration(20).setServiceStartTimeWindow(TimeWindow.newInstance(8 * 3600, 10 * 3600)) .setCapacityDemand(40).build(); - CarrierUtils.addService(carrier, service1); + CarriersUtils.addService(carrier, service1); // Service 2 CarrierService service2 = CarrierService.Builder .newInstance(Id.create("Service2", CarrierService.class), Id.createLinkId("j(0,3)R")) .setServiceDuration(20).setServiceStartTimeWindow(TimeWindow.newInstance(8 * 3600, 10 * 3600)) .setCapacityDemand(40).build(); - CarrierUtils.addService(carrier, service2); + CarriersUtils.addService(carrier, service2); return carrier; } @@ -619,14 +618,14 @@ private static Carrier addTwoShipmentsToCarrier(Carrier carrier) { .newInstance(Id.create("Shipment1", CarrierShipment.class), Id.createLinkId("i(1,8)"), Id.createLinkId("j(3,8)"), 40) .setDeliveryServiceTime(20).setDeliveryTimeWindow(TimeWindow.newInstance(8 * 3600, 12 * 3600)) .build(); - CarrierUtils.addShipment(carrier, shipment1); + CarriersUtils.addShipment(carrier, shipment1); // Shipment 2 CarrierShipment shipment2 = CarrierShipment.Builder .newInstance(Id.create("Shipment2", CarrierShipment.class),Id.createLinkId("i(1,8)"), Id.createLinkId("j(0,3)R"), 40) .setDeliveryServiceTime(20).setDeliveryTimeWindow(TimeWindow.newInstance(8 * 3600, 12 * 3600)) .build(); - CarrierUtils.addShipment(carrier, shipment2); + CarriersUtils.addShipment(carrier, shipment2); return carrier; } @@ -640,7 +639,7 @@ private static Carrier addThreeServicesToCarrier(Carrier carrier) { .newInstance(Id.create("Service3", CarrierService.class), Id.createLinkId("j(9,2)")) .setServiceDuration(20).setServiceStartTimeWindow(TimeWindow.newInstance(8 * 3600, 10 * 3600)) .setCapacityDemand(40).build(); - CarrierUtils.addService(carrier, service3); + CarriersUtils.addService(carrier, service3); return carrier; } @@ -693,7 +692,7 @@ private static void defineCarriers(Carriers carriers, FleetSize fleetSize, Carri singleCarrier.setCarrierCapabilities(CarrierCapabilities.Builder.newInstance().setFleetSize(fleetSize).build()); for (CarrierVehicle carrierVehicle : vehicles) { - CarrierUtils.addCarrierVehicle(singleCarrier, carrierVehicle); + CarriersUtils.addCarrierVehicle(singleCarrier, carrierVehicle); } singleCarrier.getCarrierCapabilities().getVehicleTypes().addAll(vehicleTypes.getVehicleTypes().values()); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/FixedCostsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/FixedCostsTest.java index fced3431ab7..a1811281682 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/FixedCostsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/FixedCostsTest.java @@ -39,7 +39,7 @@ import org.matsim.core.network.NetworkUtils; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.utils.io.IOUtils; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.EngineInformation; import org.matsim.vehicles.Vehicle; @@ -70,17 +70,17 @@ public void setUp() throws Exception { CarrierService service1 = createMatsimService("Service1", "i(3,0)", 1); CarrierService service2 = createMatsimService("Service2", "i(9,9)R", 1); - Carrier carrier1 = CarrierUtils.createCarrier(Id.create("carrier1", Carrier.class ) ); - CarrierUtils.addService(carrier1, service1); - CarrierUtils.addService(carrier1, service2); + Carrier carrier1 = CarriersUtils.createCarrier(Id.create("carrier1", Carrier.class ) ); + CarriersUtils.addService(carrier1, service1); + CarriersUtils.addService(carrier1, service2); - Carrier carrier2 = CarrierUtils.createCarrier(Id.create("carrier2", Carrier.class ) ); - CarrierUtils.addService(carrier2, service1); - CarrierUtils.addService(carrier2, service2); + Carrier carrier2 = CarriersUtils.createCarrier(Id.create("carrier2", Carrier.class ) ); + CarriersUtils.addService(carrier2, service1); + CarriersUtils.addService(carrier2, service2); - Carrier carrier3 = CarrierUtils.createCarrier(Id.create("carrier3", Carrier.class ) ); - CarrierUtils.addService(carrier3, service1); - CarrierUtils.addService(carrier3, service2); + Carrier carrier3 = CarriersUtils.createCarrier(Id.create("carrier3", Carrier.class ) ); + CarriersUtils.addService(carrier3, service1); + CarriersUtils.addService(carrier3, service2); //Create add vehicle for carriers diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java index dd4c763cbd2..984bdd3e5e8 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/IntegrationIT.java @@ -36,8 +36,7 @@ import org.matsim.core.config.ConfigUtils; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; import org.matsim.testcases.MatsimTestUtils; @@ -66,18 +65,18 @@ public void testJsprit() throws ExecutionException, InterruptedException { Scenario scenario = ScenarioUtils.createScenario(config); new MatsimNetworkReader(scenario.getNetwork()).readFile(networkFilename); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); - for (Carrier carrier : CarrierUtils.getCarriers(scenario).getCarriers().values()) { - CarrierUtils.setJspritIterations(carrier, 1); + for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) { + CarriersUtils.setJspritIterations(carrier, 1); } - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); double scoreWithRunJsprit = 0; - for (Carrier carrier : CarrierUtils.getCarriers(scenario).getCarriers().values()) { + for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) { scoreWithRunJsprit = scoreWithRunJsprit + carrier.getSelectedPlan().getJspritScore(); } - double scoreRunWithOldStructure = generateCarrierPlans(scenario.getNetwork(), CarrierUtils.getCarriers(scenario), CarrierUtils.getCarrierVehicleTypes(scenario)); + double scoreRunWithOldStructure = generateCarrierPlans(scenario.getNetwork(), CarriersUtils.getCarriers(scenario), CarriersUtils.getCarrierVehicleTypes(scenario)); Assert.assertEquals("The score of both runs are not the same", scoreWithRunJsprit, scoreRunWithOldStructure, MatsimTestUtils.EPSILON); } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/MatsimTransformerTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/MatsimTransformerTest.java index 3b1d20bc402..7b3060643a3 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/MatsimTransformerTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/MatsimTransformerTest.java @@ -38,8 +38,8 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.core.network.NetworkUtils; import org.matsim.core.network.io.MatsimNetworkReader; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -325,7 +325,7 @@ public void whenTransforming_matsimPlan2vehicleRouteSolution_itIsMadeCorrectly() VehicleRoutingProblem vehicleRoutingProblem = VehicleRoutingProblem.Builder.newInstance().addAllJobs(services1) .addAllJobs(services2).addVehicle(v1).addVehicle(v2).build(); - CarrierPlan plan = new CarrierPlan(CarrierUtils.createCarrier(Id.create("myCarrier", Carrier.class)), sTours); + CarrierPlan plan = new CarrierPlan(CarriersUtils.createCarrier(Id.create("myCarrier", Carrier.class)), sTours); plan.setScore(-100.0); VehicleRoutingProblemSolution solution = MatsimJspritFactory.createSolution(plan, vehicleRoutingProblem); assertNotNull(solution); @@ -383,7 +383,7 @@ private VehicleType getMatsimVehicleType() { // EngineInformation engineInformation = new EngineInformation(); // engineInformation.setFuelType( FuelType.diesel ); // engineInformation.setFuelConsumption( (double) 15 ); -// CarrierUtils.CarrierVehicleTypeBuilder builder = CarrierUtils.CarrierVehicleTypeBuilder.newInstance( Id.create( "matsimType", VehicleType.class ) ) +// CarriersUtils.CarrierVehicleTypeBuilder builder = CarriersUtils.CarrierVehicleTypeBuilder.newInstance( Id.create( "matsimType", VehicleType.class ) ) VehicleType vehicleType = VehicleUtils.getFactory() .createVehicleType(Id.create("matsimType", VehicleType.class)).setMaximumVelocity(13.8); vehicleType.getCapacity().setOther(50); @@ -514,7 +514,7 @@ public void createVehicleRoutingProblemBuilderWithShipments_isMadeCorrectly() { } private Carrier createCarrierWithServices() { - Carrier carrier = CarrierUtils.createCarrier(Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarriersUtils.createCarrier(Id.create("TestCarrier", Carrier.class)); VehicleType matsimType = getMatsimVehicleType(); CarrierCapabilities.Builder ccBuilder = CarrierCapabilities.Builder.newInstance() .addVehicle(getMatsimVehicle("matsimVehicle", "i(6,0)", matsimType)).setFleetSize(FleetSize.INFINITE); @@ -522,24 +522,24 @@ private Carrier createCarrierWithServices() { CarrierService carrierService1 = CarrierService.Builder .newInstance(Id.create("serviceId", CarrierService.class), Id.create("i(7,4)R", Link.class)) .setCapacityDemand(20).setServiceDuration(10.0).build(); - CarrierUtils.addService(carrier, carrierService1); + CarriersUtils.addService(carrier, carrierService1); CarrierService carrierService2 = CarrierService.Builder .newInstance(Id.create("serviceId2", CarrierService.class), Id.create("i(3,9)", Link.class)) .setCapacityDemand(10).setServiceDuration(20.0).build(); - CarrierUtils.addService(carrier, carrierService2); + CarriersUtils.addService(carrier, carrierService2); return carrier; } private Carrier createCarrierWithShipments() { - Carrier carrier = CarrierUtils.createCarrier(Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarriersUtils.createCarrier(Id.create("TestCarrier", Carrier.class)); VehicleType matsimType = getMatsimVehicleType(); CarrierCapabilities.Builder ccBuilder = CarrierCapabilities.Builder.newInstance() .addVehicle(getMatsimVehicle("matsimVehicle", "i(6,0)", matsimType)).setFleetSize(FleetSize.INFINITE); carrier.setCarrierCapabilities(ccBuilder.build()); CarrierShipment shipment1 = getMatsimShipment("shipment1", "i(6,0)", "i(7,4)R", 10); - CarrierUtils.addShipment(carrier, shipment1); + CarriersUtils.addShipment(carrier, shipment1); CarrierShipment shipment2 = getMatsimShipment("shipment2", "i(6,0)", "i(3,9)", 20); - CarrierUtils.addShipment(carrier, shipment2); + CarriersUtils.addShipment(carrier, shipment2); return carrier; } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java index ddeaab619d4..3201a4cd5c9 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/jsprit/SkillsIT.java @@ -36,7 +36,7 @@ import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.misc.Time; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.VehicleType; @@ -78,7 +78,7 @@ public void testJspritWithSameSkillsRequired(){ } private VehicleRoutingProblemSolution generateCarrierPlans(Scenario scenario) { - Carrier carrier = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); NetworkBasedTransportCosts networkBasedTransportCosts = NetworkBasedTransportCosts.Builder.newInstance( scenario.getNetwork(), carrier.getCarrierCapabilities().getVehicleTypes()) .setTimeSliceWidth((int) Time.parseTime("00:30:00")) @@ -106,9 +106,9 @@ private Scenario setupTestScenario() { Scenario scenario = ScenarioUtils.createScenario(ConfigUtils.createConfig()); new MatsimNetworkReader(scenario.getNetwork()).readFile(utils.getClassInputDirectory() + "grid-network.xml"); - Carriers carriers = CarrierUtils.addOrGetCarriers(scenario ); + Carriers carriers = CarriersUtils.addOrGetCarriers(scenario ); { - Carrier carrier = CarrierUtils.createCarrier( Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarriersUtils.createCarrier( Id.create("TestCarrier", Carrier.class)); { CarrierCapabilities.Builder capabilitiesBuilder = CarrierCapabilities.Builder.newInstance(); capabilitiesBuilder.setFleetSize(CarrierCapabilities.FleetSize.FINITE); @@ -126,7 +126,7 @@ private Scenario setupTestScenario() { typeOne.getCostInformation().setFixedCost( 1000.0 ).setCostsPerMeter( 0.001 ).setCostsPerSecond( 0.001 ) ; // typeOne.setCapacity(vehicleCapacity); typeOne.getCapacity().setOther( 2.0 ); - CarrierUtils.addSkill(typeOne, "skill 1"); + CarriersUtils.addSkill(typeOne, "skill 1"); capabilitiesBuilder.addType(typeOne); CarrierVehicle vehicleOne = CarrierVehicle.Builder.newInstance(Id.createVehicleId("1"), carrierLocation, typeOne ) .setEarliestStart(0.0) @@ -140,7 +140,7 @@ private Scenario setupTestScenario() { typeTwo.getCostInformation().setFixedCost( 1000.0 ).setCostsPerMeter( 0.001 ).setCostsPerSecond( 0.001 ) ; // typeTwo.setCapacity(vehicleCapacity); typeTwo.getCapacity().setOther( 2.0 ); - CarrierUtils.addSkill(typeTwo, "skill 2"); + CarriersUtils.addSkill(typeTwo, "skill 2"); capabilitiesBuilder.addType(typeTwo); CarrierVehicle vehicleTwo = CarrierVehicle.Builder.newInstance(Id.createVehicleId("2"), carrierLocation, typeTwo ) .setEarliestStart(0.0) @@ -157,7 +157,7 @@ private Scenario setupTestScenario() { } private void addShipmentsRequiringDifferentSkills(Scenario scenario) { - Carrier carrier = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); CarrierShipment shipmentOne = CarrierShipment.Builder.newInstance( Id.create("1", CarrierShipment.class), carrierLocation, @@ -168,8 +168,8 @@ private void addShipmentsRequiringDifferentSkills(Scenario scenario) { .setDeliveryTimeWindow(TimeWindow.newInstance(0.0, Time.parseTime("24:00:00"))) .setDeliveryServiceTime(Time.parseTime("00:05:00")) .build(); - CarrierUtils.addSkill(shipmentOne, "skill 1"); - CarrierUtils.addShipment(carrier, shipmentOne); + CarriersUtils.addSkill(shipmentOne, "skill 1"); + CarriersUtils.addShipment(carrier, shipmentOne); CarrierShipment shipmentTwo = CarrierShipment.Builder.newInstance( Id.create("2", CarrierShipment.class), @@ -181,12 +181,12 @@ private void addShipmentsRequiringDifferentSkills(Scenario scenario) { .setDeliveryTimeWindow(TimeWindow.newInstance(0.0, Time.parseTime("24:00:00"))) .setDeliveryServiceTime(Time.parseTime("00:05:00")) .build(); - CarrierUtils.addSkill(shipmentTwo, "skill 2"); - CarrierUtils.addShipment(carrier, shipmentTwo); + CarriersUtils.addSkill(shipmentTwo, "skill 2"); + CarriersUtils.addShipment(carrier, shipmentTwo); } private void addShipmentsRequiringSameSkills(Scenario scenario) { - Carrier carrier = CarrierUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); + Carrier carrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create("TestCarrier", Carrier.class)); CarrierShipment shipmentOne = CarrierShipment.Builder.newInstance( Id.create("1", CarrierShipment.class), carrierLocation, @@ -197,8 +197,8 @@ private void addShipmentsRequiringSameSkills(Scenario scenario) { .setDeliveryTimeWindow(TimeWindow.newInstance(0.0, Time.parseTime("24:00:00"))) .setDeliveryServiceTime(Time.parseTime("00:05:00")) .build(); - CarrierUtils.addSkill(shipmentOne, "skill 1"); - CarrierUtils.addShipment(carrier, shipmentOne); + CarriersUtils.addSkill(shipmentOne, "skill 1"); + CarriersUtils.addShipment(carrier, shipmentOne); CarrierShipment shipmentTwo = CarrierShipment.Builder.newInstance( Id.create("2", CarrierShipment.class), @@ -210,8 +210,8 @@ private void addShipmentsRequiringSameSkills(Scenario scenario) { .setDeliveryTimeWindow(TimeWindow.newInstance(0.0, Time.parseTime("24:00:00"))) .setDeliveryServiceTime(Time.parseTime("00:05:00")) .build(); - CarrierUtils.addSkill(shipmentTwo, "skill 1"); - CarrierUtils.addShipment(carrier, shipmentTwo); + CarriersUtils.addSkill(shipmentTwo, "skill 1"); + CarriersUtils.addShipment(carrier, shipmentTwo); } } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/DistanceScoringFunctionFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/DistanceScoringFunctionFactoryForTests.java index 2afebf0bbf7..7dba7a46fdb 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/DistanceScoringFunctionFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/DistanceScoringFunctionFactoryForTests.java @@ -36,10 +36,10 @@ import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.ActivityScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.BasicScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.LegScoring; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.CarrierVehicle; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.vehicles.Vehicle; @@ -97,7 +97,7 @@ public void endLeg(double time) { if(currentLeg.getRoute() instanceof NetworkRoute){ NetworkRoute nRoute = (NetworkRoute) currentLeg.getRoute(); Id vehicleId = nRoute.getVehicleId(); - CarrierVehicle vehicle = CarrierUtils.getCarrierVehicle(carrier, vehicleId); + CarrierVehicle vehicle = CarriersUtils.getCarrierVehicle(carrier, vehicleId); Gbl.assertNotNull(vehicle); if(!employedVehicles.contains(vehicle)){ employedVehicles.add(vehicle); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/ScoringFunctionFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/ScoringFunctionFactoryForTests.java index 2280388ccc4..be93f2ad668 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/ScoringFunctionFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/ScoringFunctionFactoryForTests.java @@ -35,10 +35,10 @@ import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.ActivityScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.BasicScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.LegScoring; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.CarrierVehicle; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.vehicles.Vehicle; @@ -96,7 +96,7 @@ public void endLeg(double time) { if(currentLeg.getRoute() instanceof NetworkRoute){ NetworkRoute nRoute = (NetworkRoute) currentLeg.getRoute(); Id vehicleId = nRoute.getVehicleId(); - CarrierVehicle vehicle = CarrierUtils.getCarrierVehicle(carrier, vehicleId); + CarrierVehicle vehicle = CarriersUtils.getCarrierVehicle(carrier, vehicleId); Gbl.assertNotNull(vehicle); if(!employedVehicles.contains(vehicle)){ employedVehicles.add(vehicle); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java index 77aa54cbd28..fc693360e04 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/StrategyManagerFactoryForTests.java @@ -34,8 +34,8 @@ import org.matsim.core.router.util.LeastCostPathCalculator; import org.matsim.core.router.util.TravelDisutility; import org.matsim.core.router.util.TravelTime; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierPlan; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierPlan; import org.matsim.freight.carriers.controler.CarrierReRouteVehicles; import org.matsim.freight.carriers.controler.CarrierStrategyManager; import org.matsim.freight.carriers.controler.CarrierControlerUtils; diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/TimeScoringFunctionFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/TimeScoringFunctionFactoryForTests.java index d4bc990052d..b55a80f9ba1 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/TimeScoringFunctionFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/mobsim/TimeScoringFunctionFactoryForTests.java @@ -36,10 +36,10 @@ import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.ActivityScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.BasicScoring; import org.matsim.deprecated.scoring.ScoringFunctionAccumulator.LegScoring; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierConstants; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.CarrierVehicle; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierConstants; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.CarrierVehicle; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.vehicles.Vehicle; @@ -97,7 +97,7 @@ public void endLeg(double time) { if(currentLeg.getRoute() instanceof NetworkRoute){ NetworkRoute nRoute = (NetworkRoute) currentLeg.getRoute(); Id vehicleId = nRoute.getVehicleId(); - CarrierVehicle vehicle = CarrierUtils.getCarrierVehicle(carrier, vehicleId); + CarrierVehicle vehicle = CarriersUtils.getCarrierVehicle(carrier, vehicleId); assert vehicle != null : "cannot find vehicle with id=" + vehicleId; if(!employedVehicles.contains(vehicle)){ employedVehicles.add(vehicle); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsIT.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsIT.java index 764fb52d25a..05f0eeb244d 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsIT.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsIT.java @@ -35,8 +35,8 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.core.network.NetworkUtils; import org.matsim.core.network.io.MatsimNetworkReader; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; @@ -72,18 +72,18 @@ public void setUp() { //Create carrier with services and shipments Carriers carriersWithServicesAndShpiments = new Carriers(); - carrierWServices = CarrierUtils.createCarrier(CARRIER_SERVICES_ID ); + carrierWServices = CarriersUtils.createCarrier(CARRIER_SERVICES_ID ); CarrierService service1 = createMatsimService("Service1", "i(3,9)", 2); - CarrierUtils.addService(carrierWServices, service1); + CarriersUtils.addService(carrierWServices, service1); CarrierService service2 = createMatsimService("Service2", "i(4,9)", 2); - CarrierUtils.addService(carrierWServices, service2); + CarriersUtils.addService(carrierWServices, service2); //Create carrier with shipments - carrierWShipments = CarrierUtils.createCarrier(CARRIER_SHIPMENTS_ID ); + carrierWShipments = CarriersUtils.createCarrier(CARRIER_SHIPMENTS_ID ); CarrierShipment shipment1 = createMatsimShipment("shipment1", "i(1,0)", "i(7,6)R", 1); - CarrierUtils.addShipment(carrierWShipments, shipment1); + CarriersUtils.addShipment(carrierWShipments, shipment1); CarrierShipment shipment2 = createMatsimShipment("shipment2", "i(3,0)", "i(3,7)", 2); - CarrierUtils.addShipment(carrierWShipments, shipment2); + CarriersUtils.addShipment(carrierWShipments, shipment2); //Create vehicle for Carriers final Id vehTypeId = Id.create( "gridType", VehicleType.class ); @@ -97,7 +97,7 @@ public void setUp() { costInfo.setCostsPerSecond( 0.001 ) ; costInfo.setCostsPerMeter( 0.0001 ) ; costInfo.setFixedCost( 130. ) ; -// VehicleType carrierVehType = CarrierUtils.CarrierVehicleTypeBuilder.newInstance( vehTypeId ) +// VehicleType carrierVehType = CarriersUtils.CarrierVehicleTypeBuilder.newInstance( vehTypeId ) carrierVehType.setMaximumVelocity(10); CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes() ; @@ -148,7 +148,7 @@ public void setUp() { */ //Convert to jsprit VRP - Carriers carriersWithShipmentsOnly = CarrierUtils.createShipmentVRPCarrierFromServiceVRPSolution( + Carriers carriersWithShipmentsOnly = CarriersUtils.createShipmentVRPCarrierFromServiceVRPSolution( carriersWithServicesAndShpiments ); // assign vehicle types to the carriers diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java index afcfea39bcd..0f4354005b1 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/utils/CarrierControlerUtilsTest.java @@ -45,9 +45,8 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.examples.ExamplesUtils; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts.Builder; @@ -83,18 +82,18 @@ public void setUp() { //Create carrier with services and shipments Carriers carriersWithServicesAndShpiments = new Carriers(); - carrierWServices = CarrierUtils.createCarrier(CARRIER_SERVICES_ID ); + carrierWServices = CarriersUtils.createCarrier(CARRIER_SERVICES_ID ); CarrierService service1 = createMatsimService("Service1", "i(3,9)", 2); - CarrierUtils.addService(carrierWServices, service1); + CarriersUtils.addService(carrierWServices, service1); CarrierService service2 = createMatsimService("Service2", "i(4,9)", 2); - CarrierUtils.addService(carrierWServices, service2); + CarriersUtils.addService(carrierWServices, service2); //Create carrier with shipments - carrierWShipments = CarrierUtils.createCarrier(CARRIER_SHIPMENTS_ID ); + carrierWShipments = CarriersUtils.createCarrier(CARRIER_SHIPMENTS_ID ); CarrierShipment shipment1 = createMatsimShipment("shipment1", "i(1,0)", "i(7,6)R", 1); - CarrierUtils.addShipment(carrierWShipments, shipment1); + CarriersUtils.addShipment(carrierWShipments, shipment1); CarrierShipment shipment2 = createMatsimShipment("shipment2", "i(3,0)", "i(3,7)", 2); - CarrierUtils.addShipment(carrierWShipments, shipment2); + CarriersUtils.addShipment(carrierWShipments, shipment2); //Create vehicle for Carriers final Id vehicleTypeId = Id.create( "gridType", VehicleType.class ); @@ -107,7 +106,7 @@ public void setUp() { costInfo.setCostsPerMeter( 0.0001 ) ; costInfo.setCostsPerSecond( 0.001 ) ; costInfo.setFixedCost( 130. ) ; -// VehicleType carrierVehType = CarrierUtils.CarrierVehicleTypeBuilder.newInstance( vehicleTypeId ) +// VehicleType carrierVehType = CarriersUtils.CarrierVehicleTypeBuilder.newInstance( vehicleTypeId ) carrierVehType.setMaximumVelocity( 10. ) ; CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes() ; vehicleTypes.getVehicleTypes().put(carrierVehType.getId(), carrierVehType); @@ -156,7 +155,7 @@ public void setUp() { */ //Convert to jsprit VRP - Carriers carriersWithShipmentsOnly = CarrierUtils.createShipmentVRPCarrierFromServiceVRPSolution(carriersWithServicesAndShpiments); + Carriers carriersWithShipmentsOnly = CarriersUtils.createShipmentVRPCarrierFromServiceVRPSolution(carriersWithServicesAndShpiments); carrierWShipmentsOnlyFromCarrierWServices = carriersWithShipmentsOnly.getCarriers().get(CARRIER_SERVICES_ID); //with converted Service carrierWShipmentsOnlyFromCarrierWShipments = carriersWithShipmentsOnly.getCarriers().get(CARRIER_SHIPMENTS_ID); //with copied Shipments @@ -244,7 +243,7 @@ public void fleetAvailableAfterConvertingIsCorrect() { public void copiingOfShipmentsIsDoneCorrectly() { boolean foundShipment1 = false; boolean foundShipment2 = false; - CarrierShipment carrierShipment1 = CarrierUtils.getShipment(carrierWShipmentsOnlyFromCarrierWShipments, Id.create("shipment1", CarrierShipment.class)); + CarrierShipment carrierShipment1 = CarriersUtils.getShipment(carrierWShipmentsOnlyFromCarrierWShipments, Id.create("shipment1", CarrierShipment.class)); assert carrierShipment1 != null; if (carrierShipment1.getId() == Id.create("shipment1", CarrierShipment.class)) { System.out.println("Found Shipment1"); @@ -259,7 +258,7 @@ public void copiingOfShipmentsIsDoneCorrectly() { Assert.assertEquals(0.0, carrierShipment1.getPickupTimeWindow().getStart(), 0); Assert.assertEquals(7200.0, carrierShipment1.getPickupTimeWindow().getEnd(), 0); } - CarrierShipment carrierShipment2 = CarrierUtils.getShipment(carrierWShipmentsOnlyFromCarrierWShipments, Id.create("shipment2", CarrierShipment.class)); + CarrierShipment carrierShipment2 = CarriersUtils.getShipment(carrierWShipmentsOnlyFromCarrierWShipments, Id.create("shipment2", CarrierShipment.class)); assert carrierShipment2 != null; if (carrierShipment2.getId() == Id.create("shipment2", CarrierShipment.class)) { System.out.println("Found Shipment2"); @@ -283,7 +282,7 @@ public void copiingOfShipmentsIsDoneCorrectly() { public void convertionOfServicesIsDoneCorrectly() { boolean foundSercice1 = false; boolean foundService2 = false; - CarrierShipment carrierShipment1 = CarrierUtils.getShipment(carrierWShipmentsOnlyFromCarrierWServices, Id.create("Service1", CarrierShipment.class)); + CarrierShipment carrierShipment1 = CarriersUtils.getShipment(carrierWShipmentsOnlyFromCarrierWServices, Id.create("Service1", CarrierShipment.class)); assert carrierShipment1 != null; if (carrierShipment1.getId() == Id.create("Service1", CarrierShipment.class)) { foundSercice1 = true; @@ -297,7 +296,7 @@ public void convertionOfServicesIsDoneCorrectly() { Assert.assertEquals(0.0, carrierShipment1.getPickupTimeWindow().getStart(), 0); Assert.assertEquals(36001.0, carrierShipment1.getPickupTimeWindow().getEnd(), 0); } - CarrierShipment carrierShipment2 = CarrierUtils.getShipment(carrierWShipmentsOnlyFromCarrierWServices, Id.create("Service2", CarrierShipment.class)); + CarrierShipment carrierShipment2 = CarriersUtils.getShipment(carrierWShipmentsOnlyFromCarrierWServices, Id.create("Service2", CarrierShipment.class)); assert carrierShipment2 != null; if (carrierShipment2.getId() == Id.create("Service2", CarrierShipment.class)) { foundService2 = true; @@ -321,11 +320,11 @@ public void convertionOfServicesIsDoneCorrectly() { */ @Test(expected=UnsupportedOperationException.class) public void exceptionIsThrownWhenUsingMixedShipmentsAndServices() { - Carrier carrierMixedWServicesAndShipments = CarrierUtils.createCarrier(Id.create("CarrierMixed", Carrier.class ) ); + Carrier carrierMixedWServicesAndShipments = CarriersUtils.createCarrier(Id.create("CarrierMixed", Carrier.class ) ); CarrierService service1 = createMatsimService("Service1", "i(3,9)", 2); - CarrierUtils.addService(carrierMixedWServicesAndShipments, service1); + CarriersUtils.addService(carrierMixedWServicesAndShipments, service1); CarrierShipment shipment1 = createMatsimShipment("shipment1", "i(1,0)", "i(7,6)R", 1); - CarrierUtils.addShipment(carrierMixedWServicesAndShipments, shipment1); + CarriersUtils.addShipment(carrierMixedWServicesAndShipments, shipment1); Network network = NetworkUtils.createNetwork(); new MatsimNetworkReader(network).readFile(testUtils.getPackageInputDirectory() + "grid-network.xml"); @@ -365,15 +364,15 @@ private static CarrierService createMatsimService(String id, String to, int size public void testAddVehicleTypeSkill(){ VehiclesFactory factory = ScenarioUtils.createScenario(ConfigUtils.createConfig()).getVehicles().getFactory(); VehicleType type = factory.createVehicleType(Id.create("test", VehicleType.class)); - Assert.assertFalse("Should not have skill.", CarrierUtils.hasSkill(type, "testSkill")); + Assert.assertFalse("Should not have skill.", CarriersUtils.hasSkill(type, "testSkill")); - CarrierUtils.addSkill(type, "testSkillOne"); - Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(type, "testSkillOne")); + CarriersUtils.addSkill(type, "testSkillOne"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarriersUtils.hasSkill(type, "testSkillOne")); - CarrierUtils.addSkill(type, "testSkillTwo"); - Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(type, "testSkillOne")); - Assert.assertTrue("Should have skill 'testSkillTwo'.", CarrierUtils.hasSkill(type, "testSkillTwo")); + CarriersUtils.addSkill(type, "testSkillTwo"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarriersUtils.hasSkill(type, "testSkillOne")); + Assert.assertTrue("Should have skill 'testSkillTwo'.", CarriersUtils.hasSkill(type, "testSkillTwo")); } @Test @@ -381,15 +380,15 @@ public void testAddShipmentSkill(){ CarrierShipment shipment = CarrierShipment.Builder.newInstance( Id.create("testShipment", CarrierShipment.class), Id.createLinkId("1"), Id.createLinkId("2"), 1) .build(); - Assert.assertFalse("Should not have skill.", CarrierUtils.hasSkill(shipment, "testSkill")); + Assert.assertFalse("Should not have skill.", CarriersUtils.hasSkill(shipment, "testSkill")); - CarrierUtils.addSkill(shipment, "testSkillOne"); - Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(shipment, "testSkillOne")); + CarriersUtils.addSkill(shipment, "testSkillOne"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarriersUtils.hasSkill(shipment, "testSkillOne")); - CarrierUtils.addSkill(shipment, "testSkillTwo"); - Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(shipment, "testSkillOne")); - Assert.assertTrue("Should have skill 'testSkillTwo'.", CarrierUtils.hasSkill(shipment, "testSkillTwo")); + CarriersUtils.addSkill(shipment, "testSkillTwo"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarriersUtils.hasSkill(shipment, "testSkillOne")); + Assert.assertTrue("Should have skill 'testSkillTwo'.", CarriersUtils.hasSkill(shipment, "testSkillTwo")); } @Test @@ -397,15 +396,15 @@ public void testAddServiceSkill(){ CarrierService service = CarrierService.Builder.newInstance( Id.create("testShipment", CarrierService.class), Id.createLinkId("2")) .build(); - Assert.assertFalse("Should not have skill.", CarrierUtils.hasSkill(service, "testSkill")); + Assert.assertFalse("Should not have skill.", CarriersUtils.hasSkill(service, "testSkill")); - CarrierUtils.addSkill(service, "testSkillOne"); - Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(service, "testSkillOne")); + CarriersUtils.addSkill(service, "testSkillOne"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarriersUtils.hasSkill(service, "testSkillOne")); - CarrierUtils.addSkill(service, "testSkillTwo"); - Assert.assertTrue("Should have skill 'testSkillOne'.", CarrierUtils.hasSkill(service, "testSkillOne")); - Assert.assertTrue("Should have skill 'testSkillTwo'.", CarrierUtils.hasSkill(service, "testSkillTwo")); + CarriersUtils.addSkill(service, "testSkillTwo"); + Assert.assertTrue("Should have skill 'testSkillOne'.", CarriersUtils.hasSkill(service, "testSkillOne")); + Assert.assertTrue("Should have skill 'testSkillTwo'.", CarriersUtils.hasSkill(service, "testSkillTwo")); } @Test @@ -421,11 +420,11 @@ public void testRunJsprit_allInformationGiven(){ Scenario scenario = ScenarioUtils.loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario ); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario ); Controler controler = new Controler(scenario); try { - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); } catch (Exception e) { e.printStackTrace(); Assert.fail(); @@ -443,15 +442,15 @@ public void testRunJsprit_NoOfJspritIterationsMissing() throws ExecutionExceptio config.controller().setOutputDirectory(utils.getOutputDirectory()); Scenario scenario = ScenarioUtils.loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); //remove all attributes --> remove the NumberOfJspritIterations attribute to trigger exception - Carriers carriers = CarrierUtils.getCarriers(scenario); + Carriers carriers = CarriersUtils.getCarriers(scenario); for (Carrier carrier : carriers.getCarriers().values()) { carrier.getAttributes().clear(); } - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); } /** @@ -462,10 +461,10 @@ public void testRunJsprit_NoAlgortihmFileGiven(){ Config config = prepareConfig(); config.controller().setOutputDirectory(utils.getOutputDirectory()); Scenario scenario = ScenarioUtils.loadScenario(config); - CarrierUtils.loadCarriersAccordingToFreightConfig(scenario); + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); try { - CarrierUtils.runJsprit(scenario); + CarriersUtils.runJsprit(scenario); } catch (Exception e) { Assert.fail(); } diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierModuleTest/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierModuleTest/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/network.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierModuleTest/network.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/network.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierModuleTest/network.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/plans100.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierModuleTest/plans100.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/plans100.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierModuleTest/plans100.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierModuleTest/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierModuleTest/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierModuleTest/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanReaderV1Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanReaderV1Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanReaderV1Test/carrierPlansEquils_unscored_unselected.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlReaderV2Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlReaderV2Test/carrierPlansEquilsFiniteFleet.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsFiniteFleetWithDtd.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlReaderV2WithDtdTest/carrierPlansEquilsWithDtd.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlWriterV1Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlWriterV2Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlWriterV2Test/carrierPlansEquilsWritten.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierPlanXmlWriterV2_1Test/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test/carriers.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierReadWriteV2_1Test/carriers.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test/carriers.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierReadWriteV2_1Test/carriers.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test/vehicles.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierReadWriteV2_1Test/vehicles.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierReadWriteV2_1Test/vehicles.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierReadWriteV2_1Test/vehicles.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeLoaderTest/carrierPlansEquils.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeLoaderTest/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeLoaderTest/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeLoaderTest/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeReaderTest/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeReaderTest/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeReaderTest/vehicleTypes_v2.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v1.xsd diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeReaderWithDtdV1Test/carrierVehicleTypes_v2.xsd diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest/vehicleTypes.xml b/contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeWriterTest/vehicleTypes.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/CarrierVehicleTypeWriterTest/vehicleTypes.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/CarrierVehicleTypeWriterTest/vehicleTypes.xml diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/carrier/vehicleTypes_v2.xml b/contribs/freight/test/input/org/matsim/freight/carriers/vehicleTypes_v2.xml similarity index 100% rename from contribs/freight/test/input/org/matsim/freight/carriers/carrier/vehicleTypes_v2.xml rename to contribs/freight/test/input/org/matsim/freight/carriers/vehicleTypes_v2.xml diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java index f3ad36c69ef..df29bc43a71 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverAgent.java @@ -22,9 +22,9 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Carriers; import org.matsim.core.scoring.ScoringFunction; import java.util.ArrayList; @@ -70,7 +70,7 @@ public void scoreSelectedPlan(Scenario scenario, ReceiverCostAllocation costAllo return; } - Carriers carriers = CarrierUtils.getCarriers(scenario); + Carriers carriers = CarriersUtils.getCarriers(scenario); double score = 0.0; List> carrierIds = new ArrayList<>(); diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java index 09bc3798dad..10fe1be6bdd 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverControlerListener.java @@ -25,10 +25,10 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.HasPlansAndId; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.ScheduledTour; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.ScheduledTour; +import org.matsim.freight.carriers.Tour; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.contrib.freightreceiver.replanning.ReceiverStrategyManager; import org.matsim.core.config.ConfigUtils; @@ -169,7 +169,7 @@ private void linkReceiverTimeWindowToCarrierTourPosition() throws IOException { bw.write("receiverId,twStart,twEnd,twDuration,positionInTour,product,deliveryStart,deliveryEnd"); bw.newLine(); - for (Carrier carrier : CarrierUtils.getCarriers(this.sc).getCarriers().values()) { + for (Carrier carrier : CarriersUtils.getCarriers(this.sc).getCarriers().values()) { Collection scheduledTours = carrier.getSelectedPlan().getScheduledTours(); for (ScheduledTour tour : scheduledTours) { for (int i = 0; i < tour.getTour().getTourElements().size(); i++) { diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocation.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocation.java index 4fd8d03c841..72ccdeb68fa 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocation.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocation.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; public interface ReceiverCostAllocation { double getScore(Carrier carrier, Receiver receiver); diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationEqualProportion.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationEqualProportion.java index f59248e8d46..6f85efcd2f1 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationEqualProportion.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationEqualProportion.java @@ -23,7 +23,7 @@ import com.google.inject.Inject; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import java.util.*; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationFixed.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationFixed.java index b719aeed717..5f3a6a2dea2 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationFixed.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverCostAllocationFixed.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; import org.apache.logging.log4j.LogManager; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; /** * A simple implementation where the cost allocated by the {@link Carrier} to diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverModule.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverModule.java index 3681654b8f4..aac11b5e7b2 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverModule.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverModule.java @@ -20,7 +20,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import org.matsim.contrib.freightreceiver.replanning.*; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.AbstractModule; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverOrder.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverOrder.java index e56c34ed9dc..081004dcb71 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverOrder.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverOrder.java @@ -22,7 +22,7 @@ import org.apache.logging.log4j.LogManager; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.BasicPlan; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import java.util.ArrayList; import java.util.Collection; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverPlan.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverPlan.java index ed8f9bc257e..0497d364b3d 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverPlan.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverPlan.java @@ -23,8 +23,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.population.BasicPlan; import org.matsim.api.core.v01.population.Person; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.utils.objectattributes.attributable.Attributable; import org.matsim.utils.objectattributes.attributable.Attributes; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java index 9190766f59d..5e9534e4911 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverScoreStats.java @@ -4,7 +4,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.events.IterationEndsEvent; @@ -92,7 +92,7 @@ public void notifyIterationEnds(final IterationEndsEvent event) { if ((event.getIteration() + 1) % (ConfigUtils.addOrGetModule(sc.getConfig(), ReceiverConfigGroup.class).getReceiverReplanningInterval()) != 0) return; String dir = event.getServices().getControlerIO().getIterationPath(event.getIteration()); - CarrierUtils.writeCarriers(CarrierUtils.getCarriers(sc), dir + File.separator + event.getIteration() + CARRIER_PLANS_XML); + CarriersUtils.writeCarriers(CarriersUtils.getCarriers(sc), dir + File.separator + event.getIteration() + CARRIER_PLANS_XML); new ReceiversWriter(ReceiverUtils.getReceivers(sc)).write(dir + File.separator + event.getIteration() + RECEIVER_PLANS_XML); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java index 3b53c146af6..938bef0d1d3 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java @@ -25,7 +25,7 @@ import org.apache.logging.log4j.LogManager; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.jsprit.MatsimJspritFactory; import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts; import org.matsim.freight.carriers.jsprit.NetworkRouter; @@ -60,7 +60,7 @@ public void notifyIterationStarts(IterationStartsEvent event) { CollaborationUtils.setCoalitionFromReceiverAttributes( sc ); // clean out plans, services, shipments from carriers: - Map, Carrier> carriers = CarrierUtils.getCarriers(sc).getCarriers(); + Map, Carrier> carriers = CarriersUtils.getCarriers(sc).getCarriers(); for( Carrier carrier : carriers.values() ){ carrier.clearPlans(); carrier.getShipments().clear(); @@ -121,7 +121,7 @@ public void notifyIterationStarts(IterationStartsEvent event) { String outputdirectory = sc.getConfig().controller().getOutputDirectory(); outputdirectory += outputdirectory.endsWith("/") ? "" : "/"; // new CarrierPlanWriter(CarrierControlerUtils.getCarriers(sc)).write(outputdirectory + ReceiverConfigGroup.CARRIERS_FILE); - new CarrierPlanWriter(CarrierUtils.getCarriers(sc)).write(outputdirectory +receiverConfig.getCarriersFile() ); + new CarrierPlanWriter(CarriersUtils.getCarriers(sc)).write(outputdirectory +receiverConfig.getCarriersFile() ); // new ReceiversWriter( ReceiverUtils.getReceivers( sc ) ).write(outputdirectory + ReceiverConfigGroup.RECEIVERS_FILE); new ReceiversWriter( ReceiverUtils.getReceivers( sc ) ).write(outputdirectory + receiverConfig.getReceiversFile()); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java index 23af52bbdf8..dcd2861daed 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java @@ -5,7 +5,7 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversReaderV2.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversReaderV2.java index 976ec89ffe5..2036326c078 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversReaderV2.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversReaderV2.java @@ -22,8 +22,8 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.api.internal.MatsimReader; import org.matsim.core.utils.io.MatsimXmlParser; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriter.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriter.java index aa1f45de263..d193d33284c 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriter.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriter.java @@ -22,7 +22,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.core.api.internal.MatsimWriter; import org.matsim.core.utils.io.MatsimXmlWriter; import org.matsim.core.utils.io.UncheckedIOException; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandler.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandler.java index bfdc735236d..09172159e06 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandler.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandler.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.TimeWindow; import java.io.BufferedWriter; import java.io.IOException; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV1.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV1.java index 470edc810b4..ecc7b58f43e 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV1.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV1.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.core.utils.misc.Time; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesXmlWriterDelegate; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV2.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV2.java index 5fb7c0addd5..c2b8fe50f1b 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV2.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiversWriterHandlerImplV2.java @@ -20,7 +20,7 @@ package org.matsim.contrib.freightreceiver; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.core.utils.misc.Time; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesXmlWriterDelegate; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/UsecasesCarrierScoringFunctionFactory.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/UsecasesCarrierScoringFunctionFactory.java index 4fca3ed3a9b..5cc872f2b50 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/UsecasesCarrierScoringFunctionFactory.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/UsecasesCarrierScoringFunctionFactory.java @@ -7,7 +7,7 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.population.Activity; import org.matsim.api.core.v01.population.Leg; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory; import org.matsim.freight.carriers.controler.FreightActivity; import org.matsim.core.population.routes.NetworkRoute; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/Coalition.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/Coalition.java index 5a7666ed6a0..9afea8cdc9e 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/Coalition.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/Coalition.java @@ -1,6 +1,6 @@ package org.matsim.contrib.freightreceiver.collaboration; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import org.matsim.contrib.freightreceiver.Receiver; import org.matsim.utils.objectattributes.attributable.Attributable; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java index fa3dc041954..25e73445613 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtils.java @@ -4,9 +4,9 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Carriers; import org.matsim.contrib.freightreceiver.*; public class CollaborationUtils{ @@ -42,7 +42,7 @@ public static void createCoalitionWithCarriersAndAddCollaboratingReceivers(Scena /* Add carrier and receivers to coalition */ Coalition coalition = CollaborationUtils.createCoalition(); - for (Carrier carrier : CarrierUtils.getCarriers(sc).getCarriers().values()){ + for (Carrier carrier : CarriersUtils.getCarriers(sc).getCarriers().values()){ if (!coalition.getCarrierCoalitionMembers().contains(carrier)){ coalition.addCarrierCoalitionMember(carrier); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtilsNew.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtilsNew.java index e0f3e180802..c3c3d3d544e 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtilsNew.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/CollaborationUtilsNew.java @@ -1,6 +1,6 @@ package org.matsim.contrib.freightreceiver.collaboration; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carriers; import org.matsim.contrib.freightreceiver.*; /** diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/MutableCoalition.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/MutableCoalition.java index 99e7792e8fe..4799f493912 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/MutableCoalition.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/MutableCoalition.java @@ -1,7 +1,7 @@ package org.matsim.contrib.freightreceiver.collaboration; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import org.matsim.contrib.freightreceiver.Receiver; import org.matsim.utils.objectattributes.attributable.Attributes; import org.matsim.utils.objectattributes.attributable.AttributesImpl; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/TimeWindowMutator.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/TimeWindowMutator.java index 9ac36f526bf..bf972b057fe 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/TimeWindowMutator.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/collaboration/TimeWindowMutator.java @@ -21,7 +21,7 @@ */ package org.matsim.contrib.freightreceiver.collaboration; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.contrib.freightreceiver.ReceiverPlan; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.replanning.ReplanningContext; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/TimeWindowUpperBoundMutator.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/TimeWindowUpperBoundMutator.java index 6b5689046fd..97ea20b2e20 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/TimeWindowUpperBoundMutator.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/replanning/TimeWindowUpperBoundMutator.java @@ -18,7 +18,7 @@ package org.matsim.contrib.freightreceiver.replanning; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.contrib.freightreceiver.ReceiverPlan; import org.matsim.core.gbl.MatsimRandom; import org.matsim.core.replanning.ReplanningContext; diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java index 9c2bea27fd0..b5b2f535b45 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/ReceiverChessboardScenario.java @@ -27,8 +27,8 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; import org.matsim.api.core.v01.network.NetworkWriter; -import org.matsim.freight.carriers.carrier.*; -import org.matsim.freight.carriers.carrier.CarrierCapabilities.FleetSize; +import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.contrib.freightreceiver.*; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.config.Config; @@ -85,7 +85,7 @@ public static Scenario createChessboardScenario(long seed, int numberOfReceivers } /* Link the carriers to the receivers. */ - CollaborationUtils.linkReceiverOrdersToCarriers(ReceiverUtils.getReceivers(sc), CarrierUtils.getCarriers(sc)); + CollaborationUtils.linkReceiverOrdersToCarriers(ReceiverUtils.getReceivers(sc), CarriersUtils.getCarriers(sc)); CollaborationUtils.createCoalitionWithCarriersAndAddCollaboratingReceivers(sc); return sc; } @@ -127,13 +127,13 @@ public static void writeFreightScenario(Scenario sc) { new NetworkWriter(sc.getNetwork()).write(outputFolder + "network.xml"); new ConfigWriter(sc.getConfig()).write(outputFolder + "config.xml"); - CarrierUtils.writeCarriers(CarrierUtils.getCarriers(sc),outputFolder + "carriers.xml"); + CarriersUtils.writeCarriers(CarriersUtils.getCarriers(sc),outputFolder + "carriers.xml"); new ReceiversWriter(ReceiverUtils.getReceivers(sc)).write(outputFolder + "receivers.xml"); /* Write the vehicle types. FIXME This will have to change so that vehicle * types lie at the Carriers level, and not per Carrier. In this scenario * there luckily is only a single Carrier. */ - new CarrierVehicleTypeWriter(CarrierVehicleTypes.getVehicleTypes(CarrierUtils.getCarriers(sc))).write(outputFolder + "carrierVehicleTypes.xml"); + new CarrierVehicleTypeWriter(CarrierVehicleTypes.getVehicleTypes(CarriersUtils.getCarriers(sc))).write(outputFolder + "carrierVehicleTypes.xml"); } @@ -142,7 +142,7 @@ public static void writeFreightScenario(Scenario sc) { * for experiments, but this must be adapted in the future to accept other parameters as inputs to enable different orders per receiver. */ private static void createReceiverOrders(Scenario sc) { - Carriers carriers = CarrierUtils.getCarriers(sc); + Carriers carriers = CarriersUtils.getCarriers(sc); Receivers receivers = ReceiverUtils.getReceivers(sc); Carrier carrierOne = carriers.getCarriers().get(Id.create("Carrier1", Carrier.class)); @@ -264,7 +264,7 @@ static void createAndAddChessboardReceivers(Scenario sc, int numberOfReceivers) */ private static void createChessboardCarriersAndAddToScenario(Scenario sc) { Id carrierId = Id.create("Carrier1", Carrier.class); - Carrier carrier = CarrierUtils.createCarrier(carrierId); + Carrier carrier = CarriersUtils.createCarrier(carrierId); Id carrierLocation = selectRandomLink(sc.getNetwork()); CarrierCapabilities.Builder capBuilder = CarrierCapabilities.Builder.newInstance(); @@ -316,7 +316,7 @@ private static void createChessboardCarriersAndAddToScenario(Scenario sc) { types.getVehicleTypes().put(typeLight.getId(), typeLight); types.getVehicleTypes().put(typeHeavy.getId(), typeHeavy); - Carriers carriers = CarrierUtils.addOrGetCarriers(sc); + Carriers carriers = CarriersUtils.addOrGetCarriers(sc); carriers.addCarrier(carrier); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java index 2e2d95f2e59..469f45574ee 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithEqualProportionCost.java @@ -23,8 +23,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; import org.matsim.contrib.freightreceiver.ReceiverModule; import org.matsim.contrib.freightreceiver.ReceiverReplanningType; @@ -83,7 +83,7 @@ static void run(int run) { * TODO This is less elegant than the embedded score stats for the receiver. */ static void prepareFreightOutputDataAndStats(MatsimServices controler) { - CarrierScoreStats scoreStats = new CarrierScoreStats(CarrierUtils.getCarriers(controler.getScenario()), controler.getScenario().getConfig().controller().getOutputDirectory() + "/carrier_scores", true); + CarrierScoreStats scoreStats = new CarrierScoreStats(CarriersUtils.getCarriers(controler.getScenario()), controler.getScenario().getConfig().controller().getOutputDirectory() + "/carrier_scores", true); controler.addControlerListener(scoreStats); } diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java index 2fe4973e49e..112785c45b8 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/run/chessboard/RunReceiverChessboardWithFixedCarrierCost.java @@ -23,8 +23,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.usecases.analysis.CarrierScoreStats; import org.matsim.contrib.freightreceiver.ReceiverModule; import org.matsim.contrib.freightreceiver.ReceiverReplanningType; @@ -85,7 +85,7 @@ static void run(int run) { * TODO This is less elegant than the embedded score stats for the receiver. */ static void prepareFreightOutputDataAndStats(MatsimServices controler) { - CarrierScoreStats scoreStats = new CarrierScoreStats(CarrierUtils.getCarriers(controler.getScenario()), controler.getScenario().getConfig().controller().getOutputDirectory() + "/carrier_scores", true); + CarrierScoreStats scoreStats = new CarrierScoreStats(CarriersUtils.getCarriers(controler.getScenario()), controler.getScenario().getConfig().controller().getOutputDirectory() + "/carrier_scores", true); controler.addControlerListener(scoreStats); } diff --git a/contribs/freightreceiver/src/test/java/org/matsim/contrib/freightreceiver/ReceiversReaderTest.java b/contribs/freightreceiver/src/test/java/org/matsim/contrib/freightreceiver/ReceiversReaderTest.java index 71c15dac476..f5ba3475e0b 100644 --- a/contribs/freightreceiver/src/test/java/org/matsim/contrib/freightreceiver/ReceiversReaderTest.java +++ b/contribs/freightreceiver/src/test/java/org/matsim/contrib/freightreceiver/ReceiversReaderTest.java @@ -24,8 +24,8 @@ import org.junit.Rule; import org.junit.Test; import org.matsim.api.core.v01.Id; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.TimeWindow; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.TimeWindow; import org.matsim.contrib.freightreceiver.collaboration.CollaborationUtils; import org.matsim.core.utils.misc.Time; import org.matsim.testcases.MatsimTestUtils; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java index 6b5de62f91a..ed766208b54 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java @@ -26,7 +26,7 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.events.Event; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.events.CarrierShipmentDeliveryStartEvent; import org.matsim.freight.carriers.events.CarrierShipmentPickupStartEvent; import org.matsim.core.events.handler.BasicEventHandler; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java index 7921f693095..08c3075ac93 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java @@ -24,8 +24,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Carriers; import java.io.BufferedWriter; import java.io.FileWriter; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java index a3652d63944..04ee6ff30ab 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java @@ -28,10 +28,10 @@ import org.matsim.api.core.v01.events.handler.*; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierService; -import org.matsim.freight.carriers.carrier.CarrierShipment; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierService; +import org.matsim.freight.carriers.CarrierShipment; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.events.CarrierServiceEndEvent; import org.matsim.freight.carriers.events.CarrierServiceStartEvent; import org.matsim.freight.carriers.events.CarrierShipmentDeliveryEndEvent; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java index a34e4ed83af..c251cef108b 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java @@ -23,7 +23,7 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.population.Person; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.freight.carriers.events.CarrierServiceEndEvent; import org.matsim.freight.carriers.events.CarrierServiceStartEvent; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java index 6153a897169..599a41f893c 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java @@ -24,8 +24,8 @@ import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Person; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierShipment; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierShipment; import org.matsim.freight.carriers.events.CarrierShipmentDeliveryEndEvent; import org.matsim.freight.carriers.events.CarrierShipmentPickupEndEvent; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java index 69075e0203d..33f42a4efe6 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java @@ -28,7 +28,7 @@ import org.matsim.api.core.v01.events.LinkLeaveEvent; import org.matsim.api.core.v01.events.PersonLeavesVehicleEvent; import org.matsim.api.core.v01.population.Person; -import org.matsim.freight.carriers.carrier.Carrier; +import org.matsim.freight.carriers.Carrier; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index 731d742e5dc..5e57f36ebad 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -27,9 +27,9 @@ import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.events.LinkEnterEvent; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierUtils; -import org.matsim.freight.carriers.carrier.Tour; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Tour; import org.matsim.freight.carriers.events.CarrierTourEndEvent; import org.matsim.freight.carriers.events.CarrierTourStartEvent; import org.matsim.core.events.handler.BasicEventHandler; @@ -162,7 +162,7 @@ void writeTravelTimeAndDistancePerVehicleType(String analysisOutputDirectory, Sc //----- All VehicleTypes in CarriervehicleTypes container. Used so that even unused vehTypes appear in the output - TreeMap, VehicleType> vehicleTypesMap = new TreeMap<>(CarrierUtils.getCarrierVehicleTypes(scenario).getVehicleTypes()); + TreeMap, VehicleType> vehicleTypesMap = new TreeMap<>(CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes()); //For the case that there are additional vehicle types found in the events. for (VehicleType vehicleType : vehicleId2VehicleType.values()) { vehicleTypesMap.putIfAbsent(vehicleType.getId(), vehicleType); diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java index 1938d02ac85..7286a6b3b40 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java @@ -22,9 +22,9 @@ package org.matsim.freight.carriers.analysis.analysis; import org.matsim.api.core.v01.network.Network; -import org.matsim.freight.carriers.carrier.CarrierPlanXmlReader; -import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.CarrierPlanXmlReader; +import org.matsim.freight.carriers.CarrierVehicleTypes; +import org.matsim.freight.carriers.Carriers; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.events.EventsUtils; import org.matsim.core.events.MatsimEventsReader; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java index b084710f861..54c3e46bc5d 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java @@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.carrier.CarrierUtils; +import org.matsim.freight.carriers.CarriersUtils; import org.matsim.freight.carriers.events.CarrierEventsReaders; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.config.Config; @@ -96,11 +96,11 @@ public void runAnalysis() throws IOException { Scenario scenario = ScenarioUtils.loadScenario(config); //load carriers according to freight config - CarrierUtils.loadCarriersAccordingToFreightConfig( scenario ); + CarriersUtils.loadCarriersAccordingToFreightConfig( scenario ); // CarrierPlanAnalysis - CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(CarrierUtils.getCarriers(scenario)); + CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(CarriersUtils.getCarriers(scenario)); carrierPlanAnalysis.runAnalysisAndWriteStats(analysisOutputDirectory); // Prepare eventsManager - start of event based Analysis; @@ -109,7 +109,7 @@ public void runAnalysis() throws IOException { FreightTimeAndDistanceAnalysisEventsHandler freightTimeAndDistanceAnalysisEventsHandler = new FreightTimeAndDistanceAnalysisEventsHandler(scenario); eventsManager.addHandler(freightTimeAndDistanceAnalysisEventsHandler); - CarrierLoadAnalysis carrierLoadAnalysis = new CarrierLoadAnalysis(CarrierUtils.getCarriers(scenario)); + CarrierLoadAnalysis carrierLoadAnalysis = new CarrierLoadAnalysis(CarriersUtils.getCarriers(scenario)); eventsManager.addHandler(carrierLoadAnalysis); eventsManager.initProcessing(); diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java index 8634a6a15f9..fbc8260b04a 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java @@ -24,8 +24,7 @@ import org.matsim.api.core.v01.events.*; import org.matsim.api.core.v01.events.handler.*; import org.matsim.api.core.v01.network.Network; -import org.matsim.freight.carriers.analysis.analysis.FreightAnalysisVehicleTracking; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carriers; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.Vehicles; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java index c23d9a18cd9..b895ce62908 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java @@ -24,10 +24,9 @@ import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; import org.matsim.api.core.v01.network.Network; -import org.matsim.freight.carriers.analysis.analysis.FreightAnalysisServiceTracking; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierService; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierService; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.events.CarrierServiceEndEvent; import org.matsim.freight.carriers.events.CarrierServiceStartEvent; import org.matsim.freight.carriers.events.eventhandler.FreightServiceEndEventHandler; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java index b44036eed60..1188f805838 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java @@ -24,10 +24,9 @@ import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; import org.matsim.api.core.v01.network.Network; -import org.matsim.freight.carriers.analysis.analysis.FreightAnalysisShipmentTracking; -import org.matsim.freight.carriers.carrier.Carrier; -import org.matsim.freight.carriers.carrier.CarrierShipment; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierShipment; +import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.events.CarrierShipmentDeliveryEndEvent; import org.matsim.freight.carriers.events.CarrierShipmentPickupEndEvent; import org.matsim.freight.carriers.events.eventhandler.FreightShipmentDeliveryEventHandler; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java index 40cf13debd1..983772cd946 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java @@ -29,7 +29,7 @@ import org.matsim.core.events.EventsUtils; import org.matsim.core.events.MatsimEventsReader; import org.matsim.core.network.NetworkUtils; -import org.matsim.freight.carriers.carrier.*; +import org.matsim.freight.carriers.*; import org.matsim.testcases.MatsimTestUtils; import org.matsim.vehicles.*; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java index f092d11c6af..a77de05ae55 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java @@ -27,10 +27,10 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.freight.carriers.carrier.CarrierPlanXmlReader; -import org.matsim.freight.carriers.carrier.CarrierShipment; -import org.matsim.freight.carriers.carrier.CarrierVehicleTypes; -import org.matsim.freight.carriers.carrier.Carriers; +import org.matsim.freight.carriers.CarrierPlanXmlReader; +import org.matsim.freight.carriers.CarrierShipment; +import org.matsim.freight.carriers.CarrierVehicleTypes; +import org.matsim.freight.carriers.Carriers; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.events.EventsUtils; import org.matsim.core.events.MatsimEventsReader; From a265eff3a25b054c9380b26abf044868844d1707 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Thu, 12 Oct 2023 23:16:59 +0200 Subject: [PATCH 5/8] move analysis code one package level up (was accidentally "analysis.analysis") --- .../carriers/analysis/{analysis => }/CarrierLoadAnalysis.java | 2 +- .../carriers/analysis/{analysis => }/CarrierPlanAnalysis.java | 2 +- .../analysis/{analysis => }/FreightAnalysisEventHandler.java | 2 +- .../analysis/{analysis => }/FreightAnalysisServiceTracking.java | 2 +- .../{analysis => }/FreightAnalysisShipmentTracking.java | 2 +- .../analysis/{analysis => }/FreightAnalysisVehicleTracking.java | 2 +- .../FreightTimeAndDistanceAnalysisEventsHandler.java | 2 +- .../matsim/freight/carriers/analysis/{analysis => }/Readme.md | 0 .../carriers/analysis/{analysis => }/RunFreightAnalysis.java | 2 +- .../analysis/{analysis => }/RunFreightAnalysisEventBased.java | 2 +- .../analysis/{analysis => }/FreightAnalysisEventBasedTest.java | 2 +- .../{analysis => }/MyFreightVehicleTrackerEventHandler.java | 2 +- .../analysis/{analysis => }/MyServiceTrackerEventHandler.java | 2 +- .../analysis/{analysis => }/MyShipmentTrackerEventHandler.java | 2 +- .../carriers/analysis/{analysis => }/RunFreightAnalysisIT.java | 2 +- .../{analysis => }/RunFreightAnalysisWithShipmentTest.java | 2 +- 16 files changed, 15 insertions(+), 15 deletions(-) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/CarrierLoadAnalysis.java (98%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/CarrierPlanAnalysis.java (98%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/FreightAnalysisEventHandler.java (99%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/FreightAnalysisServiceTracking.java (99%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/FreightAnalysisShipmentTracking.java (99%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/FreightAnalysisVehicleTracking.java (99%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/FreightTimeAndDistanceAnalysisEventsHandler.java (99%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/Readme.md (100%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/RunFreightAnalysis.java (98%) rename contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/{analysis => }/RunFreightAnalysisEventBased.java (99%) rename contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/{analysis => }/FreightAnalysisEventBasedTest.java (97%) rename contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/{analysis => }/MyFreightVehicleTrackerEventHandler.java (98%) rename contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/{analysis => }/MyServiceTrackerEventHandler.java (98%) rename contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/{analysis => }/MyShipmentTrackerEventHandler.java (98%) rename contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/{analysis => }/RunFreightAnalysisIT.java (99%) rename contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/{analysis => }/RunFreightAnalysisWithShipmentTest.java (99%) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java similarity index 98% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java index ed766208b54..7e858ee725d 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierLoadAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java similarity index 98% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index 08c3075ac93..e8f0439af85 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/CarrierPlanAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventHandler.java similarity index 99% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventHandler.java index 04ee6ff30ab..4ffe3ba7688 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventHandler.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisServiceTracking.java similarity index 99% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisServiceTracking.java index c251cef108b..88ee09b7b5c 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisServiceTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisServiceTracking.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.population.Person; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisShipmentTracking.java similarity index 99% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisShipmentTracking.java index 599a41f893c..e7126cca05e 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisShipmentTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisShipmentTracking.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.network.Link; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisVehicleTracking.java similarity index 99% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisVehicleTracking.java index 33f42a4efe6..5bc4e6a690a 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisVehicleTracking.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightAnalysisVehicleTracking.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java similarity index 99% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index 5e57f36ebad..42c95fb70ad 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/Readme.md b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/Readme.md similarity index 100% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/Readme.md rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/Readme.md diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysis.java similarity index 98% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysis.java index 7286a6b3b40..30758ffb516 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysis.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.matsim.api.core.v01.network.Network; import org.matsim.freight.carriers.CarrierPlanXmlReader; diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java similarity index 99% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java rename to contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index 54c3e46bc5d..1a60ed8b6a3 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventBasedTest.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java similarity index 97% rename from contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventBasedTest.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java index 4c7ef6d5678..713b77c06f4 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/FreightAnalysisEventBasedTest.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.junit.Rule; import org.junit.Test; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyFreightVehicleTrackerEventHandler.java similarity index 98% rename from contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyFreightVehicleTrackerEventHandler.java index fbc8260b04a..239e6573d87 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyFreightVehicleTrackerEventHandler.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyFreightVehicleTrackerEventHandler.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.matsim.api.core.v01.events.*; import org.matsim.api.core.v01.events.handler.*; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyServiceTrackerEventHandler.java similarity index 98% rename from contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyServiceTrackerEventHandler.java index b895ce62908..43c9dd2d524 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyServiceTrackerEventHandler.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyServiceTrackerEventHandler.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyShipmentTrackerEventHandler.java similarity index 98% rename from contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyShipmentTrackerEventHandler.java index 1188f805838..35b455b8944 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/MyShipmentTrackerEventHandler.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/MyShipmentTrackerEventHandler.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.matsim.api.core.v01.events.ActivityStartEvent; import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT.java similarity index 99% rename from contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT.java index 983772cd946..8dec71ea7f9 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisIT.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.junit.*; import org.matsim.api.core.v01.Id; diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest.java similarity index 99% rename from contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java rename to contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest.java index a77de05ae55..358b79d8ad4 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/analysis/RunFreightAnalysisWithShipmentTest.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest.java @@ -19,7 +19,7 @@ * */ -package org.matsim.freight.carriers.analysis.analysis; +package org.matsim.freight.carriers.analysis; import org.junit.Assert; import org.junit.Rule; From d99db376c51464a75787f06b0ca2edf0012cf4af Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Thu, 12 Oct 2023 23:19:09 +0200 Subject: [PATCH 6/8] comment/javadoc --- .../freight/carriers/controler/CarrierControlerUtils.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerUtils.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerUtils.java index 26da0775b19..fe19207bfcc 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerUtils.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/controler/CarrierControlerUtils.java @@ -22,14 +22,13 @@ package org.matsim.freight.carriers.controler; /** - * Utils for the work with the freight contrib + * Utils class for (package-private) content of freight.carriers.controler - package; * * @author kturner * */ public class CarrierControlerUtils { - public static CarrierStrategyManager createDefaultCarrierStrategyManager() { return new CarrierStrategyManagerImpl(); } From fca3da6fac62a5cd3e27cda90ebbb20206bef658 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Thu, 12 Oct 2023 23:30:02 +0200 Subject: [PATCH 7/8] fix one import --- .../freight/carriers/analysis/FreightAnalysisEventBasedTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java index 713b77c06f4..b34c72ac10b 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -23,7 +23,6 @@ import org.junit.Rule; import org.junit.Test; -import org.matsim.freight.carriers.analysis.analysis.RunFreightAnalysisEventBased; import org.matsim.testcases.MatsimTestUtils; import java.io.IOException; From f8fe8fc68d78d6ed92e30a6577e80d67f64e3ec5 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Fri, 13 Oct 2023 09:54:25 +0200 Subject: [PATCH 8/8] move test input to correct location --- .../output_allVehicles.xml.gz | Bin .../output_carriers.xml.gz | Bin .../output_events.xml.gz | Bin .../output_network.xml.gz | Bin .../Carrier_stats.tsv | 0 .../Load_perVehicle.tsv | 0 .../TimeDistance_perVehicle.tsv | 0 .../TimeDistance_perVehicleType.tsv | 0 .../compareResults/carrierStats.tsv | 0 .../compareResults/carrier_##carrier1_tripStats.tsv | 0 .../carrier_##carrier1_vehicleStats.tsv | 0 .../carrier_carrier1_ServiceStats.tsv | 0 .../carrier_carrier1_ShipmentStats.tsv | 0 .../carrier_carrier1_VehicleTypeStats.tsv | 0 .../compareResults/freightVehicleStats.tsv | 0 .../compareResults/freightVehicleTripStats.tsv | 0 .../compareResults/serviceStats.tsv | 0 .../compareResults/shipmentStats.tsv | 0 .../RunFreightAnalysisIT/output_allVehicles.xml.gz | Bin .../RunFreightAnalysisIT/output_carriers.xml.gz | Bin .../RunFreightAnalysisIT/output_events.xml.gz | Bin .../RunFreightAnalysisIT/output_network.xml.gz | Bin .../compareResults/shipment/carrierStats.tsv | 0 .../shipment/carrier_##carrier1_tripStats.tsv | 0 .../shipment/carrier_##carrier1_vehicleStats.tsv | 0 .../shipment/carrier_carrier1_ShipmentStats.tsv | 0 .../shipment/carrier_carrier1_VehicleTypeStats.tsv | 0 .../compareResults/shipment/freightVehicleStats.tsv | 0 .../shipment/freightVehicleTripStats.tsv | 0 .../shipment/output_allVehicles.xml.gz | Bin .../shipment/output_carriers.xml.gz | Bin .../shipment/output_events.xml.gz | Bin .../shipment/output_network.xml.gz | Bin 33 files changed, 0 insertions(+), 0 deletions(-) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/output_carriers.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/output_events.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisIT/output_network.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz (100%) rename contribs/vsp/test/input/org/matsim/freight/{ => carriers}/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz (100%) diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrierStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_tripStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_##carrier1_vehicleStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ServiceStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_ShipmentStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/carrier_carrier1_VehicleTypeStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/freightVehicleStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/freightVehicleTripStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/serviceStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/compareResults/shipmentStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/output_allVehicles.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_carriers.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/output_carriers.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_carriers.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/output_carriers.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_events.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/output_events.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_events.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/output_events.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_network.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/output_network.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisIT/output_network.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisIT/output_network.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrierStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_tripStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_##carrier1_vehicleStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_ShipmentStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/carrier_carrier1_VehicleTypeStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/compareResults/shipment/freightVehicleTripStats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_allVehicles.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_carriers.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_events.xml.gz diff --git a/contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz similarity index 100% rename from contribs/vsp/test/input/org/matsim/freight/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz rename to contribs/vsp/test/input/org/matsim/freight/carriers/analysis/RunFreightAnalysisWithShipmentTest/shipment/output_network.xml.gz