pareto-optimization
Multi-objective optimization with Pareto frontiers. Use when optimizing multiple conflicting objectives simultaneously, finding trade-off solutions, or computing Pareto-optimal points.
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 93
- Forks
- 8
01 前言 Front Matter
- name
- pareto-optimization
- description
- Multi-objective optimization with Pareto frontiers. Use when optimizing multiple conflicting objectives simultaneously, finding trade-off solutions, or computing Pareto-optimal points.
03 SKILL.md 正文
Pareto Frontier Computation
When to Use
Use this skill whenever you need to find the set of non-dominated solutions from multi-objective optimization results — e.g., balancing accuracy vs. cost, F1 vs. distance, precision vs. recall.
Core Algorithm
A solution is Pareto-optimal if no other solution is better on all objectives simultaneously.
import numpy as np
def pareto_frontier(objectives, maximize=None):
"""
Find Pareto-optimal points.
Args:
objectives: array of shape (n, k) where k is the number of objectives
maximize: list of bools, True = maximize that objective, False = minimize
Default: all maximize
Returns:
Boolean mask of Pareto-optimal points
"""
n = len(objectives)
if maximize is None:
maximize = [True] * objectives.shape[1]
# Flip sign for objectives to maximize (so we can treat all as minimize)
obj = objectives.copy().astype(float)
for i, m in enumerate(maximize):
if m:
obj[:, i] = -obj[:, i]
is_pareto = np.ones(n, dtype=bool)
for i in range(n):
if not is_pareto[i]:
continue
# A point dominates i if it's <= on all objectives and < on at least one
for j in range(n):
if i == j or not is_pareto[j]:
continue
if np.all(obj[j] <= obj[i]) and np.any(obj[j] < obj[i]):
is_pareto[i] = False
break
return is_pareto
Usage Pattern for Grid Search Results
import pandas as pd
# results_df has columns: F1, delta, param1, param2, ...
# Maximize F1, minimize delta
objectives = results_df[['F1', 'delta']].values
mask = pareto_frontier(objectives, maximize=[True, False])
pareto_df = results_df[mask]
Notes
- Filter out invalid/unwanted results before computing the frontier
- The frontier is sensitive to objective scales — normalization isn't needed for finding Pareto points but matters for visualization
- For two objectives, sorting by one and scanning for improvements in the other gives O(n log n) performance
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.