Files
PolySolve/src/polysolve
Jonathan Rampersad 663e72eabf
All checks were successful
Run Python Tests / test (3.10) (pull_request) Successful in 11s
Run Python Tests / test (3.12) (pull_request) Successful in 14s
Run Python Tests / test (3.8) (pull_request) Successful in 10s
fix(ga): Prevent premature convergence by widening parent pool
The GA tests were failing because the algorithm converged on a single root (e.g., -1.0) and failed to find the other (e.g., 2.5).

This was caused by creating a 'parent pool' from only the top 50% of solutions. This was too aggressive and discarded the 'niche' solutions that were exploring other valid roots.

This commit modifies the parent selection logic in both `_solve_x_numpy` and `_solve_x_cuda`. Parents for crossover and mutation are now selected from the *entire* sorted population (`data_size`).

This maintains population diversity and allows the algorithm to explore multiple optima, fixing the failing tests.
2025-10-27 10:20:08 -04:00
..