pymoo/unseeded-run
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| pymoo | info | unsafe, with xpd check --fix --unsafe-fixes |
All versions |
minimize without seed starts from a new random state on every run, so two runs return different fronts. Pass seed.
res = minimize(problem, NSGA2(pop_size=100), ("n_gen", 200))res = minimize(problem, NSGA2(pop_size=100), ("n_gen", 200), seed=1)What the rule reports
Section titled “What the rule reports”The rule reports minimize without seed. Two runs of NSGA2 on ZDT1 then returned different fronts, and two runs with seed=1 returned the same front. The rule leaves alone a call that takes **kwargs, a call whose algorithm was built with seed, and a file that calls np.random.seed, which numpy-seed-ignored reports.
How to fix it
Section titled “How to fix it”With --unsafe-fixes, xpd adds seed=1.
Diagnostic message
Section titled “Diagnostic message”minimize without seed starts from a new random state on every run, and two runs returned different fronts. Pass seed, such as seed=1, to get the same result again.See all rules in the pymoo pack.