-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C API] Add getters for logfile and output #454
Conversation
One could technically pass |
I tried innumerable variations of this, including passing |
The only thing I found was https://docs.julialang.org/en/v1/base/io-network/#Base.redirect_stdout-Tuple{Function,Any} with which one could always let HiGHS run on stdout and then pipe it to |
But perhaps a better way is to remove the setHighsOutput and setHighsLogfile, rename Highs_runQuiet to Highs_setQuiet, and introduce Highs_unsetQuiet I think this makes it more clear. What do you think @jajhall? |
Output and logging in HiGHS are clearly over-engineered from a user perspective. The "idea" was to allow output and logging to go to different files, if a user so wished.
All this would mean that we get rid of Highs_runQuiet, setHighsOutput and setHighsLogfile, and don't introduce Highs_unsetQuiet, whose behaviour will lead to queries from users. Does it revert to default, or previous settings of output options? |
I agree that setting the output could be a bit simpler. When I tried to do it my first try was to the the message_level option to 0 and was confused that HiGHS still produced output. It would be nice to have a single way of disabling enabling output and remove the output/log file split. Also it would be nice if this option and some other common options like setting limits, solver type to use, would be exposed via an API function in addition to the parameter system. Then there is type safety and the IDE/compiler can give hints about proper usage. Something else that I noticed about the API is that there are unnecessary copies involved sometimes. I changed the API for passModel to receive the model by value, and move assign it to the internal model. This allows me to solve a modified version of a problem by creating a copy, doing the modification and passing it into passModel with std::move to avoid creating another copy. The passing by value is best practice in c++11 when an internal copy of an object is created to leave the choice to the user/caller about wether they still need their copy. |
I don't know what this means. At the moment, options set with calls to setHighsOptionValue have the value checked for being of the right type and within the permitted limits
Again, I don't have the C++ knowledge to comment on this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense until we revise the output/logging in HiGHS
You don't want me to change this to |
No. I chatted to @galabovaa today, and I've agreed to change the logging/output top the Gurobi standard next week, so it can wait. |
Closing because this is now implemented another way. |
I realized I needed this for the Julia interface to be able to restore the output after setting to
NULL
. (Unless @matbesancon knows how to passstdout
from Julia to C?)But perhaps a better way is to remove the
setHighsOutput
andsetHighsLogfile
, renameHighs_runQuiet
toHighs_setQuiet
, and introduceHighs_unsetQuiet
Thoughts?