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

Add turn restriction frontier model #94

Closed
nreinicke opened this issue Jan 2, 2024 · 0 comments
Closed

Add turn restriction frontier model #94

nreinicke opened this issue Jan 2, 2024 · 0 comments

Comments

@nreinicke
Copy link
Collaborator

To capture turn restrictions, we need a new frontier model that can restrict links where a turn restriction is present (like no left turn or no u-turn). The restriction can be represented as a tuple of edge ids where if an edge id tuples exists in the set of all turn restrictions, the model should return an invalid frontier.

Our current frontier model trait will need to be expanded to include the previous edge in scope:

pub trait FrontierModel: Send + Sync {
    fn valid_frontier(
        &self,
        _edge: &Edge,
        _state: &TraversalState,
        _previous_edge: Option<&Edge>,
    ) -> Result<bool, FrontierModelError> {
        Ok(true)
    }
}

In addition, it might make sense to allow chaining of frontier models so a user can easily define what restrictions are desired at configuration time. This should be as simple as making the frontier model type go from: Arc<dyn FrontierModel> to &[Arc<dyn FrontierModel>] and omitting a link from the search if any of the models return an invalid frontier.

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

No branches or pull requests

1 participant