Replies: 8 comments
-
Or even better:
Returning a pointer to a const string and it's size and then the user should create a copy to store it. |
Beta Was this translation helpful? Give feedback.
-
There is also this related issue #764 |
Beta Was this translation helpful? Give feedback.
-
This is probably the best option. Similar to what is used in Gurobi: In HiGHS.jl I just used an arbitrarily large buffer (1024): I guess we could improve things by having a constant like We also need to be careful not to make a breaking change to the C API. |
Beta Was this translation helpful? Give feedback.
-
I don't think that we need to be careful not to make a breaking change to the C API when it's clearly have issues that will make it difficult to use. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the observation. This has been a feature of the C API for some time, and no-one else has commented on it, so fixing it isn't a priority. Plus, as @odow observes, we'd be making a breaking change to the C API. We'll modify this when we create HiGHS v2.0 |
Beta Was this translation helpful? Give feedback.
-
How often does the user call For most of the options, the strings are short, like HiGHS/src/lp_data/HighsOptions.h Lines 447 to 468 in 0329e0c The arbitrary length strings are the solution file and log file: HiGHS/src/lp_data/HighsOptions.h Lines 635 to 642 in 0329e0c But you control the user calling these, so throw an error if they pass a string longer than 1024 characters (for example). |
Beta Was this translation helpful? Give feedback.
-
In response to #1114 I've written more general C++ methods in the HiGHS class for getting values associated with options. In the C API they work the same way as the Gurobi methods mentioned in #1114 and will soon be in The old get*Value methods are still there, but call the new methods. I've added testing code to |
Beta Was this translation helpful? Give feedback.
-
The methods written in response to #1114 have been merged into |
Beta Was this translation helpful? Give feedback.
-
While trying to use this API
Highs_getStringOptionValue
I noticed that it's not easy or well designed because the user do not know how big the allocation need to be beforehand, probably would be better to return an allocated string instead and the user will be responsible tofree
it.Or maybe add another parameter to pass the allocated size and also to return the string size, so we can check if we have allocated enough or not by checking the
in_out_size
if we get an error:Something like:
Actual implementation:
Beta Was this translation helpful? Give feedback.
All reactions