Cookbook
Short, focused recipes for the patterns that come up in practice. Each recipe is self-contained and small enough to copy into your own project.
Recipes
- Parallelize evaluation with rayon — when
your
evaluateis non-trivial CPU work, theparallelfeature pays for itself almost immediately. - Async evaluation — when your
evaluateis IO-bound (HTTP / RPC / subprocess), theasyncfeature lets the optimizer await many evaluations concurrently. The differentiating feature vs other optimization libraries. - Tune a model with expensive evaluations — Bayesian Optimization, TPE, and Hyperband for the 50–500-eval regime.
- Compare two algorithms on your problem —
multi-seed harness pattern straight from
examples/compare.rs. - Optimize a permutation (TSP-style) — the permutation operator toolkit (OX / PMX / CX / ERX + Inversion / Insertion / Scramble), plus Ant Colony for distance-matrix TSP.
- Multi-objective combinatorial problems
— bi-objective TSP, bi-objective knapsack (
Vec<bool>), and 3-objective JSS via NSGA-II / NSGA-III. - Constrain your search with
Repair— bounds, simplex projection, custom repair. - Pick one answer off a Pareto front — the
a-posteriori weighted-decision pattern from the
jiggly_tuningexample. - Explore your results in a webapp — export
an
OptimizationResultto JSON and browse it interactively at heuropt-explorer — parallel coordinates, scatter, range filters, weighted ranking. - Write your own algorithm —
implement
Optimizer<P>from scratch, à la theexamples/custom_optimizer.rswalkthrough.