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

VehicleRestriction could absorb road class and turn restrictions #208

Open
nreinicke opened this issue May 10, 2024 · 1 comment
Open

VehicleRestriction could absorb road class and turn restrictions #208

nreinicke opened this issue May 10, 2024 · 1 comment
Labels
rust Applies to the rust code

Comments

@nreinicke
Copy link
Collaborator

PR #204 introduced the concept of the VehicleRestriction.

@robfitzgerald points out that:

if you think about it, the mechanism for these restrictions is the same as the turn restrictions and road class restrictions. we could just absorb them here:

pub enum VehicleRestriction {
    MaximumTotalWeight((Weight, WeightUnit)),
    MaximumWeightPerAxle((Weight, WeightUnit)),
    MaximumLength((Distance, DistanceUnit)),
    MaximumWidth((Distance, DistanceUnit)),
    MaximumHeight((Distance, DistanceUnit)),
    MaximumTrailerLength((Distance, DistanceUnit)),
    RoadClass(u8),
    TurnRestriction(EdgeId, EdgeId)
}

then we generalize VehicleParameter to RestrictionParameter. A RoadClass restriction parameter is a RoadClass(HashSet(u8)) or whatever deserialized off the query. it would tidy things up since they all have the same logic

@nreinicke nreinicke added the rust Applies to the rust code label May 10, 2024
@robfitzgerald
Copy link
Collaborator

note: wrote this, then talked myself out of it, leaving it here for posterity.

had a thought about this. still thinking that the right path is an enum. wondering if there's a smart way to do this more generally, since we are proposing this work in the base repo. could we reduce the above into:

#[derive(Serialize, Deserialize)]
pub enum VehicleRestriction {
    EdgeWeightRestriction(???),
    EdgeDistanceRestriction(???),
    // ... other units
    NumericClassRestriction(u8),
    TrajectoryRestriction(Vec<EdgeId>)
}

downstream, a user could compose these as a CombinedFrontierModel.

thing is, that stuff in the ??? would need to be open enough in it's design to handle things like "expect a number on the query at the key axles, then multiply that by a key weight, and then do a <= operation."

eh, that's writing a whole nuther DSL, and it sounds awesome, but maybe that's future work to revisit later.

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

No branches or pull requests

2 participants