← ClaudeAtlas

biased-random-key-genetic-algorithmlisted

When the user wants to design, implement, or tune a biased random-key genetic algorithm (BRKGA), where chromosomes are random-key vectors in [0,1), evolution uses elite/mutant partitioning with biased uniform crossover, and a decoder is the only problem-specific component. Also use when the user mentions "BRKGA," "random keys," "random-key encoding," "biased crossover," "decoder," or when genetic operators must never produce infeasible solutions. For decoder design patterns, see decoder-based-representations; for general GA operators and selection, see genetic-algorithms.
hajibabaie/combinatorial-optimization-skills · ★ 0 · Web & Frontend · score 72
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