-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reads from csv file, skips vehicleAdjustment(No-Op), generates beam v… #3603
base: develop
Are you sure you want to change the base?
Reads from csv file, skips vehicleAdjustment(No-Op), generates beam v… #3603
Conversation
…ehicles from vehicleInfo and binds to household Able to run with: gradle :run -PappArgs="['--config', 'test/input/beamville/beam-urbansimv2-static.conf']" Config difference: beam.agentsim.agents.vehicles.vehiclesFilePath = ${beam.inputDirectory}"/vehicles-test.csv" beam.agentsim.agents.vehicles.vehicleAdjustmentMethod = "STATIC_FROM_FILE"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to change the implementation to make it simpler.
Also, after the changes are made - let's run gradle command 'fmt', it will format the source code files.
src/main/scala/beam/utils/scenario/UrbanSimScenarioLoader.scala
Outdated
Show resolved
Hide resolved
src/main/scala/beam/utils/scenario/UrbanSimScenarioLoader.scala
Outdated
Show resolved
Hide resolved
src/main/scala/beam/utils/scenario/UrbanSimScenarioLoader.scala
Outdated
Show resolved
Hide resolved
include "../common/akka.conf" | ||
include "../common/metrics.conf" | ||
include "../common/matsim.conf" | ||
|
||
beam.agentsim.simulationName = "beamville-urbansimv2_input" | ||
beam.agentsim.agentSampleSizeAsFractionOfPopulation = 1.0 | ||
beam.agentsim.firstIteration = 0 | ||
beam.agentsim.lastIteration = 0 | ||
|
||
beam.agentsim.thresholdForWalkingInMeters = 100 | ||
beam.agentsim.thresholdForMakingParkingChoiceInMeters = 100 | ||
beam.agentsim.schedulerParallelismWindow = 30 | ||
beam.agentsim.timeBinSize = 3600 | ||
beam.agentsim.startTime = "00:00:00" | ||
beam.agentsim.endTime = "30:00:00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to create a config file that has only few config values different there is no need to copy all the content, you migh just include the base config file in the beginning and then put into config file only the config keys you want to change.
For example - test/input/beamville/beam-csv.conf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the new vehicle adjustment class a bit, the rest looks good to me
vehicles = readVechiclesFromFile() | ||
vehicleTypesMap = beamScenario.vehicleTypes.map(i => i._1 -> i._2).toMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put these rows as first rows (14-15) in the class and replace 'var' with 'val' to emphasize these values are not to be replaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the test a bit, the rest look good
ConfigFactory | ||
.parseString(s""" | ||
|beam.agentsim.simulationName = "beamville-urbansimv2_static" | ||
|beam.agentsim.agents.vehicles.vehiclesFilePath = $${beam.inputDirectory}"/vehicles-test.csv" | ||
|beam.agentsim.agents.vehicles.vehicleAdjustmentMethod = "STATIC_FROM_FILE" | ||
""".stripMargin) | ||
.withFallback(testConfig("test/input/beamville/beam-urbansimv2.conf")) | ||
.resolve() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's put this config initialization inside the test, no need to create external variable for a test
vehiclesBelongToSpecificHousehold.count(x => x.beamVehicleType.id.compareTo( | ||
Id.create("Bicycle", classOf[BeamVehicleType]) | ||
) == 0) shouldBe 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use equal
instead of compareTo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
test! |
1 similar comment
test! |
…ehicles from vehicleInfo and binds to household
Able to run with:
gradle :run -PappArgs="['--config', 'test/input/beamville/beam-urbansimv2-static.conf']"
Config difference:
beam.agentsim.agents.vehicles.vehiclesFilePath = ${beam.inputDirectory}"/vehicles-test.csv"
beam.agentsim.agents.vehicles.vehicleAdjustmentMethod = "STATIC_FROM_FILE"
This change is