Array input arguments in nonlinear expressions
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
從 GenericNonlinearExpr、MOI.(Scalar,Vector)NonlinearFunction、MOI.Nonlinear,以及 issue 中描述的提議 Node 和 Expression 結構開始。追蹤目前純量非線性表達式及其導數的表示方式,然後確定陣列和矩陣輸入應如何表示和微分。完成的標準是設計和實作支援 norm(x, p) 和 log_det(X) 等範例,並包含涵蓋其導數的測試。
由索引模型根據 Issue 內容生成。
描述
Context: Yesterday I had a chat to @rluce about nonlinear expressions, particularly as they relate to Gurobi's upcoming nonlinear interface. We broadly agree on scalar nonlinear functions, and he had some preliminary ideas for vector-inputs.
cc @ccoffrin and @chriscoey for thoughts.
Our ultimate goal is to support examples like the following:
using JuMP, Ipopt
model = Model(Ipopt.Optimizer)
@variable(model, x[1:2, 1:2])
@objective(model, Max, log(det(X)))
# or perhaps the easier to manage;
@objective(model, Max, log_det(X))
using JuMP, Ipopt
model = Model(Ipopt.Optimizer)
@variable(model, x[1:3] >= 1)
p = 2
@objective(model, Min, norm(x, p))
Another key consumer of this would be https://github.com/jump-dev/MiniZinc.jl.
Changes required in JuMP
- We'd need to support
ArrayinGenericNonlinearExprand their mapping tomoi_function. This seems pretty easy.
Changes required in MOI
- We'd need to support
ArrayinMOI.(Scalar,Vector)NonlinearFunction. This seems pretty easy. - We'd need to support
ArrayinMOI.Nonlinearand be able to compute derivatives, etc.
The tricky part is all in 2.
We'd likely need some sort of Node(NODE_VECTOR, parent, n).
But matrices are a bit more complicated. We'd need to encode (rows, cols). One option would be to store the size as a packed value::Int64. That'd mean that we couldn't have matrices with side dimension greater than typemax(Int32)... but that seems okay.
encode(m::Int64, n::Int64) = encode(Int32(m), Int32(n))
encode(m::Int32, n::Int32) = reinterpret(Int64, (m, n))
decode(x::Int64) = Int64.(reinterpret(Tuple{Int32,Int32}, x))
norm(x) would look something like:
expr = Expression(
[
Node(NODE_CALL_MULTIVARIATE, -1, OP_NORM ),
Node(NODE_ARRAY, 1, 3 #= encode(3, 0) =#),
Node(NODE_VARIABLE, 2, 1 #= x1 =# ),
Node(NODE_VARIABLE, 2, 2 #= x2 =# ),
Node(NODE_VARIABLE, 2, 3 #= x3 =# ),
],
[],
);
log_det(X) would then look something like:
expr = Expression(
[
Node(NODE_CALL_MULTIVARIATE, -1, OP_LOGDET ),
Node(NODE_ARRAY, 1, 8589934594 #= encode(2, 2) =#),
Node(NODE_VARIABLE, 2, 1 #= x11 =# ),
Node(NODE_VARIABLE, 2, 2 #= x21 =# ),
Node(NODE_VARIABLE, 2, 2 #= x12 =# ),
Node(NODE_VARIABLE, 2, 3 #= x22 =# ),
],
[],
);
Once you have the data structure, it seems to me that the AD should follow fairly well.
Output arguments
Still absolutely no idea.
- 主要語言
- Julia
- 星號
- 506
- 分支
- 103
- 平均合併
- 1 天 1 小時
- 30 天內合併 PR
- 9
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
jump-dev/MathOptInterface.jl 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
jump-dev/MathOptInterface.jl#3113 ·
維護者通常 1 天內回覆
-
[Bridges] MultirowChange in set_map.jl drops zero coefficients可能已有人在做 @odow 於 7 天前認領。 未關閉
jump-dev/MathOptInterface.jl#3106 · 2 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Precision loss in Hessian computation可能已有人在做 @blegat 於 7 天前認領。 未關閉
難度 5/5 一週以上 新手友好度 15/100
jump-dev/MathOptInterface.jl#3104 · 11 則留言 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 35/100
jump-dev/MathOptInterface.jl#2986 · 3 則留言 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 25/100
jump-dev/MathOptInterface.jl#2969 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 jump-dev/MathOptInterface.jl 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 73/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 76/100
-
documentation model-weights
難度 2/5 1-3 小時 新手友好度 72/100
FluxML/Metalhead.jl#311 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 83/100
JuliaMath/Polynomials.jl#647 ·
-
reactant ☣
難度 2/5 1-3 小時 新手友好度 79/100
NumericalEarth/Breeze.jl#1110 ·
維護者通常 1 天內回覆