()
| 88 | |
| 89 | |
| 90 | def 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) |
nothing calls this directly
no test coverage detected
searching dependent graphs…