moocore.is_nondominated_within_sets#

moocore.is_nondominated_within_sets(data, /, sets, *, maximise=False, keep_weakly=False)[source]#

Identify dominated points according to Pareto optimality within each set.

Executes the is_nondominated() function within each set in a dataset and returns back a 1D array of booleans. This is equivalent to apply_within_sets(data, sets, is_nondominated, ...) but slightly faster.

Parameters:
  • data (ArrayLike) – Array of numerical values, where each row gives the coordinates of a point in objective space. If the array is created by the read_datasets() function, remove the last column.

  • sets (ArrayLike) – 1D vector or list of values that define the sets to which each row of data belongs.

  • maximise (bool | list[bool], default: False) – Whether the objectives must be maximised instead of minimised. Either a single boolean value that applies to all objectives or a list of boolean values, with one value per objective. Also accepts a 1D numpy array with value 0/1 for each objective.

  • keep_weakly (bool, default: False) – If False, return False for any duplicates of nondominated points.

Returns:

ndarray – Returns a boolean array of the same length as the number of rows of data, where True means that the point is not dominated by any other point.

See also

filter_dominated_within_sets

filter out dominated points.

apply_within_sets

a more general way to apply any function to each set.

Examples

>>> x = np.array([[1, 2, 1], [1, 3, 1], [2, 1, 1], [2, 2, 2]])
>>> moocore.is_nondominated_within_sets(x[:, :-1], x[:, -1])
array([ True, False,  True,  True])
>>> x = moocore.get_dataset("input1.dat")
>>> nondom_per_set = moocore.is_nondominated_within_sets(
...     x[:, :-1], x[:, -1]
... )
>>> len(nondom_per_set)
100
>>> nondom_per_set  
array([False, False,  True, False,  True, False, False, False, False,
        True, False,  True,  True,  True, False,  True,  True,  True,
       False,  True, False, False, False, False,  True, False,  True,
       ...
        True,  True,  True, False,  True, False,  True,  True, False,
        True, False, False,  True,  True, False, False, False, False,
       False])
>>> x[nondom_per_set, :]  
array([[ 0.20816431,  4.62275469,  1.        ],
       [ 0.22997367,  1.11772205,  1.        ],
       [ 0.58799475,  0.73891181,  1.        ],
       [ 1.5964888 ,  5.98825094,  2.        ],
       [ 5.2812367 ,  3.47800969,  2.        ],
       [ 2.16315952,  4.7394435 ,  2.        ],
       ...
       [ 0.6510164 ,  9.42381213,  9.        ],
       [ 1.30291449,  4.50417698,  9.        ],
       [ 0.62230271,  3.56945324, 10.        ],
       [ 0.86723965,  1.58599089, 10.        ],
       [ 6.43135537,  1.00153569, 10.        ]])