• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdevelopment

cuopt-numerical-optimization-api

プラグイン
nvidia-skills
ライセンス
Apache-2.0
ソース
GitHub で見る ↗
説明

LP(線形最適化)、MILP(混合整数線形最適化)、QP(二次計画法・ベータ版)を cuOpt で解く — Python、C、CLI 対応。 次のような場合に使用: ユーザーが cuOpt のいずれかのインターフェース(Python、C、CLI など)を使って LP、MILP、または QP を解いている。

原文を表示

LP, MILP, and QP (beta) with cuOpt — Python, C, and CLI. Use when the user is solving LP, MILP, or QP with any cuOpt interface.

ユースケース
  • LP問題を解くとき
  • MILP問題を解くとき
  • QP問題を解くとき
  • PythonでcuOptを使うとき
  • CやCLIで最適化を行うとき
本文(日本語訳)

cuOpt数値最適化API

NVIDIA cuOptのGPU高速化ソルバーを使用して、LP、MILP、QP問題(線形計画法、混合整数線形計画法、二次計画法)をモデル化して解きます。

インターフェース選択

ユーザーのインターフェースに合わせて参照先を選んでください:

インターフェース 次のような場合に使用 参照先
Python ユーザーがPythonコードを書いている references/python_api.md
C / C++ ユーザーがC/C++アプリケーションに組み込む references/c_api.md
CLI ユーザーがコマンドラインからMPSファイルを解く references/cli_api.md

インターフェースがまだ明確でない場合は、コードを書く前に確認してください。

既にモデリングツールを使用中ですか? cuOptはサードパーティのモデリングツール(AMPL、GAMS / GAMSPy、PuLP、JuMP、Pyomo、CVXPY)のソルバー(計算エンジン)として機能し、コード変更はほぼ不要です(モデルのソルバー設定をcuOptに向けるだけ)。CVXPYは凸二次計画問題(凸QP)および試験段階で二次制約付き二次計画法(QCQP / SOCP)に対応しています。ユーザーが既にこれらのツールでモデルを持っている場合、cuOpt APIに移植するより、これを使用することをお勧めします。詳細はサードパーティ製モデリング言語をご覧ください。

LP、MILP、QPの使い分け

目的関数と変数の種類で判断してください:

目的関数が... かつ変数が... 使用する手法
線形(c_i * x_i の合計) すべて連続値 LP
線形 整数値または0/1値を含む MILP
二乗項(xx)や交差項(xy)を含む 連続値のみ(整数QPは未対応) QP(試験段階)

問題が許すならLPを優先してください。 LPはより速く解け、最適性の保証が強力です。問題の性質上、整数値や0/1決定が必要な場合にだけMILPを使用してください。目的関数が本当に二次式(分散、二乗誤差、運動エネルギーなど)の場合にだけQPを使用してください。

  • LPを使用: すべての量が小数で意味をなす場合(流量、比率、速度、金額、時間、材料のトン数など)
  • MILPを使用: 問題に離散的な個数、有無選択、いずれか一方を選ぶ決定が含まれる場合(工場を開くかどうか、シフト勤務を割り当てるか、トラック台数など)
  • QPを使用: 目的関数が分散、二乗誤差を最小化する、またはx*xやx*yの項を含む場合(ポートフォリオ最適化、最小二乗法、正則化回帰など)

言葉から整数型と連続型を判断

問題の表現 / 概念 変数の型 例
離散的な個数 整数型 作業者、自動車、トラック、機械、パイロット、施設、製造単位
有無やオン/オフ 整数型(0/1値、下限=0 上限=1) 工場を開く、機械を稼働させる、シフト勤務に割り当てる
小数で表現できる量 連続型 トン、リットル、金額、時間、kWh、処理能力の比率
速度や分数 連続型 稼働率、パーセンテージ、予算配分比

判断の目安: 「何個」→ 整数型。「どれだけ」→ 連続型。

QP のルール(全インターフェース共通)

  • 最小化のみサポート — ソルバーは二次目的関数の最大化を受け付けません。f(x)を最大化するには、-f(x)を最小化し、報告された目的関数値を反転させてください。
  • 連続変数のみ — 整数QPは未対応です。
  • Qは半正定値 である必要があり、凸で良好に定式化された問題になります。
  • 試験段階 — APIは進化する可能性があります。典型的な凸QPについては本番環境対応として扱えます。

双対変数(感度情報)

双対変数と既約費用はLP と QP のみで利用可能です:

  • MILP — 双対変数なし(整数最適解は連続値ではないため)
  • 二次制約 — LP/QP でも双対変数は利用不可。すべての値はNaN(未定義値)を返します
  • PDLP ウォームスタート(初期値の再利用) — LP のみ。MILP 求解は PDLP ウォームスタートを受け入れません

