Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Add Batched{S} set

未關閉
#2,904 15 則留言 7 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
冷清
技術堆疊
julia

研究方向

從 issue 中描述的 MOI.set、ConstraintSet 和 ConstraintIndex 進入點開始,然後檢視 Parameter 值和 result_count 的表示方式。當專案就具有一致批次長度和所述結果行為的 batched-set 方法達成共識並完成實作時,這項工作就完成了。

由索引模型根據 Issue 內容生成。

描述

Type: Set Request

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

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
主要語言
Julia
星號
506
分支
103
平均合併
1 天 1 小時
30 天內合併 PR
9

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

jump-dev/MathOptInterface.jl 的其他 Issue

查看 jump-dev/MathOptInterface.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。