Operations Research Modeling

v1.0.0

运筹优化数学建模辅助工具。当用户需要将实际问题转化为数学优化模型时使用,包括:(1) 输入运筹优化问题并要求建立数学模型;(2) 需要将文字描述转化为目标函数和约束条件;(3) 要求对问题进行数学公式化表述;(4) 需要验证或完善优化问题的数学模型;(5) 搜索相关学术论文了解研究现状。支持的场景:线性规划、整数...

0· 133·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for go-own-way/or-modeling.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Operations Research Modeling" (go-own-way/or-modeling) from ClawHub.
Skill page: https://clawhub.ai/go-own-way/or-modeling
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install or-modeling

ClawHub CLI

Package manager switcher

npx clawhub@latest install or-modeling
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description match the provided SKILL.md, reference material, and the included paper_search.py. The only external capability (paper search) is appropriate for a modeling assistant that offers literature review.
Instruction Scope
SKILL.md stays within modeling workflows but instructs the agent to run scripts/paper_search.py which will send the user's query to OpenAlex and Semantic Scholar APIs. That network activity is expected for a literature search, but users should know queries (problem descriptions) will be transmitted to those services.
Install Mechanism
No install spec is provided (instruction-only), and only a small Python script is included. The script requires the widely used 'requests' library but does not download or execute code from untrusted URLs. Low installation risk.
Credentials
The skill declares no environment variables, no credentials, and no config paths. The paper_search.py makes outbound HTTPS calls but does not require or attempt to read secrets — proportional to its literature-search purpose.
Persistence & Privilege
always is false, the skill is user-invocable and does not request persistent/privileged presence or modify other skills or system configs.
Assessment
This skill appears coherent and focused on modeling plus optional literature search. Before installing: (1) know that running the skill (or the paper_search.py script) will send your query text to OpenAlex and Semantic Scholar — avoid submitting sensitive or proprietary problem statements; (2) the script requires Python and the 'requests' package (it will exit with an instruction to pip install requests if missing); (3) the skill makes outbound network requests (rate limits or API policies may apply); and (4) the SKILL.md quick-confirmation mode can skip stepwise confirmations if the user replies with short affirmative phrases, so be careful when using terse confirmations. If you need offline-only modeling or must not transmit problem data, decline the literature-search step or inspect/modify paper_search.py to remove network calls.

Like a lobster shell, security has layers — review code before you run it.

latestvk97bckdgfc032cbb4pg2vqajc583dtxm
133downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

运筹优化数学建模助手

工作流程

用户输入问题描述
     │
     ▼
┌─────────────────────────────────────────────────────────────┐
│ 步骤0:问题理解确认                                         │
│  - 输出6维度问题识别结论                                     │
│  - 用户确认后继续(支持"快速确认"模式,见下方说明)          │
└─────────────────────────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────────────────────────┐
│ 步骤1:文献调研与现实场景                                    │
│  - 运行 paper_search.py 搜索论文(见下方时机说明)          │
│  - 搜索现实场景案例                                          │
│  - 识别现有研究的缺陷与不足                                  │
│  - 生成1-3个可行方案供用户选择                               │
└─────────────────────────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────────────────────────┐
│ 步骤2:逆向验证                                             │
│  - 列出所有关键假设                                          │
│  - 请用户确认假设是否符合实际                                │
│  - 迭代完善直至用户确认方案可行                              │
└─────────────────────────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────────────────────────┐
│ 步骤3:模型构建                                             │
│  - 确定决策变量                                             │
│  - 识别目标函数(最大化/最小化)                             │
│  - 选择约束模块(从通用模块库 或 问题特定模板)               │
│  - 标注参数和集合                                           │
│  - 预估计算复杂度和求解策略                                  │
└─────────────────────────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────────────────────────┐
│ 步骤4:模型自检                                             │
│  - 执行完整性检查清单(5类+求解可行性)                       │
│  - 输出自检报告                                              │
│  - 发现问题则返回对应步骤修正                                │
└─────────────────────────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────────────────────────┐
│ 步骤5:输出LaTeX数学模型                                     │
│  - 纯LaTeX模型(独立块,便于复制)                          │
│  - 模型解释说明(分离于LaTeX之外)                           │
│  - 参考文献列表                                              │
└─────────────────────────────────────────────────────────────┘

快速确认模式

适用场景: 用户问题描述较清晰,希望快速推进而非逐项确认。

触发条件: 用户回复"准确"、"可以"、"没问题"等确认词时,直接标注"✓已确认"并继续进入步骤1,无需等待逐项确认。

