I want to create the function to solve multiple optimization problems with MathOptInterface, such as

```
using MathOptInterface
const MOI = MathOptInterface
function opt(optimizer::MOI.AbstractOptimizer)
...
for i in 1:n
...
x = MOI.add_variables(optimizer, ...)
MOI.set(optimizer, ...) # scalar affine objective function
MOI.add_constraints(optimizer, ...) # scalar affine constraint
MOI.optimize!(optimizer)
...
end
...
end
```

I think I have to initialize Optimizer instance in every for loops, but there is no method to do it.

Currently, my code is

```
using MathOptInterface
const MOI = MathOptInterface
using GLPK
function opt(mathod::Symbol)
...
for i in 1:n
...
optimizer = GLPK.Optimizer(method=method) # Only use GLPK optimizer
x = MOI.add_variables(optimizer, ...)
MOI.set(optimizer, ...) # scalar affine objective function
MOI.add_constraints(optimizer, ...) # scalar affine constraint
MOI.optimize!(optimizer)
...
end
...
end
```

However, I don’t want to do hard coding, want to allow the various kinds of solver, such as `Clp.Optimizer`

and `CDDLib.Optimizer`

.

What is the best practice to do this?