|
8 | 8 |
|
9 | 9 | def test_bug27(): |
10 | 10 | """Invalid output of is_nondominated() with single-objective inputs.""" |
11 | | - x = np.asarray([[0.5], [0.6], [0.3], [0.1], [0.0], [0.9], [0.0]]) |
| 11 | + x = np.array([[0.5], [0.6], [0.3], [0.1], [0.0], [0.9], [0.0]]) |
12 | 12 |
|
13 | 13 | assert_array_equal( |
14 | 14 | moocore.is_nondominated(x), |
@@ -50,3 +50,28 @@ def test_bug29(): |
50 | 50 | x = [[0.2], [0.1], [0.2], [0.5], [0.3]] |
51 | 51 | assert_array_equal(moocore.pareto_rank(x), [1, 0, 1, 3, 2]) |
52 | 52 | assert_array_equal(moocore.pareto_rank(x, maximise=True), [2, 3, 2, 0, 1]) |
| 53 | + |
| 54 | + |
| 55 | +def test_bug38(): |
| 56 | + """Unexpected behavior of is_nondominated with 4+ objectives.""" |
| 57 | + x = np.array([[0, 0, 0, 0], [1, 1, 1, 1]]) |
| 58 | + assert_array_equal( |
| 59 | + moocore.is_nondominated(x, maximise=[False, True, True, True]), |
| 60 | + [True, True], |
| 61 | + ) |
| 62 | + assert_array_equal( |
| 63 | + moocore.is_nondominated(x, maximise=[True, False, True, True]), |
| 64 | + [True, True], |
| 65 | + ) |
| 66 | + assert_array_equal( |
| 67 | + moocore.is_nondominated(x, maximise=[True, True, False, True]), |
| 68 | + [True, True], |
| 69 | + ) |
| 70 | + assert_array_equal( |
| 71 | + moocore.is_nondominated(x, maximise=[True, True, True, False]), |
| 72 | + [True, True], |
| 73 | + ) |
| 74 | + assert_array_equal( |
| 75 | + moocore.is_nondominated(x, maximise=False), [True, False] |
| 76 | + ) |
| 77 | + assert_array_equal(moocore.is_nondominated(x, maximise=True), [False, True]) |
0 commit comments