moocore

0.2.0 · active · verified Wed Apr 15

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

Install

Imports

Quickstart

This quickstart demonstrates basic usage of moocore for identifying and filtering non-dominated points and calculating the hypervolume indicator. It assumes a minimization problem for all objectives. The `moocore.is_nondominated` function returns a boolean mask, while `moocore.filter_dominated` directly returns the non-dominated points. The `moocore.Hypervolume` class is initialized with a reference point and then called with the set of points.

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}")

view raw JSON →