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

Validate dispatcher valid_dispatch_states on input #104

Open
nreinicke opened this issue Oct 27, 2022 · 1 comment
Open

Validate dispatcher valid_dispatch_states on input #104

nreinicke opened this issue Oct 27, 2022 · 1 comment
Labels
good first issue Good for newcomers
Milestone

Comments

@nreinicke
Copy link
Collaborator

I recently added this to the manhattan.yaml scenario file:

dispatcher:
  valid_dispatch_states:
    - idle
    - repositioning
    - reserve_base 

The model ran without complaint but the true value for reserve_base should have been reservebase.

We should validate these inputs and compare them to our list of vehicle state names, only accepting valid names.

@nreinicke nreinicke added this to the PyCon 2023 milestone Apr 11, 2023
@nreinicke
Copy link
Collaborator Author

Here is where the strings get loaded from the input configurations and a good candidate for validating them:

d["valid_dispatch_states"] = tuple(s.lower() for s in d["valid_dispatch_states"])

These strings should be converted into a VehicleStateType. It probably makes sense to add a from_string classmethod to that enum while we're at it (similar to this).

Then, we'll need to update the dispatcher at this following location to use the vehicle.vehicle_state.vehicle_state_type when looking in the environment.config.dispatcher.valid_dispatch_states:

vehicle_state_str = vehicle.vehicle_state.__class__.__name__.lower()

@nreinicke nreinicke added the good first issue Good for newcomers label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant