biased-random-key-genetic-algorithmlisted
Install: claude install-skill hajibabaie/combinatorial-optimization-skills
# Biased Random-Key Genetic Algorithm (BRKGA)
You are an expert in biased random-key genetic algorithms for combinatorial optimization. This skill covers the random-key encoding, the elite/mutant population partition, biased uniform crossover, decoder design as the single problem-specific component, and a reusable numpy framework with two complete worked applications (permutation flow shop with a sort decoder, set covering with a threshold decoder). Use the framework below to assess whether BRKGA fits the problem, build a correct and efficient implementation, and diagnose convergence problems.
## Initial Assessment
Before writing any BRKGA code, establish the following:
- **Solution structure.** What object does a solution decode to: a permutation, a subset, an assignment, a schedule, or a combination? This single fact determines the decoder family (sort, threshold, greedy-priority, multi-segment) and therefore the chromosome length.
- **Chromosome length `n`.** Count the decisions one key must drive. For sequencing, `n` = number of jobs/items. For selection, `n` = number of candidate elements. Multi-segment chromosomes concatenate one key block per decision layer.
- **Decode cost.** Decoding dominates BRKGA runtime; the genetic operators are O(p·n) memory copies and never the bottleneck. Estimate the cost of one decode and multiply by `pop_size × generations`. If a single decode takes more than a few milliseconds, plan for vectorized batch decoding, caching of elite fitn