よくある問題と対処(全インターフェース共通)

問題 考えられる原因 対処法
実行不可能 制約条件が矛盾している 制約条件の論理と上下限を確認
非有界 変数に上下限がない 変数の上下限を追加
求解が遅い 問題サイズが大きい 時間制限を設定、許容誤差を拡大
QP が最大化で棄却される QP は最小化のみサポート 目的関数を反転、結果を反転
QP が非最適を返す Q が半正定値でないか数値スケールが悪い Q が半正定値か確認、変数をスケーリング

ソルバー設定(概念)

設定項目 目的
time_limit N秒後に計算を中止
mip_relative_gap MILP を最適値のX%以内で中止
mip_absolute_tolerance 絶対ギャップによる中止
log_to_console ソルバーログを表示

構文はインターフェースごとに異なります。各インターフェースの参照ファイルをご覧ください。

原文(English)を表示

cuOpt Numerical Optimization API

Model and solve LP, MILP, and QP problems using NVIDIA cuOpt's GPU-accelerated solver.

Interface Selection

Choose the reference for the user's interface:

Interface When to use Reference
Python User is writing Python code references/python_api.md
C / C++ User is embedding in a C/C++ application references/c_api.md
CLI User is solving from MPS files on the command line references/cli_api.md

If the interface is not yet clear, ask before writing any code.

Already using a modeling language? cuOpt also works as a solver backend for third-party modeling tools — AMPL, GAMS / GAMSPy, PuLP, JuMP, Pyomo, and CVXPY — with near-zero code changes (point the model's solver at cuOpt). CVXPY additionally covers convex QP and, in beta, QCQP / SOCP. Prefer this when the user already has a model in one of these tools rather than porting it to the cuOpt API. See Third-Party Modeling Languages.

Choosing LP vs MILP vs QP

Decide from the objective and variables:

If the objective is... And variables are... Use
Linear (sum of c_i * x_i) All continuous LP
Linear Some integer or binary MILP
Has squared (x*x) or cross (x*y) terms Continuous (integer QP not supported) QP (beta)

Prefer LP when the problem allows it. LP solves faster and has stronger optimality guarantees. Use MILP only when the problem logically requires whole numbers or yes/no decisions. Use QP only when the objective is genuinely quadratic (variance, squared error, kinetic energy).

  • Use LP when every quantity can meaningfully be fractional: flows, proportions, rates, dollars, hours, tonnes of material, etc.
  • Use MILP when the problem mentions counts of discrete entities, yes/no choices, or either/or decisions (e.g. open a facility or not, assign a person to a shift, number of trucks).
  • Use QP when the objective minimizes variance, squared error, or any expression with x*x or x*y terms (portfolio optimization, least squares, regularized regression).

Integer vs Continuous from Wording

Problem wording / concept Variable type Examples
Discrete entities (counts) INTEGER Workers, cars, trucks, machines, pilots, facilities, units to manufacture
Yes/no or on/off INTEGER (binary, lb=0 ub=1) Open a facility, run a machine, assign a person to a shift
Amounts that can be fractional CONTINUOUS Tonnes, litres, dollars, hours, kWh, proportion of capacity
Rates or fractions CONTINUOUS Utilization, percentage, share of budget

Rule of thumb: "How many things" → INTEGER. "How much" → CONTINUOUS.

QP Rules (all interfaces)

  • MINIMIZE only — the solver rejects MAXIMIZE for quadratic objectives. To maximize f(x), minimize -f(x) and negate the reported objective value.
  • Continuous variables only — integer QP is not supported.
  • Q should be positive semi-definite for a convex, well-posed problem.
  • Beta — API may evolve; treat as production-capable for typical convex QP.

Dual Values

Duals and reduced costs are available for LP and QP only:

  • MILP — no duals (integer optima are not continuous).
  • Quadratic constraints — duals unavailable even for LP/QP; all values return NaN.
  • PDLP warmstart — LP only; MILP solves do not accept a PDLP warmstart.

Common Issues (all interfaces)

Problem Likely cause Fix
Infeasible Conflicting constraints Check constraint logic and bounds
Unbounded Missing bounds Add variable bounds
Slow solve Large problem Set time limit; increase gap tolerance
QP rejected with MAXIMIZE QP only supports MINIMIZE Negate the objective; negate the result
QP returns non-optimal Q not PSD or badly scaled Check Q is PSD; rescale variables

Solver Settings (concepts)

Setting Purpose
time_limit Stop after N seconds
mip_relative_gap Stop MILP when within X% of optimal
mip_absolute_tolerance Absolute MIP gap stop
log_to_console Enable solver logging

Syntax varies by interface — see the interface reference file.

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。