首頁 / 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 個檔案