Skill站外收录 @skilllib/skill-2014279395123343361
constrained-optimization
提供求解带约束优化问题的系统化方法,涵盖等式与不等式约束的识别、拉格朗日乘子法与 KKT 条件的解析验证、罚函数和障碍函数的数值逼近策略,以及基于 SciPy 的高效数值求解能力,适用于工程设计、资源分配等需兼顾目标最优性与现实约束的场景。
商业与营销 AI 技能
Skills.MD
# Constrained Optimization
## When to Use
Use this skill when working on constrained-optimization problems in optimization.
## Decision Tree
1. **Constraint Classification**
- Equality: h(x) = 0
- Inequality: g(x) <= 0
- Bounds: l <= x <= u
2. **Lagrangian Method (Equality Constraints)**
- L(x, lambda) = f(x) + sum lambda_j * h_j(x)
- Solve: grad_x L = 0 and h(x) = 0
- `sympy_compute.py solve "grad_L_system"`
3. **KKT Conditions (Inequality Constraints)**
- Extend Lagrangian with mu_i for g_i(x) <= 0
- Complementary slackness: mu_i * g_i(x) = 0
- `z3_solve.py prove "kkt_satisfied"`
4. **Penalty and Barrier Methods**
- Penalty: add P(x) = rho * sum max(0, g_i(x))^2
- Barrier: add B(x) = -sum log(-g_i(x)) for interior point
- Increase penalty/decrease barrier parameter iteratively
5. **SciPy Constrained Optimization**
- `scipy.optimize.minimize(f, x0, method='SLSQP', constraints=cons)`
- constraints = [{'type': 'eq', 'fun': h}, {'type': 'ineq', 'fun': lambda x: -g(x)}]
- bounds = [(l1, u1), (l2, u2), ...]
## Tool Commands
### Scipy_Slsqp
```bash
uv run python -c "from scipy.optimize import minimize; cons = dict(type='eq', fun=lambda x: x[0] + x[1] - 1); res = minimize(lambda x: x[0]**2 + x[1]**2, [1, 1], method='SLSQP', constraints=cons); print('Min at', res.x)"
```
### Sympy_Lagrangian
```bash
uv run python -m runtime.harness scripts/sympy_compute.py solve "[2*x - lam, 2*y - lam, x + y - 1]" --vars "[x, y, lam]"
```
### Z3_Kkt_Satisfied
```bash
uv run python -m runtime.harness scripts/z3_solve.py prove "complementary_slackness"
```
## Key Techniques
*From indexed textbooks:*
- [nonlinear programming_tif] Conjugate Direction Methods** - Methods involving directions conjugate to each other with respect to a certain quadratic form, enhancing efficiency in finding minima. Quasi-Newton Methods** - Variants of Newton’s method that approximate the Hessian matrix. Nonderivative Methods** - Address optimization methods that don’t require derivative information.
- [nonlinear programming_tif] Optimization Over a Convex Set** - Focuses on optimization problems constrained within a convex set. Optimality Conditions:** Similar to unconstrained optimization, but within the context of convex sets. Feasible Directions and Conditional Gradient** - Explores methods that ensure feasibility within constraints.
- [nonlinear programming_tif] In this chapter we consider the constrained optimization problem minimize f(z) subject to z € X, where we assume throughout that: (a) X is a nonempty and convex subset of 2. When dealing with algo- rithms, we assume in addition that X is closed. The function f: %™ — R is continuously differentiable over X.
- [nonlinear programming_tif] The methods for obtaining lower bounds are elaborated on in Section 5. Lagrangian relaxation method is discussed in detail. This method requires the optimization of nondifferentiable functions, and some of the major relevant algorithms, subgradient and cutting plane methods, will be discussed in Chapter 6.
- [nonlinear programming_tif] The image depicts a three-dimensional graphical representation, likely related to linear algebra or optimization. Key elements include: - **Axes**: Three intersecting axes are shown, suggesting a three-dimensional coordinate system. Equation and Constraints**: A linear equation `{x | Ax = b, x ≥ 0}` is noted, indicating a system or set of constraints.
## Cognitive Tools Reference
See `.claude/skills/math-mode/SKILL.md` for full tool documentation.
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「constrained-optimization」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次