Say I wanted to add a variable x which represents an m x n matrix whose elements are constrianed.
In JuMP, the code would simply be:

```
@variable(model, 0 <= x[i=1:m, j=1:n] <= 1)
```

However, I am not sure how to translate this into MathOptInterface, which contains features that I need that were not carried into JuMP.

blegat
June 25, 2020, 8:49pm
#2
```
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

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

1 Like

odow
June 25, 2020, 8:50pm
#3
Which features of MOI were not carried into JuMP?

1 Like

I was working off of a suggestion from my previous question Rational{Int64} variables in JuMP? to use the CDDLib.Optimizer, which according to JuMP Documentation , requires directly implementing from MOI.

I may have misread the instructions though and could use some help clearing things up regarding whether rational fraction arithmetic from CDDLib can be used in JuMP.

odow
June 26, 2020, 2:44am
#5
No, you will need to use MOI directly.

From the tests , it looks like you need to use:

```
model = CDDLib.Optimizer{Rational{BigInt}}()
```

And make sure all your coefficients are also `Rational{BigInt}`

s.

1 Like