输出格式调整:

□ 优化目标维度 [✓已确认] 单一目标/多目标
□ 决策变量维度 [✓已确认] ...
...

如有问题请指出,无则继续。

步骤0:问题理解确认

问题识别清单(6维度分析)

输出格式:

我理解您的问题是:

□ 优化目标维度
  [识别结论]:单一目标/多目标?最大化/最小化?

□ 决策变量维度
  [识别结论]:连续/整数/混合?高维决策?

□ 约束类型维度
  [识别结论]:资源容量/时间窗口/优先级/业务规则?

□ 问题边界维度
  [识别结论]:单周期/多周期?静态/动态?

□ 不确定性维度
  [识别结论]:确定性/随机/鲁棒?

□ 求解要求维度
  [识别结论]:最优/近似最优?解释性需求?

请确认上述理解是否正确,如有偏差请指出。

步骤1:文献调研与现实场景

论文搜索时机

必须搜索论文的场景:

  • 用户问题涉及专业领域知识(如出租车调度、路径规划)
  • 现有参考模板不足以覆盖用户需求
  • 需要了解某类问题的最新研究进展

可选跳过论文搜索的场景:

  • 用户明确说"不需要调研,直接建模"
  • 问题属于教科书级别的经典问题(如简单线性规划)
  • 时间紧迫,用户要求快速输出

论文搜索命令

在技能执行目录下运行:

# 默认双源搜索(OpenAlex + Semantic Scholar)
python3 scripts/paper_search.py "问题关键词" --max-results 5

# 仅 OpenAlex(推荐,更稳定)
python3 scripts/paper_search.py "问题关键词" --source openalex --max-results 5

# 仅 Semantic Scholar
python3 scripts/paper_search.py "问题关键词" --source semantic_scholar --max-results 5

文献调研输出格式

## 文献调研报告

### 相关论文(按引用量排序)

1. **[论文标题]**
   - 作者:[作者列表]
   - 年份:[年份]
   - 引用:[引用数]
   - DOI:[DOI链接]
   - 研究贡献:[1-2句总结]
   - 对本问题的启示:[与用户问题的关联]

2. ...

### 研究趋势总结

- 主流方法:[方法1、方法2...]
- 常见挑战:[挑战1、挑战2...]
- 最新进展:[进展1、进展2...]

### 对本问题建模的建议

- 建议采用的方法:[方法]
- 需要特别注意的约束:[约束]
- 建议避免的建模方式:[方式]及原因

步骤2:逆向验证

假设确认模板

根据您的需求和文献调研,我做出以下关键假设:

【问题边界假设】
- 假设A:[如"只考虑单周期静态优化"]
- 假设B:[如"车辆容量统一为4人"]
- 假设C:[如"乘客需求为确定性已知"]

【约束条件假设】
- 假设D:[如"每位乘客有硬性时间窗 [ET_i, LT_i]"]
- 假设E:[如"最大绕行容忍系数 α ≤ 30%"]

【目标函数假设】
- 假设F:[如"多目标加权:β₁·等待时间 + β₂·空载率"]
- 假设G:[如"目标权重暂定为 0.6 : 0.4"]

【模型简化假设】
- 假设H:[如"暂不考虑动态新请求的实时更新"]
- 假设I:[如"暂不考虑乘客间的兼容性约束"]

请确认这些假设是否符合您的实际需求。

步骤3:模型构建

问题特定约束模板

自行车骑行路径规划问题推荐约束组合:

