python-optimization
БесплатноБез исполняемых скриптовНе проверенExpert guidance for mathematical optimization in Python - systematic problem classification, library selection (scipy, pyomo, cvxpy, GEKKO), solver…
Об этом скилле
Python Optimization Expert
Overview
Master mathematical optimization in Python through systematic problem analysis, appropriate library selection, and robust implementation. This skill guides you through classifying optimization problems, choosing the right solver, implementing efficient solutions, and troubleshooting convergence issues across linear programming, nonlinear programming, mixed-integer problems, and global optimization.
Core value: Transform optimization problems from mathematical formulation to working Python code with the most appropriate library and solver for your specific problem type.
When to Use
Use this skill when:
- Minimizing or maximizing objective functions
- Parameter estimation and curve fitting
- Portfolio optimization and resource allocation
- Production planning and scheduling
- Engineering design optimization
- Control and dynamic optimization
- Solving constrained or unconstrained optimization problems
- Choosing between scipy, pyomo, cvxpy, or other optimization libraries
Don't use when:
- Simple root finding (use scipy.optimize.root instead)
- Linear algebra only (use numpy/scipy.linalg)
- Symbolic mathematics needed (use sympy)
Problem Analysis Framework
Step 1: Extract Problem Components
Always identify:
Objective function: What to minimize or maximize?
- Example: minimize cost, maximize profit, minimize error
Decision variables: What can be changed?
- Continuous (real numbers) or discrete (integers)?
- How many variables?
Constraints: What restrictions exist?
- Equality constraints: h(x) = 0
- Inequality constraints: g(x) ≥ 0
- Bounds: lower ≤ x ≤ upper
Data/parameters: What values are given?
- Constants, measurements, input data
Step 2: Classify Problem Type
Linear Programming (LP)
- Linear objective function
- Linear constraints only
- Example: max c'x subject to Ax ≤ b
Quadratic Programming (QP)
- Quadratic objective function
- Linear constraints
- Example: min (1/2)x'Qx + c'x subject to Ax ≤ b
Nonlinear Programming (NLP)
- Nonlinear objective or constraints
- Smooth, differentiable functions
- Example: min f(x) subject to g(x) ≥ 0
Mixed-Integer Programming (MIP/MILP/MINLP)
- Some or all variables must be integers
- Combinatorial optimization
- Example: scheduling, assignment problems
Convex Optimization
- Convex objective function
- Convex feasible region
- Global optimum guaranteed
Global Optimization
- Multiple local minima suspected
- Non-convex problems
- Requires global search strategies
Least Squares
- Minimize sum of squared residuals
- Parameter estimation, curve fitting
- Special structure exploited by dedicated solvers
Dynamic Optimization / Optimal Control
- Time-dependent variables
- Differential equations as constraints
- Trajectory optimization
Step 3: Characterize Problem Scale
Small problems: < 100 variables
- Most methods work well
- scipy.optimize is sufficient
Medium problems: 100-1,000 variables
- Need efficient algorithms
- Consider specialized solvers
Large problems: > 1,000 variables
- Requires sparse matrix techniques
- Use pyomo or specialized solvers
- Exploit problem structure
Other characteristics:
- Are derivatives available? Analytical or numerical?
- Smooth or non-smooth?
- Sparse or dense?
- Special structure (separable, etc.)?
Library Selection Guide
scipy.optimize - Default Choice
Use when:
- Small to medium problems (<1,000 variables)
- Unconstrained or smooth constrained NLP
- Quick prototyping and development
- Least squares / curve fitting
- Python-native solution preferred
Strengths:
- Part of scipy (widely available)
- Easy to use, good documentation
- Multiple algorithms available
- No additional dependencies
Limitations:
- Not ideal for large-scale problems
- Limited support for mixed-integer
- Less sophisticated than commercial solvers
pyomo - Algebraic Modeling
Use when:
- Large-scale problems (>1,000 variables)
- Mixed-integer programming
- Need multiple solver backends
- Algebraic modeling preferred
- Production environments
Strengths:
- Scales to very large problems
- Supports many external solvers
- Clean mathematical notation
- Active development and community
Limitations:
- Requires external solvers for many problem types
- Steeper learning curve
- Additional installation complexity
cvxpy - Convex Optimization
Use when:
- Problem is (or might be) convex
- Want automatic convexity verification
- Prefer disciplined convex programming
- Portfolio optimization, control
Strengths:
- Automatic convexity detection
- Mathematical notation syntax
- Multiple solver backends
- Excellent for convex problems
Limitations:
- Only for convex problems
- Less flexible for non-convex
- Learning curve for DCP rules
GEKKO - Dynamic Optimization
Use when:
- Black-box functions (no derivatives)
- Dynamic optimi
Установить python-optimization в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
*FAQ
Что делает скилл python-optimization?
Expert guidance for mathematical optimization in Python - systematic problem classification, library selection (scipy, pyomo, cvxpy, GEKKO), solver configuration, and implementation patterns for LP, QP, NLP, MIP, convex, and global optimization problems
Как установить скилл python-optimization?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл python-optimization запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic