Here, I have two sets of codes with some trilinear terms. The first one calls Gurobi directly, and the second one is through GAMS.jl. The first one fails, while the second one returns the optimal value:
using JuMP, Gurobi
model = Model(Gurobi.Optimizer)
@variable(model, x, Bin)
@variable(model, 0 <= y <= 1)
@variable(model, 1 <= z <= 2)
@objective(model, Max, x*y*z)
This throws the error: ERROR: The solver does not support an objective function of type MathOptInterface.ScalarNonlinearFunction.
using GAMS, JuMP, Gurobi
model = Model(GAMS.Optimizer)
set_optimizer_attribute(model, GAMS.Solver(), "Gurobi")
@variable(model, x, Bin)
@variable(model, 0 <= y <= 1)
@variable(model, 1 <= z <= 2)
@objective(model, Max, x*y*z)
optimize!(model) # returns 2.0
Is there a way I can use JuMP directly to solve this with Gurobi? I can introduce another variable and split the trilinear term into two quadratic terms, but for my (large) problem, it converges too slowly. So, I wanted to let Gurobi handle the trilinear terms directly and see if it’s any better, hence the question. I am solving a large model and cannot use GAMS. Thanks!
On: Julia 1.10.3
, JuMP 1.22.2
, Gurobi 11.0.2