模块选择约束内容
C4修改流平衡(中间节点入度=出度)
起终点$\sum_j x_{sj} = 1, \sum_i x_{it} = 1$
C6路径长度上界
MTZ子回路消除 $u_i - u_j + 1 \leq (

车辆路径问题(VRP)推荐约束组合:

模块选择约束内容
C1容量约束
C3修改每个客户被访问一次
C4车辆路线连续性
起终点车辆从仓库出发并返回
MTZ子回路消除

设施选址问题推荐约束组合:

模块选择约束内容
C3每个需求点被服务
C8if-选择某设施 then-满足容量
C7互斥约束(如需要)

计算复杂度预估模板

在模型构建后,必须输出:

### 计算复杂度预估

| 指标 | 估计值 | 说明 |
|------|--------|------|
| 变量数量 | $O(\|E\| + \|V\|)$ | 路径选择 + 拓扑变量 |
| 约束数量 | $O(\|V\| + \|E\| + \|V\|^2)$ | 流平衡 + 长度 + MTZ |
| 整数变量比例 | 100% | 全二元变量 |
| 预计求解难度 | 中等/困难 | 大规模图需启发式 |

### 建议求解策略

- **小规模(|V| < 1000)**:精确算法 → CPLEX / Gurobi / MIP求解器
- **中等规模(1000 < |V| < 10000)**:约束规划 / 分支定价
- **大规模(|V| > 10000)**:元启发式算法 → 遗传算法、模拟退火
- **实时需求**:A* 变体算法 + 预计算

步骤4:模型自检

自检报告模板(增强版)

## 模型自检报告

### □ 物理可行性检查
- [x] 变量取值范围合理
- [x] 约束量纲一致
- [ ] 发现问题:...

### □ 完整性检查
- [x] 资源平衡约束完整
- [x] 变量上下界约束完整
- [ ] 互斥约束已建模
- [ ] 目标函数无遗漏成本项
- 发现问题:...

### □ 逻辑约束检查
- [x] if-then 逻辑已建模
- [ ] 需要大M法处理
- 发现问题:...

### □ 边界条件检查
- [x] 零解情况下模型有意义
- [x] 极端值情况下约束合理
- 发现问题:...

### □ 文献对照检查
- [x] 与相关论文的模型假设一致
- [ ] 发现偏差:...

### □ 求解可行性检查 【新增】
- [ ] 不确定集是否可线性化(如箱式 vs 椭球)?
- [ ] 约束数量是否在求解器能力范围内?
- [ ] MTZ vs DFJ 子回路消除的选择?
- [ ] 建议的求解器/算法?
- 发现问题:...

### 总体评估
- [x] 模型可接受 / [ ] 需要修正
- 修正建议:...

步骤5:输出LaTeX数学模型

输出格式(LaTeX与解释分离)

LaTeX模型独立成块,解释说明分离在后:

\begin alihnment}
\section{数学模型名称}

\subsection{集合定义}
\begin{aligned}
& V = \{1, 2, \ldots, n\} && \text{节点集合} \\
& E \subseteq V \times V && \text{边集合}
\end{aligned}

\subsection{参数定义}
\begin{aligned}
& d_{ij} \geq 0 && \text{边 }(i,j) \text{ 的距离} \\
& c_{ij} \geq 0 && \text{边 }(i,j) \text{ 的成本}
\end{aligned}

\subsection{决策变量}
\begin{aligned}
& x_{ij} \in \{0, 1\} && \text{是否选择边 }(i,j)
\end{aligned}

\subsection{目标函数}
\begin{aligned}
\min \quad & \sum_{(i,j) \in E} c_{ij} x_{ij}
\end{aligned}

\subsection{约束条件}
\begin{aligned}
& \sum_{j:(i,j) \in E} x_{ij} = \sum_{j:(j,i) \in E} x_{ji}, \quad && \forall i \in V \setminus \{s,t\} \\
& \sum_{j:(s,j) \in E} x_{sj} = 1, \quad \sum_{i:(i,t) \in E} x_{it} = 1
\end{aligned}
\end alihnment}

模型解释说明(独立于LaTeX之外):

### 模型解释

- **目标函数**:最小化总路径成本
- **约束(1)**:流平衡约束,确保中间节点入度=出度
- **约束(2)**:起终点约束,确保从s出发、到达t
- **变量类型**:x_{ij} 为二元变量,表示边是否被选择

常用约束模块速查

模块代码约束名称LaTeX适用场景
C1容量约束$\sum_j x_{ij} \leq Q_j y_j$车辆载重、仓库容量
C2时间窗(硬)$ET_i \leq t_i \leq LT_i$配送、服务窗口
C3唯一分配$\sum_j x_{ij} = 1$每人只被服务一次
C4流平衡$\sum_j x_{ij} = \sum_j x_{ji}$路线连续性
C5绕行容忍$d_{ij} \leq (1+\alpha)d_{ij}^*$合乘、路径约束
C6变量上下界$L_j \leq x_j \leq U_j$所有变量
C7互斥选择$x_i + x_j \leq 1$设施互斥
C8条件激活$x_j \leq M y_j$if-then逻辑
C9资源平衡$\sum_i a_i x_i = \sum_j b_j y_j$供需平衡
C10机会约束$P{x \geq D} \geq 1-\alpha$随机需求
C11多目标加权$\min \sum w_k f_k(x)$多准则决策
C12软约束惩罚$\min f + \lambda \cdot \text{penalty}$软约束

参考资料

Comments

Loading comments...