# Warning, invalid warm-start basis discarded

**URL:** <https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [July 16, 2019, 5:12am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403 "2019-07-16T05:12:49Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qun](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@Qun](https://discourse.julialang.org/u/Qun)\
**Post date:** [July 16, 2019, 5:12am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/1 "2019-07-16T05:12:49Z")

</div>

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  
myModel=Model(with\_optimizer(Gurobi.Optimizer))  
@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  
vars=all\_variables(myModel)  
vals=[2,2,12,1,0,0]  
set\_start\_value.(vars,vals)  
optimize!(myModel)  
@show termination\_status(myModel) == MOI.OPTIMAL  
@show primal\_status(myModel) == MOI.FEASIBLE\_POINT  
has\_values(myModel)  
value.(vars)

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 16, 2019, 1:48pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/2 "2019-07-16T13:48:30Z")

</div>

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](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](https://github.com/JuliaOpt/Gurobi.jl/issues/225)

---

<div class="post-metadata">

**Author:** ![Qun](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@Qun](https://discourse.julialang.org/u/Qun)\
**Post date:** [July 17, 2019, 12:06am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/3 "2019-07-17T00:06:13Z")

</div>

Thank you very much for your help and time.

---

<div class="post-metadata">

**Author:** ![Qun](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@Qun](https://discourse.julialang.org/u/Qun)\
**Post date:** [July 17, 2019, 12:33am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/4 "2019-07-17T00:33:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [July 21, 2019, 12:10pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/5 "2019-07-21T12:10:05Z")

</div>

This is known to be broken in CPLEX, Cbc, and GLPK as well. See  
[https://github.com/JuliaOpt/GLPK.jl/pull/101](https://github.com/JuliaOpt/GLPK.jl/pull/101)  
[https://github.com/JuliaOpt/Cbc.jl/issues/114](https://github.com/JuliaOpt/Cbc.jl/issues/114)  
[https://github.com/JuliaOpt/CPLEX.jl/issues/243](https://github.com/JuliaOpt/CPLEX.jl/issues/243)

---

<div class="post-metadata">

**Author:** ![Qun](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@Qun](https://discourse.julialang.org/u/Qun)\
**Post date:** [July 22, 2019, 6:45am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/6 "2019-07-22T06:45:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [July 23, 2019, 2:09pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/7 "2019-07-23T14:09:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Qun](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@Qun](https://discourse.julialang.org/u/Qun)\
**Post date:** [July 24, 2019, 1:13am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/8 "2019-07-24T01:13:41Z")

</div>

Thanks. That is a great news.

---

<div class="post-metadata">

**Author:** ![ibabeo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ibabeo/32/9788_2.png) [@ibabeo](https://discourse.julialang.org/u/ibabeo)\
**Post date:** [August 16, 2019, 2:15pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/9 "2019-08-16T14:15:54Z")

</div>

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

```julia
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)
	set_start_value(x[1],1)
	set_start_value(x[2],0)
	set_start_value(x[3],0)
	set_start_value(x[4],0)
	set_start_value(x[5],0)
    # Objective: maximize profit
    @objective(model, Max, profit' * x)
    # Constraint: can carry all
    @constraint(model, weight' * x <= capacity)
    # Solve problem using MIP solver
    JuMP.optimize!(model)
    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])
        end
    end
    @test JuMP.termination_status(model) == MOI.OPTIMAL
    @test JuMP.primal_status(model) == MOI.FEASIBLE_POINT
    @test JuMP.objective_value(model) == 16.0
end

example_knapsack()

```

And the output is like this:

```julia
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

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 16, 2019, 2:58pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/10 "2019-08-16T14:58:54Z")

</div>

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](https://github.com/JuliaOpt/JuMP.jl/pull/2003)

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

---

<div class="post-metadata">

**Author:** ![ibabeo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ibabeo/32/9788_2.png) [@ibabeo](https://discourse.julialang.org/u/ibabeo)\
**Post date:** [August 16, 2019, 3:07pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/11 "2019-08-16T15:07:18Z")

</div>

That’s great. Thanks 😊

---

<div class="post-metadata">

**Author:** ![ibabeo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ibabeo/32/9788_2.png) [@ibabeo](https://discourse.julialang.org/u/ibabeo)\
**Post date:** [August 26, 2019, 6:55pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/12 "2019-08-26T18:55:49Z")

</div>

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?

```julia
┌ 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

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 26, 2019, 7:09pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/13 "2019-08-26T19:09:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 27, 2019, 2:19pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/14 "2019-08-27T14:19:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ibabeo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ibabeo/32/9788_2.png) [@ibabeo](https://discourse.julialang.org/u/ibabeo)\
**Post date:** [August 27, 2019, 3:13pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/15 "2019-08-27T15:13:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Qun](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@Qun](https://discourse.julialang.org/u/Qun)\
**Post date:** [August 28, 2019, 8:53am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/16 "2019-08-28T08:53:55Z")

</div>

That’s great.

---

<div class="post-metadata">

**Author:** ![azberman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/azberman/32/8213_2.png) [@azberman](https://discourse.julialang.org/u/azberman)\
**Post date:** [March 19, 2020, 1:34am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/17 "2020-03-19T01:34:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [March 19, 2020, 4:17pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/18 "2020-03-19T16:17:14Z")

</div>

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 🙂

Before you do, take a read of the first post in [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757).

---

<div class="post-metadata">

**Author:** ![azberman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/azberman/32/8213_2.png) [@azberman](https://discourse.julialang.org/u/azberman)\
**Post date:** [March 19, 2020, 8:02pm UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/19 "2020-03-19T20:02:26Z")

</div>

Thanks @odow! Please see the following new post: [Warm Starts in JuMP 0.21 & GLPK 0.12.1](https://discourse.julialang.org/t/warm-starts-in-jump-0-21-glpk-0-12-1/36223)
