# MathOptInterface: How to create a 2-dimensional variable?

**URL:** <https://discourse.julialang.org/t/mathoptinterface-how-to-create-a-2-dimensional-variable/78039>\
**Category:** Optimization (Mathematical)\
**Tags:** question\
**Created:** [March 17, 2022, 5:22pm UTC](https://discourse.julialang.org/t/mathoptinterface-how-to-create-a-2-dimensional-variable/78039 "2022-03-17T17:22:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timothy\_Yu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/timothy_yu/32/26116_2.png) [@Timothy\_Yu](https://discourse.julialang.org/u/Timothy_Yu)\
**Post date:** [March 17, 2022, 5:22pm UTC](https://discourse.julialang.org/t/mathoptinterface-how-to-create-a-2-dimensional-variable/78039/1 "2022-03-17T17:22:13Z")

</div>

I am new to MOI and am looking for something equivalent to JuMP’s @variable(model, x[P,M] \>=0).

---

<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 17, 2022, 6:17pm UTC](https://discourse.julialang.org/t/mathoptinterface-how-to-create-a-2-dimensional-variable/78039/2 "2022-03-17T18:17:39Z")

</div>

You can’t do this in MOI. Stick with JuMP.

---

<div class="post-metadata">

**Author:** ![Timothy\_Yu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/timothy_yu/32/26116_2.png) [@Timothy\_Yu](https://discourse.julialang.org/u/Timothy_Yu)\
**Post date:** [March 17, 2022, 6:21pm UTC](https://discourse.julialang.org/t/mathoptinterface-how-to-create-a-2-dimensional-variable/78039/3 "2022-03-17T18:21:33Z")

</div>

Okay, good to know. Thanks for the suggestion.

---

<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 17, 2022, 7:23pm UTC](https://discourse.julialang.org/t/mathoptinterface-how-to-create-a-2-dimensional-variable/78039/4 "2022-03-17T19:23:02Z")

</div>

The distinction is really:

- if you are a modeler trying to solve optimization problems, use JuMP
- if you are a developer trying to code high-level optimization algorithms, use JuMP (as an example, [https://github.com/odow/SDDP.jl](https://github.com/odow/SDDP.jl))
- if you are a solver author wanting to link a new solver to JuMP, use MathOptInterface.

---

<div class="post-metadata">

**Author:** ![Timothy\_Yu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/timothy_yu/32/26116_2.png) [@Timothy\_Yu](https://discourse.julialang.org/u/Timothy_Yu)\
**Post date:** [March 18, 2022, 2:07am UTC](https://discourse.julialang.org/t/mathoptinterface-how-to-create-a-2-dimensional-variable/78039/5 "2022-03-18T02:07:33Z")

</div>

Thank your Oscar for the distinction. I’ll re-evaluate what I need for my use-case.
