You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the python interface, calling getSolution() gives an object with native python lists instead of numpy arrays:
col_value
col_dual
row_value
row_dual
I expect most users will after convert these to numpy arrays for further processing. In my use cases, column generation, this actually results in a small but noticeable performance decrease.
Considering during model construction we also pass numpy arrays, I think it would be both more consistent and desired to also get numpy arrays from these outputs.
Not sure if implementing it in highspy you can actually do it in a more efficient way then just doing np.array() though.
The text was updated successfully, but these errors were encountered:
In short, I don't know whether we can return anything other than native python lists when using pybind11 to create a Python interface. We're not pybind11 experts.
We're talking to the person who created the prototype of highspy tomorrow, so I'll flag it up
This could be done on the c++ side by creating a new solution object for the python interface, but it would still require copying the std::vectors into arrays. That is probably faster than creating a python list and then converting it to a numpy array, but I'd be surprised if it was significantly faster. I can give it a go (probably in a couple of weeks).
Enchancement idea:
When using the python interface, calling
getSolution()
gives an object with native python lists instead of numpy arrays:I expect most users will after convert these to numpy arrays for further processing. In my use cases, column generation, this actually results in a small but noticeable performance decrease.
Considering during model construction we also pass numpy arrays, I think it would be both more consistent and desired to also get numpy arrays from these outputs.
Not sure if implementing it in highspy you can actually do it in a more efficient way then just doing np.array() though.
The text was updated successfully, but these errors were encountered: