# Does gurobi support a different precision other than float64

**URL:** <https://discourse.julialang.org/t/does-gurobi-support-a-different-precision-other-than-float64/117658>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, gurobi\
**Created:** [July 31, 2024, 2:40am UTC](https://discourse.julialang.org/t/does-gurobi-support-a-different-precision-other-than-float64/117658 "2024-07-31T02:40:45Z")\
**Posts on this page:** 2\
**Page:** 2

<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 4, 2024, 2:32am UTC](https://discourse.julialang.org/t/does-gurobi-support-a-different-precision-other-than-float64/117658/21 "2024-08-04T02:32:26Z")

</div>

> I’m curious about the difference between two versions

The `Model` uses caching, which can batch various operations, etc, but it has the downside of requiring a copy of the model.

`direct_mode` stores only a single copy of the model and performs exactly what you type. In your case, `delete.(m, m[:c3])` is equivalent to calling

```julia
for c in m[:c3]
    delete(m, c)
end

```

so you are iteratively deleting a large number of constraints, and Gurobi is not efficient at deleting constraints.

For the error, JuMP knows how to delete a vector of constraints but not a matrix. Do `delete(m, vec(m[:c3]))`

> I constructed a general model for energy system optimization and modify some constraints according to my specific scenarios.

Read [Design patterns for larger models · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/getting_started/design_patterns_for_larger_models/)

I strongly suggest that, instead of building everything and then deleting some constraints, you add only the constraints and variables that are necessary in the first place.

---

<div class="post-metadata">

**Author:** ![Betristor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/betristor/32/45264_2.png) [@Betristor](https://discourse.julialang.org/u/Betristor)\
**Post date:** [August 4, 2024, 3:34am UTC](https://discourse.julialang.org/t/does-gurobi-support-a-different-precision-other-than-float64/117658/22 "2024-08-04T03:34:30Z")

</div>

@odow Thanks for the suggestions on model design. I considered this workflow more from a point view of users and decided to use this to make coding complete in both generic and specific scenarios. I’d like to have more discussions with you on model improvement after publishment. For research’s purposes, I keep the repo private now.  
BTW, combining `direct_model` and adjustment on solver options (using dual instead of barrier), I managed to reduce memory consumption within machine’s limits.

[Previous page](https://discourse.julialang.org/t/does-gurobi-support-a-different-precision-other-than-float64/117658.md?page=1)
