mcpbeat Sign in

Constrained Optimization Skill for Claude

Problem-solving strategies for constrained optimization in optimization

929 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
3880
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/parcadei/Continuous-Claude-v3 --skill constrained-optimization

The instruction itself

9 sections, as written by the author

Constrained Optimization

When to Use

Use this skill when working on constrained-optimization problems in optimization.

Decision Tree

  • Constraint Classification
  • Equality: h(x) = 0
  • Inequality: g(x) <= 0
  • Bounds: l <= x <= u
  • 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"
  • 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"
  • 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
  • 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

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

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

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.

Other skills for the same job

different authors, same section of the catalogue
Protocolsio Integration
by christophacham
×4

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

16k tokens
Tailored Resume Generator
by frostant
×4

Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances

3k tokens
Excalidraw Diagram Generator
by github
vendor ×3

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

36k tokens scripts
Expo Dev Client
by openai
vendor ×3

Build and distribute Expo development clients locally or via TestFlight

961 tokens
Executing Plans
by ZhanlinCui
×3

Use when you have a written implementation plan to execute in a separate session with review checkpoints

542 tokens
Anndata
by christophacham
×3

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

16k tokens
Benchling Integration
by christophacham
×3

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

14k tokens
Biopython
by christophacham
×3

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

24k tokens

How to use it

Copy the folder

Take parcadei/constrained-optimization from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.