advanced-optimization
Skill0 starsChanged 2 days agoMITView on GitHub
Choose a Julia optimiser by problem form: JuMP for constrained programs, Optimization.jl for differentiable residuals, surrogates for a black-box simulation. Use when the solver is the decision.
In this repository55 other files it gives its agents.
- bayesian-inferenceSkill
- bayesian-pinnSkill
- bayesian-ude-workflowSkill
- catalyst-reactionsSkill
- continuum-mechanics-and-rheologySkill
- control-theorySkill
- creating-julia-appSkill
- debugging-toolkitSkill
- differential-equationsSkill
- differentiationSkill
- equation-discoverySkill
- experiment-trackingSkill
- fem-feaSkill
- julia-graph-neural-networksSkill
- julia-languageSkill
- julia-ml-and-dlSkill
- julia-model-deploymentSkill
- julia-paper-implementationSkill
- julia-pro-helpSkill
- julia-pro-modeSkill
- julia-reinforcement-learningSkill
- modeling-toolkitSkill
- neural-pdeSkill
- nonlinear-dynamicsSkill
- numerical-methods-implementationSkill
- package-development-workflowSkill
- performance-tuningSkill
- physical-learning-systemsSkill
- playbook-debugSkill
- playbook-model-validateSkill
- playbook-package-releaseSkill
- playbook-paper-implementSkill
- playbook-perfSkill
- playbook-test-specSkill
- principle-both-sidesSkill
- principle-breakingSkill
- principle-file-is-truthSkill
- principle-gateSkill
- principle-limitsSkill
- principle-loud-failureSkill
- principle-one-stepSkill
- principle-proof-listSkill
- principle-rebuttalSkill
- principle-runtime-surfaceSkill
- principle-three-boundsSkill
- principle-three-clocksSkill
- scientific-visualizationSkill
- sciml-and-diffeqSkill
- setup-julia-proSkill
- signal-processingSkill
- simulation-and-hpcSkill
- statistical-physicsSkill
- symbolic-mathSkill
- web-development-juliaSkill
- zarr-cloud-arraysSkill
The file
Files
Advanced Optimization
The form of the problem picks the stack, and the form is decided before any code: a least-squares fit is not a general NLP, and a binary decision is not a continuous relaxation you can round afterwards.
Pick by form
| Form | Julia | Sign you are in this row |
| model equations are differentiable, residuals exist | Optimization.jl with AutoForwardDiff | you can write r(p) and its Jacobian |
| convex objective and constraints (LP, QP, SOCP, SDP) | JuMP.jl + HiGHS / Clarabel | DCP rules hold; the solution is global |
| integer or binary decisions | JuMP.jl + HiGHS, Cbc | the answer is a schedule, a selection, a count |
| objective is a black box (a simulation run) | Surrogates.jl, BayesianOptimization.jl | one evaluation costs minutes and has no gradient |
| several objectives with a real trade-off | JuMP epsilon-constraint, PlatEMO.jl | two metrics, neither substitutable for the other |
| parameters of a differential equation | Optimization.jl over a SciML solve | each residual requires a solve |
The pages under Depth carry the working API for a constrained program and for a fit.
Read the solver's answer
TERMINATED_BY_LIMIT and OPTIMAL are different results, and a rounded continuous relaxation is not a feasible integer point. Check, in this order: the status; the constraint violation recomputed from the solution (not reported by the solver); the gap, if integer; and the objective recomputed independently.
using JuMP, HiGHS
m = Model(HiGHS.Optimizer)
set_silent(m)
set_optimizer_attribute(m, "mip_rel_gap", 1e-4)
set_optimizer_attribute(m, "time_limit", 60.0)
@variable(m, 0 <= x[1:5] <= 1, Int)
@objective(m, Max, sum(v .* x))
@constraint(m, sum(w .* x) <= capacity)
optimize!(m)
@assert termination_status(m) == MOI.OPTIMAL
@assert sum(w .* value.(x)) <= capacity + 1e-9Black box: spend the budget on information
A grid search on a 5-parameter simulator is a waste of a week. Bayesian optimisation earns its complexity when each evaluation is expensive and the response surface is smooth enough for a GP; when it is not, use a space-filling design (Latin hypercube) and accept that you are mapping, not optimising. For a batch of parallel workers, ask for q > 1 points per round — sequential BO leaves the cluster idle.
Traps
- Rounding a relaxation. An LP relaxation of a knapsack rounds to an infeasible set more often than not; if the integrality matters, model it.
- A non-convex model in a convex solver. JuMP will reject it (good) or produce garbage (worse) depending on how it is written; prove convexity or move to a local NLP solver with multi-start.
- Tuned hyperparameters reported as the model's performance. The optimum of 100 trials on a noisy validation metric is biased upward; report a fresh-seed evaluation.
- Optimiser tolerance as accuracy. The parameter values inherit the solver's tolerance; a fit reported to 6 digits from
rel_tol=1e-3claims precision the solve does not have. - Multi-objective collapsed into a weighted sum without saying the weights. The Pareto front is the answer; a single weighted point hides the trade-off you were asked to expose.
Depth
| Page | Open when |
| optimization-patterns | parameters are fit to data — least squares, multiple shooting, an OptimizationProblem over a SciML solve |
| jump-optimization | the problem is a program with constraints: LP, QP, NLP, MIP written as a JuMP model |
Done when
The formulation is named and defended, the solver's status and recomputed constraint violation are recorded, and the reported precision matches the tolerance the solve actually achieved.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

