Skip to main content

Analyzers

Metrics for analysing solved multi objective linear programs (muoblp.MultiObjectiveLpProblem with variable values set, e.g. by a solver from muoblpsolvers).


Installation

pip install muoblpanalyzers            # python metrics
pip install "muoblpanalyzers[native]"  # + C++ native metrics (muoblpbindings)

Usage

from muoblpanalyzers import Metric, get_metrics, ejr_plus

problem.solve(solver)  # any solved MultiObjectiveLpProblem

get_metrics([Metric.EXCLUSION_RATIO, Metric.EJR_PLUS_NATIVE], problem)
# {"EXCLUSION_RATIO": {"exclusion_ratio": 0.25}, "EJR_PLUS_NATIVE": {"ejr_plus": 0}}

ejr_plus(problem)  # single metric -> {"ejr_plus": 0}

Metrics

Metric values are stable keys (used in persisted results), never renamed.

Metric Function Result Notes
EXCLUSION_RATIO exclusion_ratio {"exclusion_ratio": float} share of objectives (voters) with value 0
SUM_OBJECTIVES sum_objectives {"sum": float} sum of objective values
EJR_PLUS ejr_plus {"ejr_plus": int} unelected projects violating EJR+ (up to one)
CONSTRAINTS invalid_constraints {"pb_constraint": bool, "invalid_count": int} needs PB constraint
INSTANCE_SIZE instance_size {"size": int} number of variables
TOTAL_COST total_cost {"total_cost": float} needs PB constraint
EXCLUSION_RATIO_NATIVE native same as EXCLUSION_RATIO needs [native]
EJR_PLUS_NATIVE native same as EJR_PLUS needs [native]

PB constraint = single <= constraint covering all candidates (muoblpsolvers.election_solver.validate_pb_constraint); missing or ambiguous raises.

Native metrics

C++ implementations from muoblpbindings.metrics, each a twin of a python metric (PYTHON_COUNTERPART) with identical results (parity-tested, exact).

  • Imports are lazy: python metrics work without bindings; a native metric without bindings raises ImportError (no silent python fallback).
  • get_metrics builds one SolvedInstance handle per problem, shared by all requested native metrics; a snapshot of variable values at build time.

Adding a metric

  • Python: function (MultiObjectiveLpProblem) -> dict in metrics.py, Metric member in metric.py, entry in PYTHON_STRATEGIES.
  • Native: follow "Adding new metric" in the bindings README, then register strategy in NATIVE_STRATEGIES and its python oracle in PYTHON_COUNTERPART (native_metrics.py). Parity tests pick it up from PYTHON_COUNTERPART.
  • experiments consumers: add matching AnalyzerResult field (experiments/src/helpers/analyzers/model.py).

Development

$ poetry install --all-extras
$ poetry run pytest
$ poetry run pyright

C++ edits need a reinstall of the bindings into this venv: poetry run pip install --force-reinstall --no-deps ../bindings.

Metadata

Release files for muoblpanalyzers 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for muoblpanalyzers 0.0.1
File Size Uploaded Provenance Actions
muoblpanalyzers-0.0.1.tar.gz 4.7 kB With provenance Details for muoblpanalyzers-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for muoblpanalyzers 0.0.1
File Interpreter ABI Platform Actions
muoblpanalyzers-0.0.1-py3-none-any.whl Python 3 none any Details for muoblpanalyzers-0.0.1-py3-none-any.whl

Total release size: 10.5 kB

Release files / muoblpanalyzers-0.0.1.tar.gz

Download URL muoblpanalyzers-0.0.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
57c89a95316a2ecf08cc8abe1d1ab902bf2671a78831911382b548a6135512e7
BLAKE2b-256 checksum
How to use checksums
d243fffe6c0726cdd2c9e81121472d42f935bec2d2588960a4e82174f8442ee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / muoblpanalyzers-0.0.1-py3-none-any.whl

Download URL muoblpanalyzers-0.0.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dfed5cf5d459c3f4a787a53870bee7eea819d5530996a1a35ca35adef659b2c
BLAKE2b-256 checksum
How to use checksums
2aa333344ae034e1a7383bfff6ff29ac30d340216757a80648c371c1355d6f8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for muoblpanalyzers 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for muoblpanalyzers-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page