Warning, invalid warm-start basis discarded

I just learned how to use Julia 3 weeks ago. I used to use AIMMS to solve MIP problems. The considered MIP problem is about vehicle route problem. It involves over 50,000 binary variable. Without giving initial solution, the solver cannot even find an initial solution. I have a method to find a feasible solution. I also find a way to check the feasibility of the initial solution. Now the problem is how to feed the initial solution to the model. I use the following simple example to learn whether the initial solution is accepted by the solver or not. However, it seems that it doesn’t work. It will be great if some one can help me or point me to some direction that I can learn how to do that.

using JuMP
using MathOptInterface
using Gurobi
@variable(myModel, x, Int)
@variable(myModel, y, Int)
@variable(myModel, z>=0)
@variable(myModel, e[1:3], Bin)
@constraint(myModel,con1, 2x+3y<=10)
@constraint(myModel,con2, 3x+2y<=12)
@constraint(myModel,con3, z==2x+4y)
@constraint(myModel,con4, x>=y)
@constraint(myModel, con5, sum(e)==1)
@objective(myModel, Max,z)
@show myModel
@show termination_status(myModel) == MOI.OPTIMAL
@show primal_status(myModel) == MOI.FEASIBLE_POINT

I can reproduce this. There is a bug in the Gurobi wrapper. This is fixed in the re-write of the Gurobi wrapper (https://github.com/JuliaOpt/Gurobi.jl/pull/216). I don’t have a good work-around at present.

Edit: I’ve opened an issue: https://github.com/JuliaOpt/Gurobi.jl/issues/225

Thank you very much for your help and time.

I got a similar warning, “Warning: MathOptInterface.variablePrimalStart() is not supported by MathOptInterface.Bridges.LazyBridgeOptimizer…”, when I use CPLEX, Cbc, and GLPK.

This is known to be broken in CPLEX, Cbc, and GLPK as well. See

Is there any way to get around this issue (find some way to pass initial value to the solver)? For a very large scale problem, without providing an initial solution, the solver even cannot find a feasible solution. It will be great if you can point me to some right direction if there is a way to do so. Otherwise, I might have to go back to AIMMS.

1 Like

I expect we’ll release fixes for these issues within a few weeks. In the meantime warmstarts are working correctly with JuMP 0.18.

Thanks. That is a great news.

Hi Oscar, I’m wondering how is the status of the Gurobi wrapper. I also need a warm start for my model however it tells me the same msg. And I tested it on a simple knapsack case which gave me the same msg. Do you have any idea why is this? Thanks

using JuMP,  Gurobi, Test, MathOptInterface
function example_knapsack(; verbose = true)
    profit = [5, 3, 2, 7, 4]
    weight = [2, 8, 4, 2, 5]
    capacity = 10
    model = Model(with_optimizer(Gurobi.Optimizer, Presolve=0, Heuristics=0.0, Cuts=0))
    @variable(model, x[1:5], Bin)
    # Objective: maximize profit
    @objective(model, Max, profit' * x)
    # Constraint: can carry all
    @constraint(model, weight' * x <= capacity)
    # Solve problem using MIP solver
    if verbose
        println("Objective is: ", JuMP.objective_value(model))
        println("Solution is:")
        for i in 1:5
            print("x[$i] = ", JuMP.value(x[i]))
            println(", p[$i]/w[$i] = ", profit[i] / weight[i])
    @test JuMP.termination_status(model) == MOI.OPTIMAL
    @test JuMP.primal_status(model) == MOI.FEASIBLE_POINT
    @test JuMP.objective_value(model) == 16.0


And the output is like this:

Academic license - for non-commercial use only
Warning, invalid warm-start basis discarded
Optimize a model with 1 rows, 5 columns and 5 nonzeros
Variable types: 0 continuous, 5 integer (5 binary)
Coefficient statistics:
  Matrix range     [2e+00, 8e+00]
  Objective range  [2e+00, 7e+00]
  Bounds range     [0e+00, 0e+00]
  RHS range        [1e+01, 1e+01]
Variable types: 0 continuous, 5 integer (5 binary)

Root relaxation: objective 1.650000e+01, 1 iterations, 0.00 seconds

    Nodes    |    Current Node    |     Objective Bounds      |     Work
 Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time

     0     0   16.50000    0    1          -   16.50000      -     -    0s
     0     0   16.50000    0    1          -   16.50000      -     -    0s
     0     2   16.50000    0    1          -   16.50000      -     -    0s
*    3     0               2      16.0000000   16.00000  0.00%   1.0    0s

Explored 7 nodes (7 simplex iterations) in 0.01 seconds
Thread count was 8 (of 8 available processors)

Solution count 1: 16

Optimal solution found (tolerance 1.00e-04)
Best objective 1.600000000000e+01, best bound 1.600000000000e+01, gap 0.0000%
Objective is: 16.0
Solution is:
x[1] = 1.0, p[1]/w[1] = 2.5
x[2] = -0.0, p[2]/w[2] = 0.375
x[3] = -0.0, p[3]/w[3] = 0.5
x[4] = 1.0, p[4]/w[4] = 3.5
x[5] = 1.0, p[5]/w[5] = 0.8
Test Passed

The re-write of Gurobi is merged. I just tagged. So now we’re just waiting on a new release of JuMP: https://github.com/JuliaOpt/JuMP.jl/pull/2003

I wouldn’t expect that it is too much longer.

That’s great. Thanks :blush:

Hi, I have upgraded to JuMP v0.20.0, MOI v0.9.1 and Gurobi v0.7.0
However I still get this warning with the above code. Do you have any idea what I did wrong?

┌ Warning: MathOptInterface.VariablePrimalStart() is not supported by MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer}. This
│   information will be discarded. = "information will be discarded."
└ @ MathOptInterface.Utilities C:\Users\bj\.julia\packages\MathOptInterface\016Ol\src\Utilities\copy.jl:140Preformatted text

Sorry @ibabeo, there are still a couple of bugs. I have a fix incoming, and will need to tag a new Gurobi release.

1 Like

@ibabeo Its working now with JuMP 0.20, Gurobi 0.7.2, and MathOptInterface 0.9.1. Sorry for the hassle!

1 Like

Amazing :smiley: Thanks for fixing it so fast and letting me know. Really appreciate!

1 Like

That’s great.

I am receiving this error using Cbc, Clp and GLPK with JuMP 0.21.1, MOI 0.9.12. Are there any special work-arounds when using the start option with the @variable macro in JuMP?

Please open a new post, provide a minimal working example that demonstrates the problem, and provide a post of the error that you are seeing :slight_smile:

Before you do, take a read of the first post in Please read: make it easier to help you.

1 Like

Thanks @odow! Please see the following new post: Warm Starts in JuMP 0.21 & GLPK 0.12.1