Hi all
I’ve got some issues in adapting to the new Gurobi.jl syntax.
For example, this is a callback that I made in the old syntax:
function cb(cb_data, cb_where)
if cb_where == CB_MIPNODE
#first node
if cbget_mipnode_nodcnt(cb_data, cb_where) == 0
#Pegando a relaxação linear de todas as variáveis
linear_rel = cbget_mipnode_rel(cb_data, cb_where)
tam = length(linear_rel)-(n+1)
aux = linear_rel[1:tam]
#Graph
flow_graph = DiGraph(n+1)
capacity_matrix = zeros(n+1, n+1)
for j in 1:n
for i in 1:n+1
if aux[(j-1)*(n+1) + i] > g_params.EPS
add_edge!(flow_graph, i, j)
capacity_matrix[i,j] = aux[(j-1)*(n+1) + i]
end
end
end
end
end
I would like to transform that one to the new syntax. For the “nodcnt” I managed to adapt using
resultP = Ref {Cint} ()
GRBcbget (cb_data, cb_where, GRB_CB_MIPNODE_NODCNT, resultP)
However, I’m having issues to query the linear relaxation values
Error like these is happening:
signal (11): Segmentation fault
in expression starting at /PATH/TO/EXAMPLE.jl 88
cb at /home/afazevedo/Documentos/dissertacao/src/bc.jl:47
unknown function (ip: 0x7fffffffffffffff)
Allocations: 176939438 (Pool: 176893431; Big: 46007); GC: 148
I imagine it has to do with allocation and pointers, but I don’t know how to solve it.
Can anyone help me?
Thanks in advance!