cuopt-numerical-optimization-api-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

cuOpt Numerical Optimization — CLI

cuOpt数值优化——CLI

Solve LP, MILP, and QP problems from MPS files via
cuopt_cli
. The same command, options, and MPS workflow apply across all three; QP uses the standard MPS quadratic-objective extension.
Confirm problem type and formulation (variables, objective, constraints, variable types) before coding.
This skill is CLI only (MPS input).
通过
cuopt_cli
从MPS文件求解LP、MILP和QP问题。三者适用相同的命令、选项和MPS工作流程;QP使用标准MPS二次目标扩展。
在编码前确认问题类型和公式(变量、目标函数、约束条件、变量类型)。
本技能仅支持CLI(MPS输入)。

Basic usage

基本用法

bash
undefined
bash
undefined

Solve LP or MILP from MPS file

从MPS文件求解LP或MILP

cuopt_cli problem.mps
cuopt_cli problem.mps

With options

使用选项

cuopt_cli problem.mps --time-limit 120 --mip-relative-tolerance 0.01
undefined
cuopt_cli problem.mps --time-limit 120 --mip-relative-tolerance 0.01
undefined

Common options

常用选项

bash
cuopt_cli --help
bash
cuopt_cli --help

Time limit (seconds)

时间限制(秒)

cuopt_cli problem.mps --time-limit 120
cuopt_cli problem.mps --time-limit 120

MIP gap tolerance (stop when within X% of optimal)

MIP间隙容差(当与最优解相差X%以内时停止)

cuopt_cli problem.mps --mip-relative-tolerance 0.001
cuopt_cli problem.mps --mip-relative-tolerance 0.001

MIP absolute tolerance

MIP绝对容差

cuopt_cli problem.mps --mip-absolute-tolerance 0.0001
cuopt_cli problem.mps --mip-absolute-tolerance 0.0001

Presolve, iteration limit, method

预求解、迭代限制、方法

cuopt_cli problem.mps --presolve --iteration-limit 10000 --method 1
undefined
cuopt_cli problem.mps --presolve --iteration-limit 10000 --method 1
undefined

MPS format (required sections, in order)

MPS格式(必填部分,按顺序)

  1. NAME — problem name
  2. ROWS — N (objective), L/G/E (constraints)
  3. COLUMNS — variable names, row names, coefficients
  4. RHS — right-hand side values
  5. BOUNDS (optional) — LO, UP, FX, BV, LI, UI
  6. ENDATA
Integer variables: use
'MARKER' 'INTORG'
before and
'MARKER' 'INTEND'
after the integer columns.
  1. NAME — 问题名称
  2. ROWS — N(目标函数)、L/G/E(约束条件)
  3. COLUMNS — 变量名、行名、系数
  4. RHS — 右侧值
  5. BOUNDS(可选)—— LO、UP、FX、BV、LI、UI
  6. ENDATA
整数变量:在整数列之前使用
'MARKER' 'INTORG'
,之后使用
'MARKER' 'INTEND'

QP via CLI (beta)

基于CLI的QP(测试版)

Quadratic objectives extend the standard MPS workflow — same
cuopt_cli
command, same options. Check
cuopt_cli --help
for QP-specific flags and the repo docs at
docs/cuopt/source/cuopt-cli/
for the quadratic-objective MPS format.
QP rules:
  • MINIMIZE only. For maximization, negate the objective coefficients (and Q entries) in the MPS file.
  • Continuous variables only — do not mix integer markers with quadratic objectives.
二次目标扩展了标准MPS工作流程——使用相同的
cuopt_cli
命令和选项。查看
cuopt_cli --help
获取QP特定标志,以及仓库文档
docs/cuopt/source/cuopt-cli/
了解二次目标的MPS格式。
QP规则:
  • 仅支持最小化。若要最大化,请在MPS文件中取反目标系数(以及Q项)。
  • 仅支持连续变量——不要将整数标记与二次目标混合使用。

Troubleshooting

故障排除

  • Failed to parse MPS — Check ENDATA, section order (NAME, ROWS, COLUMNS, RHS, [BOUNDS], ENDATA), integer markers.
  • Infeasible — Check constraint directions (L/G/E) and RHS values.
  • 解析MPS失败——检查ENDATA、部分顺序(NAME、ROWS、COLUMNS、RHS、[BOUNDS]、ENDATA)、整数标记。
  • 不可行——检查约束方向(L/G/E)和RHS值。

Examples

示例

  • assets/README.md — Build/run for sample MPS files
  • lp_simple — Minimal LP (PROD_X, PROD_Y, two constraints)
  • lp_production — Production planning: chairs + tables, wood/labor
  • milp_facility — Facility location with binary open/close
  • assets/README.md — 构建/运行示例MPS文件
  • lp_simple — 最简LP问题(PROD_X、PROD_Y,两个约束)
  • lp_production — 生产规划:椅子+桌子,木材/劳动力约束
  • milp_facility — 带二进制开闭选项的设施选址

Getting the CLI

获取CLI

CLI is included with the Python package (
cuopt
). Install via pip or conda; then run
cuopt_cli --help
to verify.
CLI包含在Python包
cuopt
中。通过pip或conda安装;然后运行
cuopt_cli --help
验证安装。