From 83dc44ad8a9de0d04e78166d5bfd31c3d3776f8c Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Sat, 24 Aug 2019 01:25:02 +0300 Subject: [PATCH 01/23] added BeamServices as field into BeamSkimmer and TravelTimeObserved in order to get config updates --- src/main/scala/beam/router/BeamSkimmer.scala | 8 ++++--- .../beam/router/TravelTimeObserved.scala | 7 ++++--- .../agentsim/agents/PersonAgentSpec.scala | 16 +++++++------- .../agents/PersonAndTransitDriverSpec.scala | 4 ++-- .../PersonWithPersonalVehiclePlanSpec.scala | 16 +++++++------- .../agents/PersonWithVehicleSharingSpec.scala | 12 +++++------ .../FastHouseholdCAVSchedulingSpec.scala | 21 ++++++++++++++----- .../AgentsimWithMaximallyBadRouterSpec.scala | 4 ++-- .../beam/integration/SingleModeSpec.scala | 16 +++++++------- 9 files changed, 59 insertions(+), 45 deletions(-) diff --git a/src/main/scala/beam/router/BeamSkimmer.scala b/src/main/scala/beam/router/BeamSkimmer.scala index 0d6780419dc..b9bbd59b17e 100644 --- a/src/main/scala/beam/router/BeamSkimmer.scala +++ b/src/main/scala/beam/router/BeamSkimmer.scala @@ -1,7 +1,6 @@ package beam.router import java.io.File -import java.util.concurrent.TimeUnit import beam.agentsim.agents.choice.mode.DrivingCost import beam.agentsim.agents.vehicles.{BeamVehicle, BeamVehicleType} @@ -22,13 +21,13 @@ import beam.router.Modes.BeamMode.{ } import beam.router.model.{BeamLeg, BeamPath, EmbodiedBeamTrip} import beam.sim.common.GeoUtils +import beam.sim.config.BeamConfig import beam.sim.vehiclesharing.VehicleManager -import beam.sim.{BeamScenario, BeamServices, BeamWarmStart} +import beam.sim.{BeamScenario, BeamServices} import beam.utils.{FileUtils, ProfilingUtils} import com.typesafe.scalalogging.LazyLogging import javax.inject.Inject import org.matsim.api.core.v01.{Coord, Id} -import org.matsim.core.config.groups.TravelTimeCalculatorConfigGroup import org.matsim.core.controler.events.IterationEndsEvent import org.matsim.core.utils.io.IOUtils import org.supercsv.io.CsvMapReader @@ -40,12 +39,15 @@ import scala.util.control.NonFatal //TODO to be validated against google api class BeamSkimmer @Inject()( + val beamServices: BeamServices, val beamScenario: BeamScenario, val geo: GeoUtils ) extends LazyLogging { import BeamSkimmer._ import beamScenario._ + def beamConfig: BeamConfig = beamServices.beamConfig + // The OD/Mode/Time Matrix private var previousSkims: BeamSkimmerADT = initialPreviousSkims() private var skims: BeamSkimmerADT = TrieMap() diff --git a/src/main/scala/beam/router/TravelTimeObserved.scala b/src/main/scala/beam/router/TravelTimeObserved.scala index 7b030c5d8eb..bf876a5f86d 100644 --- a/src/main/scala/beam/router/TravelTimeObserved.scala +++ b/src/main/scala/beam/router/TravelTimeObserved.scala @@ -8,7 +8,7 @@ import beam.analysis.plots.{GraphUtils, GraphsStatsAgentSimEventsListener} import beam.router.Modes.BeamMode import beam.router.Modes.BeamMode.{CAR, WALK} import beam.router.model.{EmbodiedBeamLeg, EmbodiedBeamTrip} -import beam.sim.BeamScenario +import beam.sim.{BeamScenario, BeamServices} import beam.sim.common.GeoUtils import beam.utils.{FileUtils, GeoJsonReader, ProfilingUtils} import com.google.inject.Inject @@ -31,6 +31,7 @@ import org.supercsv.prefs.CsvPreference import scala.collection.mutable class TravelTimeObserved @Inject()( + val beamServices: BeamServices, val beamScenario: BeamScenario, val geo: GeoUtils ) extends LazyLogging { @@ -38,7 +39,7 @@ class TravelTimeObserved @Inject()( import beamScenario._ @volatile - private var skimmer: BeamSkimmer = new BeamSkimmer(beamScenario, geo) + private var skimmer: BeamSkimmer = new BeamSkimmer(beamServices, beamScenario, geo) private val observedTravelTimesOpt: Option[Map[PathCache, Float]] = { val zoneBoundariesFilePath = beamConfig.beam.calibration.roadNetwork.travelTimes.zoneBoundariesFilePath @@ -99,7 +100,7 @@ class TravelTimeObserved @Inject()( def notifyIterationEnds(event: IterationEndsEvent): Unit = { writeTravelTimeObservedVsSimulated(event) - skimmer = new BeamSkimmer(beamScenario, geo) + skimmer = new BeamSkimmer(beamServices, beamScenario, geo) } def writeTravelTimeObservedVsSimulated(event: IterationEndsEvent): Unit = { diff --git a/src/test/scala/beam/agentsim/agents/PersonAgentSpec.scala b/src/test/scala/beam/agentsim/agents/PersonAgentSpec.scala index ddfc3e3c3f0..28ce7db86da 100644 --- a/src/test/scala/beam/agentsim/agents/PersonAgentSpec.scala +++ b/src/test/scala/beam/agentsim/agents/PersonAgentSpec.scala @@ -115,9 +115,9 @@ class PersonAgentSpec parkingManager, services.tollCalculator, self, - beamSkimmer = new BeamSkimmer(beamScenario, services.geo), + beamSkimmer = new BeamSkimmer(services, beamScenario, services.geo), routeHistory = new RouteHistory(beamConfig), - travelTimeObserved = new TravelTimeObserved(beamScenario, services.geo), + travelTimeObserved = new TravelTimeObserved(services, beamScenario, services.geo), boundingBox = boundingBox ) ) @@ -181,8 +181,8 @@ class PersonAgentSpec new Coord(0.0, 0.0), Vector(), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) @@ -380,8 +380,8 @@ class PersonAgentSpec homeCoord = new Coord(0.0, 0.0), Vector(), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) @@ -658,8 +658,8 @@ class PersonAgentSpec new Coord(0.0, 0.0), Vector(), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) diff --git a/src/test/scala/beam/agentsim/agents/PersonAndTransitDriverSpec.scala b/src/test/scala/beam/agentsim/agents/PersonAndTransitDriverSpec.scala index a820acea80b..0d7c7a20af0 100644 --- a/src/test/scala/beam/agentsim/agents/PersonAndTransitDriverSpec.scala +++ b/src/test/scala/beam/agentsim/agents/PersonAndTransitDriverSpec.scala @@ -345,8 +345,8 @@ class PersonAndTransitDriverSpec homeCoord = new Coord(0.0, 0.0), Vector(), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) diff --git a/src/test/scala/beam/agentsim/agents/PersonWithPersonalVehiclePlanSpec.scala b/src/test/scala/beam/agentsim/agents/PersonWithPersonalVehiclePlanSpec.scala index 9706c506c3d..8e75470a0f2 100644 --- a/src/test/scala/beam/agentsim/agents/PersonWithPersonalVehiclePlanSpec.scala +++ b/src/test/scala/beam/agentsim/agents/PersonWithPersonalVehiclePlanSpec.scala @@ -123,8 +123,8 @@ class PersonWithPersonalVehiclePlanSpec new Coord(0.0, 0.0), Vector(), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) @@ -344,8 +344,8 @@ class PersonWithPersonalVehiclePlanSpec new Coord(0.0, 0.0), Vector(), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) @@ -489,8 +489,8 @@ class PersonWithPersonalVehiclePlanSpec new Coord(0.0, 0.0), Vector(), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) @@ -584,8 +584,8 @@ class PersonWithPersonalVehiclePlanSpec new Coord(0.0, 0.0), Vector(), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) diff --git a/src/test/scala/beam/agentsim/agents/PersonWithVehicleSharingSpec.scala b/src/test/scala/beam/agentsim/agents/PersonWithVehicleSharingSpec.scala index a5c3c7cc62e..a799ddcc7ab 100644 --- a/src/test/scala/beam/agentsim/agents/PersonWithVehicleSharingSpec.scala +++ b/src/test/scala/beam/agentsim/agents/PersonWithVehicleSharingSpec.scala @@ -134,8 +134,8 @@ class PersonWithVehicleSharingSpec new Coord(0.0, 0.0), sharedVehicleFleets = Vector(mockSharedVehicleFleet.ref), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) @@ -278,8 +278,8 @@ class PersonWithVehicleSharingSpec new Coord(0.0, 0.0), sharedVehicleFleets = Vector(mockSharedVehicleFleet.ref), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) @@ -517,8 +517,8 @@ class PersonWithVehicleSharingSpec new Coord(0.0, 0.0), Vector(mockSharedVehicleFleet.ref), new RouteHistory(beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), boundingBox ) ) diff --git a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala index fdb704d0e06..0dda92e6d40 100644 --- a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala +++ b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala @@ -8,14 +8,16 @@ import beam.agentsim.agents.vehicles.EnergyEconomyAttributes.Powertrain import beam.agentsim.agents.vehicles.{BeamVehicle, BeamVehicleType} import beam.agentsim.agents.{Dropoff, Pickup} import beam.router.BeamSkimmer -import beam.sim.BeamHelper +import beam.sim.{BeamHelper, BeamServicesImpl} import beam.sim.common.GeoUtilsImpl -import beam.sim.config.BeamConfig +import beam.sim.config.{BeamConfig, MatSimBeamConfigBuilder} +import beam.utils.{SimRunnerForTest, TestConfigUtils} import beam.utils.TestConfigUtils.testConfig import com.typesafe.config.ConfigFactory import org.matsim.api.core.v01.population.{Activity, Person, Plan, Population} import org.matsim.api.core.v01.{Coord, Id} import org.matsim.core.config.ConfigUtils +import org.matsim.core.controler.OutputDirectoryHierarchy.OverwriteFileSetting import org.matsim.core.population.PopulationUtils import org.matsim.core.population.io.PopulationReader import org.matsim.core.scenario.ScenarioUtils @@ -24,9 +26,9 @@ import org.scalatest.mockito.MockitoSugar import org.scalatest.{BeforeAndAfterAll, FunSpecLike, Matchers} import scala.collection.immutable.List -import scala.collection.{mutable, JavaConverters} +import scala.collection.{JavaConverters, mutable} import scala.concurrent.ExecutionContext - +/* class FastHouseholdCAVSchedulingSpec extends TestKit( ActorSystem( @@ -55,7 +57,15 @@ class FastHouseholdCAVSchedulingSpec private lazy val beamCfg = BeamConfig(system.settings.config) private lazy val beamScenario = loadScenario(beamCfg) - private lazy val skimmer: BeamSkimmer = new BeamSkimmer(beamScenario, new GeoUtilsImpl(beamCfg)) + private val matsimConfig = new MatSimBeamConfigBuilder(system.settings.config).buildMatSimConf() + matsimConfig.controler.setOutputDirectory(TestConfigUtils.testOutputDir) + matsimConfig.controler.setOverwriteFileSetting(OverwriteFileSetting.overwriteExistingFiles) + + private val scenario = buildScenarioFromMatsimConfig(matsimConfig, beamScenario) + private val injector = buildInjector(system.settings.config, beamCfg, scenario, beamScenario) + val services = new BeamServicesImpl(injector) + + private lazy val skimmer: BeamSkimmer = new BeamSkimmer(services, beamScenario, new GeoUtilsImpl(beamCfg)) describe("A Household CAV Scheduler") { it("generates two schedules") { @@ -308,3 +318,4 @@ class FastHouseholdCAVSchedulingSpec (sc.getPopulation, household) } } + */ \ No newline at end of file diff --git a/src/test/scala/beam/integration/AgentsimWithMaximallyBadRouterSpec.scala b/src/test/scala/beam/integration/AgentsimWithMaximallyBadRouterSpec.scala index d811547bfe6..af6a1a0e9ae 100755 --- a/src/test/scala/beam/integration/AgentsimWithMaximallyBadRouterSpec.scala +++ b/src/test/scala/beam/integration/AgentsimWithMaximallyBadRouterSpec.scala @@ -56,8 +56,8 @@ class AgentsimWithMaximallyBadRouterSpec new RideHailSurgePricingManager(services), new RideHailIterationHistory(), new RouteHistory(services.beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), new GeoUtilsImpl(services.beamConfig), services.networkHelper ) diff --git a/src/test/scala/beam/integration/SingleModeSpec.scala b/src/test/scala/beam/integration/SingleModeSpec.scala index edb9fb46400..a3ea3763155 100755 --- a/src/test/scala/beam/integration/SingleModeSpec.scala +++ b/src/test/scala/beam/integration/SingleModeSpec.scala @@ -76,8 +76,8 @@ class SingleModeSpec new RideHailSurgePricingManager(services), new RideHailIterationHistory(), new RouteHistory(services.beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), new GeoUtilsImpl(services.beamConfig), services.networkHelper ) @@ -129,8 +129,8 @@ class SingleModeSpec new RideHailSurgePricingManager(services), new RideHailIterationHistory(), new RouteHistory(services.beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), new GeoUtilsImpl(services.beamConfig), services.networkHelper ) @@ -201,8 +201,8 @@ class SingleModeSpec new RideHailSurgePricingManager(services), new RideHailIterationHistory(), new RouteHistory(services.beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), new GeoUtilsImpl(services.beamConfig), services.networkHelper ) @@ -279,8 +279,8 @@ class SingleModeSpec new RideHailSurgePricingManager(services), new RideHailIterationHistory(), new RouteHistory(services.beamConfig), - new BeamSkimmer(beamScenario, services.geo), - new TravelTimeObserved(beamScenario, services.geo), + new BeamSkimmer(services, beamScenario, services.geo), + new TravelTimeObserved(services, beamScenario, services.geo), new GeoUtilsImpl(services.beamConfig), services.networkHelper ) From 0a508c7249305f556130ac4ef31c240aacd884d3 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Sat, 24 Aug 2019 01:31:28 +0300 Subject: [PATCH 02/23] FastHouseholdCAVSchedulingSpec format fix --- .../household/FastHouseholdCAVSchedulingSpec.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala index 0dda92e6d40..b9c67f9f8a2 100644 --- a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala +++ b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala @@ -6,12 +6,11 @@ import akka.testkit.{ImplicitSender, TestKit} import akka.util.Timeout import beam.agentsim.agents.vehicles.EnergyEconomyAttributes.Powertrain import beam.agentsim.agents.vehicles.{BeamVehicle, BeamVehicleType} -import beam.agentsim.agents.{Dropoff, Pickup} import beam.router.BeamSkimmer -import beam.sim.{BeamHelper, BeamServicesImpl} import beam.sim.common.GeoUtilsImpl import beam.sim.config.{BeamConfig, MatSimBeamConfigBuilder} -import beam.utils.{SimRunnerForTest, TestConfigUtils} +import beam.sim.{BeamHelper, BeamServicesImpl} +import beam.utils.TestConfigUtils import beam.utils.TestConfigUtils.testConfig import com.typesafe.config.ConfigFactory import org.matsim.api.core.v01.population.{Activity, Person, Plan, Population} @@ -26,9 +25,9 @@ import org.scalatest.mockito.MockitoSugar import org.scalatest.{BeforeAndAfterAll, FunSpecLike, Matchers} import scala.collection.immutable.List -import scala.collection.{JavaConverters, mutable} +import scala.collection.{mutable, JavaConverters} import scala.concurrent.ExecutionContext -/* + class FastHouseholdCAVSchedulingSpec extends TestKit( ActorSystem( @@ -318,4 +317,3 @@ class FastHouseholdCAVSchedulingSpec (sc.getPopulation, household) } } - */ \ No newline at end of file From e3f9fa5648420841fb14af57d9a2cfd7098c8c16 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Sat, 24 Aug 2019 23:23:35 +0300 Subject: [PATCH 03/23] writeEventsInterval getting from beamServices to get updates in runtime --- .../via/ExpectedMaxUtilityHeatMap.java | 21 +++++++++++++------ src/main/scala/beam/sim/BeamSim.scala | 5 ++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/beam/analysis/via/ExpectedMaxUtilityHeatMap.java b/src/main/java/beam/analysis/via/ExpectedMaxUtilityHeatMap.java index dc22c4c730f..9475306de57 100755 --- a/src/main/java/beam/analysis/via/ExpectedMaxUtilityHeatMap.java +++ b/src/main/java/beam/analysis/via/ExpectedMaxUtilityHeatMap.java @@ -1,6 +1,8 @@ package beam.analysis.via; import beam.agentsim.events.ModeChoiceEvent; +import beam.sim.BeamServices; +import beam.sim.config.BeamConfig; import beam.utils.NetworkHelper; import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.network.Link; @@ -15,18 +17,24 @@ public class ExpectedMaxUtilityHeatMap implements BasicEventHandler { private final String SEPERATOR = ","; - private final NetworkHelper networkHelper; private final OutputDirectoryHierarchy controlerIO; - private final int writeEventsInterval; private CSVWriter csvWriter; static final String fileBaseName = "expectedMaxUtilityHeatMap"; private BufferedWriter bufferedWriter; private boolean writeDataInThisIteration = false; + private BeamServices beamServices; - public ExpectedMaxUtilityHeatMap(EventsManager eventsManager, NetworkHelper networkHelper, OutputDirectoryHierarchy controlerIO, int writeEventsInterval) { - this.networkHelper = networkHelper; + private NetworkHelper networkHelper() { + return beamServices.networkHelper(); + } + + private int writeEventsInterval() { + return beamServices.beamConfig().beam().outputs().writeEventsInterval(); + } + + public ExpectedMaxUtilityHeatMap(EventsManager eventsManager, BeamServices beamServices, OutputDirectoryHierarchy controlerIO) { this.controlerIO = controlerIO; - this.writeEventsInterval = writeEventsInterval; + this.beamServices = beamServices; eventsManager.addHandler(this); } @@ -35,7 +43,7 @@ public void handleEvent(Event event) { if (writeDataInThisIteration && event instanceof ModeChoiceEvent) { ModeChoiceEvent modeChoiceEvent = (ModeChoiceEvent) event; int linkId = Integer.parseInt(modeChoiceEvent.location); - Link link = networkHelper.getLinkUnsafe(linkId); + Link link = networkHelper().getLinkUnsafe(linkId); if (link != null) { // TODO: fix this, so that location of mode choice event is always initialized try { @@ -61,6 +69,7 @@ public void reset(int iteration) { this.csvWriter.closeFile(); } + int writeEventsInterval = writeEventsInterval(); writeDataInThisIteration = writeEventsInterval > 0 && iteration % writeEventsInterval == 0; if (writeDataInThisIteration) { diff --git a/src/main/scala/beam/sim/BeamSim.scala b/src/main/scala/beam/sim/BeamSim.scala index 6b37c8c08c3..e1cf6633b40 100755 --- a/src/main/scala/beam/sim/BeamSim.scala +++ b/src/main/scala/beam/sim/BeamSim.scala @@ -145,9 +145,8 @@ class BeamSim @Inject()( modalityStyleStats = new ModalityStyleStats() expectedDisutilityHeatMapDataCollector = new ExpectedMaxUtilityHeatMap( eventsManager, - beamServices.networkHelper, - event.getServices.getControlerIO, - beamServices.beamConfig.beam.outputs.writeEventsInterval + beamServices, + event.getServices.getControlerIO ) tncIterationsStatsCollector = new RideHailIterationsStatsCollector( From 3b517049d079990e5734939cbb1d62f7e3fadd88 Mon Sep 17 00:00:00 2001 From: rajnikantsh Date: Tue, 27 Aug 2019 20:52:44 +0530 Subject: [PATCH 04/23] add listener for last iteration --- src/main/scala/beam/sim/BeamHelper.scala | 1 + ...ustomTerminateAtFixedIterationNumber.scala | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/main/scala/beam/sim/CustomTerminateAtFixedIterationNumber.scala diff --git a/src/main/scala/beam/sim/BeamHelper.scala b/src/main/scala/beam/sim/BeamHelper.scala index 91902ebd52e..92ef3ae2de4 100755 --- a/src/main/scala/beam/sim/BeamHelper.scala +++ b/src/main/scala/beam/sim/BeamHelper.scala @@ -154,6 +154,7 @@ trait BeamHelper extends LazyLogging { val beamConfigChangesObservable = new BeamConfigChangesObservable(beamConfig) bind(classOf[BeamConfigChangesObservable]).toInstance(beamConfigChangesObservable) + bind(classOf[TerminationCriterion]).to(classOf[CustomTerminateAtFixedIterationNumber]) bind(classOf[PrepareForSim]).to(classOf[BeamPrepareForSim]) bind(classOf[RideHailSurgePricingManager]).asEagerSingleton() diff --git a/src/main/scala/beam/sim/CustomTerminateAtFixedIterationNumber.scala b/src/main/scala/beam/sim/CustomTerminateAtFixedIterationNumber.scala new file mode 100644 index 00000000000..70e47b74589 --- /dev/null +++ b/src/main/scala/beam/sim/CustomTerminateAtFixedIterationNumber.scala @@ -0,0 +1,24 @@ +package beam.sim + +import beam.sim.config.BeamConfigHolder +import javax.inject.Inject +import org.matsim.core.config.groups.ControlerConfigGroup +import org.matsim.core.controler.TerminationCriterion + +class CustomTerminateAtFixedIterationNumber extends TerminationCriterion { + private var lastIteration = 0 + private var beamConfigHolder: BeamConfigHolder = _ + + @Inject + def this(controlerConfigGroup: ControlerConfigGroup, beamConfigHolder: BeamConfigHolder) { + this() + this.beamConfigHolder = beamConfigHolder + this.lastIteration = controlerConfigGroup.getLastIteration + } + + override def continueIterations(iteration: Int): Boolean = { + lastIteration = beamConfigHolder.beamConfig.beam.agentsim.lastIteration + iteration <= lastIteration + } + +} From 8d33f5f2b17bcd34f4d483a2f2472f9adafeae34 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Wed, 28 Aug 2019 00:48:15 +0300 Subject: [PATCH 05/23] fix for writePlansInterval config value --- .../beam/matsim/CustomPlansDumpingImpl.java | 76 +++++++++++++++++++ src/main/scala/beam/sim/BeamHelper.scala | 7 +- .../beam/sim/config/BeamConfigHolder.scala | 10 ++- 3 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 src/main/java/beam/matsim/CustomPlansDumpingImpl.java diff --git a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java new file mode 100644 index 00000000000..d6ed5f8b3cd --- /dev/null +++ b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java @@ -0,0 +1,76 @@ +package beam.matsim; + +import com.google.inject.Inject; +import com.google.inject.Singleton; +import org.apache.log4j.Logger; +import org.matsim.analysis.IterationStopWatch; +import org.matsim.api.core.v01.network.Network; +import org.matsim.api.core.v01.population.Population; +import org.matsim.api.core.v01.population.PopulationWriter; +import org.matsim.core.config.Config; +import org.matsim.core.config.groups.ControlerConfigGroup; +import org.matsim.core.controler.OutputDirectoryHierarchy; +import org.matsim.core.controler.corelisteners.PlansDumping; +import org.matsim.core.controler.events.BeforeMobsimEvent; +import org.matsim.core.controler.listener.BeforeMobsimListener; +import org.matsim.core.utils.geometry.CoordinateTransformation; +import org.matsim.core.utils.geometry.transformations.TransformationFactory; + +@Singleton +public class CustomPlansDumpingImpl implements PlansDumping, BeforeMobsimListener { + static final private Logger log = Logger.getLogger(CustomPlansDumpingImpl.class); + + @Inject + private Config config; + @Inject + private Network network; + @Inject + private Population population; + @Inject + private IterationStopWatch stopwatch; + @Inject + private OutputDirectoryHierarchy controlerIO; + @Inject + private ControlerConfigGroup controlerConfigGroup; + + private int writePlansInterval() { + return controlerConfigGroup.getWritePlansInterval(); + } + + private int writeMoreUntilIteration() { + return controlerConfigGroup.getWritePlansUntilIteration(); + } + + @Inject + CustomPlansDumpingImpl() { + } + + @Override + public void notifyBeforeMobsim(final BeforeMobsimEvent event) { + final boolean writingPlansAtAll = writePlansInterval() > 0; + final boolean regularWritePlans = event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0; + final boolean earlyIteration = event.getIteration() <= writeMoreUntilIteration(); + if (writingPlansAtAll && (regularWritePlans || earlyIteration)) { + stopwatch.beginOperation("dump all plans"); + log.info("dumping plans..."); + final String inputCRS = config.plans().getInputCRS(); + final String internalCRS = config.global().getCoordinateSystem(); + + if (inputCRS == null) { + new PopulationWriter(population, network).write(controlerIO.getIterationFilename(event.getIteration(), "plans.xml.gz")); + } else { + log.info("re-projecting population from " + internalCRS + " back to " + inputCRS + " for export"); + + final CoordinateTransformation transformation = + TransformationFactory.getCoordinateTransformation( + internalCRS, + inputCRS); + + new PopulationWriter(transformation, population, network).write(controlerIO.getIterationFilename(event.getIteration(), "plans.xml.gz")); + } + log.info("finished plans dump."); + stopwatch.endOperation("dump all plans"); + } + } + +} diff --git a/src/main/scala/beam/sim/BeamHelper.scala b/src/main/scala/beam/sim/BeamHelper.scala index 92ef3ae2de4..479dc3638e6 100755 --- a/src/main/scala/beam/sim/BeamHelper.scala +++ b/src/main/scala/beam/sim/BeamHelper.scala @@ -12,6 +12,7 @@ import beam.agentsim.events.handling.BeamEventsHandling import beam.agentsim.infrastructure.taz.TAZTreeMap import beam.analysis.ActivityLocationPlotter import beam.analysis.plots.{GraphSurgePricing, RideHailRevenueAnalysis} +import beam.matsim.CustomPlansDumpingImpl import beam.replanning._ import beam.replanning.utilitybased.UtilityBasedModeChoice import beam.router._ @@ -44,7 +45,7 @@ import org.matsim.core.api.experimental.events.EventsManager import org.matsim.core.config.groups.TravelTimeCalculatorConfigGroup import org.matsim.core.config.{Config => MatsimConfig} import org.matsim.core.controler._ -import org.matsim.core.controler.corelisteners.{ControlerDefaultCoreListenersModule, EventsHandling} +import org.matsim.core.controler.corelisteners.{ControlerDefaultCoreListenersModule, EventsHandling, PlansDumping} import org.matsim.core.scenario.{MutableScenario, ScenarioBuilder, ScenarioByInstanceModule, ScenarioUtils} import org.matsim.core.trafficmonitoring.TravelTimeCalculator import org.matsim.households.Household @@ -153,6 +154,8 @@ trait BeamHelper extends LazyLogging { bind(classOf[BeamConfigHolder]) val beamConfigChangesObservable = new BeamConfigChangesObservable(beamConfig) + bind(classOf[PlansDumping]).to(classOf[CustomPlansDumpingImpl]) + bind(classOf[BeamConfigChangesObservable]).toInstance(beamConfigChangesObservable) bind(classOf[TerminationCriterion]).to(classOf[CustomTerminateAtFixedIterationNumber]) bind(classOf[PrepareForSim]).to(classOf[BeamPrepareForSim]) @@ -688,7 +691,7 @@ trait BeamHelper extends LazyLogging { } result.planCalcScore().setMemorizingExperiencedPlans(true) result.controler.setOutputDirectory(outputDirectory) - result.controler().setWritePlansInterval(beamConfig.beam.outputs.writePlansInterval) + result.controler.setWritePlansInterval(beamConfig.beam.outputs.writePlansInterval) result } diff --git a/src/main/scala/beam/sim/config/BeamConfigHolder.scala b/src/main/scala/beam/sim/config/BeamConfigHolder.scala index 988f16e9e2c..c1654b89341 100644 --- a/src/main/scala/beam/sim/config/BeamConfigHolder.scala +++ b/src/main/scala/beam/sim/config/BeamConfigHolder.scala @@ -3,9 +3,13 @@ import java.util.{Observable, Observer} import beam.sim.BeamConfigChangesObservable import javax.inject.Inject +import org.matsim.core.config.groups.ControlerConfigGroup -class BeamConfigHolder @Inject()(beamConfigChangesObservable: BeamConfigChangesObservable, config: BeamConfig) - extends Observer { +class BeamConfigHolder @Inject()( + beamConfigChangesObservable: BeamConfigChangesObservable, + config: BeamConfig, + controlerConfigGroup: ControlerConfigGroup +) extends Observer { var beamConfig: BeamConfig = config beamConfigChangesObservable.addObserver(this) @@ -13,5 +17,7 @@ class BeamConfigHolder @Inject()(beamConfigChangesObservable: BeamConfigChangesO override def update(o: Observable, arg: Any): Unit = { val (_, updatedBeamConfig) = arg.asInstanceOf[(_, BeamConfig)] this.beamConfig = updatedBeamConfig + + controlerConfigGroup.setWritePlansInterval(beamConfig.beam.physsim.writePlansInterval) } } From c6ff2e65834ad956ea9c67670e0f30967f3fd931 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Wed, 28 Aug 2019 16:01:14 +0300 Subject: [PATCH 06/23] fix of division by zero --- src/main/java/beam/matsim/CustomPlansDumpingImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java index d6ed5f8b3cd..eaeba8895e3 100644 --- a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java +++ b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java @@ -48,7 +48,7 @@ private int writeMoreUntilIteration() { @Override public void notifyBeforeMobsim(final BeforeMobsimEvent event) { final boolean writingPlansAtAll = writePlansInterval() > 0; - final boolean regularWritePlans = event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0; + final boolean regularWritePlans = writePlansInterval() > 0 && (event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0); final boolean earlyIteration = event.getIteration() <= writeMoreUntilIteration(); if (writingPlansAtAll && (regularWritePlans || earlyIteration)) { stopwatch.beginOperation("dump all plans"); From 1513fe73eb8b4fb5f1d793809a5c6bf79dbda2b1 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Sat, 24 Aug 2019 01:25:02 +0300 Subject: [PATCH 07/23] added BeamServices as field into BeamSkimmer and TravelTimeObserved in order to get config updates --- .../agents/household/FastHouseholdCAVSchedulingSpec.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala index b9c67f9f8a2..f73d37d8f37 100644 --- a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala +++ b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala @@ -7,10 +7,13 @@ import akka.util.Timeout import beam.agentsim.agents.vehicles.EnergyEconomyAttributes.Powertrain import beam.agentsim.agents.vehicles.{BeamVehicle, BeamVehicleType} import beam.router.BeamSkimmer +import beam.sim.{BeamHelper, BeamServicesImpl} import beam.sim.common.GeoUtilsImpl import beam.sim.config.{BeamConfig, MatSimBeamConfigBuilder} import beam.sim.{BeamHelper, BeamServicesImpl} import beam.utils.TestConfigUtils +import beam.sim.config.{BeamConfig, MatSimBeamConfigBuilder} +import beam.utils.{SimRunnerForTest, TestConfigUtils} import beam.utils.TestConfigUtils.testConfig import com.typesafe.config.ConfigFactory import org.matsim.api.core.v01.population.{Activity, Person, Plan, Population} @@ -25,9 +28,9 @@ import org.scalatest.mockito.MockitoSugar import org.scalatest.{BeforeAndAfterAll, FunSpecLike, Matchers} import scala.collection.immutable.List -import scala.collection.{mutable, JavaConverters} +import scala.collection.{JavaConverters, mutable} import scala.concurrent.ExecutionContext - +/* class FastHouseholdCAVSchedulingSpec extends TestKit( ActorSystem( @@ -317,3 +320,4 @@ class FastHouseholdCAVSchedulingSpec (sc.getPopulation, household) } } + */ \ No newline at end of file From dc2dd1eb0a1085af5baf81afafe4e2deb417b3d8 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Sat, 24 Aug 2019 01:31:28 +0300 Subject: [PATCH 08/23] FastHouseholdCAVSchedulingSpec format fix --- .../household/FastHouseholdCAVSchedulingSpec.scala | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala index f73d37d8f37..e0cbc394559 100644 --- a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala +++ b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala @@ -7,13 +7,13 @@ import akka.util.Timeout import beam.agentsim.agents.vehicles.EnergyEconomyAttributes.Powertrain import beam.agentsim.agents.vehicles.{BeamVehicle, BeamVehicleType} import beam.router.BeamSkimmer -import beam.sim.{BeamHelper, BeamServicesImpl} import beam.sim.common.GeoUtilsImpl import beam.sim.config.{BeamConfig, MatSimBeamConfigBuilder} import beam.sim.{BeamHelper, BeamServicesImpl} import beam.utils.TestConfigUtils import beam.sim.config.{BeamConfig, MatSimBeamConfigBuilder} -import beam.utils.{SimRunnerForTest, TestConfigUtils} +import beam.sim.{BeamHelper, BeamServicesImpl} +import beam.utils.TestConfigUtils import beam.utils.TestConfigUtils.testConfig import com.typesafe.config.ConfigFactory import org.matsim.api.core.v01.population.{Activity, Person, Plan, Population} @@ -28,9 +28,9 @@ import org.scalatest.mockito.MockitoSugar import org.scalatest.{BeforeAndAfterAll, FunSpecLike, Matchers} import scala.collection.immutable.List -import scala.collection.{JavaConverters, mutable} +import scala.collection.{mutable, JavaConverters} import scala.concurrent.ExecutionContext -/* + class FastHouseholdCAVSchedulingSpec extends TestKit( ActorSystem( @@ -320,4 +320,3 @@ class FastHouseholdCAVSchedulingSpec (sc.getPopulation, household) } } - */ \ No newline at end of file From f527a4648f08077dd16fb659ed5fc407b549c87a Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Sat, 24 Aug 2019 23:23:35 +0300 Subject: [PATCH 09/23] writeEventsInterval getting from beamServices to get updates in runtime From db895fb5beab809e63f0389cc3a0f9ee039729b2 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Wed, 28 Aug 2019 00:48:15 +0300 Subject: [PATCH 10/23] fix for writePlansInterval config value --- src/main/java/beam/matsim/CustomPlansDumpingImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java index eaeba8895e3..d2160c1434e 100644 --- a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java +++ b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java @@ -48,6 +48,7 @@ private int writeMoreUntilIteration() { @Override public void notifyBeforeMobsim(final BeforeMobsimEvent event) { final boolean writingPlansAtAll = writePlansInterval() > 0; + final boolean regularWritePlans = event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0; final boolean regularWritePlans = writePlansInterval() > 0 && (event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0); final boolean earlyIteration = event.getIteration() <= writeMoreUntilIteration(); if (writingPlansAtAll && (regularWritePlans || earlyIteration)) { From b6460bd0c3f8c73f40f39ca1fe83eb0780f1223f Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Wed, 4 Sep 2019 22:52:22 +0300 Subject: [PATCH 11/23] cherry-pick fix --- src/main/java/beam/matsim/CustomPlansDumpingImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java index d2160c1434e..d6ed5f8b3cd 100644 --- a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java +++ b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java @@ -49,7 +49,6 @@ private int writeMoreUntilIteration() { public void notifyBeforeMobsim(final BeforeMobsimEvent event) { final boolean writingPlansAtAll = writePlansInterval() > 0; final boolean regularWritePlans = event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0; - final boolean regularWritePlans = writePlansInterval() > 0 && (event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0); final boolean earlyIteration = event.getIteration() <= writeMoreUntilIteration(); if (writingPlansAtAll && (regularWritePlans || earlyIteration)) { stopwatch.beginOperation("dump all plans"); From 4423bd6a9087ba988ad2cae927d6d05e1ad936dc Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Wed, 28 Aug 2019 16:01:14 +0300 Subject: [PATCH 12/23] fix of division by zero --- src/main/java/beam/matsim/CustomPlansDumpingImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java index d6ed5f8b3cd..eaeba8895e3 100644 --- a/src/main/java/beam/matsim/CustomPlansDumpingImpl.java +++ b/src/main/java/beam/matsim/CustomPlansDumpingImpl.java @@ -48,7 +48,7 @@ private int writeMoreUntilIteration() { @Override public void notifyBeforeMobsim(final BeforeMobsimEvent event) { final boolean writingPlansAtAll = writePlansInterval() > 0; - final boolean regularWritePlans = event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0; + final boolean regularWritePlans = writePlansInterval() > 0 && (event.getIteration() > 0 && event.getIteration() % writePlansInterval() == 0); final boolean earlyIteration = event.getIteration() <= writeMoreUntilIteration(); if (writingPlansAtAll && (regularWritePlans || earlyIteration)) { stopwatch.beginOperation("dump all plans"); From 8c54b49da5604601e3a10fe57fca6bc1dffdd329 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Tue, 3 Sep 2019 20:50:32 +0300 Subject: [PATCH 13/23] fix for tests after introducing of runtime updates of `lastIteration` config value --- src/main/scala/beam/sim/BeamHelper.scala | 2 ++ src/test/scala/beam/integration/IntegrationSpecCommon.scala | 4 +--- src/test/scala/beam/integration/ParkingSpec.scala | 2 +- .../scala/beam/integration/ridehail/RideHailTestHelper.scala | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/scala/beam/sim/BeamHelper.scala b/src/main/scala/beam/sim/BeamHelper.scala index 479dc3638e6..258730599de 100755 --- a/src/main/scala/beam/sim/BeamHelper.scala +++ b/src/main/scala/beam/sim/BeamHelper.scala @@ -157,7 +157,9 @@ trait BeamHelper extends LazyLogging { bind(classOf[PlansDumping]).to(classOf[CustomPlansDumpingImpl]) bind(classOf[BeamConfigChangesObservable]).toInstance(beamConfigChangesObservable) + bind(classOf[TerminationCriterion]).to(classOf[CustomTerminateAtFixedIterationNumber]) + bind(classOf[PrepareForSim]).to(classOf[BeamPrepareForSim]) bind(classOf[RideHailSurgePricingManager]).asEagerSingleton() diff --git a/src/test/scala/beam/integration/IntegrationSpecCommon.scala b/src/test/scala/beam/integration/IntegrationSpecCommon.scala index 8f5bf7dd50a..d48327c7711 100755 --- a/src/test/scala/beam/integration/IntegrationSpecCommon.scala +++ b/src/test/scala/beam/integration/IntegrationSpecCommon.scala @@ -4,8 +4,6 @@ import beam.utils.TestConfigUtils.testConfig import com.typesafe.config.{Config, ConfigFactory, ConfigValueFactory} trait IntegrationSpecCommon { - private val LAST_ITER_CONF_PATH = "matsim.modules.controler.lastIteration" - protected var totalIterations: Int = 1 val configFileName = "test/input/beamville/beam.conf" @@ -15,7 +13,7 @@ trait IntegrationSpecCommon { lazy val baseConfig: Config = testConfig(configFileName) .resolve() .withValue("beam.outputs.events.fileOutputFormats", ConfigValueFactory.fromAnyRef("xml")) - .withValue(LAST_ITER_CONF_PATH, ConfigValueFactory.fromAnyRef(totalIterations - 1)) + .withValue("beam.agentsim.lastIteration", ConfigValueFactory.fromAnyRef(totalIterations - 1)) .withFallback(configLocation) .resolve diff --git a/src/test/scala/beam/integration/ParkingSpec.scala b/src/test/scala/beam/integration/ParkingSpec.scala index ade74b5c262..d86a18b659d 100755 --- a/src/test/scala/beam/integration/ParkingSpec.scala +++ b/src/test/scala/beam/integration/ParkingSpec.scala @@ -79,7 +79,7 @@ class ParkingSpec extends WordSpecLike with BeforeAndAfterAll with Matchers with ) ) .withValue( - "matsim.modules.controler.lastIteration", + "beam.agentsim.lastIteration", ConfigValueFactory.fromAnyRef(iterations) ) .withFallback(param) diff --git a/src/test/scala/beam/integration/ridehail/RideHailTestHelper.scala b/src/test/scala/beam/integration/ridehail/RideHailTestHelper.scala index cf9fadaa51d..bff7c805b39 100644 --- a/src/test/scala/beam/integration/ridehail/RideHailTestHelper.scala +++ b/src/test/scala/beam/integration/ridehail/RideHailTestHelper.scala @@ -29,6 +29,7 @@ object RideHailTestHelper { ConfigValueFactory.fromAnyRef(0) ) .withValue("beam.debug.stuckAgentDetection.enabled", ConfigValueFactory.fromAnyRef(true)) + .withValue("beam.agentsim.lastIteration", ConfigValueFactory.fromAnyRef(0)) .resolve() config @@ -38,7 +39,6 @@ object RideHailTestHelper { val configBuilder = new MatSimBeamConfigBuilder(config) val matsimConfig = configBuilder.buildMatSimConf() - matsimConfig.controler().setLastIteration(0) matsimConfig.planCalcScore().setMemorizingExperiencedPlans(true) matsimConfig } From a9d6f9bbc6d81d310734807cf08207c0668b77d9 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Wed, 4 Sep 2019 18:31:47 +0300 Subject: [PATCH 14/23] added control over linkstats.txt.gz file writing --- .../java/beam/matsim/MatsimConfigUpdater.java | 36 +++++++++++++++++++ src/main/resources/beam-template.conf | 4 +++ src/main/scala/beam/sim/BeamHelper.scala | 4 ++- .../scala/beam/sim/config/BeamConfig.scala | 24 ++++++++++++- .../beam/sim/config/BeamConfigHolder.scala | 6 +--- test/input/common/matsim.conf | 4 +++ 6 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 src/main/java/beam/matsim/MatsimConfigUpdater.java diff --git a/src/main/java/beam/matsim/MatsimConfigUpdater.java b/src/main/java/beam/matsim/MatsimConfigUpdater.java new file mode 100644 index 00000000000..4ad1c5ea013 --- /dev/null +++ b/src/main/java/beam/matsim/MatsimConfigUpdater.java @@ -0,0 +1,36 @@ +package beam.matsim; + +import beam.sim.BeamConfigChangesObservable; +import beam.sim.config.BeamConfig; +import com.google.inject.Inject; +import com.google.inject.Singleton; +import org.matsim.core.config.groups.ControlerConfigGroup; +import org.matsim.core.config.groups.LinkStatsConfigGroup; +import scala.Tuple2; + +import java.util.Observable; +import java.util.Observer; + +@Singleton +public class MatsimConfigUpdater implements Observer { + private ControlerConfigGroup controlerConfigGroup; + private LinkStatsConfigGroup linkStatsConfigGroup; + + @Inject + MatsimConfigUpdater(BeamConfigChangesObservable beamConfigChangesObservable, LinkStatsConfigGroup linkStatsConfigGroup, ControlerConfigGroup controlerConfigGroup) { + this.controlerConfigGroup = controlerConfigGroup; + this.linkStatsConfigGroup = linkStatsConfigGroup; + + beamConfigChangesObservable.addObserver(this); + } + + @Override + public void update(Observable observable, Object o) { + Tuple2 t = (Tuple2) o; + BeamConfig beamConfig = (BeamConfig) t._2; + + controlerConfigGroup.setWritePlansInterval(beamConfig.beam().physsim().writePlansInterval()); + linkStatsConfigGroup.setWriteLinkStatsInterval(beamConfig.matsim().modules().linkStats().writeLinkStatsInterval()); + + } +} diff --git a/src/main/resources/beam-template.conf b/src/main/resources/beam-template.conf index 93b44562a29..4fb75a5087b 100755 --- a/src/main/resources/beam-template.conf +++ b/src/main/resources/beam-template.conf @@ -739,5 +739,9 @@ matsim.modules { } ] } + linkStats { + writeLinkStatsInterval = "int | 10" + averageLinkStatsOverIterations = "int | 5" + } } diff --git a/src/main/scala/beam/sim/BeamHelper.scala b/src/main/scala/beam/sim/BeamHelper.scala index 258730599de..7da63f5ac5a 100755 --- a/src/main/scala/beam/sim/BeamHelper.scala +++ b/src/main/scala/beam/sim/BeamHelper.scala @@ -12,7 +12,7 @@ import beam.agentsim.events.handling.BeamEventsHandling import beam.agentsim.infrastructure.taz.TAZTreeMap import beam.analysis.ActivityLocationPlotter import beam.analysis.plots.{GraphSurgePricing, RideHailRevenueAnalysis} -import beam.matsim.CustomPlansDumpingImpl +import beam.matsim.{CustomPlansDumpingImpl, MatsimConfigUpdater} import beam.replanning._ import beam.replanning.utilitybased.UtilityBasedModeChoice import beam.router._ @@ -154,6 +154,8 @@ trait BeamHelper extends LazyLogging { bind(classOf[BeamConfigHolder]) val beamConfigChangesObservable = new BeamConfigChangesObservable(beamConfig) + bind(classOf[MatsimConfigUpdater]).asEagerSingleton() + bind(classOf[PlansDumping]).to(classOf[CustomPlansDumpingImpl]) bind(classOf[BeamConfigChangesObservable]).toInstance(beamConfigChangesObservable) diff --git a/src/main/scala/beam/sim/config/BeamConfig.scala b/src/main/scala/beam/sim/config/BeamConfig.scala index 5afc96930af..2dd7384df4e 100755 --- a/src/main/scala/beam/sim/config/BeamConfig.scala +++ b/src/main/scala/beam/sim/config/BeamConfig.scala @@ -1,4 +1,4 @@ -// generated by tscfg 0.9.4 on Mon Aug 26 21:00:03 MDT 2019 +// generated by tscfg 0.9.4 on Wed Sep 04 17:20:02 MSK 2019 // source: src/main/resources/beam-template.conf package beam.sim.config @@ -2438,6 +2438,7 @@ object BeamConfig { counts: BeamConfig.Matsim.Modules.Counts, global: BeamConfig.Matsim.Modules.Global, households: BeamConfig.Matsim.Modules.Households, + linkStats: BeamConfig.Matsim.Modules.LinkStats, network: BeamConfig.Matsim.Modules.Network, parallelEventHandling: BeamConfig.Matsim.Modules.ParallelEventHandling, planCalcScore: BeamConfig.Matsim.Modules.PlanCalcScore, @@ -2541,6 +2542,23 @@ object BeamConfig { } } + case class LinkStats( + averageLinkStatsOverIterations: scala.Int, + writeLinkStatsInterval: scala.Int + ) + + object LinkStats { + + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.LinkStats = { + BeamConfig.Matsim.Modules.LinkStats( + averageLinkStatsOverIterations = + if (c.hasPathOrNull("averageLinkStatsOverIterations")) c.getInt("averageLinkStatsOverIterations") else 5, + writeLinkStatsInterval = + if (c.hasPathOrNull("writeLinkStatsInterval")) c.getInt("writeLinkStatsInterval") else 10 + ) + } + } + case class Network( inputNetworkFile: java.lang.String ) @@ -2821,6 +2839,10 @@ object BeamConfig { if (c.hasPathOrNull("households")) c.getConfig("households") else com.typesafe.config.ConfigFactory.parseString("households{}") ), + linkStats = BeamConfig.Matsim.Modules.LinkStats( + if (c.hasPathOrNull("linkStats")) c.getConfig("linkStats") + else com.typesafe.config.ConfigFactory.parseString("linkStats{}") + ), network = BeamConfig.Matsim.Modules.Network( if (c.hasPathOrNull("network")) c.getConfig("network") else com.typesafe.config.ConfigFactory.parseString("network{}") diff --git a/src/main/scala/beam/sim/config/BeamConfigHolder.scala b/src/main/scala/beam/sim/config/BeamConfigHolder.scala index c1654b89341..1c4a561ebef 100644 --- a/src/main/scala/beam/sim/config/BeamConfigHolder.scala +++ b/src/main/scala/beam/sim/config/BeamConfigHolder.scala @@ -3,12 +3,10 @@ import java.util.{Observable, Observer} import beam.sim.BeamConfigChangesObservable import javax.inject.Inject -import org.matsim.core.config.groups.ControlerConfigGroup class BeamConfigHolder @Inject()( beamConfigChangesObservable: BeamConfigChangesObservable, - config: BeamConfig, - controlerConfigGroup: ControlerConfigGroup + config: BeamConfig ) extends Observer { var beamConfig: BeamConfig = config @@ -17,7 +15,5 @@ class BeamConfigHolder @Inject()( override def update(o: Observable, arg: Any): Unit = { val (_, updatedBeamConfig) = arg.asInstanceOf[(_, BeamConfig)] this.beamConfig = updatedBeamConfig - - controlerConfigGroup.setWritePlansInterval(beamConfig.beam.physsim.writePlansInterval) } } diff --git a/test/input/common/matsim.conf b/test/input/common/matsim.conf index 2d8d1e08b1c..cd2fce41a13 100644 --- a/test/input/common/matsim.conf +++ b/test/input/common/matsim.conf @@ -249,4 +249,8 @@ matsim.modules { } ] } + linkStats { + writeLinkStatsInterval = 1 # ${beam.outputs.defaultWriteInterval} + averageLinkStatsOverIterations = 1 + } } From 074b9d2ce48899eadc06754ef3ce294e71e3afe1 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Wed, 4 Sep 2019 23:16:56 +0300 Subject: [PATCH 15/23] default values for linkStats module config --- test/input/common/matsim.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/input/common/matsim.conf b/test/input/common/matsim.conf index cd2fce41a13..448b9572f50 100644 --- a/test/input/common/matsim.conf +++ b/test/input/common/matsim.conf @@ -250,7 +250,7 @@ matsim.modules { ] } linkStats { - writeLinkStatsInterval = 1 # ${beam.outputs.defaultWriteInterval} - averageLinkStatsOverIterations = 1 + writeLinkStatsInterval = 10 + averageLinkStatsOverIterations = 5 } } From 04b7a9beeeb026d0bcf78f3434e5be4853a20018 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Thu, 5 Sep 2019 00:34:26 +0300 Subject: [PATCH 16/23] fmt + possible fix for failing test --- .../agents/household/FastHouseholdCAVSchedulingSpec.scala | 3 --- src/test/scala/beam/integration/IntegrationSpecCommon.scala | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala index e0cbc394559..b9c67f9f8a2 100644 --- a/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala +++ b/src/test/scala/beam/agentsim/agents/household/FastHouseholdCAVSchedulingSpec.scala @@ -11,9 +11,6 @@ import beam.sim.common.GeoUtilsImpl import beam.sim.config.{BeamConfig, MatSimBeamConfigBuilder} import beam.sim.{BeamHelper, BeamServicesImpl} import beam.utils.TestConfigUtils -import beam.sim.config.{BeamConfig, MatSimBeamConfigBuilder} -import beam.sim.{BeamHelper, BeamServicesImpl} -import beam.utils.TestConfigUtils import beam.utils.TestConfigUtils.testConfig import com.typesafe.config.ConfigFactory import org.matsim.api.core.v01.population.{Activity, Person, Plan, Population} diff --git a/src/test/scala/beam/integration/IntegrationSpecCommon.scala b/src/test/scala/beam/integration/IntegrationSpecCommon.scala index d48327c7711..3b166e5d59a 100755 --- a/src/test/scala/beam/integration/IntegrationSpecCommon.scala +++ b/src/test/scala/beam/integration/IntegrationSpecCommon.scala @@ -13,6 +13,7 @@ trait IntegrationSpecCommon { lazy val baseConfig: Config = testConfig(configFileName) .resolve() .withValue("beam.outputs.events.fileOutputFormats", ConfigValueFactory.fromAnyRef("xml")) + .withValue("matsim.modules.controler.lastIteration", ConfigValueFactory.fromAnyRef(totalIterations - 1)) .withValue("beam.agentsim.lastIteration", ConfigValueFactory.fromAnyRef(totalIterations - 1)) .withFallback(configLocation) .resolve From 5a4535fbf41cdf2c0c85d2990d21398aa0db7dc1 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Thu, 5 Sep 2019 01:47:52 +0300 Subject: [PATCH 17/23] test fix --- src/test/scala/beam/integration/ParkingSpec.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/scala/beam/integration/ParkingSpec.scala b/src/test/scala/beam/integration/ParkingSpec.scala index d86a18b659d..b30a16893dc 100755 --- a/src/test/scala/beam/integration/ParkingSpec.scala +++ b/src/test/scala/beam/integration/ParkingSpec.scala @@ -82,6 +82,10 @@ class ParkingSpec extends WordSpecLike with BeforeAndAfterAll with Matchers with "beam.agentsim.lastIteration", ConfigValueFactory.fromAnyRef(iterations) ) + .withValue( + "matsim.modules.controler.lastIteration", + ConfigValueFactory.fromAnyRef(iterations) + ) .withFallback(param) .resolve() From f7388abced38eec4a9dc20bf327797d1d823bd3c Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Thu, 5 Sep 2019 12:44:06 +0300 Subject: [PATCH 18/23] blocking runtime updates of lastIteration config value in order to track what leads to tests fails --- src/main/scala/beam/sim/BeamHelper.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/beam/sim/BeamHelper.scala b/src/main/scala/beam/sim/BeamHelper.scala index 7da63f5ac5a..1e0a3fb2129 100755 --- a/src/main/scala/beam/sim/BeamHelper.scala +++ b/src/main/scala/beam/sim/BeamHelper.scala @@ -160,7 +160,7 @@ trait BeamHelper extends LazyLogging { bind(classOf[BeamConfigChangesObservable]).toInstance(beamConfigChangesObservable) - bind(classOf[TerminationCriterion]).to(classOf[CustomTerminateAtFixedIterationNumber]) + // bind(classOf[TerminationCriterion]).to(classOf[CustomTerminateAtFixedIterationNumber]) bind(classOf[PrepareForSim]).to(classOf[BeamPrepareForSim]) bind(classOf[RideHailSurgePricingManager]).asEagerSingleton() From 8902eeb5dae5c95a5f481517f71b183c2460b7c7 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Thu, 5 Sep 2019 15:44:57 +0300 Subject: [PATCH 19/23] possible test fix + revert previous commit --- src/main/scala/beam/sim/BeamHelper.scala | 2 +- .../scala/beam/integration/ridehail/RideHailTestHelper.scala | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/scala/beam/sim/BeamHelper.scala b/src/main/scala/beam/sim/BeamHelper.scala index 1e0a3fb2129..7da63f5ac5a 100755 --- a/src/main/scala/beam/sim/BeamHelper.scala +++ b/src/main/scala/beam/sim/BeamHelper.scala @@ -160,7 +160,7 @@ trait BeamHelper extends LazyLogging { bind(classOf[BeamConfigChangesObservable]).toInstance(beamConfigChangesObservable) - // bind(classOf[TerminationCriterion]).to(classOf[CustomTerminateAtFixedIterationNumber]) + bind(classOf[TerminationCriterion]).to(classOf[CustomTerminateAtFixedIterationNumber]) bind(classOf[PrepareForSim]).to(classOf[BeamPrepareForSim]) bind(classOf[RideHailSurgePricingManager]).asEagerSingleton() diff --git a/src/test/scala/beam/integration/ridehail/RideHailTestHelper.scala b/src/test/scala/beam/integration/ridehail/RideHailTestHelper.scala index bff7c805b39..fba80814b6b 100644 --- a/src/test/scala/beam/integration/ridehail/RideHailTestHelper.scala +++ b/src/test/scala/beam/integration/ridehail/RideHailTestHelper.scala @@ -29,6 +29,7 @@ object RideHailTestHelper { ConfigValueFactory.fromAnyRef(0) ) .withValue("beam.debug.stuckAgentDetection.enabled", ConfigValueFactory.fromAnyRef(true)) + .withValue("matsim.modules.controler.lastIteration", ConfigValueFactory.fromAnyRef(0)) .withValue("beam.agentsim.lastIteration", ConfigValueFactory.fromAnyRef(0)) .resolve() From bf8c49f6a2793c01c9a46602fda257939964537f Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Thu, 5 Sep 2019 15:54:06 +0300 Subject: [PATCH 20/23] reverted strange changes --- src/main/scala/beam/sim/BeamHelper.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/beam/sim/BeamHelper.scala b/src/main/scala/beam/sim/BeamHelper.scala index 7da63f5ac5a..c8ca676cad9 100755 --- a/src/main/scala/beam/sim/BeamHelper.scala +++ b/src/main/scala/beam/sim/BeamHelper.scala @@ -695,7 +695,7 @@ trait BeamHelper extends LazyLogging { } result.planCalcScore().setMemorizingExperiencedPlans(true) result.controler.setOutputDirectory(outputDirectory) - result.controler.setWritePlansInterval(beamConfig.beam.outputs.writePlansInterval) + result.controler().setWritePlansInterval(beamConfig.beam.outputs.writePlansInterval) result } From a71a857aaa8ce1983be006192ed1e160bce51d13 Mon Sep 17 00:00:00 2001 From: Justin Pihony Date: Thu, 5 Sep 2019 14:12:40 -0400 Subject: [PATCH 21/23] fmt --- .../scala/beam/sim/config/BeamConfig.scala | 3106 +++++++++++------ 1 file changed, 2006 insertions(+), 1100 deletions(-) diff --git a/src/main/scala/beam/sim/config/BeamConfig.scala b/src/main/scala/beam/sim/config/BeamConfig.scala index 48467ec99ca..9b0f7a2e96b 100755 --- a/src/main/scala/beam/sim/config/BeamConfig.scala +++ b/src/main/scala/beam/sim/config/BeamConfig.scala @@ -4,2003 +4,2909 @@ package beam.sim.config case class BeamConfig( - beam : BeamConfig.Beam, - matsim : BeamConfig.Matsim + beam: BeamConfig.Beam, + matsim: BeamConfig.Matsim ) + object BeamConfig { case class Beam( - agentsim : BeamConfig.Beam.Agentsim, - beamskimmer : BeamConfig.Beam.Beamskimmer, - calibration : BeamConfig.Beam.Calibration, - cluster : BeamConfig.Beam.Cluster, - debug : BeamConfig.Beam.Debug, - exchange : BeamConfig.Beam.Exchange, - experimental : BeamConfig.Beam.Experimental, - inputDirectory : java.lang.String, - logger : BeamConfig.Beam.Logger, - metrics : BeamConfig.Beam.Metrics, - outputs : BeamConfig.Beam.Outputs, - physsim : BeamConfig.Beam.Physsim, - replanning : BeamConfig.Beam.Replanning, - routing : BeamConfig.Beam.Routing, - spatial : BeamConfig.Beam.Spatial, - useLocalWorker : scala.Boolean, - warmStart : BeamConfig.Beam.WarmStart + agentsim: BeamConfig.Beam.Agentsim, + beamskimmer: BeamConfig.Beam.Beamskimmer, + calibration: BeamConfig.Beam.Calibration, + cluster: BeamConfig.Beam.Cluster, + debug: BeamConfig.Beam.Debug, + exchange: BeamConfig.Beam.Exchange, + experimental: BeamConfig.Beam.Experimental, + inputDirectory: java.lang.String, + logger: BeamConfig.Beam.Logger, + metrics: BeamConfig.Beam.Metrics, + outputs: BeamConfig.Beam.Outputs, + physsim: BeamConfig.Beam.Physsim, + replanning: BeamConfig.Beam.Replanning, + routing: BeamConfig.Beam.Routing, + spatial: BeamConfig.Beam.Spatial, + useLocalWorker: scala.Boolean, + warmStart: BeamConfig.Beam.WarmStart ) + object Beam { case class Agentsim( - agentSampleSizeAsFractionOfPopulation : scala.Double, - agents : BeamConfig.Beam.Agentsim.Agents, - endTime : java.lang.String, - firstIteration : scala.Int, - lastIteration : scala.Int, - populationAdjustment : java.lang.String, - scenarios : BeamConfig.Beam.Agentsim.Scenarios, - scheduleMonitorTask : BeamConfig.Beam.Agentsim.ScheduleMonitorTask, - schedulerParallelismWindow : scala.Int, - simulationName : java.lang.String, - startTime : java.lang.String, - taz : BeamConfig.Beam.Agentsim.Taz, - thresholdForMakingParkingChoiceInMeters : scala.Int, - thresholdForWalkingInMeters : scala.Int, - timeBinSize : scala.Int, - toll : BeamConfig.Beam.Agentsim.Toll, - tuning : BeamConfig.Beam.Agentsim.Tuning + agentSampleSizeAsFractionOfPopulation: scala.Double, + agents: BeamConfig.Beam.Agentsim.Agents, + endTime: java.lang.String, + firstIteration: scala.Int, + lastIteration: scala.Int, + populationAdjustment: java.lang.String, + scenarios: BeamConfig.Beam.Agentsim.Scenarios, + scheduleMonitorTask: BeamConfig.Beam.Agentsim.ScheduleMonitorTask, + schedulerParallelismWindow: scala.Int, + simulationName: java.lang.String, + startTime: java.lang.String, + taz: BeamConfig.Beam.Agentsim.Taz, + thresholdForMakingParkingChoiceInMeters: scala.Int, + thresholdForWalkingInMeters: scala.Int, + timeBinSize: scala.Int, + toll: BeamConfig.Beam.Agentsim.Toll, + tuning: BeamConfig.Beam.Agentsim.Tuning ) + object Agentsim { case class Agents( - bodyType : java.lang.String, - households : BeamConfig.Beam.Agentsim.Agents.Households, - modalBehaviors : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors, - modeIncentive : BeamConfig.Beam.Agentsim.Agents.ModeIncentive, - parking : BeamConfig.Beam.Agentsim.Agents.Parking, - plans : BeamConfig.Beam.Agentsim.Agents.Plans, - population : BeamConfig.Beam.Agentsim.Agents.Population, - ptFare : BeamConfig.Beam.Agentsim.Agents.PtFare, - rideHail : BeamConfig.Beam.Agentsim.Agents.RideHail, - rideHailTransit : BeamConfig.Beam.Agentsim.Agents.RideHailTransit, - vehicles : BeamConfig.Beam.Agentsim.Agents.Vehicles + bodyType: java.lang.String, + households: BeamConfig.Beam.Agentsim.Agents.Households, + modalBehaviors: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors, + modeIncentive: BeamConfig.Beam.Agentsim.Agents.ModeIncentive, + parking: BeamConfig.Beam.Agentsim.Agents.Parking, + plans: BeamConfig.Beam.Agentsim.Agents.Plans, + population: BeamConfig.Beam.Agentsim.Agents.Population, + ptFare: BeamConfig.Beam.Agentsim.Agents.PtFare, + rideHail: BeamConfig.Beam.Agentsim.Agents.RideHail, + rideHailTransit: BeamConfig.Beam.Agentsim.Agents.RideHailTransit, + vehicles: BeamConfig.Beam.Agentsim.Agents.Vehicles ) + object Agents { case class Households( - inputFilePath : java.lang.String, - inputHouseholdAttributesFilePath : java.lang.String + inputFilePath: java.lang.String, + inputHouseholdAttributesFilePath: java.lang.String ) + object Households { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Households = { BeamConfig.Beam.Agentsim.Agents.Households( - inputFilePath = if(c.hasPathOrNull("inputFilePath")) c.getString("inputFilePath") else "/test/input/beamville/households.xml.gz", - inputHouseholdAttributesFilePath = if(c.hasPathOrNull("inputHouseholdAttributesFilePath")) c.getString("inputHouseholdAttributesFilePath") else "/test/input/beamville/householdAttributes.xml.gz" + inputFilePath = + if (c.hasPathOrNull("inputFilePath")) c.getString("inputFilePath") + else "/test/input/beamville/households.xml.gz", + inputHouseholdAttributesFilePath = + if (c.hasPathOrNull("inputHouseholdAttributesFilePath")) c.getString("inputHouseholdAttributesFilePath") + else "/test/input/beamville/householdAttributes.xml.gz" ) } } - + case class ModalBehaviors( - defaultValueOfTime : scala.Double, - highTimeSensitivity : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity, - lccm : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.Lccm, - lowTimeSensitivity : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity, - maximumNumberOfReplanningAttempts : scala.Int, - modeChoiceClass : java.lang.String, - modeVotMultiplier : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.ModeVotMultiplier, - mulitnomialLogit : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit, - overrideAutomationForVOTT : scala.Boolean, - overrideAutomationLevel : scala.Int, - poolingMultiplier : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.PoolingMultiplier + defaultValueOfTime: scala.Double, + highTimeSensitivity: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity, + lccm: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.Lccm, + lowTimeSensitivity: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity, + maximumNumberOfReplanningAttempts: scala.Int, + modeChoiceClass: java.lang.String, + modeVotMultiplier: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.ModeVotMultiplier, + mulitnomialLogit: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit, + overrideAutomationForVOTT: scala.Boolean, + overrideAutomationLevel: scala.Int, + poolingMultiplier: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.PoolingMultiplier ) + object ModalBehaviors { case class HighTimeSensitivity( - highCongestion : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion, - lowCongestion : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion + highCongestion: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion, + lowCongestion: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion ) + object HighTimeSensitivity { case class HighCongestion( - highwayFactor : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.HighwayFactor, - nonHighwayFactor : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.NonHighwayFactor + highwayFactor: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.HighwayFactor, + nonHighwayFactor: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.NonHighwayFactor ) + object HighCongestion { case class HighwayFactor( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object HighwayFactor { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.HighwayFactor = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.HighwayFactor = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.HighwayFactor( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - + case class NonHighwayFactor( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object NonHighwayFactor { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.NonHighwayFactor = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.NonHighwayFactor = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.NonHighwayFactor( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion( - highwayFactor = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.HighwayFactor(if(c.hasPathOrNull("highwayFactor")) c.getConfig("highwayFactor") else com.typesafe.config.ConfigFactory.parseString("highwayFactor{}")), - nonHighwayFactor = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.NonHighwayFactor(if(c.hasPathOrNull("nonHighwayFactor")) c.getConfig("nonHighwayFactor") else com.typesafe.config.ConfigFactory.parseString("nonHighwayFactor{}")) + highwayFactor = + BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.HighwayFactor( + if (c.hasPathOrNull("highwayFactor")) c.getConfig("highwayFactor") + else com.typesafe.config.ConfigFactory.parseString("highwayFactor{}") + ), + nonHighwayFactor = + BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion.NonHighwayFactor( + if (c.hasPathOrNull("nonHighwayFactor")) c.getConfig("nonHighwayFactor") + else com.typesafe.config.ConfigFactory.parseString("nonHighwayFactor{}") + ) ) } } - + case class LowCongestion( - highwayFactor : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.HighwayFactor, - nonHighwayFactor : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.NonHighwayFactor + highwayFactor: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.HighwayFactor, + nonHighwayFactor: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.NonHighwayFactor ) + object LowCongestion { case class HighwayFactor( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object HighwayFactor { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.HighwayFactor = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.HighwayFactor = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.HighwayFactor( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - + case class NonHighwayFactor( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object NonHighwayFactor { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.NonHighwayFactor = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.NonHighwayFactor = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.NonHighwayFactor( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion( - highwayFactor = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.HighwayFactor(if(c.hasPathOrNull("highwayFactor")) c.getConfig("highwayFactor") else com.typesafe.config.ConfigFactory.parseString("highwayFactor{}")), - nonHighwayFactor = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.NonHighwayFactor(if(c.hasPathOrNull("nonHighwayFactor")) c.getConfig("nonHighwayFactor") else com.typesafe.config.ConfigFactory.parseString("nonHighwayFactor{}")) + highwayFactor = + BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.HighwayFactor( + if (c.hasPathOrNull("highwayFactor")) c.getConfig("highwayFactor") + else com.typesafe.config.ConfigFactory.parseString("highwayFactor{}") + ), + nonHighwayFactor = + BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion.NonHighwayFactor( + if (c.hasPathOrNull("nonHighwayFactor")) c.getConfig("nonHighwayFactor") + else com.typesafe.config.ConfigFactory.parseString("nonHighwayFactor{}") + ) ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity( - highCongestion = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion(if(c.hasPathOrNull("highCongestion")) c.getConfig("highCongestion") else com.typesafe.config.ConfigFactory.parseString("highCongestion{}")), - lowCongestion = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion(if(c.hasPathOrNull("lowCongestion")) c.getConfig("lowCongestion") else com.typesafe.config.ConfigFactory.parseString("lowCongestion{}")) + highCongestion = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.HighCongestion( + if (c.hasPathOrNull("highCongestion")) c.getConfig("highCongestion") + else com.typesafe.config.ConfigFactory.parseString("highCongestion{}") + ), + lowCongestion = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity.LowCongestion( + if (c.hasPathOrNull("lowCongestion")) c.getConfig("lowCongestion") + else com.typesafe.config.ConfigFactory.parseString("lowCongestion{}") + ) ) } } - + case class Lccm( - filePath : java.lang.String + filePath: java.lang.String ) + object Lccm { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.Lccm = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.Lccm( - filePath = if(c.hasPathOrNull("filePath")) c.getString("filePath") else "/test/input/beamville/lccm-long.csv" + filePath = + if (c.hasPathOrNull("filePath")) c.getString("filePath") else "/test/input/beamville/lccm-long.csv" ) } } - + case class LowTimeSensitivity( - highCongestion : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion, - lowCongestion : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion + highCongestion: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion, + lowCongestion: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion ) + object LowTimeSensitivity { case class HighCongestion( - highwayFactor : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.HighwayFactor, - nonHighwayFactor : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.NonHighwayFactor + highwayFactor: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.HighwayFactor, + nonHighwayFactor: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.NonHighwayFactor ) + object HighCongestion { case class HighwayFactor( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object HighwayFactor { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.HighwayFactor = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.HighwayFactor = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.HighwayFactor( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - + case class NonHighwayFactor( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object NonHighwayFactor { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.NonHighwayFactor = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.NonHighwayFactor = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.NonHighwayFactor( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion( - highwayFactor = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.HighwayFactor(if(c.hasPathOrNull("highwayFactor")) c.getConfig("highwayFactor") else com.typesafe.config.ConfigFactory.parseString("highwayFactor{}")), - nonHighwayFactor = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.NonHighwayFactor(if(c.hasPathOrNull("nonHighwayFactor")) c.getConfig("nonHighwayFactor") else com.typesafe.config.ConfigFactory.parseString("nonHighwayFactor{}")) + highwayFactor = + BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.HighwayFactor( + if (c.hasPathOrNull("highwayFactor")) c.getConfig("highwayFactor") + else com.typesafe.config.ConfigFactory.parseString("highwayFactor{}") + ), + nonHighwayFactor = + BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion.NonHighwayFactor( + if (c.hasPathOrNull("nonHighwayFactor")) c.getConfig("nonHighwayFactor") + else com.typesafe.config.ConfigFactory.parseString("nonHighwayFactor{}") + ) ) } } - + case class LowCongestion( - highwayFactor : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.HighwayFactor, - nonHighwayFactor : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.NonHighwayFactor + highwayFactor: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.HighwayFactor, + nonHighwayFactor: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.NonHighwayFactor ) + object LowCongestion { case class HighwayFactor( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object HighwayFactor { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.HighwayFactor = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.HighwayFactor = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.HighwayFactor( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - + case class NonHighwayFactor( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object NonHighwayFactor { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.NonHighwayFactor = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.NonHighwayFactor = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.NonHighwayFactor( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion( - highwayFactor = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.HighwayFactor(if(c.hasPathOrNull("highwayFactor")) c.getConfig("highwayFactor") else com.typesafe.config.ConfigFactory.parseString("highwayFactor{}")), - nonHighwayFactor = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.NonHighwayFactor(if(c.hasPathOrNull("nonHighwayFactor")) c.getConfig("nonHighwayFactor") else com.typesafe.config.ConfigFactory.parseString("nonHighwayFactor{}")) + highwayFactor = + BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.HighwayFactor( + if (c.hasPathOrNull("highwayFactor")) c.getConfig("highwayFactor") + else com.typesafe.config.ConfigFactory.parseString("highwayFactor{}") + ), + nonHighwayFactor = + BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion.NonHighwayFactor( + if (c.hasPathOrNull("nonHighwayFactor")) c.getConfig("nonHighwayFactor") + else com.typesafe.config.ConfigFactory.parseString("nonHighwayFactor{}") + ) ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity( - highCongestion = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion(if(c.hasPathOrNull("highCongestion")) c.getConfig("highCongestion") else com.typesafe.config.ConfigFactory.parseString("highCongestion{}")), - lowCongestion = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion(if(c.hasPathOrNull("lowCongestion")) c.getConfig("lowCongestion") else com.typesafe.config.ConfigFactory.parseString("lowCongestion{}")) + highCongestion = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.HighCongestion( + if (c.hasPathOrNull("highCongestion")) c.getConfig("highCongestion") + else com.typesafe.config.ConfigFactory.parseString("highCongestion{}") + ), + lowCongestion = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity.LowCongestion( + if (c.hasPathOrNull("lowCongestion")) c.getConfig("lowCongestion") + else com.typesafe.config.ConfigFactory.parseString("lowCongestion{}") + ) ) } } - + case class ModeVotMultiplier( - CAV : scala.Double, - bike : scala.Double, - drive : scala.Double, - rideHail : scala.Double, - rideHailPooled : scala.Double, - rideHailTransit : scala.Double, - transit : scala.Double, - waiting : scala.Double, - walk : scala.Double + CAV: scala.Double, + bike: scala.Double, + drive: scala.Double, + rideHail: scala.Double, + rideHailPooled: scala.Double, + rideHailTransit: scala.Double, + transit: scala.Double, + waiting: scala.Double, + walk: scala.Double ) + object ModeVotMultiplier { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.ModeVotMultiplier = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.ModeVotMultiplier = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.ModeVotMultiplier( - CAV = if(c.hasPathOrNull("CAV")) c.getDouble("CAV") else 1.0, - bike = if(c.hasPathOrNull("bike")) c.getDouble("bike") else 1.0, - drive = if(c.hasPathOrNull("drive")) c.getDouble("drive") else 1.0, - rideHail = if(c.hasPathOrNull("rideHail")) c.getDouble("rideHail") else 1.0, - rideHailPooled = if(c.hasPathOrNull("rideHailPooled")) c.getDouble("rideHailPooled") else 1.0, - rideHailTransit = if(c.hasPathOrNull("rideHailTransit")) c.getDouble("rideHailTransit") else 1.0, - transit = if(c.hasPathOrNull("transit")) c.getDouble("transit") else 1.0, - waiting = if(c.hasPathOrNull("waiting")) c.getDouble("waiting") else 1.0, - walk = if(c.hasPathOrNull("walk")) c.getDouble("walk") else 1.0 + CAV = if (c.hasPathOrNull("CAV")) c.getDouble("CAV") else 1.0, + bike = if (c.hasPathOrNull("bike")) c.getDouble("bike") else 1.0, + drive = if (c.hasPathOrNull("drive")) c.getDouble("drive") else 1.0, + rideHail = if (c.hasPathOrNull("rideHail")) c.getDouble("rideHail") else 1.0, + rideHailPooled = if (c.hasPathOrNull("rideHailPooled")) c.getDouble("rideHailPooled") else 1.0, + rideHailTransit = if (c.hasPathOrNull("rideHailTransit")) c.getDouble("rideHailTransit") else 1.0, + transit = if (c.hasPathOrNull("transit")) c.getDouble("transit") else 1.0, + waiting = if (c.hasPathOrNull("waiting")) c.getDouble("waiting") else 1.0, + walk = if (c.hasPathOrNull("walk")) c.getDouble("walk") else 1.0 ) } } - + case class MulitnomialLogit( - params : BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit.Params + params: BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit.Params ) + object MulitnomialLogit { case class Params( - bike_intercept : scala.Double, - car_intercept : scala.Double, - cav_intercept : scala.Double, - drive_transit_intercept : scala.Double, - ride_hail_intercept : scala.Double, - ride_hail_pooled_intercept : scala.Double, - ride_hail_transit_intercept : scala.Double, - transfer : scala.Double, - walk_intercept : scala.Double, - walk_transit_intercept : scala.Double + bike_intercept: scala.Double, + car_intercept: scala.Double, + cav_intercept: scala.Double, + drive_transit_intercept: scala.Double, + ride_hail_intercept: scala.Double, + ride_hail_pooled_intercept: scala.Double, + ride_hail_transit_intercept: scala.Double, + transfer: scala.Double, + walk_intercept: scala.Double, + walk_transit_intercept: scala.Double ) + object Params { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit.Params = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit.Params = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit.Params( - bike_intercept = if(c.hasPathOrNull("bike_intercept")) c.getDouble("bike_intercept") else 0.0, - car_intercept = if(c.hasPathOrNull("car_intercept")) c.getDouble("car_intercept") else 0.0, - cav_intercept = if(c.hasPathOrNull("cav_intercept")) c.getDouble("cav_intercept") else 0.0, - drive_transit_intercept = if(c.hasPathOrNull("drive_transit_intercept")) c.getDouble("drive_transit_intercept") else 0.0, - ride_hail_intercept = if(c.hasPathOrNull("ride_hail_intercept")) c.getDouble("ride_hail_intercept") else 0.0, - ride_hail_pooled_intercept = if(c.hasPathOrNull("ride_hail_pooled_intercept")) c.getDouble("ride_hail_pooled_intercept") else 0.0, - ride_hail_transit_intercept = if(c.hasPathOrNull("ride_hail_transit_intercept")) c.getDouble("ride_hail_transit_intercept") else 0.0, - transfer = if(c.hasPathOrNull("transfer")) c.getDouble("transfer") else -1.4, - walk_intercept = if(c.hasPathOrNull("walk_intercept")) c.getDouble("walk_intercept") else 0.0, - walk_transit_intercept = if(c.hasPathOrNull("walk_transit_intercept")) c.getDouble("walk_transit_intercept") else 0.0 + bike_intercept = if (c.hasPathOrNull("bike_intercept")) c.getDouble("bike_intercept") else 0.0, + car_intercept = if (c.hasPathOrNull("car_intercept")) c.getDouble("car_intercept") else 0.0, + cav_intercept = if (c.hasPathOrNull("cav_intercept")) c.getDouble("cav_intercept") else 0.0, + drive_transit_intercept = + if (c.hasPathOrNull("drive_transit_intercept")) c.getDouble("drive_transit_intercept") else 0.0, + ride_hail_intercept = + if (c.hasPathOrNull("ride_hail_intercept")) c.getDouble("ride_hail_intercept") else 0.0, + ride_hail_pooled_intercept = + if (c.hasPathOrNull("ride_hail_pooled_intercept")) c.getDouble("ride_hail_pooled_intercept") + else 0.0, + ride_hail_transit_intercept = + if (c.hasPathOrNull("ride_hail_transit_intercept")) c.getDouble("ride_hail_transit_intercept") + else 0.0, + transfer = if (c.hasPathOrNull("transfer")) c.getDouble("transfer") else -1.4, + walk_intercept = if (c.hasPathOrNull("walk_intercept")) c.getDouble("walk_intercept") else 0.0, + walk_transit_intercept = + if (c.hasPathOrNull("walk_transit_intercept")) c.getDouble("walk_transit_intercept") else 0.0 ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit( - params = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit.Params(if(c.hasPathOrNull("params")) c.getConfig("params") else com.typesafe.config.ConfigFactory.parseString("params{}")) + params = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit.Params( + if (c.hasPathOrNull("params")) c.getConfig("params") + else com.typesafe.config.ConfigFactory.parseString("params{}") + ) ) } } - + case class PoolingMultiplier( - Level3 : scala.Double, - Level4 : scala.Double, - Level5 : scala.Double, - LevelLE2 : scala.Double + Level3: scala.Double, + Level4: scala.Double, + Level5: scala.Double, + LevelLE2: scala.Double ) + object PoolingMultiplier { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.PoolingMultiplier = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.PoolingMultiplier = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.PoolingMultiplier( - Level3 = if(c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, - Level4 = if(c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, - Level5 = if(c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, - LevelLE2 = if(c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 + Level3 = if (c.hasPathOrNull("Level3")) c.getDouble("Level3") else 1.0, + Level4 = if (c.hasPathOrNull("Level4")) c.getDouble("Level4") else 1.0, + Level5 = if (c.hasPathOrNull("Level5")) c.getDouble("Level5") else 1.0, + LevelLE2 = if (c.hasPathOrNull("LevelLE2")) c.getDouble("LevelLE2") else 1.0 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModalBehaviors = { BeamConfig.Beam.Agentsim.Agents.ModalBehaviors( - defaultValueOfTime = if(c.hasPathOrNull("defaultValueOfTime")) c.getDouble("defaultValueOfTime") else 8.0, - highTimeSensitivity = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity(if(c.hasPathOrNull("highTimeSensitivity")) c.getConfig("highTimeSensitivity") else com.typesafe.config.ConfigFactory.parseString("highTimeSensitivity{}")), - lccm = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.Lccm(if(c.hasPathOrNull("lccm")) c.getConfig("lccm") else com.typesafe.config.ConfigFactory.parseString("lccm{}")), - lowTimeSensitivity = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity(if(c.hasPathOrNull("lowTimeSensitivity")) c.getConfig("lowTimeSensitivity") else com.typesafe.config.ConfigFactory.parseString("lowTimeSensitivity{}")), - maximumNumberOfReplanningAttempts = if(c.hasPathOrNull("maximumNumberOfReplanningAttempts")) c.getInt("maximumNumberOfReplanningAttempts") else 3, - modeChoiceClass = if(c.hasPathOrNull("modeChoiceClass")) c.getString("modeChoiceClass") else "ModeChoiceMultinomialLogit", - modeVotMultiplier = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.ModeVotMultiplier(if(c.hasPathOrNull("modeVotMultiplier")) c.getConfig("modeVotMultiplier") else com.typesafe.config.ConfigFactory.parseString("modeVotMultiplier{}")), - mulitnomialLogit = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit(if(c.hasPathOrNull("mulitnomialLogit")) c.getConfig("mulitnomialLogit") else com.typesafe.config.ConfigFactory.parseString("mulitnomialLogit{}")), - overrideAutomationForVOTT = c.hasPathOrNull("overrideAutomationForVOTT") && c.getBoolean("overrideAutomationForVOTT"), - overrideAutomationLevel = if(c.hasPathOrNull("overrideAutomationLevel")) c.getInt("overrideAutomationLevel") else 1, - poolingMultiplier = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.PoolingMultiplier(if(c.hasPathOrNull("poolingMultiplier")) c.getConfig("poolingMultiplier") else com.typesafe.config.ConfigFactory.parseString("poolingMultiplier{}")) + defaultValueOfTime = + if (c.hasPathOrNull("defaultValueOfTime")) c.getDouble("defaultValueOfTime") else 8.0, + highTimeSensitivity = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.HighTimeSensitivity( + if (c.hasPathOrNull("highTimeSensitivity")) c.getConfig("highTimeSensitivity") + else com.typesafe.config.ConfigFactory.parseString("highTimeSensitivity{}") + ), + lccm = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.Lccm( + if (c.hasPathOrNull("lccm")) c.getConfig("lccm") + else com.typesafe.config.ConfigFactory.parseString("lccm{}") + ), + lowTimeSensitivity = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.LowTimeSensitivity( + if (c.hasPathOrNull("lowTimeSensitivity")) c.getConfig("lowTimeSensitivity") + else com.typesafe.config.ConfigFactory.parseString("lowTimeSensitivity{}") + ), + maximumNumberOfReplanningAttempts = + if (c.hasPathOrNull("maximumNumberOfReplanningAttempts")) c.getInt("maximumNumberOfReplanningAttempts") + else 3, + modeChoiceClass = + if (c.hasPathOrNull("modeChoiceClass")) c.getString("modeChoiceClass") + else "ModeChoiceMultinomialLogit", + modeVotMultiplier = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.ModeVotMultiplier( + if (c.hasPathOrNull("modeVotMultiplier")) c.getConfig("modeVotMultiplier") + else com.typesafe.config.ConfigFactory.parseString("modeVotMultiplier{}") + ), + mulitnomialLogit = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.MulitnomialLogit( + if (c.hasPathOrNull("mulitnomialLogit")) c.getConfig("mulitnomialLogit") + else com.typesafe.config.ConfigFactory.parseString("mulitnomialLogit{}") + ), + overrideAutomationForVOTT = c.hasPathOrNull("overrideAutomationForVOTT") && c.getBoolean( + "overrideAutomationForVOTT" + ), + overrideAutomationLevel = + if (c.hasPathOrNull("overrideAutomationLevel")) c.getInt("overrideAutomationLevel") else 1, + poolingMultiplier = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors.PoolingMultiplier( + if (c.hasPathOrNull("poolingMultiplier")) c.getConfig("poolingMultiplier") + else com.typesafe.config.ConfigFactory.parseString("poolingMultiplier{}") + ) ) } } - + case class ModeIncentive( - filePath : java.lang.String + filePath: java.lang.String ) + object ModeIncentive { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.ModeIncentive = { BeamConfig.Beam.Agentsim.Agents.ModeIncentive( - filePath = if(c.hasPathOrNull("filePath")) c.getString("filePath") else "" + filePath = if (c.hasPathOrNull("filePath")) c.getString("filePath") else "" ) } } - + case class Parking( - maxSearchRadius : scala.Double, - minSearchRadius : scala.Double, - mulitnomialLogit : BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit, - rangeAnxietyBuffer : scala.Double + maxSearchRadius: scala.Double, + minSearchRadius: scala.Double, + mulitnomialLogit: BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit, + rangeAnxietyBuffer: scala.Double ) + object Parking { case class MulitnomialLogit( - params : BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit.Params + params: BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit.Params ) + object MulitnomialLogit { case class Params( - distanceMultiplier : scala.Double, - homeActivityPrefersResidentialParkingMultiplier : scala.Double, - parkingPriceMultiplier : scala.Double, - rangeAnxietyMultiplier : scala.Double + distanceMultiplier: scala.Double, + homeActivityPrefersResidentialParkingMultiplier: scala.Double, + parkingPriceMultiplier: scala.Double, + rangeAnxietyMultiplier: scala.Double ) + object Params { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit.Params = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit.Params = { BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit.Params( - distanceMultiplier = if(c.hasPathOrNull("distanceMultiplier")) c.getDouble("distanceMultiplier") else -0.086, - homeActivityPrefersResidentialParkingMultiplier = if(c.hasPathOrNull("homeActivityPrefersResidentialParkingMultiplier")) c.getDouble("homeActivityPrefersResidentialParkingMultiplier") else 1.0, - parkingPriceMultiplier = if(c.hasPathOrNull("parkingPriceMultiplier")) c.getDouble("parkingPriceMultiplier") else -0.005, - rangeAnxietyMultiplier = if(c.hasPathOrNull("rangeAnxietyMultiplier")) c.getDouble("rangeAnxietyMultiplier") else -0.5 + distanceMultiplier = + if (c.hasPathOrNull("distanceMultiplier")) c.getDouble("distanceMultiplier") else -0.086, + homeActivityPrefersResidentialParkingMultiplier = + if (c.hasPathOrNull("homeActivityPrefersResidentialParkingMultiplier")) + c.getDouble("homeActivityPrefersResidentialParkingMultiplier") + else 1.0, + parkingPriceMultiplier = + if (c.hasPathOrNull("parkingPriceMultiplier")) c.getDouble("parkingPriceMultiplier") else -0.005, + rangeAnxietyMultiplier = + if (c.hasPathOrNull("rangeAnxietyMultiplier")) c.getDouble("rangeAnxietyMultiplier") else -0.5 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit = { BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit( - params = BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit.Params(if(c.hasPathOrNull("params")) c.getConfig("params") else com.typesafe.config.ConfigFactory.parseString("params{}")) + params = BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit.Params( + if (c.hasPathOrNull("params")) c.getConfig("params") + else com.typesafe.config.ConfigFactory.parseString("params{}") + ) ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Parking = { BeamConfig.Beam.Agentsim.Agents.Parking( - maxSearchRadius = if(c.hasPathOrNull("maxSearchRadius")) c.getDouble("maxSearchRadius") else 8046.72, - minSearchRadius = if(c.hasPathOrNull("minSearchRadius")) c.getDouble("minSearchRadius") else 250.00, - mulitnomialLogit = BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit(if(c.hasPathOrNull("mulitnomialLogit")) c.getConfig("mulitnomialLogit") else com.typesafe.config.ConfigFactory.parseString("mulitnomialLogit{}")), - rangeAnxietyBuffer = if(c.hasPathOrNull("rangeAnxietyBuffer")) c.getDouble("rangeAnxietyBuffer") else 20000.0 + maxSearchRadius = if (c.hasPathOrNull("maxSearchRadius")) c.getDouble("maxSearchRadius") else 8046.72, + minSearchRadius = if (c.hasPathOrNull("minSearchRadius")) c.getDouble("minSearchRadius") else 250.00, + mulitnomialLogit = BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit( + if (c.hasPathOrNull("mulitnomialLogit")) c.getConfig("mulitnomialLogit") + else com.typesafe.config.ConfigFactory.parseString("mulitnomialLogit{}") + ), + rangeAnxietyBuffer = + if (c.hasPathOrNull("rangeAnxietyBuffer")) c.getDouble("rangeAnxietyBuffer") else 20000.0 ) } } - + case class Plans( - inputPersonAttributesFilePath : java.lang.String, - inputPlansFilePath : java.lang.String + inputPersonAttributesFilePath: java.lang.String, + inputPlansFilePath: java.lang.String ) + object Plans { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Plans = { BeamConfig.Beam.Agentsim.Agents.Plans( - inputPersonAttributesFilePath = if(c.hasPathOrNull("inputPersonAttributesFilePath")) c.getString("inputPersonAttributesFilePath") else "/test/input/beamville/populationAttributes.xml.gz", - inputPlansFilePath = if(c.hasPathOrNull("inputPlansFilePath")) c.getString("inputPlansFilePath") else "/test/input/beamville/population.xml.gz" + inputPersonAttributesFilePath = + if (c.hasPathOrNull("inputPersonAttributesFilePath")) c.getString("inputPersonAttributesFilePath") + else "/test/input/beamville/populationAttributes.xml.gz", + inputPlansFilePath = + if (c.hasPathOrNull("inputPlansFilePath")) c.getString("inputPlansFilePath") + else "/test/input/beamville/population.xml.gz" ) } } - + case class Population( - useVehicleSampling : scala.Boolean + useVehicleSampling: scala.Boolean ) + object Population { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Population = { BeamConfig.Beam.Agentsim.Agents.Population( useVehicleSampling = c.hasPathOrNull("useVehicleSampling") && c.getBoolean("useVehicleSampling") ) } } - + case class PtFare( - filePath : java.lang.String + filePath: java.lang.String ) + object PtFare { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.PtFare = { BeamConfig.Beam.Agentsim.Agents.PtFare( - filePath = if(c.hasPathOrNull("filePath")) c.getString("filePath") else "" + filePath = if (c.hasPathOrNull("filePath")) c.getString("filePath") else "" ) } } - + case class RideHail( - allocationManager : BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager, - cav : BeamConfig.Beam.Agentsim.Agents.RideHail.Cav, - defaultBaseCost : scala.Double, - defaultCostPerMile : scala.Double, - defaultCostPerMinute : scala.Double, - human : BeamConfig.Beam.Agentsim.Agents.RideHail.Human, - initialization : BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization, - iterationStats : BeamConfig.Beam.Agentsim.Agents.RideHail.IterationStats, - pooledBaseCost : scala.Double, - pooledCostPerMile : scala.Double, - pooledCostPerMinute : scala.Double, - pooledToRegularRideCostRatio : scala.Double, - rangeBufferForDispatchInMeters : scala.Int, - refuelLocationType : java.lang.String, - refuelThresholdInMeters : scala.Double, - repositioningManager : BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager, - rideHailManager : BeamConfig.Beam.Agentsim.Agents.RideHail.RideHailManager, - surgePricing : BeamConfig.Beam.Agentsim.Agents.RideHail.SurgePricing + allocationManager: BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager, + cav: BeamConfig.Beam.Agentsim.Agents.RideHail.Cav, + defaultBaseCost: scala.Double, + defaultCostPerMile: scala.Double, + defaultCostPerMinute: scala.Double, + human: BeamConfig.Beam.Agentsim.Agents.RideHail.Human, + initialization: BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization, + iterationStats: BeamConfig.Beam.Agentsim.Agents.RideHail.IterationStats, + pooledBaseCost: scala.Double, + pooledCostPerMile: scala.Double, + pooledCostPerMinute: scala.Double, + pooledToRegularRideCostRatio: scala.Double, + rangeBufferForDispatchInMeters: scala.Int, + refuelLocationType: java.lang.String, + refuelThresholdInMeters: scala.Double, + repositioningManager: BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager, + rideHailManager: BeamConfig.Beam.Agentsim.Agents.RideHail.RideHailManager, + surgePricing: BeamConfig.Beam.Agentsim.Agents.RideHail.SurgePricing ) + object RideHail { case class AllocationManager( - alonsoMora : BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.AlonsoMora, - name : java.lang.String, - repositionLowWaitingTimes : BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.RepositionLowWaitingTimes, - requestBufferTimeoutInSeconds : scala.Int + alonsoMora: BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.AlonsoMora, + name: java.lang.String, + repositionLowWaitingTimes: BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.RepositionLowWaitingTimes, + requestBufferTimeoutInSeconds: scala.Int ) + object AllocationManager { case class AlonsoMora( - solutionSpaceSizePerVehicle : scala.Int, - travelTimeDelayAsFraction : scala.Double, - waitingTimeInSec : scala.Int + solutionSpaceSizePerVehicle: scala.Int, + travelTimeDelayAsFraction: scala.Double, + waitingTimeInSec: scala.Int ) + object AlonsoMora { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.AlonsoMora = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.AlonsoMora = { BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.AlonsoMora( - solutionSpaceSizePerVehicle = if(c.hasPathOrNull("solutionSpaceSizePerVehicle")) c.getInt("solutionSpaceSizePerVehicle") else 5, - travelTimeDelayAsFraction = if(c.hasPathOrNull("travelTimeDelayAsFraction")) c.getDouble("travelTimeDelayAsFraction") else 0.2, - waitingTimeInSec = if(c.hasPathOrNull("waitingTimeInSec")) c.getInt("waitingTimeInSec") else 360 + solutionSpaceSizePerVehicle = + if (c.hasPathOrNull("solutionSpaceSizePerVehicle")) c.getInt("solutionSpaceSizePerVehicle") else 5, + travelTimeDelayAsFraction = + if (c.hasPathOrNull("travelTimeDelayAsFraction")) c.getDouble("travelTimeDelayAsFraction") else 0.2, + waitingTimeInSec = if (c.hasPathOrNull("waitingTimeInSec")) c.getInt("waitingTimeInSec") else 360 ) } } - + case class RepositionLowWaitingTimes( - allowIncreasingRadiusIfDemandInRadiusLow : scala.Boolean, - demandWeight : scala.Double, - distanceWeight : scala.Double, - keepMaxTopNScores : scala.Int, - minDemandPercentageInRadius : scala.Double, - minScoreThresholdForRepositioning : scala.Double, - minimumNumberOfIdlingVehiclesThresholdForRepositioning : scala.Int, - percentageOfVehiclesToReposition : scala.Double, - produceDebugImages : scala.Boolean, - repositionCircleRadiusInMeters : scala.Double, - repositioningMethod : java.lang.String, - timeWindowSizeInSecForDecidingAboutRepositioning : scala.Double, - waitingTimeWeight : scala.Double + allowIncreasingRadiusIfDemandInRadiusLow: scala.Boolean, + demandWeight: scala.Double, + distanceWeight: scala.Double, + keepMaxTopNScores: scala.Int, + minDemandPercentageInRadius: scala.Double, + minScoreThresholdForRepositioning: scala.Double, + minimumNumberOfIdlingVehiclesThresholdForRepositioning: scala.Int, + percentageOfVehiclesToReposition: scala.Double, + produceDebugImages: scala.Boolean, + repositionCircleRadiusInMeters: scala.Double, + repositioningMethod: java.lang.String, + timeWindowSizeInSecForDecidingAboutRepositioning: scala.Double, + waitingTimeWeight: scala.Double ) + object RepositionLowWaitingTimes { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.RepositionLowWaitingTimes = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.RepositionLowWaitingTimes = { BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.RepositionLowWaitingTimes( - allowIncreasingRadiusIfDemandInRadiusLow = !c.hasPathOrNull("allowIncreasingRadiusIfDemandInRadiusLow") || c.getBoolean("allowIncreasingRadiusIfDemandInRadiusLow"), - demandWeight = if(c.hasPathOrNull("demandWeight")) c.getDouble("demandWeight") else 4.0, - distanceWeight = if(c.hasPathOrNull("distanceWeight")) c.getDouble("distanceWeight") else 0.01, - keepMaxTopNScores = if(c.hasPathOrNull("keepMaxTopNScores")) c.getInt("keepMaxTopNScores") else 1, - minDemandPercentageInRadius = if(c.hasPathOrNull("minDemandPercentageInRadius")) c.getDouble("minDemandPercentageInRadius") else 0.1, - minScoreThresholdForRepositioning = if(c.hasPathOrNull("minScoreThresholdForRepositioning")) c.getDouble("minScoreThresholdForRepositioning") else 0.1, - minimumNumberOfIdlingVehiclesThresholdForRepositioning = if(c.hasPathOrNull("minimumNumberOfIdlingVehiclesThresholdForRepositioning")) c.getInt("minimumNumberOfIdlingVehiclesThresholdForRepositioning") else 1, - percentageOfVehiclesToReposition = if(c.hasPathOrNull("percentageOfVehiclesToReposition")) c.getDouble("percentageOfVehiclesToReposition") else 0.01, - produceDebugImages = !c.hasPathOrNull("produceDebugImages") || c.getBoolean("produceDebugImages"), - repositionCircleRadiusInMeters = if(c.hasPathOrNull("repositionCircleRadiusInMeters")) c.getDouble("repositionCircleRadiusInMeters") else 3000, - repositioningMethod = if(c.hasPathOrNull("repositioningMethod")) c.getString("repositioningMethod") else "TOP_SCORES", - timeWindowSizeInSecForDecidingAboutRepositioning = if(c.hasPathOrNull("timeWindowSizeInSecForDecidingAboutRepositioning")) c.getDouble("timeWindowSizeInSecForDecidingAboutRepositioning") else 1200, - waitingTimeWeight = if(c.hasPathOrNull("waitingTimeWeight")) c.getDouble("waitingTimeWeight") else 4.0 + allowIncreasingRadiusIfDemandInRadiusLow = !c.hasPathOrNull( + "allowIncreasingRadiusIfDemandInRadiusLow" + ) || c.getBoolean("allowIncreasingRadiusIfDemandInRadiusLow"), + demandWeight = if (c.hasPathOrNull("demandWeight")) c.getDouble("demandWeight") else 4.0, + distanceWeight = if (c.hasPathOrNull("distanceWeight")) c.getDouble("distanceWeight") else 0.01, + keepMaxTopNScores = if (c.hasPathOrNull("keepMaxTopNScores")) c.getInt("keepMaxTopNScores") else 1, + minDemandPercentageInRadius = + if (c.hasPathOrNull("minDemandPercentageInRadius")) c.getDouble("minDemandPercentageInRadius") + else 0.1, + minScoreThresholdForRepositioning = + if (c.hasPathOrNull("minScoreThresholdForRepositioning")) + c.getDouble("minScoreThresholdForRepositioning") + else 0.1, + minimumNumberOfIdlingVehiclesThresholdForRepositioning = + if (c.hasPathOrNull("minimumNumberOfIdlingVehiclesThresholdForRepositioning")) + c.getInt("minimumNumberOfIdlingVehiclesThresholdForRepositioning") + else 1, + percentageOfVehiclesToReposition = + if (c.hasPathOrNull("percentageOfVehiclesToReposition")) + c.getDouble("percentageOfVehiclesToReposition") + else 0.01, + produceDebugImages = !c.hasPathOrNull("produceDebugImages") || c.getBoolean("produceDebugImages"), + repositionCircleRadiusInMeters = + if (c.hasPathOrNull("repositionCircleRadiusInMeters")) c.getDouble("repositionCircleRadiusInMeters") + else 3000, + repositioningMethod = + if (c.hasPathOrNull("repositioningMethod")) c.getString("repositioningMethod") else "TOP_SCORES", + timeWindowSizeInSecForDecidingAboutRepositioning = + if (c.hasPathOrNull("timeWindowSizeInSecForDecidingAboutRepositioning")) + c.getDouble("timeWindowSizeInSecForDecidingAboutRepositioning") + else 1200, + waitingTimeWeight = + if (c.hasPathOrNull("waitingTimeWeight")) c.getDouble("waitingTimeWeight") else 4.0 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager = { BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager( - alonsoMora = BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.AlonsoMora(if(c.hasPathOrNull("alonsoMora")) c.getConfig("alonsoMora") else com.typesafe.config.ConfigFactory.parseString("alonsoMora{}")), - name = if(c.hasPathOrNull("name")) c.getString("name") else "DEFAULT_MANAGER", - repositionLowWaitingTimes = BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.RepositionLowWaitingTimes(if(c.hasPathOrNull("repositionLowWaitingTimes")) c.getConfig("repositionLowWaitingTimes") else com.typesafe.config.ConfigFactory.parseString("repositionLowWaitingTimes{}")), - requestBufferTimeoutInSeconds = if(c.hasPathOrNull("requestBufferTimeoutInSeconds")) c.getInt("requestBufferTimeoutInSeconds") else 0 + alonsoMora = BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.AlonsoMora( + if (c.hasPathOrNull("alonsoMora")) c.getConfig("alonsoMora") + else com.typesafe.config.ConfigFactory.parseString("alonsoMora{}") + ), + name = if (c.hasPathOrNull("name")) c.getString("name") else "DEFAULT_MANAGER", + repositionLowWaitingTimes = + BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager.RepositionLowWaitingTimes( + if (c.hasPathOrNull("repositionLowWaitingTimes")) c.getConfig("repositionLowWaitingTimes") + else com.typesafe.config.ConfigFactory.parseString("repositionLowWaitingTimes{}") + ), + requestBufferTimeoutInSeconds = + if (c.hasPathOrNull("requestBufferTimeoutInSeconds")) c.getInt("requestBufferTimeoutInSeconds") else 0 ) } } - + case class Cav( - noRefuelThresholdInMeters : scala.Int, - refuelRequiredThresholdInMeters : scala.Int, - valueOfTime : scala.Int + noRefuelThresholdInMeters: scala.Int, + refuelRequiredThresholdInMeters: scala.Int, + valueOfTime: scala.Int ) + object Cav { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.Cav = { BeamConfig.Beam.Agentsim.Agents.RideHail.Cav( - noRefuelThresholdInMeters = if(c.hasPathOrNull("noRefuelThresholdInMeters")) c.getInt("noRefuelThresholdInMeters") else 96540, - refuelRequiredThresholdInMeters = if(c.hasPathOrNull("refuelRequiredThresholdInMeters")) c.getInt("refuelRequiredThresholdInMeters") else 16090, - valueOfTime = if(c.hasPathOrNull("valueOfTime")) c.getInt("valueOfTime") else 1 + noRefuelThresholdInMeters = + if (c.hasPathOrNull("noRefuelThresholdInMeters")) c.getInt("noRefuelThresholdInMeters") else 96540, + refuelRequiredThresholdInMeters = + if (c.hasPathOrNull("refuelRequiredThresholdInMeters")) c.getInt("refuelRequiredThresholdInMeters") + else 16090, + valueOfTime = if (c.hasPathOrNull("valueOfTime")) c.getInt("valueOfTime") else 1 ) } } - + case class Human( - noRefuelThresholdInMeters : scala.Int, - refuelRequiredThresholdInMeters : scala.Int, - valueOfTime : scala.Double + noRefuelThresholdInMeters: scala.Int, + refuelRequiredThresholdInMeters: scala.Int, + valueOfTime: scala.Double ) + object Human { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.Human = { BeamConfig.Beam.Agentsim.Agents.RideHail.Human( - noRefuelThresholdInMeters = if(c.hasPathOrNull("noRefuelThresholdInMeters")) c.getInt("noRefuelThresholdInMeters") else 128720, - refuelRequiredThresholdInMeters = if(c.hasPathOrNull("refuelRequiredThresholdInMeters")) c.getInt("refuelRequiredThresholdInMeters") else 32180, - valueOfTime = if(c.hasPathOrNull("valueOfTime")) c.getDouble("valueOfTime") else 22.9 + noRefuelThresholdInMeters = + if (c.hasPathOrNull("noRefuelThresholdInMeters")) c.getInt("noRefuelThresholdInMeters") else 128720, + refuelRequiredThresholdInMeters = + if (c.hasPathOrNull("refuelRequiredThresholdInMeters")) c.getInt("refuelRequiredThresholdInMeters") + else 32180, + valueOfTime = if (c.hasPathOrNull("valueOfTime")) c.getDouble("valueOfTime") else 22.9 ) } } - + case class Initialization( - filePath : java.lang.String, - initType : java.lang.String, - parking : BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Parking, - procedural : BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural + filePath: java.lang.String, + initType: java.lang.String, + parking: BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Parking, + procedural: BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural ) + object Initialization { case class Parking( - filePath : java.lang.String + filePath: java.lang.String ) + object Parking { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Parking = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Parking = { BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Parking( - filePath = if(c.hasPathOrNull("filePath")) c.getString("filePath") else "/test/input/beamville/ride-hail-parking.csv" + filePath = + if (c.hasPathOrNull("filePath")) c.getString("filePath") + else "/test/input/beamville/ride-hail-parking.csv" ) } } - + case class Procedural( - fractionOfInitialVehicleFleet : scala.Double, - initialLocation : BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation, - vehicleTypeId : java.lang.String, - vehicleTypePrefix : java.lang.String + fractionOfInitialVehicleFleet: scala.Double, + initialLocation: BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation, + vehicleTypeId: java.lang.String, + vehicleTypePrefix: java.lang.String ) + object Procedural { case class InitialLocation( - home : BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation.Home, - name : java.lang.String + home: BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation.Home, + name: java.lang.String ) + object InitialLocation { case class Home( - radiusInMeters : scala.Double + radiusInMeters: scala.Double ) + object Home { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation.Home = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation.Home = { BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation.Home( - radiusInMeters = if(c.hasPathOrNull("radiusInMeters")) c.getDouble("radiusInMeters") else 10000 + radiusInMeters = if (c.hasPathOrNull("radiusInMeters")) c.getDouble("radiusInMeters") else 10000 ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation = { BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation( - home = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation.Home(if(c.hasPathOrNull("home")) c.getConfig("home") else com.typesafe.config.ConfigFactory.parseString("home{}")), - name = if(c.hasPathOrNull("name")) c.getString("name") else "HOME" + home = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation.Home( + if (c.hasPathOrNull("home")) c.getConfig("home") + else com.typesafe.config.ConfigFactory.parseString("home{}") + ), + name = if (c.hasPathOrNull("name")) c.getString("name") else "HOME" ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural = { BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural( - fractionOfInitialVehicleFleet = if(c.hasPathOrNull("fractionOfInitialVehicleFleet")) c.getDouble("fractionOfInitialVehicleFleet") else 0.1, - initialLocation = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation(if(c.hasPathOrNull("initialLocation")) c.getConfig("initialLocation") else com.typesafe.config.ConfigFactory.parseString("initialLocation{}")), - vehicleTypeId = if(c.hasPathOrNull("vehicleTypeId")) c.getString("vehicleTypeId") else "Car", - vehicleTypePrefix = if(c.hasPathOrNull("vehicleTypePrefix")) c.getString("vehicleTypePrefix") else "RH" + fractionOfInitialVehicleFleet = + if (c.hasPathOrNull("fractionOfInitialVehicleFleet")) c.getDouble("fractionOfInitialVehicleFleet") + else 0.1, + initialLocation = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural.InitialLocation( + if (c.hasPathOrNull("initialLocation")) c.getConfig("initialLocation") + else com.typesafe.config.ConfigFactory.parseString("initialLocation{}") + ), + vehicleTypeId = if (c.hasPathOrNull("vehicleTypeId")) c.getString("vehicleTypeId") else "Car", + vehicleTypePrefix = + if (c.hasPathOrNull("vehicleTypePrefix")) c.getString("vehicleTypePrefix") else "RH" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization = { BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization( - filePath = if(c.hasPathOrNull("filePath")) c.getString("filePath") else "/test/input/beamville/ride-hail-fleet.csv", - initType = if(c.hasPathOrNull("initType")) c.getString("initType") else "PROCEDURAL", - parking = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Parking(if(c.hasPathOrNull("parking")) c.getConfig("parking") else com.typesafe.config.ConfigFactory.parseString("parking{}")), - procedural = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural(if(c.hasPathOrNull("procedural")) c.getConfig("procedural") else com.typesafe.config.ConfigFactory.parseString("procedural{}")) + filePath = + if (c.hasPathOrNull("filePath")) c.getString("filePath") + else "/test/input/beamville/ride-hail-fleet.csv", + initType = if (c.hasPathOrNull("initType")) c.getString("initType") else "PROCEDURAL", + parking = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Parking( + if (c.hasPathOrNull("parking")) c.getConfig("parking") + else com.typesafe.config.ConfigFactory.parseString("parking{}") + ), + procedural = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization.Procedural( + if (c.hasPathOrNull("procedural")) c.getConfig("procedural") + else com.typesafe.config.ConfigFactory.parseString("procedural{}") + ) ) } } - + case class IterationStats( - timeBinSizeInSec : scala.Double + timeBinSizeInSec: scala.Double ) + object IterationStats { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.IterationStats = { BeamConfig.Beam.Agentsim.Agents.RideHail.IterationStats( - timeBinSizeInSec = if(c.hasPathOrNull("timeBinSizeInSec")) c.getDouble("timeBinSizeInSec") else 3600.0 + timeBinSizeInSec = if (c.hasPathOrNull("timeBinSizeInSec")) c.getDouble("timeBinSizeInSec") else 3600.0 ) } } - + case class RepositioningManager( - demandFollowingRepositioningManager : BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager.DemandFollowingRepositioningManager, - name : java.lang.String, - timeout : scala.Int + demandFollowingRepositioningManager: BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager.DemandFollowingRepositioningManager, + name: java.lang.String, + timeout: scala.Int ) + object RepositioningManager { case class DemandFollowingRepositioningManager( - fractionOfClosestClustersToConsider : scala.Double, - numberOfClustersForDemand : scala.Int, - sensitivityOfRepositioningToDemand : scala.Double, - sensitivityOfRepositioningToDemandForCAVs : scala.Double + fractionOfClosestClustersToConsider: scala.Double, + numberOfClustersForDemand: scala.Int, + sensitivityOfRepositioningToDemand: scala.Double, + sensitivityOfRepositioningToDemandForCAVs: scala.Double ) + object DemandFollowingRepositioningManager { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager.DemandFollowingRepositioningManager = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager.DemandFollowingRepositioningManager = { BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager.DemandFollowingRepositioningManager( - fractionOfClosestClustersToConsider = if(c.hasPathOrNull("fractionOfClosestClustersToConsider")) c.getDouble("fractionOfClosestClustersToConsider") else 0.2, - numberOfClustersForDemand = if(c.hasPathOrNull("numberOfClustersForDemand")) c.getInt("numberOfClustersForDemand") else 30, - sensitivityOfRepositioningToDemand = if(c.hasPathOrNull("sensitivityOfRepositioningToDemand")) c.getDouble("sensitivityOfRepositioningToDemand") else 1, - sensitivityOfRepositioningToDemandForCAVs = if(c.hasPathOrNull("sensitivityOfRepositioningToDemandForCAVs")) c.getDouble("sensitivityOfRepositioningToDemandForCAVs") else 1 + fractionOfClosestClustersToConsider = + if (c.hasPathOrNull("fractionOfClosestClustersToConsider")) + c.getDouble("fractionOfClosestClustersToConsider") + else 0.2, + numberOfClustersForDemand = + if (c.hasPathOrNull("numberOfClustersForDemand")) c.getInt("numberOfClustersForDemand") else 30, + sensitivityOfRepositioningToDemand = + if (c.hasPathOrNull("sensitivityOfRepositioningToDemand")) + c.getDouble("sensitivityOfRepositioningToDemand") + else 1, + sensitivityOfRepositioningToDemandForCAVs = + if (c.hasPathOrNull("sensitivityOfRepositioningToDemandForCAVs")) + c.getDouble("sensitivityOfRepositioningToDemandForCAVs") + else 1 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager = { BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager( - demandFollowingRepositioningManager = BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager.DemandFollowingRepositioningManager(if(c.hasPathOrNull("demandFollowingRepositioningManager")) c.getConfig("demandFollowingRepositioningManager") else com.typesafe.config.ConfigFactory.parseString("demandFollowingRepositioningManager{}")), - name = if(c.hasPathOrNull("name")) c.getString("name") else "DEFAULT_REPOSITIONING_MANAGER", - timeout = if(c.hasPathOrNull("timeout")) c.getInt("timeout") else 0 + demandFollowingRepositioningManager = + BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager.DemandFollowingRepositioningManager( + if (c.hasPathOrNull("demandFollowingRepositioningManager")) + c.getConfig("demandFollowingRepositioningManager") + else com.typesafe.config.ConfigFactory.parseString("demandFollowingRepositioningManager{}") + ), + name = if (c.hasPathOrNull("name")) c.getString("name") else "DEFAULT_REPOSITIONING_MANAGER", + timeout = if (c.hasPathOrNull("timeout")) c.getInt("timeout") else 0 ) } } - + case class RideHailManager( - radiusInMeters : scala.Double + radiusInMeters: scala.Double ) + object RideHailManager { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.RideHailManager = { BeamConfig.Beam.Agentsim.Agents.RideHail.RideHailManager( - radiusInMeters = if(c.hasPathOrNull("radiusInMeters")) c.getDouble("radiusInMeters") else 5000 + radiusInMeters = if (c.hasPathOrNull("radiusInMeters")) c.getDouble("radiusInMeters") else 5000 ) } } - + case class SurgePricing( - minimumSurgeLevel : scala.Double, - numberOfCategories : scala.Int, - priceAdjustmentStrategy : java.lang.String, - surgeLevelAdaptionStep : scala.Double + minimumSurgeLevel: scala.Double, + numberOfCategories: scala.Int, + priceAdjustmentStrategy: java.lang.String, + surgeLevelAdaptionStep: scala.Double ) + object SurgePricing { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail.SurgePricing = { BeamConfig.Beam.Agentsim.Agents.RideHail.SurgePricing( - minimumSurgeLevel = if(c.hasPathOrNull("minimumSurgeLevel")) c.getDouble("minimumSurgeLevel") else 0.1, - numberOfCategories = if(c.hasPathOrNull("numberOfCategories")) c.getInt("numberOfCategories") else 6, - priceAdjustmentStrategy = if(c.hasPathOrNull("priceAdjustmentStrategy")) c.getString("priceAdjustmentStrategy") else "KEEP_PRICE_LEVEL_FIXED_AT_ONE", - surgeLevelAdaptionStep = if(c.hasPathOrNull("surgeLevelAdaptionStep")) c.getDouble("surgeLevelAdaptionStep") else 0.1 + minimumSurgeLevel = if (c.hasPathOrNull("minimumSurgeLevel")) c.getDouble("minimumSurgeLevel") else 0.1, + numberOfCategories = if (c.hasPathOrNull("numberOfCategories")) c.getInt("numberOfCategories") else 6, + priceAdjustmentStrategy = + if (c.hasPathOrNull("priceAdjustmentStrategy")) c.getString("priceAdjustmentStrategy") + else "KEEP_PRICE_LEVEL_FIXED_AT_ONE", + surgeLevelAdaptionStep = + if (c.hasPathOrNull("surgeLevelAdaptionStep")) c.getDouble("surgeLevelAdaptionStep") else 0.1 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHail = { BeamConfig.Beam.Agentsim.Agents.RideHail( - allocationManager = BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager(if(c.hasPathOrNull("allocationManager")) c.getConfig("allocationManager") else com.typesafe.config.ConfigFactory.parseString("allocationManager{}")), - cav = BeamConfig.Beam.Agentsim.Agents.RideHail.Cav(if(c.hasPathOrNull("cav")) c.getConfig("cav") else com.typesafe.config.ConfigFactory.parseString("cav{}")), - defaultBaseCost = if(c.hasPathOrNull("defaultBaseCost")) c.getDouble("defaultBaseCost") else 1.8, - defaultCostPerMile = if(c.hasPathOrNull("defaultCostPerMile")) c.getDouble("defaultCostPerMile") else 0.91, - defaultCostPerMinute = if(c.hasPathOrNull("defaultCostPerMinute")) c.getDouble("defaultCostPerMinute") else 0.28, - human = BeamConfig.Beam.Agentsim.Agents.RideHail.Human(if(c.hasPathOrNull("human")) c.getConfig("human") else com.typesafe.config.ConfigFactory.parseString("human{}")), - initialization = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization(if(c.hasPathOrNull("initialization")) c.getConfig("initialization") else com.typesafe.config.ConfigFactory.parseString("initialization{}")), - iterationStats = BeamConfig.Beam.Agentsim.Agents.RideHail.IterationStats(if(c.hasPathOrNull("iterationStats")) c.getConfig("iterationStats") else com.typesafe.config.ConfigFactory.parseString("iterationStats{}")), - pooledBaseCost = if(c.hasPathOrNull("pooledBaseCost")) c.getDouble("pooledBaseCost") else 1.89, - pooledCostPerMile = if(c.hasPathOrNull("pooledCostPerMile")) c.getDouble("pooledCostPerMile") else 1.11, - pooledCostPerMinute = if(c.hasPathOrNull("pooledCostPerMinute")) c.getDouble("pooledCostPerMinute") else 0.07, - pooledToRegularRideCostRatio = if(c.hasPathOrNull("pooledToRegularRideCostRatio")) c.getDouble("pooledToRegularRideCostRatio") else 0.6, - rangeBufferForDispatchInMeters = if(c.hasPathOrNull("rangeBufferForDispatchInMeters")) c.getInt("rangeBufferForDispatchInMeters") else 10000, - refuelLocationType = if(c.hasPathOrNull("refuelLocationType")) c.getString("refuelLocationType") else "AtTAZCenter", - refuelThresholdInMeters = if(c.hasPathOrNull("refuelThresholdInMeters")) c.getDouble("refuelThresholdInMeters") else 5000.0, - repositioningManager = BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager(if(c.hasPathOrNull("repositioningManager")) c.getConfig("repositioningManager") else com.typesafe.config.ConfigFactory.parseString("repositioningManager{}")), - rideHailManager = BeamConfig.Beam.Agentsim.Agents.RideHail.RideHailManager(if(c.hasPathOrNull("rideHailManager")) c.getConfig("rideHailManager") else com.typesafe.config.ConfigFactory.parseString("rideHailManager{}")), - surgePricing = BeamConfig.Beam.Agentsim.Agents.RideHail.SurgePricing(if(c.hasPathOrNull("surgePricing")) c.getConfig("surgePricing") else com.typesafe.config.ConfigFactory.parseString("surgePricing{}")) + allocationManager = BeamConfig.Beam.Agentsim.Agents.RideHail.AllocationManager( + if (c.hasPathOrNull("allocationManager")) c.getConfig("allocationManager") + else com.typesafe.config.ConfigFactory.parseString("allocationManager{}") + ), + cav = BeamConfig.Beam.Agentsim.Agents.RideHail.Cav( + if (c.hasPathOrNull("cav")) c.getConfig("cav") + else com.typesafe.config.ConfigFactory.parseString("cav{}") + ), + defaultBaseCost = if (c.hasPathOrNull("defaultBaseCost")) c.getDouble("defaultBaseCost") else 1.8, + defaultCostPerMile = + if (c.hasPathOrNull("defaultCostPerMile")) c.getDouble("defaultCostPerMile") else 0.91, + defaultCostPerMinute = + if (c.hasPathOrNull("defaultCostPerMinute")) c.getDouble("defaultCostPerMinute") else 0.28, + human = BeamConfig.Beam.Agentsim.Agents.RideHail.Human( + if (c.hasPathOrNull("human")) c.getConfig("human") + else com.typesafe.config.ConfigFactory.parseString("human{}") + ), + initialization = BeamConfig.Beam.Agentsim.Agents.RideHail.Initialization( + if (c.hasPathOrNull("initialization")) c.getConfig("initialization") + else com.typesafe.config.ConfigFactory.parseString("initialization{}") + ), + iterationStats = BeamConfig.Beam.Agentsim.Agents.RideHail.IterationStats( + if (c.hasPathOrNull("iterationStats")) c.getConfig("iterationStats") + else com.typesafe.config.ConfigFactory.parseString("iterationStats{}") + ), + pooledBaseCost = if (c.hasPathOrNull("pooledBaseCost")) c.getDouble("pooledBaseCost") else 1.89, + pooledCostPerMile = if (c.hasPathOrNull("pooledCostPerMile")) c.getDouble("pooledCostPerMile") else 1.11, + pooledCostPerMinute = + if (c.hasPathOrNull("pooledCostPerMinute")) c.getDouble("pooledCostPerMinute") else 0.07, + pooledToRegularRideCostRatio = + if (c.hasPathOrNull("pooledToRegularRideCostRatio")) c.getDouble("pooledToRegularRideCostRatio") + else 0.6, + rangeBufferForDispatchInMeters = + if (c.hasPathOrNull("rangeBufferForDispatchInMeters")) c.getInt("rangeBufferForDispatchInMeters") + else 10000, + refuelLocationType = + if (c.hasPathOrNull("refuelLocationType")) c.getString("refuelLocationType") else "AtTAZCenter", + refuelThresholdInMeters = + if (c.hasPathOrNull("refuelThresholdInMeters")) c.getDouble("refuelThresholdInMeters") else 5000.0, + repositioningManager = BeamConfig.Beam.Agentsim.Agents.RideHail.RepositioningManager( + if (c.hasPathOrNull("repositioningManager")) c.getConfig("repositioningManager") + else com.typesafe.config.ConfigFactory.parseString("repositioningManager{}") + ), + rideHailManager = BeamConfig.Beam.Agentsim.Agents.RideHail.RideHailManager( + if (c.hasPathOrNull("rideHailManager")) c.getConfig("rideHailManager") + else com.typesafe.config.ConfigFactory.parseString("rideHailManager{}") + ), + surgePricing = BeamConfig.Beam.Agentsim.Agents.RideHail.SurgePricing( + if (c.hasPathOrNull("surgePricing")) c.getConfig("surgePricing") + else com.typesafe.config.ConfigFactory.parseString("surgePricing{}") + ) ) } } - + case class RideHailTransit( - modesToConsider : java.lang.String + modesToConsider: java.lang.String ) + object RideHailTransit { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.RideHailTransit = { BeamConfig.Beam.Agentsim.Agents.RideHailTransit( - modesToConsider = if(c.hasPathOrNull("modesToConsider")) c.getString("modesToConsider") else "MASS" + modesToConsider = if (c.hasPathOrNull("modesToConsider")) c.getString("modesToConsider") else "MASS" ) } } - + case class Vehicles( - downsamplingMethod : java.lang.String, - fractionOfInitialVehicleFleet : scala.Double, - fuelTypesFilePath : java.lang.String, - linkToGradePercentFilePath : java.lang.String, - meanPrivateVehicleStartingSOC : scala.Double, - meanRidehailVehicleStartingSOC : scala.Double, - sharedFleets : scala.List[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm], - transitVehicleTypesByRouteFile : java.lang.String, - vehicleAdjustmentMethod : java.lang.String, - vehicleTypesFilePath : java.lang.String, - vehiclesFilePath : java.lang.String + downsamplingMethod: java.lang.String, + fractionOfInitialVehicleFleet: scala.Double, + fuelTypesFilePath: java.lang.String, + linkToGradePercentFilePath: java.lang.String, + meanPrivateVehicleStartingSOC: scala.Double, + meanRidehailVehicleStartingSOC: scala.Double, + sharedFleets: scala.List[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm], + transitVehicleTypesByRouteFile: java.lang.String, + vehicleAdjustmentMethod: java.lang.String, + vehicleTypesFilePath: java.lang.String, + vehiclesFilePath: java.lang.String ) + object Vehicles { case class SharedFleets$Elm( - fixed_non_reserving : scala.Option[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReserving], - fixed_non_reserving_fleet_by_taz : scala.Option[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReservingFleetByTaz], - inexhaustible_reserving : scala.Option[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.InexhaustibleReserving], - managerType : java.lang.String, - name : java.lang.String, - reposition : scala.Option[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition] + fixed_non_reserving: scala.Option[ + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReserving + ], + fixed_non_reserving_fleet_by_taz: scala.Option[ + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReservingFleetByTaz + ], + inexhaustible_reserving: scala.Option[ + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.InexhaustibleReserving + ], + managerType: java.lang.String, + name: java.lang.String, + reposition: scala.Option[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition] ) + object SharedFleets$Elm { case class FixedNonReserving( - maxWalkingDistance : scala.Int, - vehicleTypeId : java.lang.String + maxWalkingDistance: scala.Int, + vehicleTypeId: java.lang.String ) + object FixedNonReserving { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReserving = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReserving = { BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReserving( - maxWalkingDistance = if(c.hasPathOrNull("maxWalkingDistance")) c.getInt("maxWalkingDistance") else 500, - vehicleTypeId = if(c.hasPathOrNull("vehicleTypeId")) c.getString("vehicleTypeId") else "sharedCar" + maxWalkingDistance = + if (c.hasPathOrNull("maxWalkingDistance")) c.getInt("maxWalkingDistance") else 500, + vehicleTypeId = if (c.hasPathOrNull("vehicleTypeId")) c.getString("vehicleTypeId") else "sharedCar" ) } } - + case class FixedNonReservingFleetByTaz( - fleetSize : scala.Int, - maxWalkingDistance : scala.Int, - vehicleTypeId : java.lang.String, - vehiclesSharePerTAZFromCSV : scala.Option[java.lang.String] + fleetSize: scala.Int, + maxWalkingDistance: scala.Int, + vehicleTypeId: java.lang.String, + vehiclesSharePerTAZFromCSV: scala.Option[java.lang.String] ) + object FixedNonReservingFleetByTaz { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReservingFleetByTaz = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReservingFleetByTaz = { BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReservingFleetByTaz( - fleetSize = if(c.hasPathOrNull("fleetSize")) c.getInt("fleetSize") else 10, - maxWalkingDistance = if(c.hasPathOrNull("maxWalkingDistance")) c.getInt("maxWalkingDistance") else 500, - vehicleTypeId = if(c.hasPathOrNull("vehicleTypeId")) c.getString("vehicleTypeId") else "sharedCar", - vehiclesSharePerTAZFromCSV = if(c.hasPathOrNull("vehiclesSharePerTAZFromCSV")) Some(c.getString("vehiclesSharePerTAZFromCSV")) else None + fleetSize = if (c.hasPathOrNull("fleetSize")) c.getInt("fleetSize") else 10, + maxWalkingDistance = + if (c.hasPathOrNull("maxWalkingDistance")) c.getInt("maxWalkingDistance") else 500, + vehicleTypeId = if (c.hasPathOrNull("vehicleTypeId")) c.getString("vehicleTypeId") else "sharedCar", + vehiclesSharePerTAZFromCSV = + if (c.hasPathOrNull("vehiclesSharePerTAZFromCSV")) Some(c.getString("vehiclesSharePerTAZFromCSV")) + else None ) } } - + case class InexhaustibleReserving( - vehicleTypeId : java.lang.String + vehicleTypeId: java.lang.String ) + object InexhaustibleReserving { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.InexhaustibleReserving = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.InexhaustibleReserving = { BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.InexhaustibleReserving( - vehicleTypeId = if(c.hasPathOrNull("vehicleTypeId")) c.getString("vehicleTypeId") else "sharedCar" + vehicleTypeId = if (c.hasPathOrNull("vehicleTypeId")) c.getString("vehicleTypeId") else "sharedCar" ) } } - + case class Reposition( - min_availability_undersupply_algorithm : scala.Option[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition.MinAvailabilityUndersupplyAlgorithm], - name : java.lang.String, - repositionTimeBin : scala.Int, - statTimeBin : scala.Int + min_availability_undersupply_algorithm: scala.Option[ + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition.MinAvailabilityUndersupplyAlgorithm + ], + name: java.lang.String, + repositionTimeBin: scala.Int, + statTimeBin: scala.Int ) + object Reposition { case class MinAvailabilityUndersupplyAlgorithm( - matchLimit : scala.Int + matchLimit: scala.Int ) + object MinAvailabilityUndersupplyAlgorithm { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition.MinAvailabilityUndersupplyAlgorithm = { - BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition.MinAvailabilityUndersupplyAlgorithm( - matchLimit = if(c.hasPathOrNull("matchLimit")) c.getInt("matchLimit") else 99999 - ) + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition.MinAvailabilityUndersupplyAlgorithm = { + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition + .MinAvailabilityUndersupplyAlgorithm( + matchLimit = if (c.hasPathOrNull("matchLimit")) c.getInt("matchLimit") else 99999 + ) } } - - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition = { BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition( - min_availability_undersupply_algorithm = if(c.hasPathOrNull("min-availability-undersupply-algorithm")) scala.Some(BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition.MinAvailabilityUndersupplyAlgorithm(c.getConfig("min-availability-undersupply-algorithm"))) else None, - name = if(c.hasPathOrNull("name")) c.getString("name") else "my-reposition-algorithm", - repositionTimeBin = if(c.hasPathOrNull("repositionTimeBin")) c.getInt("repositionTimeBin") else 3600, - statTimeBin = if(c.hasPathOrNull("statTimeBin")) c.getInt("statTimeBin") else 300 + min_availability_undersupply_algorithm = + if (c.hasPathOrNull("min-availability-undersupply-algorithm")) + scala.Some( + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition + .MinAvailabilityUndersupplyAlgorithm(c.getConfig("min-availability-undersupply-algorithm")) + ) + else None, + name = if (c.hasPathOrNull("name")) c.getString("name") else "my-reposition-algorithm", + repositionTimeBin = if (c.hasPathOrNull("repositionTimeBin")) c.getInt("repositionTimeBin") else 3600, + statTimeBin = if (c.hasPathOrNull("statTimeBin")) c.getInt("statTimeBin") else 300 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm = { BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm( - fixed_non_reserving = if(c.hasPathOrNull("fixed-non-reserving")) scala.Some(BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReserving(c.getConfig("fixed-non-reserving"))) else None, - fixed_non_reserving_fleet_by_taz = if(c.hasPathOrNull("fixed-non-reserving-fleet-by-taz")) scala.Some(BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.FixedNonReservingFleetByTaz(c.getConfig("fixed-non-reserving-fleet-by-taz"))) else None, - inexhaustible_reserving = if(c.hasPathOrNull("inexhaustible-reserving")) scala.Some(BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.InexhaustibleReserving(c.getConfig("inexhaustible-reserving"))) else None, - managerType = if(c.hasPathOrNull("managerType")) c.getString("managerType") else "fixed-non-reserving", - name = if(c.hasPathOrNull("name")) c.getString("name") else "my-fixed-non-reserving-fleet", - reposition = if(c.hasPathOrNull("reposition")) scala.Some(BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition(c.getConfig("reposition"))) else None + fixed_non_reserving = + if (c.hasPathOrNull("fixed-non-reserving")) + scala.Some( + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm + .FixedNonReserving(c.getConfig("fixed-non-reserving")) + ) + else None, + fixed_non_reserving_fleet_by_taz = + if (c.hasPathOrNull("fixed-non-reserving-fleet-by-taz")) + scala.Some( + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm + .FixedNonReservingFleetByTaz(c.getConfig("fixed-non-reserving-fleet-by-taz")) + ) + else None, + inexhaustible_reserving = + if (c.hasPathOrNull("inexhaustible-reserving")) + scala.Some( + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm + .InexhaustibleReserving(c.getConfig("inexhaustible-reserving")) + ) + else None, + managerType = if (c.hasPathOrNull("managerType")) c.getString("managerType") else "fixed-non-reserving", + name = if (c.hasPathOrNull("name")) c.getString("name") else "my-fixed-non-reserving-fleet", + reposition = + if (c.hasPathOrNull("reposition")) + scala.Some( + BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm.Reposition(c.getConfig("reposition")) + ) + else None ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Vehicles = { BeamConfig.Beam.Agentsim.Agents.Vehicles( - downsamplingMethod = if(c.hasPathOrNull("downsamplingMethod")) c.getString("downsamplingMethod") else "SECONDARY_VEHICLES_FIRST", - fractionOfInitialVehicleFleet = if(c.hasPathOrNull("fractionOfInitialVehicleFleet")) c.getDouble("fractionOfInitialVehicleFleet") else 1.0, - fuelTypesFilePath = if(c.hasPathOrNull("fuelTypesFilePath")) c.getString("fuelTypesFilePath") else "/test/input/beamville/beamFuelTypes.csv", - linkToGradePercentFilePath = if(c.hasPathOrNull("linkToGradePercentFilePath")) c.getString("linkToGradePercentFilePath") else "", - meanPrivateVehicleStartingSOC = if(c.hasPathOrNull("meanPrivateVehicleStartingSOC")) c.getDouble("meanPrivateVehicleStartingSOC") else 1.0, - meanRidehailVehicleStartingSOC = if(c.hasPathOrNull("meanRidehailVehicleStartingSOC")) c.getDouble("meanRidehailVehicleStartingSOC") else 1.0, - sharedFleets = $_LBeamConfig_Beam_Agentsim_Agents_Vehicles_SharedFleets$Elm(c.getList("sharedFleets")), - transitVehicleTypesByRouteFile = if(c.hasPathOrNull("transitVehicleTypesByRouteFile")) c.getString("transitVehicleTypesByRouteFile") else "", - vehicleAdjustmentMethod = if(c.hasPathOrNull("vehicleAdjustmentMethod")) c.getString("vehicleAdjustmentMethod") else "UNIFORM", - vehicleTypesFilePath = if(c.hasPathOrNull("vehicleTypesFilePath")) c.getString("vehicleTypesFilePath") else "/test/input/beamville/vehicleTypes.csv", - vehiclesFilePath = if(c.hasPathOrNull("vehiclesFilePath")) c.getString("vehiclesFilePath") else "/test/input/beamville/vehicles.csv" + downsamplingMethod = + if (c.hasPathOrNull("downsamplingMethod")) c.getString("downsamplingMethod") + else "SECONDARY_VEHICLES_FIRST", + fractionOfInitialVehicleFleet = + if (c.hasPathOrNull("fractionOfInitialVehicleFleet")) c.getDouble("fractionOfInitialVehicleFleet") + else 1.0, + fuelTypesFilePath = + if (c.hasPathOrNull("fuelTypesFilePath")) c.getString("fuelTypesFilePath") + else "/test/input/beamville/beamFuelTypes.csv", + linkToGradePercentFilePath = + if (c.hasPathOrNull("linkToGradePercentFilePath")) c.getString("linkToGradePercentFilePath") else "", + meanPrivateVehicleStartingSOC = + if (c.hasPathOrNull("meanPrivateVehicleStartingSOC")) c.getDouble("meanPrivateVehicleStartingSOC") + else 1.0, + meanRidehailVehicleStartingSOC = + if (c.hasPathOrNull("meanRidehailVehicleStartingSOC")) c.getDouble("meanRidehailVehicleStartingSOC") + else 1.0, + sharedFleets = $_LBeamConfig_Beam_Agentsim_Agents_Vehicles_SharedFleets$Elm(c.getList("sharedFleets")), + transitVehicleTypesByRouteFile = + if (c.hasPathOrNull("transitVehicleTypesByRouteFile")) c.getString("transitVehicleTypesByRouteFile") + else "", + vehicleAdjustmentMethod = + if (c.hasPathOrNull("vehicleAdjustmentMethod")) c.getString("vehicleAdjustmentMethod") else "UNIFORM", + vehicleTypesFilePath = + if (c.hasPathOrNull("vehicleTypesFilePath")) c.getString("vehicleTypesFilePath") + else "/test/input/beamville/vehicleTypes.csv", + vehiclesFilePath = + if (c.hasPathOrNull("vehiclesFilePath")) c.getString("vehiclesFilePath") + else "/test/input/beamville/vehicles.csv" ) } - private def $_LBeamConfig_Beam_Agentsim_Agents_Vehicles_SharedFleets$Elm(cl:com.typesafe.config.ConfigList): scala.List[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm] = { + private def $_LBeamConfig_Beam_Agentsim_Agents_Vehicles_SharedFleets$Elm( + cl: com.typesafe.config.ConfigList + ): scala.List[BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm] = { import scala.collection.JavaConverters._ - cl.asScala.map(cv => BeamConfig.Beam.Agentsim.Agents.Vehicles.SharedFleets$Elm(cv.asInstanceOf[com.typesafe.config.ConfigObject].toConfig)).toList + cl.asScala + .map( + cv => + BeamConfig.Beam.Agentsim.Agents.Vehicles + .SharedFleets$Elm(cv.asInstanceOf[com.typesafe.config.ConfigObject].toConfig) + ) + .toList } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents = { BeamConfig.Beam.Agentsim.Agents( - bodyType = if(c.hasPathOrNull("bodyType")) c.getString("bodyType") else "BODY-TYPE-DEFAULT", - households = BeamConfig.Beam.Agentsim.Agents.Households(if(c.hasPathOrNull("households")) c.getConfig("households") else com.typesafe.config.ConfigFactory.parseString("households{}")), - modalBehaviors = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors(if(c.hasPathOrNull("modalBehaviors")) c.getConfig("modalBehaviors") else com.typesafe.config.ConfigFactory.parseString("modalBehaviors{}")), - modeIncentive = BeamConfig.Beam.Agentsim.Agents.ModeIncentive(if(c.hasPathOrNull("modeIncentive")) c.getConfig("modeIncentive") else com.typesafe.config.ConfigFactory.parseString("modeIncentive{}")), - parking = BeamConfig.Beam.Agentsim.Agents.Parking(if(c.hasPathOrNull("parking")) c.getConfig("parking") else com.typesafe.config.ConfigFactory.parseString("parking{}")), - plans = BeamConfig.Beam.Agentsim.Agents.Plans(if(c.hasPathOrNull("plans")) c.getConfig("plans") else com.typesafe.config.ConfigFactory.parseString("plans{}")), - population = BeamConfig.Beam.Agentsim.Agents.Population(if(c.hasPathOrNull("population")) c.getConfig("population") else com.typesafe.config.ConfigFactory.parseString("population{}")), - ptFare = BeamConfig.Beam.Agentsim.Agents.PtFare(if(c.hasPathOrNull("ptFare")) c.getConfig("ptFare") else com.typesafe.config.ConfigFactory.parseString("ptFare{}")), - rideHail = BeamConfig.Beam.Agentsim.Agents.RideHail(if(c.hasPathOrNull("rideHail")) c.getConfig("rideHail") else com.typesafe.config.ConfigFactory.parseString("rideHail{}")), - rideHailTransit = BeamConfig.Beam.Agentsim.Agents.RideHailTransit(if(c.hasPathOrNull("rideHailTransit")) c.getConfig("rideHailTransit") else com.typesafe.config.ConfigFactory.parseString("rideHailTransit{}")), - vehicles = BeamConfig.Beam.Agentsim.Agents.Vehicles(if(c.hasPathOrNull("vehicles")) c.getConfig("vehicles") else com.typesafe.config.ConfigFactory.parseString("vehicles{}")) + bodyType = if (c.hasPathOrNull("bodyType")) c.getString("bodyType") else "BODY-TYPE-DEFAULT", + households = BeamConfig.Beam.Agentsim.Agents.Households( + if (c.hasPathOrNull("households")) c.getConfig("households") + else com.typesafe.config.ConfigFactory.parseString("households{}") + ), + modalBehaviors = BeamConfig.Beam.Agentsim.Agents.ModalBehaviors( + if (c.hasPathOrNull("modalBehaviors")) c.getConfig("modalBehaviors") + else com.typesafe.config.ConfigFactory.parseString("modalBehaviors{}") + ), + modeIncentive = BeamConfig.Beam.Agentsim.Agents.ModeIncentive( + if (c.hasPathOrNull("modeIncentive")) c.getConfig("modeIncentive") + else com.typesafe.config.ConfigFactory.parseString("modeIncentive{}") + ), + parking = BeamConfig.Beam.Agentsim.Agents.Parking( + if (c.hasPathOrNull("parking")) c.getConfig("parking") + else com.typesafe.config.ConfigFactory.parseString("parking{}") + ), + plans = BeamConfig.Beam.Agentsim.Agents.Plans( + if (c.hasPathOrNull("plans")) c.getConfig("plans") + else com.typesafe.config.ConfigFactory.parseString("plans{}") + ), + population = BeamConfig.Beam.Agentsim.Agents.Population( + if (c.hasPathOrNull("population")) c.getConfig("population") + else com.typesafe.config.ConfigFactory.parseString("population{}") + ), + ptFare = BeamConfig.Beam.Agentsim.Agents.PtFare( + if (c.hasPathOrNull("ptFare")) c.getConfig("ptFare") + else com.typesafe.config.ConfigFactory.parseString("ptFare{}") + ), + rideHail = BeamConfig.Beam.Agentsim.Agents.RideHail( + if (c.hasPathOrNull("rideHail")) c.getConfig("rideHail") + else com.typesafe.config.ConfigFactory.parseString("rideHail{}") + ), + rideHailTransit = BeamConfig.Beam.Agentsim.Agents.RideHailTransit( + if (c.hasPathOrNull("rideHailTransit")) c.getConfig("rideHailTransit") + else com.typesafe.config.ConfigFactory.parseString("rideHailTransit{}") + ), + vehicles = BeamConfig.Beam.Agentsim.Agents.Vehicles( + if (c.hasPathOrNull("vehicles")) c.getConfig("vehicles") + else com.typesafe.config.ConfigFactory.parseString("vehicles{}") + ) ) } } - + case class Scenarios( - frequencyAdjustmentFile : java.lang.String + frequencyAdjustmentFile: java.lang.String ) + object Scenarios { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Scenarios = { BeamConfig.Beam.Agentsim.Scenarios( - frequencyAdjustmentFile = if(c.hasPathOrNull("frequencyAdjustmentFile")) c.getString("frequencyAdjustmentFile") else "/test/input/beamville/r5/FrequencyAdjustment.csv" + frequencyAdjustmentFile = + if (c.hasPathOrNull("frequencyAdjustmentFile")) c.getString("frequencyAdjustmentFile") + else "/test/input/beamville/r5/FrequencyAdjustment.csv" ) } } - + case class ScheduleMonitorTask( - initialDelay : scala.Int, - interval : scala.Int + initialDelay: scala.Int, + interval: scala.Int ) + object ScheduleMonitorTask { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.ScheduleMonitorTask = { BeamConfig.Beam.Agentsim.ScheduleMonitorTask( - initialDelay = if(c.hasPathOrNull("initialDelay")) c.getInt("initialDelay") else 1, - interval = if(c.hasPathOrNull("interval")) c.getInt("interval") else 30 + initialDelay = if (c.hasPathOrNull("initialDelay")) c.getInt("initialDelay") else 1, + interval = if (c.hasPathOrNull("interval")) c.getInt("interval") else 30 ) } } - + case class Taz( - filePath : java.lang.String, - parkingCostScalingFactor : scala.Double, - parkingFilePath : java.lang.String, - parkingStallCountScalingFactor : scala.Double + filePath: java.lang.String, + parkingCostScalingFactor: scala.Double, + parkingFilePath: java.lang.String, + parkingStallCountScalingFactor: scala.Double ) + object Taz { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Taz = { BeamConfig.Beam.Agentsim.Taz( - filePath = if(c.hasPathOrNull("filePath")) c.getString("filePath") else "/test/input/beamville/taz-centers.csv", - parkingCostScalingFactor = if(c.hasPathOrNull("parkingCostScalingFactor")) c.getDouble("parkingCostScalingFactor") else 1.0, - parkingFilePath = if(c.hasPathOrNull("parkingFilePath")) c.getString("parkingFilePath") else "/test/input/beamville/taz-parking.csv", - parkingStallCountScalingFactor = if(c.hasPathOrNull("parkingStallCountScalingFactor")) c.getDouble("parkingStallCountScalingFactor") else 1.0 + filePath = + if (c.hasPathOrNull("filePath")) c.getString("filePath") else "/test/input/beamville/taz-centers.csv", + parkingCostScalingFactor = + if (c.hasPathOrNull("parkingCostScalingFactor")) c.getDouble("parkingCostScalingFactor") else 1.0, + parkingFilePath = + if (c.hasPathOrNull("parkingFilePath")) c.getString("parkingFilePath") + else "/test/input/beamville/taz-parking.csv", + parkingStallCountScalingFactor = + if (c.hasPathOrNull("parkingStallCountScalingFactor")) c.getDouble("parkingStallCountScalingFactor") + else 1.0 ) } } - + case class Toll( - filePath : java.lang.String + filePath: java.lang.String ) + object Toll { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Toll = { BeamConfig.Beam.Agentsim.Toll( - filePath = if(c.hasPathOrNull("filePath")) c.getString("filePath") else "/test/input/beamville/toll-prices.csv" + filePath = + if (c.hasPathOrNull("filePath")) c.getString("filePath") else "/test/input/beamville/toll-prices.csv" ) } } - + case class Tuning( - fuelCapacityInJoules : scala.Double, - rideHailPrice : scala.Double, - tollPrice : scala.Double, - transitCapacity : scala.Option[scala.Double], - transitPrice : scala.Double + fuelCapacityInJoules: scala.Double, + rideHailPrice: scala.Double, + tollPrice: scala.Double, + transitCapacity: scala.Option[scala.Double], + transitPrice: scala.Double ) + object Tuning { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Tuning = { BeamConfig.Beam.Agentsim.Tuning( - fuelCapacityInJoules = if(c.hasPathOrNull("fuelCapacityInJoules")) c.getDouble("fuelCapacityInJoules") else 86400000, - rideHailPrice = if(c.hasPathOrNull("rideHailPrice")) c.getDouble("rideHailPrice") else 1.0, - tollPrice = if(c.hasPathOrNull("tollPrice")) c.getDouble("tollPrice") else 1.0, - transitCapacity = if(c.hasPathOrNull("transitCapacity")) Some(c.getDouble("transitCapacity")) else None, - transitPrice = if(c.hasPathOrNull("transitPrice")) c.getDouble("transitPrice") else 1.0 + fuelCapacityInJoules = + if (c.hasPathOrNull("fuelCapacityInJoules")) c.getDouble("fuelCapacityInJoules") else 86400000, + rideHailPrice = if (c.hasPathOrNull("rideHailPrice")) c.getDouble("rideHailPrice") else 1.0, + tollPrice = if (c.hasPathOrNull("tollPrice")) c.getDouble("tollPrice") else 1.0, + transitCapacity = if (c.hasPathOrNull("transitCapacity")) Some(c.getDouble("transitCapacity")) else None, + transitPrice = if (c.hasPathOrNull("transitPrice")) c.getDouble("transitPrice") else 1.0 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim = { BeamConfig.Beam.Agentsim( - agentSampleSizeAsFractionOfPopulation = if(c.hasPathOrNull("agentSampleSizeAsFractionOfPopulation")) c.getDouble("agentSampleSizeAsFractionOfPopulation") else 1.0, - agents = BeamConfig.Beam.Agentsim.Agents(if(c.hasPathOrNull("agents")) c.getConfig("agents") else com.typesafe.config.ConfigFactory.parseString("agents{}")), - endTime = if(c.hasPathOrNull("endTime")) c.getString("endTime") else "30:00:00", - firstIteration = if(c.hasPathOrNull("firstIteration")) c.getInt("firstIteration") else 0, - lastIteration = if(c.hasPathOrNull("lastIteration")) c.getInt("lastIteration") else 0, - populationAdjustment = if(c.hasPathOrNull("populationAdjustment")) c.getString("populationAdjustment") else "DEFAULT_ADJUSTMENT", - scenarios = BeamConfig.Beam.Agentsim.Scenarios(if(c.hasPathOrNull("scenarios")) c.getConfig("scenarios") else com.typesafe.config.ConfigFactory.parseString("scenarios{}")), - scheduleMonitorTask = BeamConfig.Beam.Agentsim.ScheduleMonitorTask(if(c.hasPathOrNull("scheduleMonitorTask")) c.getConfig("scheduleMonitorTask") else com.typesafe.config.ConfigFactory.parseString("scheduleMonitorTask{}")), - schedulerParallelismWindow = if(c.hasPathOrNull("schedulerParallelismWindow")) c.getInt("schedulerParallelismWindow") else 30, - simulationName = if(c.hasPathOrNull("simulationName")) c.getString("simulationName") else "beamville", - startTime = if(c.hasPathOrNull("startTime")) c.getString("startTime") else "00:00:00", - taz = BeamConfig.Beam.Agentsim.Taz(if(c.hasPathOrNull("taz")) c.getConfig("taz") else com.typesafe.config.ConfigFactory.parseString("taz{}")), - thresholdForMakingParkingChoiceInMeters = if(c.hasPathOrNull("thresholdForMakingParkingChoiceInMeters")) c.getInt("thresholdForMakingParkingChoiceInMeters") else 100, - thresholdForWalkingInMeters = if(c.hasPathOrNull("thresholdForWalkingInMeters")) c.getInt("thresholdForWalkingInMeters") else 100, - timeBinSize = if(c.hasPathOrNull("timeBinSize")) c.getInt("timeBinSize") else 3600, - toll = BeamConfig.Beam.Agentsim.Toll(if(c.hasPathOrNull("toll")) c.getConfig("toll") else com.typesafe.config.ConfigFactory.parseString("toll{}")), - tuning = BeamConfig.Beam.Agentsim.Tuning(if(c.hasPathOrNull("tuning")) c.getConfig("tuning") else com.typesafe.config.ConfigFactory.parseString("tuning{}")) + agentSampleSizeAsFractionOfPopulation = + if (c.hasPathOrNull("agentSampleSizeAsFractionOfPopulation")) + c.getDouble("agentSampleSizeAsFractionOfPopulation") + else 1.0, + agents = BeamConfig.Beam.Agentsim.Agents( + if (c.hasPathOrNull("agents")) c.getConfig("agents") + else com.typesafe.config.ConfigFactory.parseString("agents{}") + ), + endTime = if (c.hasPathOrNull("endTime")) c.getString("endTime") else "30:00:00", + firstIteration = if (c.hasPathOrNull("firstIteration")) c.getInt("firstIteration") else 0, + lastIteration = if (c.hasPathOrNull("lastIteration")) c.getInt("lastIteration") else 0, + populationAdjustment = + if (c.hasPathOrNull("populationAdjustment")) c.getString("populationAdjustment") else "DEFAULT_ADJUSTMENT", + scenarios = BeamConfig.Beam.Agentsim.Scenarios( + if (c.hasPathOrNull("scenarios")) c.getConfig("scenarios") + else com.typesafe.config.ConfigFactory.parseString("scenarios{}") + ), + scheduleMonitorTask = BeamConfig.Beam.Agentsim.ScheduleMonitorTask( + if (c.hasPathOrNull("scheduleMonitorTask")) c.getConfig("scheduleMonitorTask") + else com.typesafe.config.ConfigFactory.parseString("scheduleMonitorTask{}") + ), + schedulerParallelismWindow = + if (c.hasPathOrNull("schedulerParallelismWindow")) c.getInt("schedulerParallelismWindow") else 30, + simulationName = if (c.hasPathOrNull("simulationName")) c.getString("simulationName") else "beamville", + startTime = if (c.hasPathOrNull("startTime")) c.getString("startTime") else "00:00:00", + taz = BeamConfig.Beam.Agentsim.Taz( + if (c.hasPathOrNull("taz")) c.getConfig("taz") else com.typesafe.config.ConfigFactory.parseString("taz{}") + ), + thresholdForMakingParkingChoiceInMeters = + if (c.hasPathOrNull("thresholdForMakingParkingChoiceInMeters")) + c.getInt("thresholdForMakingParkingChoiceInMeters") + else 100, + thresholdForWalkingInMeters = + if (c.hasPathOrNull("thresholdForWalkingInMeters")) c.getInt("thresholdForWalkingInMeters") else 100, + timeBinSize = if (c.hasPathOrNull("timeBinSize")) c.getInt("timeBinSize") else 3600, + toll = BeamConfig.Beam.Agentsim.Toll( + if (c.hasPathOrNull("toll")) c.getConfig("toll") + else com.typesafe.config.ConfigFactory.parseString("toll{}") + ), + tuning = BeamConfig.Beam.Agentsim.Tuning( + if (c.hasPathOrNull("tuning")) c.getConfig("tuning") + else com.typesafe.config.ConfigFactory.parseString("tuning{}") + ) ) } } - + case class Beamskimmer( - writeAllModeSkimsForPeakNonPeakPeriodsInterval : scala.Int, - writeFullSkimsInterval : scala.Int, - writeObservedSkimsInterval : scala.Int, - writeObservedSkimsPlusInterval : scala.Int + writeAllModeSkimsForPeakNonPeakPeriodsInterval: scala.Int, + writeFullSkimsInterval: scala.Int, + writeObservedSkimsInterval: scala.Int, + writeObservedSkimsPlusInterval: scala.Int ) + object Beamskimmer { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Beamskimmer = { BeamConfig.Beam.Beamskimmer( - writeAllModeSkimsForPeakNonPeakPeriodsInterval = if(c.hasPathOrNull("writeAllModeSkimsForPeakNonPeakPeriodsInterval")) c.getInt("writeAllModeSkimsForPeakNonPeakPeriodsInterval") else 0, - writeFullSkimsInterval = if(c.hasPathOrNull("writeFullSkimsInterval")) c.getInt("writeFullSkimsInterval") else 0, - writeObservedSkimsInterval = if(c.hasPathOrNull("writeObservedSkimsInterval")) c.getInt("writeObservedSkimsInterval") else 0, - writeObservedSkimsPlusInterval = if(c.hasPathOrNull("writeObservedSkimsPlusInterval")) c.getInt("writeObservedSkimsPlusInterval") else 0 + writeAllModeSkimsForPeakNonPeakPeriodsInterval = + if (c.hasPathOrNull("writeAllModeSkimsForPeakNonPeakPeriodsInterval")) + c.getInt("writeAllModeSkimsForPeakNonPeakPeriodsInterval") + else 0, + writeFullSkimsInterval = + if (c.hasPathOrNull("writeFullSkimsInterval")) c.getInt("writeFullSkimsInterval") else 0, + writeObservedSkimsInterval = + if (c.hasPathOrNull("writeObservedSkimsInterval")) c.getInt("writeObservedSkimsInterval") else 0, + writeObservedSkimsPlusInterval = + if (c.hasPathOrNull("writeObservedSkimsPlusInterval")) c.getInt("writeObservedSkimsPlusInterval") else 0 ) } } - + case class Calibration( - counts : BeamConfig.Beam.Calibration.Counts, - meanToCountsWeightRatio : scala.Double, - mode : BeamConfig.Beam.Calibration.Mode, - objectiveFunction : java.lang.String, - roadNetwork : BeamConfig.Beam.Calibration.RoadNetwork + counts: BeamConfig.Beam.Calibration.Counts, + meanToCountsWeightRatio: scala.Double, + mode: BeamConfig.Beam.Calibration.Mode, + objectiveFunction: java.lang.String, + roadNetwork: BeamConfig.Beam.Calibration.RoadNetwork ) + object Calibration { case class Counts( - averageCountsOverIterations : scala.Int, - countsScaleFactor : scala.Int, - inputCountsFile : java.lang.String, - writeCountsInterval : scala.Int + averageCountsOverIterations: scala.Int, + countsScaleFactor: scala.Int, + inputCountsFile: java.lang.String, + writeCountsInterval: scala.Int ) + object Counts { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Calibration.Counts = { BeamConfig.Beam.Calibration.Counts( - averageCountsOverIterations = if(c.hasPathOrNull("averageCountsOverIterations")) c.getInt("averageCountsOverIterations") else 1, - countsScaleFactor = if(c.hasPathOrNull("countsScaleFactor")) c.getInt("countsScaleFactor") else 10, - inputCountsFile = if(c.hasPathOrNull("inputCountsFile")) c.getString("inputCountsFile") else "/test/input/beamville/counts.xml", - writeCountsInterval = if(c.hasPathOrNull("writeCountsInterval")) c.getInt("writeCountsInterval") else 1 + averageCountsOverIterations = + if (c.hasPathOrNull("averageCountsOverIterations")) c.getInt("averageCountsOverIterations") else 1, + countsScaleFactor = if (c.hasPathOrNull("countsScaleFactor")) c.getInt("countsScaleFactor") else 10, + inputCountsFile = + if (c.hasPathOrNull("inputCountsFile")) c.getString("inputCountsFile") + else "/test/input/beamville/counts.xml", + writeCountsInterval = if (c.hasPathOrNull("writeCountsInterval")) c.getInt("writeCountsInterval") else 1 ) } } - + case class Mode( - benchmarkFilePath : java.lang.String + benchmarkFilePath: java.lang.String ) + object Mode { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Calibration.Mode = { BeamConfig.Beam.Calibration.Mode( - benchmarkFilePath = if(c.hasPathOrNull("benchmarkFilePath")) c.getString("benchmarkFilePath") else "" + benchmarkFilePath = if (c.hasPathOrNull("benchmarkFilePath")) c.getString("benchmarkFilePath") else "" ) } } - + case class RoadNetwork( - travelTimes : BeamConfig.Beam.Calibration.RoadNetwork.TravelTimes + travelTimes: BeamConfig.Beam.Calibration.RoadNetwork.TravelTimes ) + object RoadNetwork { case class TravelTimes( - zoneBoundariesFilePath : java.lang.String, - zoneODTravelTimesFilePath : java.lang.String + zoneBoundariesFilePath: java.lang.String, + zoneODTravelTimesFilePath: java.lang.String ) + object TravelTimes { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Calibration.RoadNetwork.TravelTimes = { BeamConfig.Beam.Calibration.RoadNetwork.TravelTimes( - zoneBoundariesFilePath = if(c.hasPathOrNull("zoneBoundariesFilePath")) c.getString("zoneBoundariesFilePath") else "", - zoneODTravelTimesFilePath = if(c.hasPathOrNull("zoneODTravelTimesFilePath")) c.getString("zoneODTravelTimesFilePath") else "" + zoneBoundariesFilePath = + if (c.hasPathOrNull("zoneBoundariesFilePath")) c.getString("zoneBoundariesFilePath") else "", + zoneODTravelTimesFilePath = + if (c.hasPathOrNull("zoneODTravelTimesFilePath")) c.getString("zoneODTravelTimesFilePath") else "" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Calibration.RoadNetwork = { BeamConfig.Beam.Calibration.RoadNetwork( - travelTimes = BeamConfig.Beam.Calibration.RoadNetwork.TravelTimes(if(c.hasPathOrNull("travelTimes")) c.getConfig("travelTimes") else com.typesafe.config.ConfigFactory.parseString("travelTimes{}")) + travelTimes = BeamConfig.Beam.Calibration.RoadNetwork.TravelTimes( + if (c.hasPathOrNull("travelTimes")) c.getConfig("travelTimes") + else com.typesafe.config.ConfigFactory.parseString("travelTimes{}") + ) ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Calibration = { BeamConfig.Beam.Calibration( - counts = BeamConfig.Beam.Calibration.Counts(if(c.hasPathOrNull("counts")) c.getConfig("counts") else com.typesafe.config.ConfigFactory.parseString("counts{}")), - meanToCountsWeightRatio = if(c.hasPathOrNull("meanToCountsWeightRatio")) c.getDouble("meanToCountsWeightRatio") else 0.5, - mode = BeamConfig.Beam.Calibration.Mode(if(c.hasPathOrNull("mode")) c.getConfig("mode") else com.typesafe.config.ConfigFactory.parseString("mode{}")), - objectiveFunction = if(c.hasPathOrNull("objectiveFunction")) c.getString("objectiveFunction") else "ModeChoiceObjectiveFunction", - roadNetwork = BeamConfig.Beam.Calibration.RoadNetwork(if(c.hasPathOrNull("roadNetwork")) c.getConfig("roadNetwork") else com.typesafe.config.ConfigFactory.parseString("roadNetwork{}")) + counts = BeamConfig.Beam.Calibration.Counts( + if (c.hasPathOrNull("counts")) c.getConfig("counts") + else com.typesafe.config.ConfigFactory.parseString("counts{}") + ), + meanToCountsWeightRatio = + if (c.hasPathOrNull("meanToCountsWeightRatio")) c.getDouble("meanToCountsWeightRatio") else 0.5, + mode = BeamConfig.Beam.Calibration.Mode( + if (c.hasPathOrNull("mode")) c.getConfig("mode") + else com.typesafe.config.ConfigFactory.parseString("mode{}") + ), + objectiveFunction = + if (c.hasPathOrNull("objectiveFunction")) c.getString("objectiveFunction") + else "ModeChoiceObjectiveFunction", + roadNetwork = BeamConfig.Beam.Calibration.RoadNetwork( + if (c.hasPathOrNull("roadNetwork")) c.getConfig("roadNetwork") + else com.typesafe.config.ConfigFactory.parseString("roadNetwork{}") + ) ) } } - + case class Cluster( - clusterType : scala.Option[java.lang.String], - enabled : scala.Boolean + clusterType: scala.Option[java.lang.String], + enabled: scala.Boolean ) + object Cluster { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Cluster = { BeamConfig.Beam.Cluster( - clusterType = if(c.hasPathOrNull("clusterType")) Some(c.getString("clusterType")) else None, - enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled") + clusterType = if (c.hasPathOrNull("clusterType")) Some(c.getString("clusterType")) else None, + enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled") ) } } - + case class Debug( - actor : BeamConfig.Beam.Debug.Actor, - agentTripScoresInterval : scala.Int, - clearRoutedOutstandingWorkEnabled : scala.Boolean, - debugActorTimerIntervalInSec : scala.Int, - debugEnabled : scala.Boolean, - memoryConsumptionDisplayTimeoutInSec : scala.Int, - secondsToWaitToClearRoutedOutstandingWork : scala.Int, - stuckAgentDetection : BeamConfig.Beam.Debug.StuckAgentDetection, - triggerMeasurer : BeamConfig.Beam.Debug.TriggerMeasurer + actor: BeamConfig.Beam.Debug.Actor, + agentTripScoresInterval: scala.Int, + clearRoutedOutstandingWorkEnabled: scala.Boolean, + debugActorTimerIntervalInSec: scala.Int, + debugEnabled: scala.Boolean, + memoryConsumptionDisplayTimeoutInSec: scala.Int, + secondsToWaitToClearRoutedOutstandingWork: scala.Int, + stuckAgentDetection: BeamConfig.Beam.Debug.StuckAgentDetection, + triggerMeasurer: BeamConfig.Beam.Debug.TriggerMeasurer ) + object Debug { case class Actor( - logDepth : scala.Int + logDepth: scala.Int ) + object Actor { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Debug.Actor = { BeamConfig.Beam.Debug.Actor( - logDepth = if(c.hasPathOrNull("logDepth")) c.getInt("logDepth") else 0 + logDepth = if (c.hasPathOrNull("logDepth")) c.getInt("logDepth") else 0 ) } } - + case class StuckAgentDetection( - checkIntervalMs : scala.Long, - checkMaxNumberOfMessagesEnabled : scala.Boolean, - defaultTimeoutMs : scala.Long, - enabled : scala.Boolean, - overallSimulationTimeoutMs : scala.Long, - thresholds : scala.List[BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm] + checkIntervalMs: scala.Long, + checkMaxNumberOfMessagesEnabled: scala.Boolean, + defaultTimeoutMs: scala.Long, + enabled: scala.Boolean, + overallSimulationTimeoutMs: scala.Long, + thresholds: scala.List[BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm] ) + object StuckAgentDetection { case class Thresholds$Elm( - actorTypeToMaxNumberOfMessages : BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm.ActorTypeToMaxNumberOfMessages, - markAsStuckAfterMs : scala.Long, - triggerType : java.lang.String + actorTypeToMaxNumberOfMessages: BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm.ActorTypeToMaxNumberOfMessages, + markAsStuckAfterMs: scala.Long, + triggerType: java.lang.String ) + object Thresholds$Elm { case class ActorTypeToMaxNumberOfMessages( - population : scala.Option[scala.Int], - rideHailAgent : scala.Option[scala.Int], - rideHailManager : scala.Option[scala.Int], - transitDriverAgent : scala.Option[scala.Int] + population: scala.Option[scala.Int], + rideHailAgent: scala.Option[scala.Int], + rideHailManager: scala.Option[scala.Int], + transitDriverAgent: scala.Option[scala.Int] ) + object ActorTypeToMaxNumberOfMessages { - def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm.ActorTypeToMaxNumberOfMessages = { + + def apply( + c: com.typesafe.config.Config + ): BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm.ActorTypeToMaxNumberOfMessages = { BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm.ActorTypeToMaxNumberOfMessages( - population = if(c.hasPathOrNull("population")) Some(c.getInt("population")) else None, - rideHailAgent = if(c.hasPathOrNull("rideHailAgent")) Some(c.getInt("rideHailAgent")) else None, - rideHailManager = if(c.hasPathOrNull("rideHailManager")) Some(c.getInt("rideHailManager")) else None, - transitDriverAgent = if(c.hasPathOrNull("transitDriverAgent")) Some(c.getInt("transitDriverAgent")) else None + population = if (c.hasPathOrNull("population")) Some(c.getInt("population")) else None, + rideHailAgent = if (c.hasPathOrNull("rideHailAgent")) Some(c.getInt("rideHailAgent")) else None, + rideHailManager = if (c.hasPathOrNull("rideHailManager")) Some(c.getInt("rideHailManager")) else None, + transitDriverAgent = + if (c.hasPathOrNull("transitDriverAgent")) Some(c.getInt("transitDriverAgent")) else None ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm = { BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm( - actorTypeToMaxNumberOfMessages = BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm.ActorTypeToMaxNumberOfMessages(if(c.hasPathOrNull("actorTypeToMaxNumberOfMessages")) c.getConfig("actorTypeToMaxNumberOfMessages") else com.typesafe.config.ConfigFactory.parseString("actorTypeToMaxNumberOfMessages{}")), - markAsStuckAfterMs = if(c.hasPathOrNull("markAsStuckAfterMs")) c.getDuration("markAsStuckAfterMs", java.util.concurrent.TimeUnit.MILLISECONDS) else 20000, - triggerType = if(c.hasPathOrNull("triggerType")) c.getString("triggerType") else "beam.agentsim.agents.PersonAgent$ActivityStartTrigger" + actorTypeToMaxNumberOfMessages = + BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm.ActorTypeToMaxNumberOfMessages( + if (c.hasPathOrNull("actorTypeToMaxNumberOfMessages")) c.getConfig("actorTypeToMaxNumberOfMessages") + else com.typesafe.config.ConfigFactory.parseString("actorTypeToMaxNumberOfMessages{}") + ), + markAsStuckAfterMs = + if (c.hasPathOrNull("markAsStuckAfterMs")) + c.getDuration("markAsStuckAfterMs", java.util.concurrent.TimeUnit.MILLISECONDS) + else 20000, + triggerType = + if (c.hasPathOrNull("triggerType")) c.getString("triggerType") + else "beam.agentsim.agents.PersonAgent$ActivityStartTrigger" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Debug.StuckAgentDetection = { BeamConfig.Beam.Debug.StuckAgentDetection( - checkIntervalMs = if(c.hasPathOrNull("checkIntervalMs")) c.getDuration("checkIntervalMs", java.util.concurrent.TimeUnit.MILLISECONDS) else 200, - checkMaxNumberOfMessagesEnabled = !c.hasPathOrNull("checkMaxNumberOfMessagesEnabled") || c.getBoolean("checkMaxNumberOfMessagesEnabled"), - defaultTimeoutMs = if(c.hasPathOrNull("defaultTimeoutMs")) c.getDuration("defaultTimeoutMs", java.util.concurrent.TimeUnit.MILLISECONDS) else 60000, - enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled"), - overallSimulationTimeoutMs = if(c.hasPathOrNull("overallSimulationTimeoutMs")) c.getDuration("overallSimulationTimeoutMs", java.util.concurrent.TimeUnit.MILLISECONDS) else 100000, - thresholds = $_LBeamConfig_Beam_Debug_StuckAgentDetection_Thresholds$Elm(c.getList("thresholds")) + checkIntervalMs = + if (c.hasPathOrNull("checkIntervalMs")) + c.getDuration("checkIntervalMs", java.util.concurrent.TimeUnit.MILLISECONDS) + else 200, + checkMaxNumberOfMessagesEnabled = !c.hasPathOrNull("checkMaxNumberOfMessagesEnabled") || c.getBoolean( + "checkMaxNumberOfMessagesEnabled" + ), + defaultTimeoutMs = + if (c.hasPathOrNull("defaultTimeoutMs")) + c.getDuration("defaultTimeoutMs", java.util.concurrent.TimeUnit.MILLISECONDS) + else 60000, + enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled"), + overallSimulationTimeoutMs = + if (c.hasPathOrNull("overallSimulationTimeoutMs")) + c.getDuration("overallSimulationTimeoutMs", java.util.concurrent.TimeUnit.MILLISECONDS) + else 100000, + thresholds = $_LBeamConfig_Beam_Debug_StuckAgentDetection_Thresholds$Elm(c.getList("thresholds")) ) } - private def $_LBeamConfig_Beam_Debug_StuckAgentDetection_Thresholds$Elm(cl:com.typesafe.config.ConfigList): scala.List[BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm] = { + private def $_LBeamConfig_Beam_Debug_StuckAgentDetection_Thresholds$Elm( + cl: com.typesafe.config.ConfigList + ): scala.List[BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm] = { import scala.collection.JavaConverters._ - cl.asScala.map(cv => BeamConfig.Beam.Debug.StuckAgentDetection.Thresholds$Elm(cv.asInstanceOf[com.typesafe.config.ConfigObject].toConfig)).toList + cl.asScala + .map( + cv => + BeamConfig.Beam.Debug.StuckAgentDetection + .Thresholds$Elm(cv.asInstanceOf[com.typesafe.config.ConfigObject].toConfig) + ) + .toList } } - + case class TriggerMeasurer( - enabled : scala.Boolean, - writeStuckAgentDetectionConfig : scala.Boolean + enabled: scala.Boolean, + writeStuckAgentDetectionConfig: scala.Boolean ) + object TriggerMeasurer { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Debug.TriggerMeasurer = { BeamConfig.Beam.Debug.TriggerMeasurer( - enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled"), - writeStuckAgentDetectionConfig = !c.hasPathOrNull("writeStuckAgentDetectionConfig") || c.getBoolean("writeStuckAgentDetectionConfig") + enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled"), + writeStuckAgentDetectionConfig = !c.hasPathOrNull("writeStuckAgentDetectionConfig") || c.getBoolean( + "writeStuckAgentDetectionConfig" + ) ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Debug = { BeamConfig.Beam.Debug( - actor = BeamConfig.Beam.Debug.Actor(if(c.hasPathOrNull("actor")) c.getConfig("actor") else com.typesafe.config.ConfigFactory.parseString("actor{}")), - agentTripScoresInterval = if(c.hasPathOrNull("agentTripScoresInterval")) c.getInt("agentTripScoresInterval") else 0, - clearRoutedOutstandingWorkEnabled = c.hasPathOrNull("clearRoutedOutstandingWorkEnabled") && c.getBoolean("clearRoutedOutstandingWorkEnabled"), - debugActorTimerIntervalInSec = if(c.hasPathOrNull("debugActorTimerIntervalInSec")) c.getInt("debugActorTimerIntervalInSec") else 0, - debugEnabled = c.hasPathOrNull("debugEnabled") && c.getBoolean("debugEnabled"), - memoryConsumptionDisplayTimeoutInSec = if(c.hasPathOrNull("memoryConsumptionDisplayTimeoutInSec")) c.getInt("memoryConsumptionDisplayTimeoutInSec") else 0, - secondsToWaitToClearRoutedOutstandingWork = if(c.hasPathOrNull("secondsToWaitToClearRoutedOutstandingWork")) c.getInt("secondsToWaitToClearRoutedOutstandingWork") else 60, - stuckAgentDetection = BeamConfig.Beam.Debug.StuckAgentDetection(if(c.hasPathOrNull("stuckAgentDetection")) c.getConfig("stuckAgentDetection") else com.typesafe.config.ConfigFactory.parseString("stuckAgentDetection{}")), - triggerMeasurer = BeamConfig.Beam.Debug.TriggerMeasurer(if(c.hasPathOrNull("triggerMeasurer")) c.getConfig("triggerMeasurer") else com.typesafe.config.ConfigFactory.parseString("triggerMeasurer{}")) + actor = BeamConfig.Beam.Debug.Actor( + if (c.hasPathOrNull("actor")) c.getConfig("actor") + else com.typesafe.config.ConfigFactory.parseString("actor{}") + ), + agentTripScoresInterval = + if (c.hasPathOrNull("agentTripScoresInterval")) c.getInt("agentTripScoresInterval") else 0, + clearRoutedOutstandingWorkEnabled = c.hasPathOrNull("clearRoutedOutstandingWorkEnabled") && c.getBoolean( + "clearRoutedOutstandingWorkEnabled" + ), + debugActorTimerIntervalInSec = + if (c.hasPathOrNull("debugActorTimerIntervalInSec")) c.getInt("debugActorTimerIntervalInSec") else 0, + debugEnabled = c.hasPathOrNull("debugEnabled") && c.getBoolean("debugEnabled"), + memoryConsumptionDisplayTimeoutInSec = + if (c.hasPathOrNull("memoryConsumptionDisplayTimeoutInSec")) + c.getInt("memoryConsumptionDisplayTimeoutInSec") + else 0, + secondsToWaitToClearRoutedOutstandingWork = + if (c.hasPathOrNull("secondsToWaitToClearRoutedOutstandingWork")) + c.getInt("secondsToWaitToClearRoutedOutstandingWork") + else 60, + stuckAgentDetection = BeamConfig.Beam.Debug.StuckAgentDetection( + if (c.hasPathOrNull("stuckAgentDetection")) c.getConfig("stuckAgentDetection") + else com.typesafe.config.ConfigFactory.parseString("stuckAgentDetection{}") + ), + triggerMeasurer = BeamConfig.Beam.Debug.TriggerMeasurer( + if (c.hasPathOrNull("triggerMeasurer")) c.getConfig("triggerMeasurer") + else com.typesafe.config.ConfigFactory.parseString("triggerMeasurer{}") + ) ) } } - + case class Exchange( - scenario : BeamConfig.Beam.Exchange.Scenario + scenario: BeamConfig.Beam.Exchange.Scenario ) + object Exchange { case class Scenario( - convertWgs2Utm : scala.Boolean, - fileFormat : java.lang.String, - folder : java.lang.String, - source : java.lang.String + convertWgs2Utm: scala.Boolean, + fileFormat: java.lang.String, + folder: java.lang.String, + source: java.lang.String ) + object Scenario { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Exchange.Scenario = { BeamConfig.Beam.Exchange.Scenario( convertWgs2Utm = c.hasPathOrNull("convertWgs2Utm") && c.getBoolean("convertWgs2Utm"), - fileFormat = if(c.hasPathOrNull("fileFormat")) c.getString("fileFormat") else "xml", - folder = if(c.hasPathOrNull("folder")) c.getString("folder") else "", - source = if(c.hasPathOrNull("source")) c.getString("source") else "Beam" + fileFormat = if (c.hasPathOrNull("fileFormat")) c.getString("fileFormat") else "xml", + folder = if (c.hasPathOrNull("folder")) c.getString("folder") else "", + source = if (c.hasPathOrNull("source")) c.getString("source") else "Beam" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Exchange = { BeamConfig.Beam.Exchange( - scenario = BeamConfig.Beam.Exchange.Scenario(if(c.hasPathOrNull("scenario")) c.getConfig("scenario") else com.typesafe.config.ConfigFactory.parseString("scenario{}")) + scenario = BeamConfig.Beam.Exchange.Scenario( + if (c.hasPathOrNull("scenario")) c.getConfig("scenario") + else com.typesafe.config.ConfigFactory.parseString("scenario{}") + ) ) } } - + case class Experimental( - optimizer : BeamConfig.Beam.Experimental.Optimizer + optimizer: BeamConfig.Beam.Experimental.Optimizer ) + object Experimental { case class Optimizer( - enabled : scala.Boolean + enabled: scala.Boolean ) + object Optimizer { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Experimental.Optimizer = { BeamConfig.Beam.Experimental.Optimizer( enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled") ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Experimental = { BeamConfig.Beam.Experimental( - optimizer = BeamConfig.Beam.Experimental.Optimizer(if(c.hasPathOrNull("optimizer")) c.getConfig("optimizer") else com.typesafe.config.ConfigFactory.parseString("optimizer{}")) + optimizer = BeamConfig.Beam.Experimental.Optimizer( + if (c.hasPathOrNull("optimizer")) c.getConfig("optimizer") + else com.typesafe.config.ConfigFactory.parseString("optimizer{}") + ) ) } } - + case class Logger( - keepConsoleAppenderOn : scala.Boolean + keepConsoleAppenderOn: scala.Boolean ) + object Logger { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Logger = { BeamConfig.Beam.Logger( keepConsoleAppenderOn = !c.hasPathOrNull("keepConsoleAppenderOn") || c.getBoolean("keepConsoleAppenderOn") ) } } - + case class Metrics( - level : java.lang.String + level: java.lang.String ) + object Metrics { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Metrics = { BeamConfig.Beam.Metrics( - level = if(c.hasPathOrNull("level")) c.getString("level") else "verbose" + level = if (c.hasPathOrNull("level")) c.getString("level") else "verbose" ) } } - + case class Outputs( - addTimestampToOutputDirectory : scala.Boolean, - baseOutputDirectory : java.lang.String, - defaultWriteInterval : scala.Int, - displayPerformanceTimings : scala.Boolean, - events : BeamConfig.Beam.Outputs.Events, - generalizedLinkStats : BeamConfig.Beam.Outputs.GeneralizedLinkStats, - generalizedLinkStatsInterval : scala.Int, - stats : BeamConfig.Beam.Outputs.Stats, - writeEventsInterval : scala.Int, - writeGraphs : scala.Boolean, - writeLinkTraversalInterval : scala.Int, - writePlansInterval : scala.Int + addTimestampToOutputDirectory: scala.Boolean, + baseOutputDirectory: java.lang.String, + defaultWriteInterval: scala.Int, + displayPerformanceTimings: scala.Boolean, + events: BeamConfig.Beam.Outputs.Events, + generalizedLinkStats: BeamConfig.Beam.Outputs.GeneralizedLinkStats, + generalizedLinkStatsInterval: scala.Int, + stats: BeamConfig.Beam.Outputs.Stats, + writeEventsInterval: scala.Int, + writeGraphs: scala.Boolean, + writeLinkTraversalInterval: scala.Int, + writePlansInterval: scala.Int ) + object Outputs { case class Events( - eventsToWrite : java.lang.String, - fileOutputFormats : java.lang.String + eventsToWrite: java.lang.String, + fileOutputFormats: java.lang.String ) + object Events { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Outputs.Events = { BeamConfig.Beam.Outputs.Events( - eventsToWrite = if(c.hasPathOrNull("eventsToWrite")) c.getString("eventsToWrite") else "ActivityEndEvent,ActivityStartEvent,PersonEntersVehicleEvent,PersonLeavesVehicleEvent,ModeChoiceEvent,PathTraversalEvent,ReserveRideHailEvent,ReplanningEvent,RefuelSessionEvent,ChargingPlugInEvent,ChargingPlugOutEvent,ParkEvent,LeavingParkingEvent", - fileOutputFormats = if(c.hasPathOrNull("fileOutputFormats")) c.getString("fileOutputFormats") else "csv" + eventsToWrite = + if (c.hasPathOrNull("eventsToWrite")) c.getString("eventsToWrite") + else + "ActivityEndEvent,ActivityStartEvent,PersonEntersVehicleEvent,PersonLeavesVehicleEvent,ModeChoiceEvent,PathTraversalEvent,ReserveRideHailEvent,ReplanningEvent,RefuelSessionEvent,ChargingPlugInEvent,ChargingPlugOutEvent,ParkEvent,LeavingParkingEvent", + fileOutputFormats = if (c.hasPathOrNull("fileOutputFormats")) c.getString("fileOutputFormats") else "csv" ) } } - + case class GeneralizedLinkStats( - endTime : scala.Int, - startTime : scala.Int + endTime: scala.Int, + startTime: scala.Int ) + object GeneralizedLinkStats { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Outputs.GeneralizedLinkStats = { BeamConfig.Beam.Outputs.GeneralizedLinkStats( - endTime = if(c.hasPathOrNull("endTime")) c.getInt("endTime") else 32400, - startTime = if(c.hasPathOrNull("startTime")) c.getInt("startTime") else 25200 + endTime = if (c.hasPathOrNull("endTime")) c.getInt("endTime") else 32400, + startTime = if (c.hasPathOrNull("startTime")) c.getInt("startTime") else 25200 ) } } - + case class Stats( - binSize : scala.Int + binSize: scala.Int ) + object Stats { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Outputs.Stats = { BeamConfig.Beam.Outputs.Stats( - binSize = if(c.hasPathOrNull("binSize")) c.getInt("binSize") else 3600 + binSize = if (c.hasPathOrNull("binSize")) c.getInt("binSize") else 3600 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Outputs = { BeamConfig.Beam.Outputs( - addTimestampToOutputDirectory = !c.hasPathOrNull("addTimestampToOutputDirectory") || c.getBoolean("addTimestampToOutputDirectory"), - baseOutputDirectory = if(c.hasPathOrNull("baseOutputDirectory")) c.getString("baseOutputDirectory") else "output", - defaultWriteInterval = if(c.hasPathOrNull("defaultWriteInterval")) c.getInt("defaultWriteInterval") else 1, - displayPerformanceTimings = c.hasPathOrNull("displayPerformanceTimings") && c.getBoolean("displayPerformanceTimings"), - events = BeamConfig.Beam.Outputs.Events(if(c.hasPathOrNull("events")) c.getConfig("events") else com.typesafe.config.ConfigFactory.parseString("events{}")), - generalizedLinkStats = BeamConfig.Beam.Outputs.GeneralizedLinkStats(if(c.hasPathOrNull("generalizedLinkStats")) c.getConfig("generalizedLinkStats") else com.typesafe.config.ConfigFactory.parseString("generalizedLinkStats{}")), - generalizedLinkStatsInterval = if(c.hasPathOrNull("generalizedLinkStatsInterval")) c.getInt("generalizedLinkStatsInterval") else 0, - stats = BeamConfig.Beam.Outputs.Stats(if(c.hasPathOrNull("stats")) c.getConfig("stats") else com.typesafe.config.ConfigFactory.parseString("stats{}")), - writeEventsInterval = if(c.hasPathOrNull("writeEventsInterval")) c.getInt("writeEventsInterval") else 1, - writeGraphs = !c.hasPathOrNull("writeGraphs") || c.getBoolean("writeGraphs"), - writeLinkTraversalInterval = if(c.hasPathOrNull("writeLinkTraversalInterval")) c.getInt("writeLinkTraversalInterval") else 0, - writePlansInterval = if(c.hasPathOrNull("writePlansInterval")) c.getInt("writePlansInterval") else 0 + addTimestampToOutputDirectory = !c.hasPathOrNull("addTimestampToOutputDirectory") || c.getBoolean( + "addTimestampToOutputDirectory" + ), + baseOutputDirectory = + if (c.hasPathOrNull("baseOutputDirectory")) c.getString("baseOutputDirectory") else "output", + defaultWriteInterval = if (c.hasPathOrNull("defaultWriteInterval")) c.getInt("defaultWriteInterval") else 1, + displayPerformanceTimings = c.hasPathOrNull("displayPerformanceTimings") && c.getBoolean( + "displayPerformanceTimings" + ), + events = BeamConfig.Beam.Outputs.Events( + if (c.hasPathOrNull("events")) c.getConfig("events") + else com.typesafe.config.ConfigFactory.parseString("events{}") + ), + generalizedLinkStats = BeamConfig.Beam.Outputs.GeneralizedLinkStats( + if (c.hasPathOrNull("generalizedLinkStats")) c.getConfig("generalizedLinkStats") + else com.typesafe.config.ConfigFactory.parseString("generalizedLinkStats{}") + ), + generalizedLinkStatsInterval = + if (c.hasPathOrNull("generalizedLinkStatsInterval")) c.getInt("generalizedLinkStatsInterval") else 0, + stats = BeamConfig.Beam.Outputs.Stats( + if (c.hasPathOrNull("stats")) c.getConfig("stats") + else com.typesafe.config.ConfigFactory.parseString("stats{}") + ), + writeEventsInterval = if (c.hasPathOrNull("writeEventsInterval")) c.getInt("writeEventsInterval") else 1, + writeGraphs = !c.hasPathOrNull("writeGraphs") || c.getBoolean("writeGraphs"), + writeLinkTraversalInterval = + if (c.hasPathOrNull("writeLinkTraversalInterval")) c.getInt("writeLinkTraversalInterval") else 0, + writePlansInterval = if (c.hasPathOrNull("writePlansInterval")) c.getInt("writePlansInterval") else 0 ) } } - + case class Physsim( - eventsForFullVersionOfVia : scala.Boolean, - eventsSampling : scala.Double, - flowCapacityFactor : scala.Double, - initializeRouterWithFreeFlowTimes : scala.Boolean, - inputNetworkFilePath : java.lang.String, - jdeqsim : BeamConfig.Beam.Physsim.Jdeqsim, - linkStatsBinSize : scala.Int, - linkStatsWriteInterval : scala.Int, - overwriteLinkParamPath : java.lang.String, - ptSampleSize : scala.Double, - quick_fix_minCarSpeedInMetersPerSecond : scala.Double, - skipPhysSim : scala.Boolean, - storageCapacityFactor : scala.Double, - writeEventsInterval : scala.Int, - writeMATSimNetwork : scala.Boolean, - writePlansInterval : scala.Int, - writeRouteHistoryInterval : scala.Int + eventsForFullVersionOfVia: scala.Boolean, + eventsSampling: scala.Double, + flowCapacityFactor: scala.Double, + initializeRouterWithFreeFlowTimes: scala.Boolean, + inputNetworkFilePath: java.lang.String, + jdeqsim: BeamConfig.Beam.Physsim.Jdeqsim, + linkStatsBinSize: scala.Int, + linkStatsWriteInterval: scala.Int, + overwriteLinkParamPath: java.lang.String, + ptSampleSize: scala.Double, + quick_fix_minCarSpeedInMetersPerSecond: scala.Double, + skipPhysSim: scala.Boolean, + storageCapacityFactor: scala.Double, + writeEventsInterval: scala.Int, + writeMATSimNetwork: scala.Boolean, + writePlansInterval: scala.Int, + writeRouteHistoryInterval: scala.Int ) + object Physsim { case class Jdeqsim( - agentSimPhysSimInterfaceDebugger : BeamConfig.Beam.Physsim.Jdeqsim.AgentSimPhysSimInterfaceDebugger, - cacc : BeamConfig.Beam.Physsim.Jdeqsim.Cacc + agentSimPhysSimInterfaceDebugger: BeamConfig.Beam.Physsim.Jdeqsim.AgentSimPhysSimInterfaceDebugger, + cacc: BeamConfig.Beam.Physsim.Jdeqsim.Cacc ) + object Jdeqsim { case class AgentSimPhysSimInterfaceDebugger( - enabled : scala.Boolean + enabled: scala.Boolean ) + object AgentSimPhysSimInterfaceDebugger { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Physsim.Jdeqsim.AgentSimPhysSimInterfaceDebugger = { BeamConfig.Beam.Physsim.Jdeqsim.AgentSimPhysSimInterfaceDebugger( enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled") ) } } - + case class Cacc( - capacityPlansWriteInterval : scala.Int, - enabled : scala.Boolean, - minRoadCapacity : scala.Int, - minSpeedMetersPerSec : scala.Int, - speedAdjustmentFactor : scala.Double + capacityPlansWriteInterval: scala.Int, + enabled: scala.Boolean, + minRoadCapacity: scala.Int, + minSpeedMetersPerSec: scala.Int, + speedAdjustmentFactor: scala.Double ) + object Cacc { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Physsim.Jdeqsim.Cacc = { BeamConfig.Beam.Physsim.Jdeqsim.Cacc( - capacityPlansWriteInterval = if(c.hasPathOrNull("capacityPlansWriteInterval")) c.getInt("capacityPlansWriteInterval") else 0, - enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled"), - minRoadCapacity = if(c.hasPathOrNull("minRoadCapacity")) c.getInt("minRoadCapacity") else 2000, - minSpeedMetersPerSec = if(c.hasPathOrNull("minSpeedMetersPerSec")) c.getInt("minSpeedMetersPerSec") else 20, - speedAdjustmentFactor = if(c.hasPathOrNull("speedAdjustmentFactor")) c.getDouble("speedAdjustmentFactor") else 1.0 + capacityPlansWriteInterval = + if (c.hasPathOrNull("capacityPlansWriteInterval")) c.getInt("capacityPlansWriteInterval") else 0, + enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled"), + minRoadCapacity = if (c.hasPathOrNull("minRoadCapacity")) c.getInt("minRoadCapacity") else 2000, + minSpeedMetersPerSec = + if (c.hasPathOrNull("minSpeedMetersPerSec")) c.getInt("minSpeedMetersPerSec") else 20, + speedAdjustmentFactor = + if (c.hasPathOrNull("speedAdjustmentFactor")) c.getDouble("speedAdjustmentFactor") else 1.0 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Physsim.Jdeqsim = { BeamConfig.Beam.Physsim.Jdeqsim( - agentSimPhysSimInterfaceDebugger = BeamConfig.Beam.Physsim.Jdeqsim.AgentSimPhysSimInterfaceDebugger(if(c.hasPathOrNull("agentSimPhysSimInterfaceDebugger")) c.getConfig("agentSimPhysSimInterfaceDebugger") else com.typesafe.config.ConfigFactory.parseString("agentSimPhysSimInterfaceDebugger{}")), - cacc = BeamConfig.Beam.Physsim.Jdeqsim.Cacc(if(c.hasPathOrNull("cacc")) c.getConfig("cacc") else com.typesafe.config.ConfigFactory.parseString("cacc{}")) + agentSimPhysSimInterfaceDebugger = BeamConfig.Beam.Physsim.Jdeqsim.AgentSimPhysSimInterfaceDebugger( + if (c.hasPathOrNull("agentSimPhysSimInterfaceDebugger")) c.getConfig("agentSimPhysSimInterfaceDebugger") + else com.typesafe.config.ConfigFactory.parseString("agentSimPhysSimInterfaceDebugger{}") + ), + cacc = BeamConfig.Beam.Physsim.Jdeqsim.Cacc( + if (c.hasPathOrNull("cacc")) c.getConfig("cacc") + else com.typesafe.config.ConfigFactory.parseString("cacc{}") + ) ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Physsim = { BeamConfig.Beam.Physsim( - eventsForFullVersionOfVia = !c.hasPathOrNull("eventsForFullVersionOfVia") || c.getBoolean("eventsForFullVersionOfVia"), - eventsSampling = if(c.hasPathOrNull("eventsSampling")) c.getDouble("eventsSampling") else 1.0, - flowCapacityFactor = if(c.hasPathOrNull("flowCapacityFactor")) c.getDouble("flowCapacityFactor") else 1.0, - initializeRouterWithFreeFlowTimes = !c.hasPathOrNull("initializeRouterWithFreeFlowTimes") || c.getBoolean("initializeRouterWithFreeFlowTimes"), - inputNetworkFilePath = if(c.hasPathOrNull("inputNetworkFilePath")) c.getString("inputNetworkFilePath") else "/test/input/beamville/r5/physsim-network.xml", - jdeqsim = BeamConfig.Beam.Physsim.Jdeqsim(if(c.hasPathOrNull("jdeqsim")) c.getConfig("jdeqsim") else com.typesafe.config.ConfigFactory.parseString("jdeqsim{}")), - linkStatsBinSize = if(c.hasPathOrNull("linkStatsBinSize")) c.getInt("linkStatsBinSize") else 3600, - linkStatsWriteInterval = if(c.hasPathOrNull("linkStatsWriteInterval")) c.getInt("linkStatsWriteInterval") else 0, - overwriteLinkParamPath = if(c.hasPathOrNull("overwriteLinkParamPath")) c.getString("overwriteLinkParamPath") else "", - ptSampleSize = if(c.hasPathOrNull("ptSampleSize")) c.getDouble("ptSampleSize") else 1.0, - quick_fix_minCarSpeedInMetersPerSecond = if(c.hasPathOrNull("quick_fix_minCarSpeedInMetersPerSecond")) c.getDouble("quick_fix_minCarSpeedInMetersPerSecond") else 0.5, - skipPhysSim = c.hasPathOrNull("skipPhysSim") && c.getBoolean("skipPhysSim"), - storageCapacityFactor = if(c.hasPathOrNull("storageCapacityFactor")) c.getDouble("storageCapacityFactor") else 1.0, - writeEventsInterval = if(c.hasPathOrNull("writeEventsInterval")) c.getInt("writeEventsInterval") else 0, - writeMATSimNetwork = !c.hasPathOrNull("writeMATSimNetwork") || c.getBoolean("writeMATSimNetwork"), - writePlansInterval = if(c.hasPathOrNull("writePlansInterval")) c.getInt("writePlansInterval") else 0, - writeRouteHistoryInterval = if(c.hasPathOrNull("writeRouteHistoryInterval")) c.getInt("writeRouteHistoryInterval") else 10 + eventsForFullVersionOfVia = !c.hasPathOrNull("eventsForFullVersionOfVia") || c.getBoolean( + "eventsForFullVersionOfVia" + ), + eventsSampling = if (c.hasPathOrNull("eventsSampling")) c.getDouble("eventsSampling") else 1.0, + flowCapacityFactor = if (c.hasPathOrNull("flowCapacityFactor")) c.getDouble("flowCapacityFactor") else 1.0, + initializeRouterWithFreeFlowTimes = !c.hasPathOrNull("initializeRouterWithFreeFlowTimes") || c.getBoolean( + "initializeRouterWithFreeFlowTimes" + ), + inputNetworkFilePath = + if (c.hasPathOrNull("inputNetworkFilePath")) c.getString("inputNetworkFilePath") + else "/test/input/beamville/r5/physsim-network.xml", + jdeqsim = BeamConfig.Beam.Physsim.Jdeqsim( + if (c.hasPathOrNull("jdeqsim")) c.getConfig("jdeqsim") + else com.typesafe.config.ConfigFactory.parseString("jdeqsim{}") + ), + linkStatsBinSize = if (c.hasPathOrNull("linkStatsBinSize")) c.getInt("linkStatsBinSize") else 3600, + linkStatsWriteInterval = + if (c.hasPathOrNull("linkStatsWriteInterval")) c.getInt("linkStatsWriteInterval") else 0, + overwriteLinkParamPath = + if (c.hasPathOrNull("overwriteLinkParamPath")) c.getString("overwriteLinkParamPath") else "", + ptSampleSize = if (c.hasPathOrNull("ptSampleSize")) c.getDouble("ptSampleSize") else 1.0, + quick_fix_minCarSpeedInMetersPerSecond = + if (c.hasPathOrNull("quick_fix_minCarSpeedInMetersPerSecond")) + c.getDouble("quick_fix_minCarSpeedInMetersPerSecond") + else 0.5, + skipPhysSim = c.hasPathOrNull("skipPhysSim") && c.getBoolean("skipPhysSim"), + storageCapacityFactor = + if (c.hasPathOrNull("storageCapacityFactor")) c.getDouble("storageCapacityFactor") else 1.0, + writeEventsInterval = if (c.hasPathOrNull("writeEventsInterval")) c.getInt("writeEventsInterval") else 0, + writeMATSimNetwork = !c.hasPathOrNull("writeMATSimNetwork") || c.getBoolean("writeMATSimNetwork"), + writePlansInterval = if (c.hasPathOrNull("writePlansInterval")) c.getInt("writePlansInterval") else 0, + writeRouteHistoryInterval = + if (c.hasPathOrNull("writeRouteHistoryInterval")) c.getInt("writeRouteHistoryInterval") else 10 ) } } - + case class Replanning( - ModuleProbability_1 : scala.Double, - ModuleProbability_2 : scala.Double, - ModuleProbability_3 : scala.Double, - ModuleProbability_4 : scala.Int, - Module_1 : java.lang.String, - Module_2 : java.lang.String, - Module_3 : java.lang.String, - Module_4 : java.lang.String, - cleanNonCarModesInIteration : scala.Int, - fractionOfIterationsToDisableInnovation : scala.Double, - maxAgentPlanMemorySize : scala.Int + ModuleProbability_1: scala.Double, + ModuleProbability_2: scala.Double, + ModuleProbability_3: scala.Double, + ModuleProbability_4: scala.Int, + Module_1: java.lang.String, + Module_2: java.lang.String, + Module_3: java.lang.String, + Module_4: java.lang.String, + cleanNonCarModesInIteration: scala.Int, + fractionOfIterationsToDisableInnovation: scala.Double, + maxAgentPlanMemorySize: scala.Int ) + object Replanning { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Replanning = { BeamConfig.Beam.Replanning( - ModuleProbability_1 = if(c.hasPathOrNull("ModuleProbability_1")) c.getDouble("ModuleProbability_1") else 0.8, - ModuleProbability_2 = if(c.hasPathOrNull("ModuleProbability_2")) c.getDouble("ModuleProbability_2") else 0.1, - ModuleProbability_3 = if(c.hasPathOrNull("ModuleProbability_3")) c.getDouble("ModuleProbability_3") else 0.1, - ModuleProbability_4 = if(c.hasPathOrNull("ModuleProbability_4")) c.getInt("ModuleProbability_4") else 0, - Module_1 = if(c.hasPathOrNull("Module_1")) c.getString("Module_1") else "SelectExpBeta", - Module_2 = if(c.hasPathOrNull("Module_2")) c.getString("Module_2") else "ClearRoutes", - Module_3 = if(c.hasPathOrNull("Module_3")) c.getString("Module_3") else "ClearModes", - Module_4 = if(c.hasPathOrNull("Module_4")) c.getString("Module_4") else "TimeMutator", - cleanNonCarModesInIteration = if(c.hasPathOrNull("cleanNonCarModesInIteration")) c.getInt("cleanNonCarModesInIteration") else 0, - fractionOfIterationsToDisableInnovation = if(c.hasPathOrNull("fractionOfIterationsToDisableInnovation")) c.getDouble("fractionOfIterationsToDisableInnovation") else Double.PositiveInfinity, - maxAgentPlanMemorySize = if(c.hasPathOrNull("maxAgentPlanMemorySize")) c.getInt("maxAgentPlanMemorySize") else 5 + ModuleProbability_1 = if (c.hasPathOrNull("ModuleProbability_1")) c.getDouble("ModuleProbability_1") else 0.8, + ModuleProbability_2 = if (c.hasPathOrNull("ModuleProbability_2")) c.getDouble("ModuleProbability_2") else 0.1, + ModuleProbability_3 = if (c.hasPathOrNull("ModuleProbability_3")) c.getDouble("ModuleProbability_3") else 0.1, + ModuleProbability_4 = if (c.hasPathOrNull("ModuleProbability_4")) c.getInt("ModuleProbability_4") else 0, + Module_1 = if (c.hasPathOrNull("Module_1")) c.getString("Module_1") else "SelectExpBeta", + Module_2 = if (c.hasPathOrNull("Module_2")) c.getString("Module_2") else "ClearRoutes", + Module_3 = if (c.hasPathOrNull("Module_3")) c.getString("Module_3") else "ClearModes", + Module_4 = if (c.hasPathOrNull("Module_4")) c.getString("Module_4") else "TimeMutator", + cleanNonCarModesInIteration = + if (c.hasPathOrNull("cleanNonCarModesInIteration")) c.getInt("cleanNonCarModesInIteration") else 0, + fractionOfIterationsToDisableInnovation = + if (c.hasPathOrNull("fractionOfIterationsToDisableInnovation")) + c.getDouble("fractionOfIterationsToDisableInnovation") + else Double.PositiveInfinity, + maxAgentPlanMemorySize = + if (c.hasPathOrNull("maxAgentPlanMemorySize")) c.getInt("maxAgentPlanMemorySize") else 5 ) } } - + case class Routing( - baseDate : java.lang.String, - r5 : BeamConfig.Beam.Routing.R5, - startingIterationForTravelTimesMSA : scala.Int, - transitOnStreetNetwork : scala.Boolean + baseDate: java.lang.String, + r5: BeamConfig.Beam.Routing.R5, + startingIterationForTravelTimesMSA: scala.Int, + transitOnStreetNetwork: scala.Boolean ) + object Routing { case class R5( - departureWindow : scala.Double, - directory : java.lang.String, - mNetBuilder : BeamConfig.Beam.Routing.R5.MNetBuilder, - numberOfSamples : scala.Int, - osmFile : java.lang.String, - osmMapdbFile : java.lang.String + departureWindow: scala.Double, + directory: java.lang.String, + mNetBuilder: BeamConfig.Beam.Routing.R5.MNetBuilder, + numberOfSamples: scala.Int, + osmFile: java.lang.String, + osmMapdbFile: java.lang.String ) + object R5 { case class MNetBuilder( - fromCRS : java.lang.String, - toCRS : java.lang.String + fromCRS: java.lang.String, + toCRS: java.lang.String ) + object MNetBuilder { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Routing.R5.MNetBuilder = { BeamConfig.Beam.Routing.R5.MNetBuilder( - fromCRS = if(c.hasPathOrNull("fromCRS")) c.getString("fromCRS") else "EPSG:4326", - toCRS = if(c.hasPathOrNull("toCRS")) c.getString("toCRS") else "EPSG:26910" + fromCRS = if (c.hasPathOrNull("fromCRS")) c.getString("fromCRS") else "EPSG:4326", + toCRS = if (c.hasPathOrNull("toCRS")) c.getString("toCRS") else "EPSG:26910" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Routing.R5 = { BeamConfig.Beam.Routing.R5( - departureWindow = if(c.hasPathOrNull("departureWindow")) c.getDouble("departureWindow") else 15.0, - directory = if(c.hasPathOrNull("directory")) c.getString("directory") else "/test/input/beamville/r5", - mNetBuilder = BeamConfig.Beam.Routing.R5.MNetBuilder(if(c.hasPathOrNull("mNetBuilder")) c.getConfig("mNetBuilder") else com.typesafe.config.ConfigFactory.parseString("mNetBuilder{}")), - numberOfSamples = if(c.hasPathOrNull("numberOfSamples")) c.getInt("numberOfSamples") else 1, - osmFile = if(c.hasPathOrNull("osmFile")) c.getString("osmFile") else "/test/input/beamville/r5/beamville.osm.pbf", - osmMapdbFile = if(c.hasPathOrNull("osmMapdbFile")) c.getString("osmMapdbFile") else "/test/input/beamville/r5/osm.mapdb" + departureWindow = if (c.hasPathOrNull("departureWindow")) c.getDouble("departureWindow") else 15.0, + directory = if (c.hasPathOrNull("directory")) c.getString("directory") else "/test/input/beamville/r5", + mNetBuilder = BeamConfig.Beam.Routing.R5.MNetBuilder( + if (c.hasPathOrNull("mNetBuilder")) c.getConfig("mNetBuilder") + else com.typesafe.config.ConfigFactory.parseString("mNetBuilder{}") + ), + numberOfSamples = if (c.hasPathOrNull("numberOfSamples")) c.getInt("numberOfSamples") else 1, + osmFile = + if (c.hasPathOrNull("osmFile")) c.getString("osmFile") else "/test/input/beamville/r5/beamville.osm.pbf", + osmMapdbFile = + if (c.hasPathOrNull("osmMapdbFile")) c.getString("osmMapdbFile") else "/test/input/beamville/r5/osm.mapdb" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Routing = { BeamConfig.Beam.Routing( - baseDate = if(c.hasPathOrNull("baseDate")) c.getString("baseDate") else "2016-10-17T00:00:00-07:00", - r5 = BeamConfig.Beam.Routing.R5(if(c.hasPathOrNull("r5")) c.getConfig("r5") else com.typesafe.config.ConfigFactory.parseString("r5{}")), - startingIterationForTravelTimesMSA = if(c.hasPathOrNull("startingIterationForTravelTimesMSA")) c.getInt("startingIterationForTravelTimesMSA") else 0, - transitOnStreetNetwork = !c.hasPathOrNull("transitOnStreetNetwork") || c.getBoolean("transitOnStreetNetwork") + baseDate = if (c.hasPathOrNull("baseDate")) c.getString("baseDate") else "2016-10-17T00:00:00-07:00", + r5 = BeamConfig.Beam.Routing.R5( + if (c.hasPathOrNull("r5")) c.getConfig("r5") else com.typesafe.config.ConfigFactory.parseString("r5{}") + ), + startingIterationForTravelTimesMSA = + if (c.hasPathOrNull("startingIterationForTravelTimesMSA")) c.getInt("startingIterationForTravelTimesMSA") + else 0, + transitOnStreetNetwork = !c.hasPathOrNull("transitOnStreetNetwork") || c.getBoolean("transitOnStreetNetwork") ) } } - + case class Spatial( - boundingBoxBuffer : scala.Int, - localCRS : java.lang.String + boundingBoxBuffer: scala.Int, + localCRS: java.lang.String ) + object Spatial { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Spatial = { BeamConfig.Beam.Spatial( - boundingBoxBuffer = if(c.hasPathOrNull("boundingBoxBuffer")) c.getInt("boundingBoxBuffer") else 5000, - localCRS = if(c.hasPathOrNull("localCRS")) c.getString("localCRS") else "epsg:32631" + boundingBoxBuffer = if (c.hasPathOrNull("boundingBoxBuffer")) c.getInt("boundingBoxBuffer") else 5000, + localCRS = if (c.hasPathOrNull("localCRS")) c.getString("localCRS") else "epsg:32631" ) } } - + case class WarmStart( - enabled : scala.Boolean, - path : java.lang.String, - routeHistoryFileName : java.lang.String, - routeHistoryFilePath : java.lang.String, - skimsFileName : java.lang.String, - skimsFilePath : java.lang.String, - skimsPlusFileName : java.lang.String, - skimsPlusFilePath : java.lang.String + enabled: scala.Boolean, + path: java.lang.String, + routeHistoryFileName: java.lang.String, + routeHistoryFilePath: java.lang.String, + skimsFileName: java.lang.String, + skimsFilePath: java.lang.String, + skimsPlusFileName: java.lang.String, + skimsPlusFilePath: java.lang.String ) + object WarmStart { + def apply(c: com.typesafe.config.Config): BeamConfig.Beam.WarmStart = { BeamConfig.Beam.WarmStart( - enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled"), - path = if(c.hasPathOrNull("path")) c.getString("path") else "", - routeHistoryFileName = if(c.hasPathOrNull("routeHistoryFileName")) c.getString("routeHistoryFileName") else "routeHistory.csv.gz", - routeHistoryFilePath = if(c.hasPathOrNull("routeHistoryFilePath")) c.getString("routeHistoryFilePath") else "", - skimsFileName = if(c.hasPathOrNull("skimsFileName")) c.getString("skimsFileName") else "skims.csv.gz", - skimsFilePath = if(c.hasPathOrNull("skimsFilePath")) c.getString("skimsFilePath") else "", - skimsPlusFileName = if(c.hasPathOrNull("skimsPlusFileName")) c.getString("skimsPlusFileName") else "skimsPlus.csv.gz", - skimsPlusFilePath = if(c.hasPathOrNull("skimsPlusFilePath")) c.getString("skimsPlusFilePath") else "" + enabled = c.hasPathOrNull("enabled") && c.getBoolean("enabled"), + path = if (c.hasPathOrNull("path")) c.getString("path") else "", + routeHistoryFileName = + if (c.hasPathOrNull("routeHistoryFileName")) c.getString("routeHistoryFileName") else "routeHistory.csv.gz", + routeHistoryFilePath = + if (c.hasPathOrNull("routeHistoryFilePath")) c.getString("routeHistoryFilePath") else "", + skimsFileName = if (c.hasPathOrNull("skimsFileName")) c.getString("skimsFileName") else "skims.csv.gz", + skimsFilePath = if (c.hasPathOrNull("skimsFilePath")) c.getString("skimsFilePath") else "", + skimsPlusFileName = + if (c.hasPathOrNull("skimsPlusFileName")) c.getString("skimsPlusFileName") else "skimsPlus.csv.gz", + skimsPlusFilePath = if (c.hasPathOrNull("skimsPlusFilePath")) c.getString("skimsPlusFilePath") else "" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Beam = { BeamConfig.Beam( - agentsim = BeamConfig.Beam.Agentsim(if(c.hasPathOrNull("agentsim")) c.getConfig("agentsim") else com.typesafe.config.ConfigFactory.parseString("agentsim{}")), - beamskimmer = BeamConfig.Beam.Beamskimmer(if(c.hasPathOrNull("beamskimmer")) c.getConfig("beamskimmer") else com.typesafe.config.ConfigFactory.parseString("beamskimmer{}")), - calibration = BeamConfig.Beam.Calibration(if(c.hasPathOrNull("calibration")) c.getConfig("calibration") else com.typesafe.config.ConfigFactory.parseString("calibration{}")), - cluster = BeamConfig.Beam.Cluster(if(c.hasPathOrNull("cluster")) c.getConfig("cluster") else com.typesafe.config.ConfigFactory.parseString("cluster{}")), - debug = BeamConfig.Beam.Debug(if(c.hasPathOrNull("debug")) c.getConfig("debug") else com.typesafe.config.ConfigFactory.parseString("debug{}")), - exchange = BeamConfig.Beam.Exchange(if(c.hasPathOrNull("exchange")) c.getConfig("exchange") else com.typesafe.config.ConfigFactory.parseString("exchange{}")), - experimental = BeamConfig.Beam.Experimental(if(c.hasPathOrNull("experimental")) c.getConfig("experimental") else com.typesafe.config.ConfigFactory.parseString("experimental{}")), - inputDirectory = if(c.hasPathOrNull("inputDirectory")) c.getString("inputDirectory") else "/test/input/beamville", - logger = BeamConfig.Beam.Logger(if(c.hasPathOrNull("logger")) c.getConfig("logger") else com.typesafe.config.ConfigFactory.parseString("logger{}")), - metrics = BeamConfig.Beam.Metrics(if(c.hasPathOrNull("metrics")) c.getConfig("metrics") else com.typesafe.config.ConfigFactory.parseString("metrics{}")), - outputs = BeamConfig.Beam.Outputs(if(c.hasPathOrNull("outputs")) c.getConfig("outputs") else com.typesafe.config.ConfigFactory.parseString("outputs{}")), - physsim = BeamConfig.Beam.Physsim(if(c.hasPathOrNull("physsim")) c.getConfig("physsim") else com.typesafe.config.ConfigFactory.parseString("physsim{}")), - replanning = BeamConfig.Beam.Replanning(if(c.hasPathOrNull("replanning")) c.getConfig("replanning") else com.typesafe.config.ConfigFactory.parseString("replanning{}")), - routing = BeamConfig.Beam.Routing(if(c.hasPathOrNull("routing")) c.getConfig("routing") else com.typesafe.config.ConfigFactory.parseString("routing{}")), - spatial = BeamConfig.Beam.Spatial(if(c.hasPathOrNull("spatial")) c.getConfig("spatial") else com.typesafe.config.ConfigFactory.parseString("spatial{}")), + agentsim = BeamConfig.Beam.Agentsim( + if (c.hasPathOrNull("agentsim")) c.getConfig("agentsim") + else com.typesafe.config.ConfigFactory.parseString("agentsim{}") + ), + beamskimmer = BeamConfig.Beam.Beamskimmer( + if (c.hasPathOrNull("beamskimmer")) c.getConfig("beamskimmer") + else com.typesafe.config.ConfigFactory.parseString("beamskimmer{}") + ), + calibration = BeamConfig.Beam.Calibration( + if (c.hasPathOrNull("calibration")) c.getConfig("calibration") + else com.typesafe.config.ConfigFactory.parseString("calibration{}") + ), + cluster = BeamConfig.Beam.Cluster( + if (c.hasPathOrNull("cluster")) c.getConfig("cluster") + else com.typesafe.config.ConfigFactory.parseString("cluster{}") + ), + debug = BeamConfig.Beam.Debug( + if (c.hasPathOrNull("debug")) c.getConfig("debug") + else com.typesafe.config.ConfigFactory.parseString("debug{}") + ), + exchange = BeamConfig.Beam.Exchange( + if (c.hasPathOrNull("exchange")) c.getConfig("exchange") + else com.typesafe.config.ConfigFactory.parseString("exchange{}") + ), + experimental = BeamConfig.Beam.Experimental( + if (c.hasPathOrNull("experimental")) c.getConfig("experimental") + else com.typesafe.config.ConfigFactory.parseString("experimental{}") + ), + inputDirectory = + if (c.hasPathOrNull("inputDirectory")) c.getString("inputDirectory") else "/test/input/beamville", + logger = BeamConfig.Beam.Logger( + if (c.hasPathOrNull("logger")) c.getConfig("logger") + else com.typesafe.config.ConfigFactory.parseString("logger{}") + ), + metrics = BeamConfig.Beam.Metrics( + if (c.hasPathOrNull("metrics")) c.getConfig("metrics") + else com.typesafe.config.ConfigFactory.parseString("metrics{}") + ), + outputs = BeamConfig.Beam.Outputs( + if (c.hasPathOrNull("outputs")) c.getConfig("outputs") + else com.typesafe.config.ConfigFactory.parseString("outputs{}") + ), + physsim = BeamConfig.Beam.Physsim( + if (c.hasPathOrNull("physsim")) c.getConfig("physsim") + else com.typesafe.config.ConfigFactory.parseString("physsim{}") + ), + replanning = BeamConfig.Beam.Replanning( + if (c.hasPathOrNull("replanning")) c.getConfig("replanning") + else com.typesafe.config.ConfigFactory.parseString("replanning{}") + ), + routing = BeamConfig.Beam.Routing( + if (c.hasPathOrNull("routing")) c.getConfig("routing") + else com.typesafe.config.ConfigFactory.parseString("routing{}") + ), + spatial = BeamConfig.Beam.Spatial( + if (c.hasPathOrNull("spatial")) c.getConfig("spatial") + else com.typesafe.config.ConfigFactory.parseString("spatial{}") + ), useLocalWorker = !c.hasPathOrNull("useLocalWorker") || c.getBoolean("useLocalWorker"), - warmStart = BeamConfig.Beam.WarmStart(if(c.hasPathOrNull("warmStart")) c.getConfig("warmStart") else com.typesafe.config.ConfigFactory.parseString("warmStart{}")) + warmStart = BeamConfig.Beam.WarmStart( + if (c.hasPathOrNull("warmStart")) c.getConfig("warmStart") + else com.typesafe.config.ConfigFactory.parseString("warmStart{}") + ) ) } } - + case class Matsim( - conversion : BeamConfig.Matsim.Conversion, - modules : BeamConfig.Matsim.Modules + conversion: BeamConfig.Matsim.Conversion, + modules: BeamConfig.Matsim.Modules ) + object Matsim { case class Conversion( - defaultHouseholdIncome : BeamConfig.Matsim.Conversion.DefaultHouseholdIncome, - generateVehicles : scala.Boolean, - matsimNetworkFile : java.lang.String, - osmFile : java.lang.String, - populationFile : java.lang.String, - scenarioDirectory : java.lang.String, - shapeConfig : BeamConfig.Matsim.Conversion.ShapeConfig, - vehiclesFile : java.lang.String + defaultHouseholdIncome: BeamConfig.Matsim.Conversion.DefaultHouseholdIncome, + generateVehicles: scala.Boolean, + matsimNetworkFile: java.lang.String, + osmFile: java.lang.String, + populationFile: java.lang.String, + scenarioDirectory: java.lang.String, + shapeConfig: BeamConfig.Matsim.Conversion.ShapeConfig, + vehiclesFile: java.lang.String ) + object Conversion { case class DefaultHouseholdIncome( - currency : java.lang.String, - period : java.lang.String, - value : scala.Int + currency: java.lang.String, + period: java.lang.String, + value: scala.Int ) + object DefaultHouseholdIncome { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Conversion.DefaultHouseholdIncome = { BeamConfig.Matsim.Conversion.DefaultHouseholdIncome( - currency = if(c.hasPathOrNull("currency")) c.getString("currency") else "usd", - period = if(c.hasPathOrNull("period")) c.getString("period") else "year", - value = if(c.hasPathOrNull("value")) c.getInt("value") else 50000 + currency = if (c.hasPathOrNull("currency")) c.getString("currency") else "usd", + period = if (c.hasPathOrNull("period")) c.getString("period") else "year", + value = if (c.hasPathOrNull("value")) c.getInt("value") else 50000 ) } } - + case class ShapeConfig( - shapeFile : java.lang.String, - tazIdFieldName : java.lang.String + shapeFile: java.lang.String, + tazIdFieldName: java.lang.String ) + object ShapeConfig { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Conversion.ShapeConfig = { BeamConfig.Matsim.Conversion.ShapeConfig( - shapeFile = if(c.hasPathOrNull("shapeFile")) c.getString("shapeFile") else "tz46_d00.shp", - tazIdFieldName = if(c.hasPathOrNull("tazIdFieldName")) c.getString("tazIdFieldName") else "TZ46_D00_I" + shapeFile = if (c.hasPathOrNull("shapeFile")) c.getString("shapeFile") else "tz46_d00.shp", + tazIdFieldName = if (c.hasPathOrNull("tazIdFieldName")) c.getString("tazIdFieldName") else "TZ46_D00_I" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Conversion = { BeamConfig.Matsim.Conversion( - defaultHouseholdIncome = BeamConfig.Matsim.Conversion.DefaultHouseholdIncome(if(c.hasPathOrNull("defaultHouseholdIncome")) c.getConfig("defaultHouseholdIncome") else com.typesafe.config.ConfigFactory.parseString("defaultHouseholdIncome{}")), - generateVehicles = !c.hasPathOrNull("generateVehicles") || c.getBoolean("generateVehicles"), - matsimNetworkFile = if(c.hasPathOrNull("matsimNetworkFile")) c.getString("matsimNetworkFile") else "Siouxfalls_network_PT.xml", - osmFile = if(c.hasPathOrNull("osmFile")) c.getString("osmFile") else "south-dakota-latest.osm.pbf", - populationFile = if(c.hasPathOrNull("populationFile")) c.getString("populationFile") else "Siouxfalls_population.xml", - scenarioDirectory = if(c.hasPathOrNull("scenarioDirectory")) c.getString("scenarioDirectory") else "/path/to/scenario/directory", - shapeConfig = BeamConfig.Matsim.Conversion.ShapeConfig(if(c.hasPathOrNull("shapeConfig")) c.getConfig("shapeConfig") else com.typesafe.config.ConfigFactory.parseString("shapeConfig{}")), - vehiclesFile = if(c.hasPathOrNull("vehiclesFile")) c.getString("vehiclesFile") else "Siouxfalls_vehicles.xml" + defaultHouseholdIncome = BeamConfig.Matsim.Conversion.DefaultHouseholdIncome( + if (c.hasPathOrNull("defaultHouseholdIncome")) c.getConfig("defaultHouseholdIncome") + else com.typesafe.config.ConfigFactory.parseString("defaultHouseholdIncome{}") + ), + generateVehicles = !c.hasPathOrNull("generateVehicles") || c.getBoolean("generateVehicles"), + matsimNetworkFile = + if (c.hasPathOrNull("matsimNetworkFile")) c.getString("matsimNetworkFile") else "Siouxfalls_network_PT.xml", + osmFile = if (c.hasPathOrNull("osmFile")) c.getString("osmFile") else "south-dakota-latest.osm.pbf", + populationFile = + if (c.hasPathOrNull("populationFile")) c.getString("populationFile") else "Siouxfalls_population.xml", + scenarioDirectory = + if (c.hasPathOrNull("scenarioDirectory")) c.getString("scenarioDirectory") + else "/path/to/scenario/directory", + shapeConfig = BeamConfig.Matsim.Conversion.ShapeConfig( + if (c.hasPathOrNull("shapeConfig")) c.getConfig("shapeConfig") + else com.typesafe.config.ConfigFactory.parseString("shapeConfig{}") + ), + vehiclesFile = if (c.hasPathOrNull("vehiclesFile")) c.getString("vehiclesFile") else "Siouxfalls_vehicles.xml" ) } } - + case class Modules( - changeMode : BeamConfig.Matsim.Modules.ChangeMode, - controler : BeamConfig.Matsim.Modules.Controler, - counts : BeamConfig.Matsim.Modules.Counts, - global : BeamConfig.Matsim.Modules.Global, - households : BeamConfig.Matsim.Modules.Households, - linkStats : BeamConfig.Matsim.Modules.LinkStats, - network : BeamConfig.Matsim.Modules.Network, - parallelEventHandling : BeamConfig.Matsim.Modules.ParallelEventHandling, - planCalcScore : BeamConfig.Matsim.Modules.PlanCalcScore, - plans : BeamConfig.Matsim.Modules.Plans, - qsim : BeamConfig.Matsim.Modules.Qsim, - strategy : BeamConfig.Matsim.Modules.Strategy, - transit : BeamConfig.Matsim.Modules.Transit, - vehicles : BeamConfig.Matsim.Modules.Vehicles + changeMode: BeamConfig.Matsim.Modules.ChangeMode, + controler: BeamConfig.Matsim.Modules.Controler, + counts: BeamConfig.Matsim.Modules.Counts, + global: BeamConfig.Matsim.Modules.Global, + households: BeamConfig.Matsim.Modules.Households, + linkStats: BeamConfig.Matsim.Modules.LinkStats, + network: BeamConfig.Matsim.Modules.Network, + parallelEventHandling: BeamConfig.Matsim.Modules.ParallelEventHandling, + planCalcScore: BeamConfig.Matsim.Modules.PlanCalcScore, + plans: BeamConfig.Matsim.Modules.Plans, + qsim: BeamConfig.Matsim.Modules.Qsim, + strategy: BeamConfig.Matsim.Modules.Strategy, + transit: BeamConfig.Matsim.Modules.Transit, + vehicles: BeamConfig.Matsim.Modules.Vehicles ) + object Modules { case class ChangeMode( - modes : java.lang.String + modes: java.lang.String ) + object ChangeMode { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.ChangeMode = { BeamConfig.Matsim.Modules.ChangeMode( - modes = if(c.hasPathOrNull("modes")) c.getString("modes") else "car,pt" + modes = if (c.hasPathOrNull("modes")) c.getString("modes") else "car,pt" ) } } - + case class Controler( - eventsFileFormat : java.lang.String, - firstIteration : scala.Int, - lastIteration : scala.Int, - mobsim : java.lang.String, - outputDirectory : java.lang.String, - overwriteFiles : java.lang.String + eventsFileFormat: java.lang.String, + firstIteration: scala.Int, + lastIteration: scala.Int, + mobsim: java.lang.String, + outputDirectory: java.lang.String, + overwriteFiles: java.lang.String ) + object Controler { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Controler = { BeamConfig.Matsim.Modules.Controler( - eventsFileFormat = if(c.hasPathOrNull("eventsFileFormat")) c.getString("eventsFileFormat") else "xml", - firstIteration = if(c.hasPathOrNull("firstIteration")) c.getInt("firstIteration") else 0, - lastIteration = if(c.hasPathOrNull("lastIteration")) c.getInt("lastIteration") else 0, - mobsim = if(c.hasPathOrNull("mobsim")) c.getString("mobsim") else "metasim", - outputDirectory = if(c.hasPathOrNull("outputDirectory")) c.getString("outputDirectory") else "", - overwriteFiles = if(c.hasPathOrNull("overwriteFiles")) c.getString("overwriteFiles") else "overwriteExistingFiles" + eventsFileFormat = if (c.hasPathOrNull("eventsFileFormat")) c.getString("eventsFileFormat") else "xml", + firstIteration = if (c.hasPathOrNull("firstIteration")) c.getInt("firstIteration") else 0, + lastIteration = if (c.hasPathOrNull("lastIteration")) c.getInt("lastIteration") else 0, + mobsim = if (c.hasPathOrNull("mobsim")) c.getString("mobsim") else "metasim", + outputDirectory = if (c.hasPathOrNull("outputDirectory")) c.getString("outputDirectory") else "", + overwriteFiles = + if (c.hasPathOrNull("overwriteFiles")) c.getString("overwriteFiles") else "overwriteExistingFiles" ) } } - + case class Counts( - averageCountsOverIterations : scala.Int, - countsScaleFactor : scala.Double, - inputCountsFile : java.lang.String, - outputformat : java.lang.String, - writeCountsInterval : scala.Int + averageCountsOverIterations: scala.Int, + countsScaleFactor: scala.Double, + inputCountsFile: java.lang.String, + outputformat: java.lang.String, + writeCountsInterval: scala.Int ) + object Counts { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Counts = { BeamConfig.Matsim.Modules.Counts( - averageCountsOverIterations = if(c.hasPathOrNull("averageCountsOverIterations")) c.getInt("averageCountsOverIterations") else 0, - countsScaleFactor = if(c.hasPathOrNull("countsScaleFactor")) c.getDouble("countsScaleFactor") else 10.355, - inputCountsFile = if(c.hasPathOrNull("inputCountsFile")) c.getString("inputCountsFile") else "", - outputformat = if(c.hasPathOrNull("outputformat")) c.getString("outputformat") else "all", - writeCountsInterval = if(c.hasPathOrNull("writeCountsInterval")) c.getInt("writeCountsInterval") else 0 + averageCountsOverIterations = + if (c.hasPathOrNull("averageCountsOverIterations")) c.getInt("averageCountsOverIterations") else 0, + countsScaleFactor = if (c.hasPathOrNull("countsScaleFactor")) c.getDouble("countsScaleFactor") else 10.355, + inputCountsFile = if (c.hasPathOrNull("inputCountsFile")) c.getString("inputCountsFile") else "", + outputformat = if (c.hasPathOrNull("outputformat")) c.getString("outputformat") else "all", + writeCountsInterval = if (c.hasPathOrNull("writeCountsInterval")) c.getInt("writeCountsInterval") else 0 ) } } - + case class Global( - coordinateSystem : java.lang.String, - randomSeed : scala.Int + coordinateSystem: java.lang.String, + randomSeed: scala.Int ) + object Global { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Global = { BeamConfig.Matsim.Modules.Global( - coordinateSystem = if(c.hasPathOrNull("coordinateSystem")) c.getString("coordinateSystem") else "Atlantis", - randomSeed = if(c.hasPathOrNull("randomSeed")) c.getInt("randomSeed") else 4711 + coordinateSystem = if (c.hasPathOrNull("coordinateSystem")) c.getString("coordinateSystem") else "Atlantis", + randomSeed = if (c.hasPathOrNull("randomSeed")) c.getInt("randomSeed") else 4711 ) } } - + case class Households( - inputFile : java.lang.String, - inputHouseholdAttributesFile : java.lang.String + inputFile: java.lang.String, + inputHouseholdAttributesFile: java.lang.String ) + object Households { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Households = { BeamConfig.Matsim.Modules.Households( - inputFile = if(c.hasPathOrNull("inputFile")) c.getString("inputFile") else "/test/input/beamville/households.xml", - inputHouseholdAttributesFile = if(c.hasPathOrNull("inputHouseholdAttributesFile")) c.getString("inputHouseholdAttributesFile") else "/test/input/beamville/householdAttributes.xml" + inputFile = + if (c.hasPathOrNull("inputFile")) c.getString("inputFile") else "/test/input/beamville/households.xml", + inputHouseholdAttributesFile = + if (c.hasPathOrNull("inputHouseholdAttributesFile")) c.getString("inputHouseholdAttributesFile") + else "/test/input/beamville/householdAttributes.xml" ) } } - + case class LinkStats( - averageLinkStatsOverIterations : scala.Int, - writeLinkStatsInterval : scala.Int + averageLinkStatsOverIterations: scala.Int, + writeLinkStatsInterval: scala.Int ) + object LinkStats { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.LinkStats = { BeamConfig.Matsim.Modules.LinkStats( - averageLinkStatsOverIterations = if(c.hasPathOrNull("averageLinkStatsOverIterations")) c.getInt("averageLinkStatsOverIterations") else 5, - writeLinkStatsInterval = if(c.hasPathOrNull("writeLinkStatsInterval")) c.getInt("writeLinkStatsInterval") else 10 + averageLinkStatsOverIterations = + if (c.hasPathOrNull("averageLinkStatsOverIterations")) c.getInt("averageLinkStatsOverIterations") else 5, + writeLinkStatsInterval = + if (c.hasPathOrNull("writeLinkStatsInterval")) c.getInt("writeLinkStatsInterval") else 10 ) } } - + case class Network( - inputNetworkFile : java.lang.String + inputNetworkFile: java.lang.String ) + object Network { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Network = { BeamConfig.Matsim.Modules.Network( - inputNetworkFile = if(c.hasPathOrNull("inputNetworkFile")) c.getString("inputNetworkFile") else "/test/input/beamville/physsim-network.xml" + inputNetworkFile = + if (c.hasPathOrNull("inputNetworkFile")) c.getString("inputNetworkFile") + else "/test/input/beamville/physsim-network.xml" ) } } - + case class ParallelEventHandling( - estimatedNumberOfEvents : scala.Int, - numberOfThreads : scala.Int, - oneThreadPerHandler : scala.Boolean, - synchronizeOnSimSteps : scala.Boolean + estimatedNumberOfEvents: scala.Int, + numberOfThreads: scala.Int, + oneThreadPerHandler: scala.Boolean, + synchronizeOnSimSteps: scala.Boolean ) + object ParallelEventHandling { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.ParallelEventHandling = { BeamConfig.Matsim.Modules.ParallelEventHandling( - estimatedNumberOfEvents = if(c.hasPathOrNull("estimatedNumberOfEvents")) c.getInt("estimatedNumberOfEvents") else 1000000000, - numberOfThreads = if(c.hasPathOrNull("numberOfThreads")) c.getInt("numberOfThreads") else 1, - oneThreadPerHandler = c.hasPathOrNull("oneThreadPerHandler") && c.getBoolean("oneThreadPerHandler"), - synchronizeOnSimSteps = c.hasPathOrNull("synchronizeOnSimSteps") && c.getBoolean("synchronizeOnSimSteps") + estimatedNumberOfEvents = + if (c.hasPathOrNull("estimatedNumberOfEvents")) c.getInt("estimatedNumberOfEvents") else 1000000000, + numberOfThreads = if (c.hasPathOrNull("numberOfThreads")) c.getInt("numberOfThreads") else 1, + oneThreadPerHandler = c.hasPathOrNull("oneThreadPerHandler") && c.getBoolean("oneThreadPerHandler"), + synchronizeOnSimSteps = c.hasPathOrNull("synchronizeOnSimSteps") && c.getBoolean("synchronizeOnSimSteps") ) } } - + case class PlanCalcScore( - BrainExpBeta : scala.Long, - earlyDeparture : scala.Long, - lateArrival : scala.Long, - learningRate : scala.Long, - parameterset : scala.List[BeamConfig.Matsim.Modules.PlanCalcScore.Parameterset$Elm], - performing : scala.Long, - traveling : scala.Long, - waiting : scala.Long, - writeExperiencedPlans : scala.Boolean + BrainExpBeta: scala.Long, + earlyDeparture: scala.Long, + lateArrival: scala.Long, + learningRate: scala.Long, + parameterset: scala.List[BeamConfig.Matsim.Modules.PlanCalcScore.Parameterset$Elm], + performing: scala.Long, + traveling: scala.Long, + waiting: scala.Long, + writeExperiencedPlans: scala.Boolean ) + object PlanCalcScore { case class Parameterset$Elm( - activityType : java.lang.String, - priority : scala.Int, - scoringThisActivityAtAll : scala.Boolean, - `type` : java.lang.String, - typicalDuration : java.lang.String, - typicalDurationScoreComputation : java.lang.String + activityType: java.lang.String, + priority: scala.Int, + scoringThisActivityAtAll: scala.Boolean, + `type`: java.lang.String, + typicalDuration: java.lang.String, + typicalDurationScoreComputation: java.lang.String ) + object Parameterset$Elm { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.PlanCalcScore.Parameterset$Elm = { BeamConfig.Matsim.Modules.PlanCalcScore.Parameterset$Elm( - activityType = if(c.hasPathOrNull("activityType")) c.getString("activityType") else "Home", - priority = if(c.hasPathOrNull("priority")) c.getInt("priority") else 1, - scoringThisActivityAtAll = !c.hasPathOrNull("scoringThisActivityAtAll") || c.getBoolean("scoringThisActivityAtAll"), - `type` = if(c.hasPathOrNull("type")) c.getString("type") else "activityParams", - typicalDuration = if(c.hasPathOrNull("typicalDuration")) c.getString("typicalDuration") else "01:00:00", - typicalDurationScoreComputation = if(c.hasPathOrNull("typicalDurationScoreComputation")) c.getString("typicalDurationScoreComputation") else "uniform" + activityType = if (c.hasPathOrNull("activityType")) c.getString("activityType") else "Home", + priority = if (c.hasPathOrNull("priority")) c.getInt("priority") else 1, + scoringThisActivityAtAll = !c.hasPathOrNull("scoringThisActivityAtAll") || c.getBoolean( + "scoringThisActivityAtAll" + ), + `type` = if (c.hasPathOrNull("type")) c.getString("type") else "activityParams", + typicalDuration = if (c.hasPathOrNull("typicalDuration")) c.getString("typicalDuration") else "01:00:00", + typicalDurationScoreComputation = + if (c.hasPathOrNull("typicalDurationScoreComputation")) c.getString("typicalDurationScoreComputation") + else "uniform" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.PlanCalcScore = { BeamConfig.Matsim.Modules.PlanCalcScore( - BrainExpBeta = if(c.hasPathOrNull("BrainExpBeta")) c.getDuration("BrainExpBeta", java.util.concurrent.TimeUnit.MILLISECONDS) else 2, - earlyDeparture = if(c.hasPathOrNull("earlyDeparture")) c.getDuration("earlyDeparture", java.util.concurrent.TimeUnit.MILLISECONDS) else 0, - lateArrival = if(c.hasPathOrNull("lateArrival")) c.getDuration("lateArrival", java.util.concurrent.TimeUnit.MILLISECONDS) else -18, - learningRate = if(c.hasPathOrNull("learningRate")) c.getDuration("learningRate", java.util.concurrent.TimeUnit.MILLISECONDS) else 1, - parameterset = $_LBeamConfig_Matsim_Modules_PlanCalcScore_Parameterset$Elm(c.getList("parameterset")), - performing = if(c.hasPathOrNull("performing")) c.getDuration("performing", java.util.concurrent.TimeUnit.MILLISECONDS) else 6, - traveling = if(c.hasPathOrNull("traveling")) c.getDuration("traveling", java.util.concurrent.TimeUnit.MILLISECONDS) else -6, - waiting = if(c.hasPathOrNull("waiting")) c.getDuration("waiting", java.util.concurrent.TimeUnit.MILLISECONDS) else 0, + BrainExpBeta = + if (c.hasPathOrNull("BrainExpBeta")) + c.getDuration("BrainExpBeta", java.util.concurrent.TimeUnit.MILLISECONDS) + else 2, + earlyDeparture = + if (c.hasPathOrNull("earlyDeparture")) + c.getDuration("earlyDeparture", java.util.concurrent.TimeUnit.MILLISECONDS) + else 0, + lateArrival = + if (c.hasPathOrNull("lateArrival")) + c.getDuration("lateArrival", java.util.concurrent.TimeUnit.MILLISECONDS) + else -18, + learningRate = + if (c.hasPathOrNull("learningRate")) + c.getDuration("learningRate", java.util.concurrent.TimeUnit.MILLISECONDS) + else 1, + parameterset = $_LBeamConfig_Matsim_Modules_PlanCalcScore_Parameterset$Elm(c.getList("parameterset")), + performing = + if (c.hasPathOrNull("performing")) c.getDuration("performing", java.util.concurrent.TimeUnit.MILLISECONDS) + else 6, + traveling = + if (c.hasPathOrNull("traveling")) c.getDuration("traveling", java.util.concurrent.TimeUnit.MILLISECONDS) + else -6, + waiting = + if (c.hasPathOrNull("waiting")) c.getDuration("waiting", java.util.concurrent.TimeUnit.MILLISECONDS) + else 0, writeExperiencedPlans = !c.hasPathOrNull("writeExperiencedPlans") || c.getBoolean("writeExperiencedPlans") ) } - private def $_LBeamConfig_Matsim_Modules_PlanCalcScore_Parameterset$Elm(cl:com.typesafe.config.ConfigList): scala.List[BeamConfig.Matsim.Modules.PlanCalcScore.Parameterset$Elm] = { + private def $_LBeamConfig_Matsim_Modules_PlanCalcScore_Parameterset$Elm( + cl: com.typesafe.config.ConfigList + ): scala.List[BeamConfig.Matsim.Modules.PlanCalcScore.Parameterset$Elm] = { import scala.collection.JavaConverters._ - cl.asScala.map(cv => BeamConfig.Matsim.Modules.PlanCalcScore.Parameterset$Elm(cv.asInstanceOf[com.typesafe.config.ConfigObject].toConfig)).toList + cl.asScala + .map( + cv => + BeamConfig.Matsim.Modules.PlanCalcScore + .Parameterset$Elm(cv.asInstanceOf[com.typesafe.config.ConfigObject].toConfig) + ) + .toList } } - + case class Plans( - inputPersonAttributesFile : java.lang.String, - inputPlansFile : java.lang.String + inputPersonAttributesFile: java.lang.String, + inputPlansFile: java.lang.String ) + object Plans { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Plans = { BeamConfig.Matsim.Modules.Plans( - inputPersonAttributesFile = if(c.hasPathOrNull("inputPersonAttributesFile")) c.getString("inputPersonAttributesFile") else "/test/input/beamville/populationAttributes.xml", - inputPlansFile = if(c.hasPathOrNull("inputPlansFile")) c.getString("inputPlansFile") else "/test/input/beamville/population.xml" + inputPersonAttributesFile = + if (c.hasPathOrNull("inputPersonAttributesFile")) c.getString("inputPersonAttributesFile") + else "/test/input/beamville/populationAttributes.xml", + inputPlansFile = + if (c.hasPathOrNull("inputPlansFile")) c.getString("inputPlansFile") + else "/test/input/beamville/population.xml" ) } } - + case class Qsim( - endTime : java.lang.String, - snapshotperiod : java.lang.String, - startTime : java.lang.String + endTime: java.lang.String, + snapshotperiod: java.lang.String, + startTime: java.lang.String ) + object Qsim { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Qsim = { BeamConfig.Matsim.Modules.Qsim( - endTime = if(c.hasPathOrNull("endTime")) c.getString("endTime") else "30:00:00", - snapshotperiod = if(c.hasPathOrNull("snapshotperiod")) c.getString("snapshotperiod") else "00:00:00", - startTime = if(c.hasPathOrNull("startTime")) c.getString("startTime") else "00:00:00" + endTime = if (c.hasPathOrNull("endTime")) c.getString("endTime") else "30:00:00", + snapshotperiod = if (c.hasPathOrNull("snapshotperiod")) c.getString("snapshotperiod") else "00:00:00", + startTime = if (c.hasPathOrNull("startTime")) c.getString("startTime") else "00:00:00" ) } } - + case class Strategy( - ModuleProbability_1 : scala.Int, - ModuleProbability_2 : scala.Int, - ModuleProbability_3 : scala.Int, - ModuleProbability_4 : scala.Int, - Module_1 : java.lang.String, - Module_2 : java.lang.String, - Module_3 : java.lang.String, - Module_4 : java.lang.String, - fractionOfIterationsToDisableInnovation : scala.Int, - maxAgentPlanMemorySize : scala.Int, - parameterset : scala.List[BeamConfig.Matsim.Modules.Strategy.Parameterset$Elm], - planSelectorForRemoval : java.lang.String + ModuleProbability_1: scala.Int, + ModuleProbability_2: scala.Int, + ModuleProbability_3: scala.Int, + ModuleProbability_4: scala.Int, + Module_1: java.lang.String, + Module_2: java.lang.String, + Module_3: java.lang.String, + Module_4: java.lang.String, + fractionOfIterationsToDisableInnovation: scala.Int, + maxAgentPlanMemorySize: scala.Int, + parameterset: scala.List[BeamConfig.Matsim.Modules.Strategy.Parameterset$Elm], + planSelectorForRemoval: java.lang.String ) + object Strategy { case class Parameterset$Elm( - disableAfterIteration : scala.Int, - strategyName : java.lang.String, - `type` : java.lang.String, - weight : scala.Int + disableAfterIteration: scala.Int, + strategyName: java.lang.String, + `type`: java.lang.String, + weight: scala.Int ) + object Parameterset$Elm { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Strategy.Parameterset$Elm = { BeamConfig.Matsim.Modules.Strategy.Parameterset$Elm( - disableAfterIteration = if(c.hasPathOrNull("disableAfterIteration")) c.getInt("disableAfterIteration") else -1, - strategyName = if(c.hasPathOrNull("strategyName")) c.getString("strategyName") else "", - `type` = if(c.hasPathOrNull("type")) c.getString("type") else "strategysettings", - weight = if(c.hasPathOrNull("weight")) c.getInt("weight") else 0 + disableAfterIteration = + if (c.hasPathOrNull("disableAfterIteration")) c.getInt("disableAfterIteration") else -1, + strategyName = if (c.hasPathOrNull("strategyName")) c.getString("strategyName") else "", + `type` = if (c.hasPathOrNull("type")) c.getString("type") else "strategysettings", + weight = if (c.hasPathOrNull("weight")) c.getInt("weight") else 0 ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Strategy = { BeamConfig.Matsim.Modules.Strategy( - ModuleProbability_1 = if(c.hasPathOrNull("ModuleProbability_1")) c.getInt("ModuleProbability_1") else 0, - ModuleProbability_2 = if(c.hasPathOrNull("ModuleProbability_2")) c.getInt("ModuleProbability_2") else 0, - ModuleProbability_3 = if(c.hasPathOrNull("ModuleProbability_3")) c.getInt("ModuleProbability_3") else 0, - ModuleProbability_4 = if(c.hasPathOrNull("ModuleProbability_4")) c.getInt("ModuleProbability_4") else 0, - Module_1 = if(c.hasPathOrNull("Module_1")) c.getString("Module_1") else "", - Module_2 = if(c.hasPathOrNull("Module_2")) c.getString("Module_2") else "", - Module_3 = if(c.hasPathOrNull("Module_3")) c.getString("Module_3") else "", - Module_4 = if(c.hasPathOrNull("Module_4")) c.getString("Module_4") else "", - fractionOfIterationsToDisableInnovation = if(c.hasPathOrNull("fractionOfIterationsToDisableInnovation")) c.getInt("fractionOfIterationsToDisableInnovation") else 999999, - maxAgentPlanMemorySize = if(c.hasPathOrNull("maxAgentPlanMemorySize")) c.getInt("maxAgentPlanMemorySize") else 5, - parameterset = $_LBeamConfig_Matsim_Modules_Strategy_Parameterset$Elm(c.getList("parameterset")), - planSelectorForRemoval = if(c.hasPathOrNull("planSelectorForRemoval")) c.getString("planSelectorForRemoval") else "WorstPlanForRemovalSelector" + ModuleProbability_1 = if (c.hasPathOrNull("ModuleProbability_1")) c.getInt("ModuleProbability_1") else 0, + ModuleProbability_2 = if (c.hasPathOrNull("ModuleProbability_2")) c.getInt("ModuleProbability_2") else 0, + ModuleProbability_3 = if (c.hasPathOrNull("ModuleProbability_3")) c.getInt("ModuleProbability_3") else 0, + ModuleProbability_4 = if (c.hasPathOrNull("ModuleProbability_4")) c.getInt("ModuleProbability_4") else 0, + Module_1 = if (c.hasPathOrNull("Module_1")) c.getString("Module_1") else "", + Module_2 = if (c.hasPathOrNull("Module_2")) c.getString("Module_2") else "", + Module_3 = if (c.hasPathOrNull("Module_3")) c.getString("Module_3") else "", + Module_4 = if (c.hasPathOrNull("Module_4")) c.getString("Module_4") else "", + fractionOfIterationsToDisableInnovation = + if (c.hasPathOrNull("fractionOfIterationsToDisableInnovation")) + c.getInt("fractionOfIterationsToDisableInnovation") + else 999999, + maxAgentPlanMemorySize = + if (c.hasPathOrNull("maxAgentPlanMemorySize")) c.getInt("maxAgentPlanMemorySize") else 5, + parameterset = $_LBeamConfig_Matsim_Modules_Strategy_Parameterset$Elm(c.getList("parameterset")), + planSelectorForRemoval = + if (c.hasPathOrNull("planSelectorForRemoval")) c.getString("planSelectorForRemoval") + else "WorstPlanForRemovalSelector" ) } - private def $_LBeamConfig_Matsim_Modules_Strategy_Parameterset$Elm(cl:com.typesafe.config.ConfigList): scala.List[BeamConfig.Matsim.Modules.Strategy.Parameterset$Elm] = { + private def $_LBeamConfig_Matsim_Modules_Strategy_Parameterset$Elm( + cl: com.typesafe.config.ConfigList + ): scala.List[BeamConfig.Matsim.Modules.Strategy.Parameterset$Elm] = { import scala.collection.JavaConverters._ - cl.asScala.map(cv => BeamConfig.Matsim.Modules.Strategy.Parameterset$Elm(cv.asInstanceOf[com.typesafe.config.ConfigObject].toConfig)).toList + cl.asScala + .map( + cv => + BeamConfig.Matsim.Modules.Strategy + .Parameterset$Elm(cv.asInstanceOf[com.typesafe.config.ConfigObject].toConfig) + ) + .toList } } - + case class Transit( - transitModes : java.lang.String, - useTransit : scala.Boolean, - vehiclesFile : java.lang.String + transitModes: java.lang.String, + useTransit: scala.Boolean, + vehiclesFile: java.lang.String ) + object Transit { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Transit = { BeamConfig.Matsim.Modules.Transit( - transitModes = if(c.hasPathOrNull("transitModes")) c.getString("transitModes") else "pt", - useTransit = c.hasPathOrNull("useTransit") && c.getBoolean("useTransit"), - vehiclesFile = if(c.hasPathOrNull("vehiclesFile")) c.getString("vehiclesFile") else "" + transitModes = if (c.hasPathOrNull("transitModes")) c.getString("transitModes") else "pt", + useTransit = c.hasPathOrNull("useTransit") && c.getBoolean("useTransit"), + vehiclesFile = if (c.hasPathOrNull("vehiclesFile")) c.getString("vehiclesFile") else "" ) } } - + case class Vehicles( - vehiclesFile : java.lang.String + vehiclesFile: java.lang.String ) + object Vehicles { + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules.Vehicles = { BeamConfig.Matsim.Modules.Vehicles( - vehiclesFile = if(c.hasPathOrNull("vehiclesFile")) c.getString("vehiclesFile") else "" + vehiclesFile = if (c.hasPathOrNull("vehiclesFile")) c.getString("vehiclesFile") else "" ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim.Modules = { BeamConfig.Matsim.Modules( - changeMode = BeamConfig.Matsim.Modules.ChangeMode(if(c.hasPathOrNull("changeMode")) c.getConfig("changeMode") else com.typesafe.config.ConfigFactory.parseString("changeMode{}")), - controler = BeamConfig.Matsim.Modules.Controler(if(c.hasPathOrNull("controler")) c.getConfig("controler") else com.typesafe.config.ConfigFactory.parseString("controler{}")), - counts = BeamConfig.Matsim.Modules.Counts(if(c.hasPathOrNull("counts")) c.getConfig("counts") else com.typesafe.config.ConfigFactory.parseString("counts{}")), - global = BeamConfig.Matsim.Modules.Global(if(c.hasPathOrNull("global")) c.getConfig("global") else com.typesafe.config.ConfigFactory.parseString("global{}")), - households = BeamConfig.Matsim.Modules.Households(if(c.hasPathOrNull("households")) c.getConfig("households") else com.typesafe.config.ConfigFactory.parseString("households{}")), - linkStats = BeamConfig.Matsim.Modules.LinkStats(if(c.hasPathOrNull("linkStats")) c.getConfig("linkStats") else com.typesafe.config.ConfigFactory.parseString("linkStats{}")), - network = BeamConfig.Matsim.Modules.Network(if(c.hasPathOrNull("network")) c.getConfig("network") else com.typesafe.config.ConfigFactory.parseString("network{}")), - parallelEventHandling = BeamConfig.Matsim.Modules.ParallelEventHandling(if(c.hasPathOrNull("parallelEventHandling")) c.getConfig("parallelEventHandling") else com.typesafe.config.ConfigFactory.parseString("parallelEventHandling{}")), - planCalcScore = BeamConfig.Matsim.Modules.PlanCalcScore(if(c.hasPathOrNull("planCalcScore")) c.getConfig("planCalcScore") else com.typesafe.config.ConfigFactory.parseString("planCalcScore{}")), - plans = BeamConfig.Matsim.Modules.Plans(if(c.hasPathOrNull("plans")) c.getConfig("plans") else com.typesafe.config.ConfigFactory.parseString("plans{}")), - qsim = BeamConfig.Matsim.Modules.Qsim(if(c.hasPathOrNull("qsim")) c.getConfig("qsim") else com.typesafe.config.ConfigFactory.parseString("qsim{}")), - strategy = BeamConfig.Matsim.Modules.Strategy(if(c.hasPathOrNull("strategy")) c.getConfig("strategy") else com.typesafe.config.ConfigFactory.parseString("strategy{}")), - transit = BeamConfig.Matsim.Modules.Transit(if(c.hasPathOrNull("transit")) c.getConfig("transit") else com.typesafe.config.ConfigFactory.parseString("transit{}")), - vehicles = BeamConfig.Matsim.Modules.Vehicles(if(c.hasPathOrNull("vehicles")) c.getConfig("vehicles") else com.typesafe.config.ConfigFactory.parseString("vehicles{}")) + changeMode = BeamConfig.Matsim.Modules.ChangeMode( + if (c.hasPathOrNull("changeMode")) c.getConfig("changeMode") + else com.typesafe.config.ConfigFactory.parseString("changeMode{}") + ), + controler = BeamConfig.Matsim.Modules.Controler( + if (c.hasPathOrNull("controler")) c.getConfig("controler") + else com.typesafe.config.ConfigFactory.parseString("controler{}") + ), + counts = BeamConfig.Matsim.Modules.Counts( + if (c.hasPathOrNull("counts")) c.getConfig("counts") + else com.typesafe.config.ConfigFactory.parseString("counts{}") + ), + global = BeamConfig.Matsim.Modules.Global( + if (c.hasPathOrNull("global")) c.getConfig("global") + else com.typesafe.config.ConfigFactory.parseString("global{}") + ), + households = BeamConfig.Matsim.Modules.Households( + if (c.hasPathOrNull("households")) c.getConfig("households") + else com.typesafe.config.ConfigFactory.parseString("households{}") + ), + linkStats = BeamConfig.Matsim.Modules.LinkStats( + if (c.hasPathOrNull("linkStats")) c.getConfig("linkStats") + else com.typesafe.config.ConfigFactory.parseString("linkStats{}") + ), + network = BeamConfig.Matsim.Modules.Network( + if (c.hasPathOrNull("network")) c.getConfig("network") + else com.typesafe.config.ConfigFactory.parseString("network{}") + ), + parallelEventHandling = BeamConfig.Matsim.Modules.ParallelEventHandling( + if (c.hasPathOrNull("parallelEventHandling")) c.getConfig("parallelEventHandling") + else com.typesafe.config.ConfigFactory.parseString("parallelEventHandling{}") + ), + planCalcScore = BeamConfig.Matsim.Modules.PlanCalcScore( + if (c.hasPathOrNull("planCalcScore")) c.getConfig("planCalcScore") + else com.typesafe.config.ConfigFactory.parseString("planCalcScore{}") + ), + plans = BeamConfig.Matsim.Modules.Plans( + if (c.hasPathOrNull("plans")) c.getConfig("plans") + else com.typesafe.config.ConfigFactory.parseString("plans{}") + ), + qsim = BeamConfig.Matsim.Modules.Qsim( + if (c.hasPathOrNull("qsim")) c.getConfig("qsim") + else com.typesafe.config.ConfigFactory.parseString("qsim{}") + ), + strategy = BeamConfig.Matsim.Modules.Strategy( + if (c.hasPathOrNull("strategy")) c.getConfig("strategy") + else com.typesafe.config.ConfigFactory.parseString("strategy{}") + ), + transit = BeamConfig.Matsim.Modules.Transit( + if (c.hasPathOrNull("transit")) c.getConfig("transit") + else com.typesafe.config.ConfigFactory.parseString("transit{}") + ), + vehicles = BeamConfig.Matsim.Modules.Vehicles( + if (c.hasPathOrNull("vehicles")) c.getConfig("vehicles") + else com.typesafe.config.ConfigFactory.parseString("vehicles{}") + ) ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig.Matsim = { BeamConfig.Matsim( - conversion = BeamConfig.Matsim.Conversion(if(c.hasPathOrNull("conversion")) c.getConfig("conversion") else com.typesafe.config.ConfigFactory.parseString("conversion{}")), - modules = BeamConfig.Matsim.Modules(if(c.hasPathOrNull("modules")) c.getConfig("modules") else com.typesafe.config.ConfigFactory.parseString("modules{}")) + conversion = BeamConfig.Matsim.Conversion( + if (c.hasPathOrNull("conversion")) c.getConfig("conversion") + else com.typesafe.config.ConfigFactory.parseString("conversion{}") + ), + modules = BeamConfig.Matsim.Modules( + if (c.hasPathOrNull("modules")) c.getConfig("modules") + else com.typesafe.config.ConfigFactory.parseString("modules{}") + ) ) } } - + def apply(c: com.typesafe.config.Config): BeamConfig = { BeamConfig( - beam = BeamConfig.Beam(if(c.hasPathOrNull("beam")) c.getConfig("beam") else com.typesafe.config.ConfigFactory.parseString("beam{}")), - matsim = BeamConfig.Matsim(if(c.hasPathOrNull("matsim")) c.getConfig("matsim") else com.typesafe.config.ConfigFactory.parseString("matsim{}")) + beam = BeamConfig.Beam( + if (c.hasPathOrNull("beam")) c.getConfig("beam") else com.typesafe.config.ConfigFactory.parseString("beam{}") + ), + matsim = BeamConfig.Matsim( + if (c.hasPathOrNull("matsim")) c.getConfig("matsim") + else com.typesafe.config.ConfigFactory.parseString("matsim{}") + ) ) } } - From 0df48fdc4e3a59e1f9754ecfd37df22b79684828 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Thu, 5 Sep 2019 23:46:39 +0300 Subject: [PATCH 22/23] fixes demanded by review --- .../java/beam/matsim/MatsimConfigUpdater.java | 15 +++++++++------ src/main/scala/beam/router/BeamSkimmer.scala | 16 +++++++++++----- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/java/beam/matsim/MatsimConfigUpdater.java b/src/main/java/beam/matsim/MatsimConfigUpdater.java index 4ad1c5ea013..12f88fafe50 100644 --- a/src/main/java/beam/matsim/MatsimConfigUpdater.java +++ b/src/main/java/beam/matsim/MatsimConfigUpdater.java @@ -26,11 +26,14 @@ public class MatsimConfigUpdater implements Observer { @Override public void update(Observable observable, Object o) { - Tuple2 t = (Tuple2) o; - BeamConfig beamConfig = (BeamConfig) t._2; - - controlerConfigGroup.setWritePlansInterval(beamConfig.beam().physsim().writePlansInterval()); - linkStatsConfigGroup.setWriteLinkStatsInterval(beamConfig.matsim().modules().linkStats().writeLinkStatsInterval()); - + if (o instanceof Tuple2) { + Tuple2 t = (Tuple2) o; + if (t._2 instanceof BeamConfig) { + BeamConfig beamConfig = (BeamConfig) t._2; + + controlerConfigGroup.setWritePlansInterval(beamConfig.beam().physsim().writePlansInterval()); + linkStatsConfigGroup.setWriteLinkStatsInterval(beamConfig.matsim().modules().linkStats().writeLinkStatsInterval()); + } + } } } diff --git a/src/main/scala/beam/router/BeamSkimmer.scala b/src/main/scala/beam/router/BeamSkimmer.scala index b9bbd59b17e..91155929c4a 100644 --- a/src/main/scala/beam/router/BeamSkimmer.scala +++ b/src/main/scala/beam/router/BeamSkimmer.scala @@ -53,7 +53,7 @@ class BeamSkimmer @Inject()( private var skims: BeamSkimmerADT = TrieMap() private def skimsFilePath: Option[String] = { - val filePath = beamScenario.beamConfig.beam.warmStart.skimsFilePath + val filePath = beamConfig.beam.warmStart.skimsFilePath if (new File(filePath).isFile) { Some(filePath) } else { @@ -385,7 +385,7 @@ class BeamSkimmer @Inject()( BeamSkimmer.excerptSkimsFileBaseName + ".csv.gz" ) val dummyId = Id.create( - beamScenario.beamConfig.beam.agentsim.agents.rideHail.initialization.procedural.vehicleTypeId, + beamConfig.beam.agentsim.agents.rideHail.initialization.procedural.vehicleTypeId, classOf[BeamVehicleType] ) val writer = IOUtils.getBufferedWriter(filePath) @@ -444,7 +444,7 @@ class BeamSkimmer @Inject()( val uniqueTimeBins = 0 to 23 val dummyId = Id.create( - beamScenario.beamConfig.beam.agentsim.agents.rideHail.initialization.procedural.vehicleTypeId, + beamConfig.beam.agentsim.agents.rideHail.initialization.procedural.vehicleTypeId, classOf[BeamVehicleType] ) @@ -513,7 +513,7 @@ class BeamSkimmer @Inject()( initialPreviousSkimsPlus() private var skimsPlus: TrieMap[BeamSkimmerPlusKey, Double] = TrieMap() private def skimsPlusFilePath: Option[String] = { - val filePath = beamScenario.beamConfig.beam.warmStart.skimsPlusFilePath + val filePath = beamConfig.beam.warmStart.skimsPlusFilePath if (new File(filePath).isFile) { Some(filePath) } else { @@ -561,7 +561,13 @@ class BeamSkimmer @Inject()( skimsPlus.put(key, skimsPlus.getOrElse(key, 0.0) + count.toDouble) } - def addValue(curBin: Int, tazId: Id[TAZ], vehicleManager: Id[VehicleManager], label: Label, value: Double) = { + def addValue( + curBin: Int, + tazId: Id[TAZ], + vehicleManager: Id[VehicleManager], + label: Label, + value: Double + ): Option[Double] = { if (curBin > trackSkimsPlusTS) trackSkimsPlusTS = curBin val key = (trackSkimsPlusTS, tazId, vehicleManager, label) skimsPlus.put(key, skimsPlus.getOrElse(key, 0.0) + value) From ee2a05d8785323f4c653a56cb5d74667e9f96068 Mon Sep 17 00:00:00 2001 From: Nikolay Ilin Date: Wed, 11 Sep 2019 19:12:34 +0300 Subject: [PATCH 23/23] fmt --- src/main/scala/beam/sim/config/BeamConfig.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/beam/sim/config/BeamConfig.scala b/src/main/scala/beam/sim/config/BeamConfig.scala index 3d9fff6bcbc..4f18dd2f3d0 100755 --- a/src/main/scala/beam/sim/config/BeamConfig.scala +++ b/src/main/scala/beam/sim/config/BeamConfig.scala @@ -1,5 +1,5 @@ // generated by tscfg 0.9.4 on Fri Sep 06 01:02:36 EDT 2019 - +// source: src/main/resources/beam-template.conf package beam.sim.config