I’m trying something like
using JuMP
import Gurobi
grb_model = Gurobi.Optimizer()
Gurobi.GRBreadmodel(
grb_model.env,
"foo.lp",
Ptr{Gurobi.GRBmodel}(pointer_from_objref(grb_model))
)
model = direct_model(grb_model)
I can call optimize!(model)
on that (which works), but the model
itself (obviously?) remains empty (the obj
comes from the “name” in the LP file, which seems to be properly set as ModelName
):
obj
Feasibility problem with:
Variables: 0
Model mode: DIRECT
Solver name: Gurobi
The optimizer shows the loaded problem:
julia> backend(model)
sense : minimize
number of variables = 464326
number of linear constraints = 586972
number of quadratic constraints = 0
number of sos constraints = 0
number of non-zero coeffs = 1490227
number of non-zero qp objective terms = 0
number of non-zero qp constraint terms = 0
Is there any way to use GRBreadmodel
and then “easily” reconstruct an “equivalent” JuMP
model (without manually checking each potentially existing “thing”, like GRBgetvars
, …)?
I kinda tried too many different ways but all of them failed… Thanks!
If that sounds weird, the actual use case would have been to use Gurobi as an efficient LP file reader (which I know sounds absurd, but I did not manage to make read_from_file
work, and thought it would be a quick workaround before re-implementing some parts of that manually - the main culprit seems to be the string(...)
call in LP.jl as far as a quick profiling revealed).