CyLP
CyLP copied to clipboard
add primalColumnSolution and dualColumnSolution properties
For improved performance, adding 2 new properties
- primalColumnSolution as alternative to 'primalVariableSolution'
- dualColumnSolution as alternative to 'dualVariableSolution'
These 2 new properties allow solution data to be retrieved as single numpy array, instead of the dictionary format provided by primalVariableSolution and dualVariableSolution.
This provides better performance when solution as numpy array is all that is required.
Further details: The small models, the properties primalVariableSolution and dualVariableSolution can take significant time to return data.
Below is example output showing the overhead of calling primalVariableSolution and dualVariableSolution If I could use primalColumnSolution and dualColumnSolution instead, that overhead of 13.9 seconds would disappear
0.322 seconds to add 364560 vars to model 0.005 seconds to add 7440 constraints to model 0.018 seconds to add objective to model 0.766 seconds to solve model 13.903 seconds to get solution using primalVariableSolution and dualVariableSolution
Do I need to do anything else for this PR to be accepted?
You had said you would add some tests, but I'm sure you noticed that the existing tests are not that well-maintained and I haven't taken the time to set up automated testing yet (on the list). This is a side project that I don't have a lot of bandwidth for. But if you could add a test or at least paste in a script I could run for minimal verification here, I would try to build this PR and ensure everything looks OK.
@tkralphs I have added a test for the new properties
Thank you very much for the work you do on this project. It's very much appreciated
@tkralphs Do you require anything else for this PR ?