Trouble trying to serialize JuMP Models to .mps, .lp, .rew formats

I am trying to serialize JuMP Models to .mps, .lp, .rew formats via write_to_file method. But I am facing the same error with all three conversion while the .nl conversion is successful:

MathOptInterface.UnsupportedConstraint{MathOptInterface.ScalarNonlinearFunction, MathOptInterface.EqualTo{Float64}}: MathOptInterface.ScalarNonlinearFunction-in-MathOptInterface.EqualTo{Float64} constraint is not supported by the model.

The models that I am using are PGLIB models instantiated as JuMP models.

Would appreciate any support/insight. Thanks!

Hi @gangway, welcome to the forum!

It looks like your model has a nonlinear equality constraint.

The .mps, .lp, and .rew file formats do not support nonlinear constraints, so you cannot write this model to one of those file formats.

1 Like

I read
Gurobi AddGenConstrPoly() in JuMP

Since my main objective is to solve these models to solve using Gurobi, but trying to solve this JuMP model directly with Gurobi.Optimizer generates the same error.
Is there any way to bypass this error by working with Gurobi C api during direct_model()?
I tried:
model = direct_model(Gurobi.Optimizer())
instantiate model(filepath, model) #To load the model
JuMP.optimize!(model)

It runs and log indicate that Gurobi is being used, terminal status is 1 but objective function is zero.

“Barrier solved model in 0 iterations and 0.01 seconds (0.00 work units)
Optimal objective 0.00000000e+00.”

The model works perfectly well with Ipopt and other solvers.

You cannot read a model from file that contains nonlinear constraints and pass it to Gurobi. You must build it manually.

Gurobi are working on an upcoming version that will support this, but it isn’t ready yet. Perhaps in 6 or 12 months :slight_smile:

1 Like