Skip to content
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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

alvinlee001
Copy link
Contributor

@alvinlee001 alvinlee001 commented Aug 26, 2022

…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 Reviewable

…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"
Copy link
Collaborator

@nikolayilyin nikolayilyin left a 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.

Comment on lines 1 to 15
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"
Copy link
Collaborator

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

Copy link
Collaborator

@nikolayilyin nikolayilyin left a 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

Comment on lines 52 to 53
vehicles = readVechiclesFromFile()
vehicleTypesMap = beamScenario.vehicleTypes.map(i => i._1 -> i._2).toMap
Copy link
Collaborator

@nikolayilyin nikolayilyin Aug 30, 2022

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.

Copy link
Collaborator

@nikolayilyin nikolayilyin left a 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

Comment on lines 131 to 138
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()
Copy link
Collaborator

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

Comment on lines 120 to 122
vehiclesBelongToSpecificHousehold.count(x => x.beamVehicleType.id.compareTo(
Id.create("Bicycle", classOf[BeamVehicleType])
) == 0) shouldBe 7
Copy link
Collaborator

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

Copy link
Collaborator

@nikolayilyin nikolayilyin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nikolayilyin
Copy link
Collaborator

test!

1 similar comment
@nikolayilyin
Copy link
Collaborator

test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to load vehicles from file for urbansim inputs
2 participants