# How to set tolerance attributes of Gurobi inside Google Colab’s Julia environment

**URL:** https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678
**Category:** Optimization (Mathematical)
**Tags:** question, gurobi
**Created:** [May 4, 2025, 3:41am UTC](https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678 "2025-05-04T03:41:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)
#### Post date: [May 4, 2025, 3:41am UTC](https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678/1 "2025-05-04T03:41:44Z")

</div>

I am dealing with a multi-stage mixed-integer stochastic global supply chain optimization problem and want to solve the stage-wise problem instances using the Gurobi solver within SDDiP algorithm using the [SDDP.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/SDDP) package in Julia.

In this regard, I want to determine the default values of optimality, feasibility, and other tolerance parameters, and how I can set them to achieve good performance in solving the problem.

---

<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: [May 4, 2025, 4:51am UTC](https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678/2 "2025-05-04T04:51:53Z")

</div>

You probably shouldn’t change the default tolerances. Please read [Tolerances and numerical issues · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/getting_started/tolerances/) and change the tolerances only if you understand the implications.

Setting options in SDDP.jl can be done like any JuMP model. See the JuMP documentation: [Models · JuMP](https://jump.dev/JuMP.jl/stable/manual/models/#solver_options)

For example:

```Julia
using SDDP, Gurobi
GRB_ENV = Gurpbi.Env()
model = SDDP.LinearPolicyGraph(;
    optimizer = optimizer_with_attributes(
        () -> Gurobi.Optimizer(GRB_ENV),
        "TimeLimit" => 60.0,
    )
) do sp, t
end

```

or

```Julia
using SDDP, Gurobi
GRB_ENV = Gurpbi.Env()
model = SDDP.LinearPolicyGraph(;
    optimizer = () -> Gurobi.Optimizer(GRB_ENV),
) do sp, t
    set_attribute(sp, "TimeLimit", 60.0)
end

```

The Gurobi options can be found here [jump-dev/Gurobi.jl · JuMP](https://jump.dev/JuMP.jl/stable/packages/Gurobi/#Options)

p.s., I assume this is what you meant by your other question: [How to license Gurobi inside Google Colab's Julia environment - #7 by Engr\_Moiz\_Ahmad](https://discourse.julialang.org/t/how-to-license-gurobi-inside-google-colabs-julia-environment/128407/7). Setting parameters in a gurobi _environment_ (the `Env()`) object) is subtly different to settings parameters in a model. In general, you should prefer to set them in the model object. Use parameters in the `Env` only if needed by that particular parameter.

---

<div class="post-metadata">

### Author: ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)
#### Post date: [May 4, 2025, 5:05am UTC](https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678/3 "2025-05-04T05:05:45Z")

</div>

Got it! I may ask that what the default values are for these tolerance parameters (can you list down tolerance parameters along with their values?) in the context of SDDP.jl.

Are they the same regardless of which solver (e.g., Gurobi, GLPK, HiGHS, etc.) we use to solve stage-wise subproblems?

Responding to your postscript, yes, I did mean that from my question: [How to license Gurobi inside Google Colab's Julia environment - #7 by Engr\_Moiz\_Ahmad](https://discourse.julialang.org/t/how-to-license-gurobi-inside-google-colabs-julia-environment/128407/7).

---

<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: [May 4, 2025, 5:14am UTC](https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678/4 "2025-05-04T05:14:42Z")

</div>

All tolerances are solver dependent. SDDP.jl does not change them. You should read the documentation of each solver to find them.

---

<div class="post-metadata">

### Author: ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)
#### Post date: [May 4, 2025, 5:18am UTC](https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678/5 "2025-05-04T05:18:47Z")

</div>

In order to compare the performances of MILP solvers for solving subproblems in the SDDiP algorithm and extensive-form linear programs, should I use the default values of these tolerances specific to each solver?

If yes, why should I do so, and how can I report it in a manuscript, for example?

---

<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: [May 4, 2025, 5:49am UTC](https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678/6 "2025-05-04T05:49:45Z")

</div>

Thats a choice for you to make. Just describe what you did in the manuscript.

Re SDDiP, see [Integrality · SDDP.jl](https://sddp.dev/stable/guides/add_integrality/#Does-SDDP.jl-implement-the-SDDiP-algorithm)?

---

<div class="post-metadata">

### Author: ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)
#### Post date: [May 5, 2025, 12:47pm UTC](https://discourse.julialang.org/t/how-to-set-tolerance-attributes-of-gurobi-inside-google-colab-s-julia-environment/128678/7 "2025-05-05T12:47:08Z")

</div>

Got it.
