CyLP icon indicating copy to clipboard operation
CyLP copied to clipboard

add primalColumnSolution and dualColumnSolution properties

Open PaulFlanaganGenscape opened this issue 3 years ago • 5 comments

For improved performance, adding 2 new properties

  1. primalColumnSolution as alternative to 'primalVariableSolution'
  2. 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.

PaulFlanaganGenscape avatar Apr 14 '21 09:04 PaulFlanaganGenscape

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 14 '21 09:04 CLAassistant

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?

PaulFlanaganGenscape avatar Apr 15 '21 12:04 PaulFlanaganGenscape

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 avatar Apr 16 '21 17:04 tkralphs

@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

PaulFlanaganGenscape avatar Apr 20 '21 12:04 PaulFlanaganGenscape

@tkralphs Do you require anything else for this PR ?

PaulFlanaganGenscape avatar Apr 28 '21 08:04 PaulFlanaganGenscape