(ref_dirs, evaluator)
| 22 | |
| 23 | |
| 24 | def test_association(ref_dirs, evaluator): |
| 25 | problem = C1DTLZ3(n_var=12, n_obj=3) |
| 26 | ca_x = np.loadtxt(load_to_test_resource('ctaea', 'c1dtlz3', 'case3', 'preCA.x')) |
| 27 | CA = Population.new(X=ca_x) |
| 28 | evaluator.eval(problem, CA) |
| 29 | |
| 30 | da_x = np.loadtxt(load_to_test_resource('ctaea', 'c1dtlz3', 'case3', 'preDA.x')) |
| 31 | DA = Population.new(X=da_x) |
| 32 | evaluator.eval(problem, DA) |
| 33 | |
| 34 | off_x = np.loadtxt(load_to_test_resource('ctaea', 'c1dtlz3', 'case3', 'offspring.x')) |
| 35 | off = Population.new(X=off_x) |
| 36 | evaluator.eval(problem, off) |
| 37 | |
| 38 | true_assoc = np.loadtxt(load_to_test_resource('ctaea', 'c1dtlz3', 'case3', 'feasible_rank0.txt')) |
| 39 | true_niche = true_assoc[:, 1] |
| 40 | true_id = true_assoc[:, 0] |
| 41 | sorted_id = np.argsort(true_id) |
| 42 | |
| 43 | survival = CADASurvival(ref_dirs) |
| 44 | mixed = Population.merge(CA, off) |
| 45 | survival.ideal_point = np.min(np.vstack((DA.get("F"), mixed.get("F"))), axis=0) |
| 46 | |
| 47 | fronts = NonDominatedSorting().do(mixed.get("F"), n_stop_if_ranked=len(ref_dirs)) |
| 48 | I = np.concatenate(fronts) |
| 49 | niche, _ = survival._associate(mixed[I]) |
| 50 | sorted_I = np.argsort(I) |
| 51 | |
| 52 | assert (niche[sorted_I] == true_niche[sorted_id]).all() |
| 53 | |
| 54 | |
| 55 | def test_update_ca(ref_dirs, evaluator): |
nothing calls this directly
no test coverage detected
searching dependent graphs…