@amontoison wants this. There are also some folks in the GPU/cvxpy domain sniffing around this (cvxpy/cvxpy#2485).
We have almost everything we need. There's just a choice between two approaches.
First, we could set the value of Parameter to a vector of sets:
MOI.set(
::Optimizer,
::MOI.ConstraintSet,
::MOI.ConstraintIndex{MOI.VariableIndex,MOI.Parameter{T}},
::Vector{MOI.Parameter{T}},
)
But this might be hard to get through the various MOI layers.
The easier alternative is to add a new Batched{S<:MOI.AbstractSet} set.
If there are multiple batched sets, they all must have the same length. Then the results are returned via result_count and we don't support returning multiple solutions within a batch.
Then a solver could choose to natively support batched parameters. And we could have a fallback optimizer like:
using JuMP
import Ipopt
import MathOptBatchOptimizer as MOBO
model = Model(() -> MOBO.Optimizer(Ipopt.Optimizer))
@variable(model, x)
@variable(model, p in Parameter(1))
set_parameter_value(p, 1:100) # <-- set as a vector, not a scalar
@objective(model, Min, x)
@constraint(model, x >= p)
optimize!(model)
@assert result_count(model) == 100
@amontoison wants this. There are also some folks in the GPU/cvxpy domain sniffing around this (cvxpy/cvxpy#2485).
We have almost everything we need. There's just a choice between two approaches.
First, we could set the value of
Parameterto a vector of sets:But this might be hard to get through the various MOI layers.
The easier alternative is to add a new
Batched{S<:MOI.AbstractSet}set.If there are multiple batched sets, they all must have the same length. Then the results are returned via
result_countand we don't support returning multiple solutions within a batch.Then a solver could choose to natively support batched parameters. And we could have a fallback optimizer like: