Dear folks,
I try to call CPXcallbackgetinfoint within a callback but unfortunately fail to do so. From what I could extract from the source code of the CPLEX package, it should work something like this:
function myCallback( cb_data::CPLEX.CallbackContext )
data_p = Ref{Cint}()
ret = CPLEX.@cpx_ccall(callbackgetinfoint, Cint,
(Ptr{Cvoid}, Cint, Ref{Cint}),
cb_data, 1, data_p) # "1" should correspond to CPXCALLBACKINFO_NODECOUNT
mydata = data_p[]
println("$mydata")
do_something_else( cb_data )
return
end
MOI.set( model, MOI.UserCutCallback(), myCallback ) #"model" is a JuMP model
Unfortunatly this throws an error stating MethodError(Base.unsafe_convert, ...)
.
Any ideas how to call such functions correctly? Thank you very much in advance!
I use:
JuMP.jl v0.21.2
,
CPLEX.jl v0.6.5
MathOptInterface.jl v0.9.13
CPLEX 12.9