首页 / Skills / 研究与学习 / cuOpt 优化问题建模 cuOpt Optimization Formulation
研究与学习

cuOpt 优化问题建模 cuOpt Optimization Formulation

NVIDIAApache-2.0Skill 语言: 英文
协议已核对不含脚本
演示真实运行记录 · claude-sonnet-5-5 · 2026年10月
A bakery operates 2 ovens and plans to bake 300 loaves of bread this week. It may also bake cakes, which earn $12 each and cost $5 in ingredients; bread earns $4 and costs $1.5. Each oven runs at most 40 hours; a loaf takes 0.1 oven-hours and a cake 0.4. Determine the weekly baking plan. Classify each sentence as parameter, constraint, decision or objective, and state the objective. No code.
Skill: cuopt-numerical-optimization-formulation

Sentence classification

Sentence Label Note
"Operates 2 ovens" Parameter Both ovens are available. This is not an oven-selection problem.
"Plans to bake 300 loaves this week" Constraint (implicit) Committed phrasing, so bread = 300 exactly.
"May also bake cakes" Decision The number of cakes is chosen.
"Cakes earn $12, cost $5; bread earns $4, costs $1.50" Parameters Net per unit is $7 per cake and $2.50 per loaf.
"Each oven runs at most 40 hours" Parameter (40) and constraint Oven time used is at most 2 × 40 = 80 hours.
"A loaf takes 0.1 oven-hours, a cake 0.4" Parameters They set the oven-time usage.
"Determine the weekly baking plan" Objective (implicit) Revenue and costs are both given, so maximize total profit.

Formulation

  • Decision: c = number of cakes (≥ 0). Integer in practice, though the LP optimum is already whole.
  • Fixed by commitment: loaves b = 300.
  • Objective: maximize 2.5·b + 7·c, which is profit = revenue − ingredient cost.
  • Constraint: 0.1·b + 0.4·c ≤ 80 oven-hours.
  • Problem type: LP, or a trivial MILP if cakes must be integers.

Solution

  • Bread uses 300 × 0.1 = 30 oven-hours, leaving 50 hours.
  • Each cake nets a positive $7, so the oven time left over goes to cakes: c = 50 / 0.4 = 125 cakes.
  • The plan splits across the two ovens without trouble. For example, oven 1 bakes all 300 loaves and 25 cakes (30 + 10 = 40 h), and oven 2 bakes 100 cakes (40 h).

Plan: 300 loaves and 125 cakes. Profit = 300 × 2.50 + 125 × 7 = $750 + $875 = $1,625. Revenue is $2,700 and ingredient cost is $1,075. Both ovens are fully used at 80 of 80 hours.

Ambiguities

  • "Plans to bake 300 loaves": I read this as exactly 300. If it meant at least 300, the answer changes. Bread earns $25 per oven-hour against $17.50 for cakes, so the plan would become 800 loaves and 0 cakes, with a profit of $2,000. Tell me if that is what you meant.
  • "Earn": I read this as revenue, with cost subtracted. If $12 and $4 were already profits, the plan stays the same (300 loaves and 125 cakes) and the profit would be $2,700.

Concepts-only skill, so the trial gave the model only the Skill and Read tools. The model's arithmetic was checked by hand (300 loaves and 125 cakes, profit 1,625; 800 loaves if the commitment were a minimum). Nothing was compared against a no-skill run.

它做什么
教模型根据文字描述的问题建立线性规划(LP)、混合整数规划(MILP)和二次规划(QP)模型。只讲概念,不涉及求解器接口,也不写代码。

工作方式

  1. 把每句话归类为参数、约束、决策或目标,并区分“计划生产”“拥有”这类已确定的说法与“可以”“考虑”这类可选的说法。
  2. 找出隐含的目标:只给成本时,“制定计划”意味着成本最小;同时给出成本和收入时,则是利润最大。
  3. 要求模型遇到歧义时先提问,或把所有合理的理解都算一遍并报告结果,而不是悄悄选一种。
  4. 覆盖常见建模模式和陷阱:分段线性利润加整数总量、下料问题的废料、目标规划、多期库存、带共用混合工序的配料。

适合
运筹学作业和真实的计划问题:生产、排程、配料、投资组合、资源分配。

局限
只负责建模,不负责求解,配合哪个求解器由你决定。包内附带 NVIDIA 自己的评测报告(是他们的评测,不是我们的),其中说明 cuOpt 的 QP 支持仍处于 beta。

说明与风险

低风险:纯指令文件,来自 NVIDIA 官方 Skills 仓库(Apache-2.0)。没有脚本、不联网、不写文件,也不需要账号或密钥。压缩包里还有 NVIDIA 自己的评测报告和一个签名文件,我们原样收录,没有验证过这个签名。结果由模型生成:用于真实决策前,请自己核对模型和其中的数字。

SKILL.md 原文包内共 6 个文件