Skip to content

Commit

Permalink
Update callbacks.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Dec 30, 2024
1 parent caa56b1 commit c267aed
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ primal solution available from [`callback_value`](@ref) is integer feasible.
julia> import Gurobi
julia> model = Model(Gurobi.Optimizer);
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 722777
Set parameter GURO_PAR_SPECIAL
WLS license 722777 - registered to JuMP Development
julia> set_silent(model)
Expand All @@ -29,17 +34,17 @@ julia> @objective(model, Max, x);
julia> function my_callback_function(cb_data, cb_where)
status = callback_node_status(cb_data, model)
println("Status is: ", status)
if status == MOI.CALLBACK_NODE_STATUS_INTEGER
println("Status is: ", status)
end
return
end
my_callback_function (generic function with 1 method)
julia> set_attribute(model, Gurobi.CallbackFunction(), my_callback_function)
julia> optimize!(model)
Status is: CALLBACK_NODE_STATUS_UNKNOWN
Status is: CALLBACK_NODE_STATUS_INTEGER
Status is: CALLBACK_NODE_STATUS_UNKNOWN
```
"""
function callback_node_status(cb_data, model::GenericModel)
Expand Down Expand Up @@ -72,6 +77,11 @@ Use [`callback_node_status`](@ref) to check whether a solution is available.
julia> import Gurobi
julia> model = Model(Gurobi.Optimizer);
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 722777
Set parameter GURO_PAR_SPECIAL
WLS license 722777 - registered to JuMP Development
julia> set_silent(model)
Expand Down

0 comments on commit c267aed

Please sign in to comment.