Replies: 4 comments 6 replies
-
I do consider this worth because as you said "sometimes problems are large and you need more memory" but till that point with the same amount of memory we can do a lot of work id we do not use memory naively. |
Beta Was this translation helpful? Give feedback.
-
See also this comment #855 (comment) |
Beta Was this translation helpful? Give feedback.
-
Once we've finished the thin Python wrapper around the C++ class, so that use of HiGHS from Python will not involve the C interface, this situation will probably ease. However, it has to be stressed that if a model is so large that this extra copy is significant, then HiGHS probably won't be able to solve it (a) because it's so large and (b) because a couple of partial copies of the constraint matrix are made internally as part of the LP solution process. If you really want to cut down on memory use, pass the model to HiGHS and then deallocate the memory at the Python level before calling Highs_run(). If you want the model back, then extract it with Highs_getLp(). The work of moving away from |
Beta Was this translation helpful? Give feedback.
-
I'm not saying to "move away from |
Beta Was this translation helpful? Give feedback.
-
This may be more of a discussion item, but starting here.
We encountered an interesting case of out-of-memory exception when constructing large problems in scipy/scipy#15888. I think while there's not necessarily anything to do about it (sometimes problems are large and you need more memory), in this case it appears it could be helped by not requiring a double allocation of memory (once for the Python C array copies and once for the HiGHS
std::vector
copies).As I observed in the SciPy issue:
I'm curious if there's a possible refactor from using
std::vector
to something able to take ownership of existing memory allocations, most importantly, C arrays. Most interactions between HiGHS and other programming languages (Python, Julia, Fortran, etc.) are usually going to be facilitated through C interfaces. In these use cases, HiGHS will require at least double the amount of memory for a single problem unless another internal container is used which supports copy-less assignment.I'm happy to try a few things if there's an appetite for this kind of overhaul, also wanting to know if you consider this model-creation "optimization" worth the effort
Beta Was this translation helpful? Give feedback.
All reactions