wsp-sag / network_wrangler

A Python Library for Managing Travel Model Network Scenarios
https://wsp-sag.github.io/network_wrangler/
Apache License 2.0
13 stars 3 forks source link

[BUG] Dependency sort does not work properly when a project is the repreq for more than one other projects #341

Closed i-am-sijia closed 3 weeks ago

i-am-sijia commented 5 months ago

Describe the bug

From Rachel:

My 2050 build scenario is still spinning but I’m noticing an issue with the project card order that is ignoring pre-reqs.

I have two managed lanes projects (94 NB and 94 SB) that use links created in another project card (mn252 hwy conversion). I set this highway project as a pre-req for both managed lanes. But 94 NB Mnpass ran before the mn252 card, ignoring the pre-req. The 94SB card ran after, correctly following the prereq. The pre-reqs look identical, so I’m confused why this might be. Any idea? I’m hoping when I review outputs tomorrow this won’t be an issue but based on this output message I’m guessing my NB lane will be missing segments.

Full output copied below, important sections highlighted image

To Reproduce

Steps to reproduce the behavior:

  1. Sijia reproduced Rachel's error by using this notebook

Triggering line of code

https://github.com/wsp-sag/network_wrangler/blob/8fa7698d6e9d2348bb537a25dfa63fd61bb43cc3/network_wrangler/scenario.py#L473-L486

Thoughts on resolution

The sorting pre-req code is not treat more than one dependent card properly. Instead of overwriting the adjacent_list, it should append. The error is on line 481.

Full stack trace

Environment

Operating system: Win64 Context (conda, jupyter, etc): Environment (e.g. output from conda list): Lasso: develop_with_ranch Wrangler: develop_with_ranch

fyi: @RachelWikenMC

i-am-sijia commented 5 months ago

I tested the code fix locally and it's working. We will close this issue once Rachel confirms this is working for her.

e-lo commented 3 weeks ago

Implemented in selection-refactor branch as https://github.com/wsp-sag/network_wrangler/commit/5bf40e663ff893ce9e3ba4b4ebdd36a993f532c5