MCPcopy Create free account
hub / github.com/anyoptimization/pymoo / test_min_vs_loop_vs_infill

Function test_min_vs_loop_vs_infill

tests/algorithms/test_algorithms.py:90–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89
90def test_min_vs_loop_vs_infill():
91 problem = get_problem("zdt1")
92 n_gen = 30
93
94 algorithm = NSGA2(pop_size=100)
95 min_res = minimize(problem, algorithm, ('n_gen', n_gen), seed=1)
96
97 algorithm = NSGA2(pop_size=100)
98 algorithm.setup(problem, termination=('n_gen', n_gen), seed=1)
99 while algorithm.has_next():
100 algorithm.next()
101 algorithm.finalize()
102 loop_res = algorithm.result()
103
104 np.testing.assert_allclose(min_res.X, loop_res.X)
105
106 algorithm = NSGA2(pop_size=100)
107 algorithm.setup(problem, termination=('n_gen', n_gen), seed=1)
108 while algorithm.has_next():
109 infills = algorithm.infill()
110 Evaluator().eval(problem, infills)
111 algorithm.advance(infills=infills)
112 algorithm.finalize()
113 infill_res = algorithm.result()
114
115 np.testing.assert_allclose(min_res.X, infill_res.X)

Callers

nothing calls this directly

Calls 12

get_problemFunction · 0.90
NSGA2Class · 0.90
minimizeFunction · 0.90
EvaluatorClass · 0.90
resultMethod · 0.80
infillMethod · 0.80
setupMethod · 0.45
has_nextMethod · 0.45
nextMethod · 0.45
finalizeMethod · 0.45
evalMethod · 0.45
advanceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…