Skip to content

pymoo/unseeded-run

Rule unseeded-run
Pack pymoo
Severity info
Fix none, edit by hand
Library versions every version

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)

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.

xpd has no automatic fix, so make the change by hand.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

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.

Browse the other rules of the pymoo pack.