The output of Gurobi's solution isn't qualified as its own input in terms of feasibility

WalterMadelim
Tue, 11 Nov 2025 05:09:54 +0000
Optimization (Mathematical)

I write decomposition algorithms with the Gurobi solver, so occasionally I need to use Gurobi’s solution as data input to another model, which is also solved by Gurobi. But I find it annoying that the “$THE_TITLE”.

julia> JuMP.owner_model(X[2583].bU_1[29])
A JuMP Model
├ mode: DIRECT
├ solver: Gurobi
├ objective_sense: MIN_SENSE
│ └ objective_function_type: JuMP.AffExpr
├ num_variables: 1080
├ num_constraints: 2025
│ ├ JuMP.AffExpr in MOI.GreaterThan{Float64}: 33
│ ├ JuMP.AffExpr in MOI.LessThan{Float64}: 384
│ ├ JuMP.VariableRef in MOI.GreaterThan{Float64}: 552
│ ├ JuMP.AffExpr in MOI.EqualTo{Float64}: 360
│ ├ JuMP.VariableRef in MOI.ZeroOne: 336
│ └ JuMP.VariableRef in MOI.LessThan{Float64}: 360
└ Names registered in the model
  └ :primobj

julia> JuMP.owner_model(X[2583].bU_1[29]) === inn[2583]
true

julia> let v = X[2583].bU_1[29], m = inn[2583]
           @assert JuMP.is_binary(v)
           JuMP.optimize!(m)
           @assert JuMP.termination_status(m) == JuMP.OPTIMAL
           @assert JuMP.primal_status(m) == JuMP.FEASIBLE_POINT
           println(JuMP.value(v))
       end
Gurobi Optimizer version 12.0.3 build v12.0.3rc0 (linux64 - "Debian GNU/Linux 12 (bookworm)")

CPU model: AMD EPYC 7763 64-Core Processor, instruction set [SSE2|AVX|AVX2]
Thread count: 128 physical cores, 256 logical processors, using up to 1 threads

Non-default parameters:
TimeLimit  300
Threads  1

Optimize a model with 777 rows, 1080 columns and 3959 nonzeros
Model fingerprint: 0x43e59afa
Variable types: 744 continuous, 336 integer (336 binary)
Coefficient statistics:
  Matrix range     [2e-01, 1e+01]
  Objective range  [3e+00, 8e+00]
  Bounds range     [8e+00, 5e+01]
  RHS range        [1e+00, 1e+02]
Presolved: 595 rows, 802 columns, 2940 nonzeros

Continuing optimization...


Cutting planes:
  Gomory: 3
  Cover: 1
  MIR: 30
  Flow cover: 7

Explored 16 nodes (1484 simplex iterations) in 0.00 seconds (0.00 work units)
Thread count was 1 (of 256 available processors)

Solution count 10: 10214.6 10215.7 10215.9 ... 11370.6

Optimal solution found (tolerance 1.00e-04)
Best objective 1.021463213362e+04, best bound 1.021463213362e+04, gap 0.0000%

User-callback calls 37, time in user-callback 0.00 sec
3.1340395433073535e-6

The annoying consequence is that

julia> m = JuMP.Model(Gurobi.Optimizer)

julia> JuMP.@variable(m, x, Int)

julia> JuMP.@constraint(m, x == 3.134e-6)

julia> JuMP.optimize!(m)
Gurobi Optimizer version 12.0.3 build v12.0.3rc0 (linux64 - "Debian GNU/Linux 12 (bookworm)")

Model is infeasible
Best objective -, best bound -, gap -

I guess we need to “rectify” the raw solution from Gurobi somehow…

9 posts - 3 participants