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

Function test_update

tests/algorithms/test_ctaea.py:185–220  ·  view source on GitHub ↗
(ref_dirs, evaluator)

Source from the content-addressed store, hash-verified

183
184
185def test_update(ref_dirs, evaluator):
186 problem = C3DTLZ4(n_var=12, n_obj=3)
187 ca_x = np.loadtxt(load_to_test_resource('ctaea', 'c3dtlz4', 'case2', 'preCA.x'))
188 CA = Population.new(X=ca_x)
189 evaluator.eval(problem, CA)
190
191 da_x = np.loadtxt(load_to_test_resource('ctaea', 'c3dtlz4', 'case2', 'preDA.x'))
192 DA = Population.new(X=da_x)
193 evaluator.eval(problem, DA)
194
195 off_x = np.loadtxt(load_to_test_resource('ctaea', 'c3dtlz4', 'case2', 'offspring.x'))
196 off = Population.new(X=off_x)
197 evaluator.eval(problem, off)
198
199 post_ca_x = np.loadtxt(load_to_test_resource('ctaea', 'c3dtlz4', 'case2', 'postCA.x'))
200 true_pCA = Population.new(X=post_ca_x)
201 evaluator.eval(problem, true_pCA)
202
203 post_da_x = np.loadtxt(load_to_test_resource('ctaea', 'c3dtlz4', 'case2', 'postDA.x'))
204 true_pDA = Population.new(X=post_da_x)
205 evaluator.eval(problem, true_pDA)
206
207 survival = CADASurvival(ref_dirs)
208 mixed = Population.merge(CA, off)
209 survival.ideal_point = np.array([0., 0., 0.])
210
211 pCA, pDA = survival.do(problem, mixed, DA, len(ref_dirs))
212
213 pCA_X = set([tuple(x) for x in pCA.get("X")])
214 tpCA_X = set([tuple(x) for x in true_pCA.get("X")])
215
216 pDA_X = set([tuple(x) for x in pDA.get("X")])
217 tpDA_X = set([tuple(x) for x in true_pDA.get("X")])
218
219 assert pCA_X == tpCA_X
220 assert pDA_X == tpDA_X
221
222
223def test_mating_comparison(ref_dirs, evaluator):

Callers

nothing calls this directly

Calls 8

doMethod · 0.95
C3DTLZ4Class · 0.90
load_to_test_resourceFunction · 0.90
CADASurvivalClass · 0.90
mergeMethod · 0.80
newMethod · 0.45
evalMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…