180-bit Genomes Reach Functional Self-Parking After 40 Generations in TypeScript GA Simulator
A TypeScript genetic algorithm evolves 180-bit control genomes for an 8-sensor car, achieving usable self-parking by generation 40. The discrete encoding and fitness metric produce measurable progress without neural networks. The work illustrates low-overhead evolutionary methods applicable to constrained robotics problems.
The implementation maps each genome to a pure function that converts eight ray-cast distances into engine and steering signals every 100 ms. Initial populations exhibit random motion with frequent collisions. Selection retains genomes minimizing distance to the target spot while applying crossover and bit-flip mutation across generations. By generation 40, selected individuals consistently approach the spot from varied starting positions despite residual wall contacts.
Data from repeated simulator runs show median fitness rising sharply between generations 15 and 35 before plateauing. The 180-bit encoding corresponds to a lookup table or simple threshold logic rather than a trained neural network, limiting generalization beyond the fixed parking geometry. This matches patterns in early evolutionary robotics papers where discrete genomes solved low-dimensional control tasks faster than continuous parameter optimization.
The approach demonstrates verifiable incremental improvement on a benchmark task without requiring gradient computation or labeled trajectories. Operationally it highlights that browser-based GA loops can iterate thousands of evaluations in seconds, enabling rapid parameter sweeps on mutation rate and population size. Extensions to real vehicles would require sensor noise models and continuous action spaces absent from the current discrete formulation.
Future simulator updates could incorporate multi-spot scenarios or dynamic obstacles to test whether the same genome length maintains convergence within 50 generations.
Trekhleb: Browser GA runs with adjusted mutation rates will reach median fitness plateau below generation 30 within documented test cases by end of 2022.
Sources (3)
- [1]Self-parking car using genetic algorithm(https://trekhleb.dev/blog/2021/self-parking-car-evolution/)
- [2]self-parking-car-evolution GitHub repository(https://github.com/trekhleb/self-parking-car-evolution)
- [3]Adaptation in Natural and Artificial Systems(https://mitpress.mit.edu/9780262581110/adaptation-in-natural-and-artificial-systems/)