moocore
moocore provides fast implementations of core mathematical functions and algorithms for multi-objective optimization. While available in R, this entry focuses on the Python package (v0.2.0). It offers functionalities for generating and transforming non-dominated sets, identifying dominated vectors, and computing various quality metrics like hypervolume and epsilon indicator. The critical functionality is implemented in C for high performance. The project maintains a frequent release cadence, often with minor updates.
Warnings
- gotcha Performance vs. Numerical Precision: `moocore` prioritizes speed through C implementations, which might lead to minor numerical differences compared to other multi-objective optimization libraries that use different underlying algorithms or floating-point precision strategies. Users migrating from other libraries should verify results for critical applications.
- breaking C-Core Error Handling: Older versions might terminate abruptly due to `exit()` or `abort()` calls within the C core instead of raising Python exceptions. While there are ongoing efforts to improve this, users might encounter unexpected program termination instead of catchable Python errors in some scenarios.
- gotcha Implicit NumPy Dependency: Although `numpy` is not a strict PyPI dependency, most examples and practical usage patterns for data handling within `moocore` implicitly rely on `numpy` arrays. Directly passing Python lists to certain functions may lead to performance overhead or unexpected behavior if not properly handled internally.
- gotcha Lack of Explicit Breaking Change Notes for 0.2.0: Despite incrementing the minor version from 0.1.x to 0.2.0, no explicit breaking changes were highlighted in the release notes. Users upgrading from 0.1.x versions should exercise caution and thoroughly test their applications, as underlying algorithm changes or interface adjustments might have occurred without explicit documentation.
Install
-
pip install moocore
Imports
- moocore
import moocore
- filter_dominated
import moocore points = moocore.filter_dominated(data)
- Hypervolume
import moocore hv_calculator = moocore.Hypervolume(reference=ref_point)
Quickstart
import numpy as np
import moocore
# Example data: a set of 2D points (assuming minimization)
# Each row is a point, each column is an objective
data = np.array([
[1.0, 5.0],
[2.0, 3.0],
[3.0, 2.0],
[4.0, 1.0],
[2.5, 2.5],
[1.5, 4.0]
])
# 1. Identify non-dominated points
nondominated_points_mask = moocore.is_nondominated(data)
nondominated_set = data[nondominated_points_mask]
print(f"Non-dominated points:\n{nondominated_set}")
# 2. Filter dominated points (returns only non-dominated ones)
filtered_set = moocore.filter_dominated(data)
print(f"Filtered (non-dominated) set:\n{filtered_set}")
# 3. Calculate Hypervolume (requires a reference point)
# Reference point should be worse than all points in the objective space
# For minimization, this means typically larger values.
ref_point = np.array([5.0, 5.0]) # Example reference point
hv_calculator = moocore.Hypervolume(reference=ref_point)
hypervolume_value = hv_calculator(filtered_set)
print(f"Hypervolume of the non-dominated set: {hypervolume_value}")