- Rewrites cookbook/permutation.md to cover the new operator toolkit: initializers, crossovers (OX/PMX/CX/ERX), mutations, a 'what should I use' picker, and a worked GA-on-TSP example. JSS multiset section explains why the strict-permutation crossovers don't compose with operation-string encodings and shows the local POX pattern. - Adds cookbook/multi-objective-combinatorial.md: bi-objective TSP via NSGA-II, bi-objective knapsack (binary encoding), 3-objective JSS via NSGA-III, and a hypervolume-based operator comparison. - Updates choosing-an-algorithm.md to reference the new operators in the single- and multi-objective decision tables, plus a noting NSGA-II/III's genericity over Vec<usize> and Vec<bool> decisions. - SUMMARY.md and cookbook.md updated to list the new recipe.
1.9 KiB
1.9 KiB
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.