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

Jl/update ridehail surge #3740

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
Draft

Jl/update ridehail surge #3740

wants to merge 11 commits into from

Conversation

jlaz
Copy link
Collaborator

@jlaz jlaz commented Apr 12, 2023

Updating surge pricing to work for multiple ridehail managers.

@jlaz jlaz marked this pull request as draft April 13, 2023 21:09
@@ -27,7 +27,7 @@ public class RideHailRevenueAnalysis implements ControlerListener, IterationEnds
private final Logger log = LoggerFactory.getLogger(RideHailRevenueAnalysis.class);

private final RideHailSurgePricingManager surgePricingManager;
static final String fileBaseName = "rideHailRevenue";
static final String fileBaseName = "rideHailRevenue_%s";
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 avoid putting formatting into the variable, instead let's use it in the string.format method directly, this will improve readability

Comment on lines +14 to +18
class RideHailSurgePricingManager @Inject() (
val beamConfig: BeamConfig,
val beamScenario: BeamScenario,
val managerName: String
) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using constant link to beamConfig will prevent automatic updates of config in case it was changed during a simulation, instead it is better to get the latest version of config from the beamServices object each time or manually subscribe to changes of beamConfig and updating it each time.

There is the same issue for the any config values that are stored in variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see. The issue here is that beamServices is initialized after RideHailSurgePricingManager. And since I am initializing a map of multiple RideHailSurgePricingManager objects, I needed to actually initialize each one, which would error without access to beamServices. @nikolayilyin do you have any suggestions for alternative approaches?

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.

2 participants