jump-dev / jump-dev/MathOptInterface.jl

Add Batched{S} set

Đang mở
#2,904 15 bình luận 7 reaction 0 người được giao Xem trên GitHub
Type: Set Request
Ngôn ngữ chính
Julia
Star
504
Fork
101
Merge trung bình
6 giờ 26 phút
Pull request đã merge (30 ngày)
22

Mô tả

@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
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
julia
Lĩnh vực
backend-api-design
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.