# Rewriting JuMP code in MathOptInterface

**URL:** <https://discourse.julialang.org/t/rewriting-jump-code-in-mathoptinterface/42061>\
**Category:** Optimization (Mathematical)\
**Created:** [June 25, 2020, 7:09pm UTC](https://discourse.julialang.org/t/rewriting-jump-code-in-mathoptinterface/42061 "2020-06-25T19:09:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [June 25, 2020, 8:49pm UTC](https://discourse.julialang.org/t/rewriting-jump-code-in-mathoptinterface/42061/2 "2020-06-25T20:49:39Z")

</div>

```julia
x = reshape(MOI.add_variables(model, m * n), m, n)
cx = MOI.add_constraint(model, MOI.SingleVariable.(x), MOI.Interval(0.0, 1.0))

```

Or

```julia
x = [MOI.add_constrained_variables(model, MOI.Interval(0.0, 1.0))(1) for i in 1:m, j in 1:n]

```

---

_[View the full topic](https://discourse.julialang.org/t/rewriting-jump-code-in-mathoptinterface/42061)._
