名称: dp状态设计器 描述: 协助设计最优的动态规划状态和转移 允许使用的工具:
- 读取
- 写入
- 搜索
- 全局匹配
DP状态设计器技能
目的
协助为复杂的动态规划问题设计最优的状态定义、状态转移和优化方案。
能力
- 从问题描述中识别子问题结构
- 建议状态表示(维度、参数)
- 推导状态转移公式
- 识别优化机会(滚动数组、位掩码压缩)
- 生成状态空间复杂度估算
- 检测重叠子问题
目标流程
- dp模式匹配
- dp状态优化
- dp转移推导
- 高级dp技术
DP设计框架
- 子问题识别: 哪些更小的问题构成了解决方案?
- 状态定义: 哪些参数能唯一标识一个子问题?
- 转移公式: 如何组合子问题的解?
- 基础情况: 哪些是简单的子问题?
- 计算顺序: 应以什么顺序解决子问题?
- 空间优化: 能否减少内存使用?
输入模式
{
"type": "object",
"properties": {
"problemDescription": { "type": "string" },
"constraints": { "type": "object" },
"examples": { "type": "array" },
"requestType": {
"type": "string",
"enum": ["fullDesign", "stateOnly", "transitions", "optimize"]
}
},
"required": ["problemDescription", "requestType"]
}
输出模式
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"state": {
"type": "object",
"properties": {
"definition": { "type": "string" },
"parameters": { "type": "array" },
"complexity": { "type": "string" }
}
},
"transitions": { "type": "array" },
"baseCases": { "type": "array" },
"optimizations": { "type": "array" }
},
"required": ["success"]
}