jump-dev / jump-dev/MathOptInterface.jl

Add Batched{S} set

未关闭
#2,904 15 条评论 7 个 reaction 已指派 0 人 在 GitHub 查看
Type: Set Request
主要语言
Julia
星标
504
派生
101
平均合并
6 小时 26 分钟
30 天内合并 PR
22

描述

@amontoison wants this. There are also some folks in the GPU/cvxpy domain sniffing around this (https://github.com/cvxpy/cvxpy/issues/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:
```julia
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:
```Julia
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
```

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start with the MOI.set ConstraintSet and ConstraintIndex entry points described in the issue, then review how Parameter values and result_count are represented. The work is done when the project has agreed on and implemented a batched-set approach with consistent batch lengths and the stated result behavior.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia
领域
backend-api-design
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。