GetAllDimensionNames and GetDimensions are not iterable (python) #2453
Labels
Bug
Lang: Python
Python wrapper issue
Solver: Routing
Uses the Routing library and the original CP solver
Projects
Milestone
What version of OR-Tools and what language are you using?
Version: 8.1.8487
Language: Python
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
Routing Solver
What operating system (Linux, Windows, ...) and version?
Ubuntu 20.04 (via Windows Subsystem for Linux v2)
What did you do?
I have created a small script that reproduces the error:
The same errors occur when you swap
GetAllDimensionNamesforGetDimensionsas well.What did you expect to see
I would expect these methods to either return a python list containing the dimension names/dimension objects, or some other container with
__iter__and__getitem__methods so that the container can be iterated over or indexed into to retrieve the elements. It looks like someone also ran into this issue in #1417, but it was closed with the recommendation that the user should keep track of the dimensions themselves. I think it would be very convenient to have the ability to inspect the routing model itself rather than having to handle it manually!What did you see instead?
I observed the
TypeErrors mentioned in the comments of the script.Make sure you include information that can help us debug (full error message, model Proto).
Anything else we should know about your project / environment
The text was updated successfully, but these errors were encountered: