You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typically julia's output (mostly println and minor logging messages) will show in the REPL, but is there a way to redirect gurobi's log into logging too, as Logging and LoggingExtras modules will do.
The text was updated successfully, but these errors were encountered:
I'm not sure if there is an easy way to redirect to Logging.jl, but I guess you could write a solver-specific callback that intercepted all MESSAGE callbacks:
using JuMP, Gurobi
model =Model(Gurobi.Optimizer)
set_optimizer_attribute(model, "LogToConsole", false)
functionmy_callback_function(cb_data, cb_where::Cint)
if cb_where == GRB_CB_MESSAGE
resultP =Ref{Ptr{Cchar}}()
GRBcbget(cb_data, cb_where, GRB_CB_MSG_STRING, resultP)
@infounsafe_string(resultP[])
endreturnend
MOI.set(model, Gurobi.CallbackFunction(), my_callback_function)
julia>optimize!(model)
[ Info: Gurobi Optimizer version 9.5.1 build v9.5.1rc2 (mac64[x86])
[ Info: Thread count:4 physical cores, 8 logical processors, using up to 8 threads
[ Info: Optimize a model with 0 rows, 0 columns and 0 nonzeros
[ Info: Model fingerprint:0xf9715da1
[ Info: Coefficient statistics:
[ Info: Matrix range [0e+00, 0e+00]
[ Info: Objective range [0e+00, 0e+00]
[ Info: Bounds range [0e+00, 0e+00]
[ Info: RHS range [0e+00, 0e+00]
[ Info: Presolve time:0.00s
[ Info: Presolve: All rows and columns removed
[ Info: Iteration Objective Primal Inf. Dual Inf. Time
[ Info:00.0000000e+000.000000e+000.000000e+000s
[ Info:
[ Info: Solved in0 iterations and 0.00 seconds (0.00 work units)
[ Info: Optimal objective 0.000000000e+00
[ Info:
[ Info: User-callback calls 20, time in user-callback 0.03 sec
Typically julia's output (mostly println and minor logging messages) will show in the REPL, but is there a way to redirect gurobi's log into logging too, as
Logging
andLoggingExtras
modules will do.The text was updated successfully, but these errors were encountered: