arup-group / genet

Manipulate MATSim networks via a Python API.
MIT License
45 stars 9 forks source link

Fix references to stop names changing during snapping+routing #225

Closed KasiaKoz closed 10 months ago

KasiaKoz commented 10 months ago

Fixes #224

@brynpickering - maybe you know of a better way of pulling results out from a pyomo model? (Bearing in mind I want to test this without having to mock loads of objects...)

brynpickering commented 10 months ago

How about pd.Series(variable.extract_values())? that's what we use in calliope

KasiaKoz commented 10 months ago

I pulled out the entire code block that processes the model for solution variables - I didn't want to do it initially, because I really didn't want to mock loads of objects, but it turned out to not be that bad at all (no need to even use mocker). I noticed there was a dedicated method to get the index of the variable, which is much cleaner than processing the string representation of the variable. I hope the method and test names look a lot better now too - let me know what you think @mfitz !