Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Array input arguments in nonlinear expressions

オープン
#2,402 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
julia
領域
backend

調査の方向性

GenericNonlinearExpr、MOI.(Scalar,Vector)NonlinearFunction、MOI.Nonlinear、および issue で説明されている提案中の Node 構造体と Expression 構造体から始めます。現在、スカラー非線形式とその微分がどのように表現されているかを追跡し、その後、配列および行列の入力をどのように表現し、微分すべきかを決定します。norm(x, p) や log_det(X) のような例を設計と実装がサポートし、それらの微分を対象とするテストが含まれていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Project: next-gen nonlinear support Submodule: Nonlinear

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 Array in GenericNonlinearExpr and their mapping to moi_function. This seems pretty easy.

Changes required in MOI

  1. We'd need to support Array in MOI.(Scalar,Vector)NonlinearFunction. This seems pretty easy.
  2. We'd need to support Array in MOI.Nonlinear and 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時間
マージ済み PR(30日)
9

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

jump-dev/MathOptInterface.jl のほかの issue

jump-dev/MathOptInterface.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。