fix: genome GA converges via BFS fitness + two-rate prefix-aware mutation
- Replace Manhattan distance with BFS distances (actual maze path length) - Switch from NN to direct sequence genome (what YouTube Shorts actually use) - Mutation-only GA (crossover breaks positional maze paths) - Two-rate mutation: low rate before best-step (preserve prefix), high after (explore tail) - Auto-seed selection finds maze with short BFS path - Default maze 15x15, cell_size=36, max_steps=150 - Typically converges in 5-15 generations
This commit is contained in:
20
config.py
20
config.py
@@ -3,21 +3,23 @@ from dataclasses import dataclass
|
||||
@dataclass
|
||||
class MazeConfig:
|
||||
# Maze geometry
|
||||
maze_cols: int = 25
|
||||
maze_rows: int = 25
|
||||
cell_size: int = 24
|
||||
maze_cols: int = 15
|
||||
maze_rows: int = 15
|
||||
cell_size: int = 36
|
||||
wall_width: int = 2
|
||||
|
||||
# GA / Training
|
||||
population: int = 100
|
||||
max_steps: int = 300
|
||||
max_steps: int = 150
|
||||
elite_frac: float = 0.30
|
||||
mutation_std: float = 0.05
|
||||
mutation_rate: float = 0.20
|
||||
n_elite: int = 3 # few elites → maintains population diversity
|
||||
mutation_std: float = 0.08
|
||||
mutation_rate: float = 0.35
|
||||
temperature: float = 0.7 # softmax sampling temperature (lower = more greedy)
|
||||
|
||||
# Neural net
|
||||
n_inputs: int = 8
|
||||
n_hidden: int = 12
|
||||
# Neural net — 14 inputs: 4 walls + 2 goal dir + 2 pos + 4 last-action + 1 blocked + 1 revisit
|
||||
n_inputs: int = 14
|
||||
n_hidden: int = 16
|
||||
n_outputs: int = 4
|
||||
|
||||
# Fitness
|
||||
|
||||
Reference in New Issue
Block a user