Pabumeasures
Pabumeasures implements the project performance measures from Evaluation of Project Performance in Participatory Budgeting (Boehmer et al., arXiv:2312.14723) for the GreedyAV, Greedy over Cost, Phragmén, and Method of Equal Shares rules with both cost and approval-based utility functions.
The package is fully compatible with pabutools, using its Instance, ApprovalProfile, and BudgetAllocation types.
Installation
Prerequisites
- CMake,
- Google OR-Tools (C++) – install via a package manager (e.g.,
brew) or download a binary distribution.
Building
Pabumeasures uses dynamic linking to reduce build times, so you might need to make the OR-Tools headers and libraries discoverable at both build-time and runtime. The path to OR-Tools must be the installation root containing the lib and include subdirectories.
Linux
export CMAKE_PREFIX_PATH="/path/to/ortools"
export LD_LIBRARY_PATH="$CMAKE_PREFIX_PATH/lib:$LD_LIBRARY_PATH"
macOS
export CMAKE_PREFIX_PATH="/path/to/ortools"
export DYLD_LIBRARY_PATH="$CMAKE_PREFIX_PATH/lib:$DYLD_LIBRARY_PATH"
Windows
set CMAKE_PREFIX_PATH=C:\path\to\ortools
set PATH=%CMAKE_PREFIX_PATH%\lib;%PATH%
You can then install pabumeasures from PyPI:
pip install pabumeasures
Documentation
The general workflow is: create or import PB instances using pabutools, then compute rule outcomes and measures using pabumeasures.
Example
from pabumeasures import Measure, mes_cost, mes_cost_measure
from pabutools.election import ApprovalBallot, ApprovalProfile, Instance, Project
p1 = Project("p1", 1)
p2 = Project("p2", 1)
p3 = Project("p3", 3)
b1 = ApprovalBallot([p1, p2])
b2 = ApprovalBallot([p1, p2, p3])
b3 = ApprovalBallot([p3])
instance = Instance([p1, p2, p3], budget_limit=3)
profile = ApprovalProfile([b1, b2, b3])
mes_cost(instance, profile) # returns BudgetAllocation([p1, p2])
mes_cost_measure(instance, profile, p3, Measure.ADD_APPROVAL_OPTIMIST) # returns 1
Available functions
Rules
| pabumeasures | pabutools equivalent |
|---|---|
greedy(instance, profile) |
greedy_utilitarian_welfare(instance, profile, sat_class=Cost_Sat) |
greedy_over_cost(instance, profile) |
greedy_utilitarian_welfare(instance, profile, sat_class=Cardinality_Sat) |
mes_cost(instance, profile) |
method_of_equal_shares(instance, profile, sat_class=Cost_Sat) |
mes_apr(instance, profile) |
method_of_equal_shares(instance, profile, sat_class=Cardinality_Sat) |
phragmen(instance, profile) |
sequential_phragmen(instance, profile) |
All rule functions return a BudgetAllocation and accept an optional tie_breaking: ProjectComparator (default: ProjectComparator.ByCostAsc).
Measures
Measure functions have no pabutools equivalent.
| Function | Description |
|---|---|
greedy_measure(instance, profile, project, measure) |
Measure for GreedyAV |
greedy_over_cost_measure(instance, profile, project, measure) |
Measure for Greedy over Cost |
mes_cost_measure(instance, profile, project, measure) |
Measure for MES-Cost |
mes_apr_measure(instance, profile, project, measure) |
Measure for MES-Apr |
phragmen_measure(instance, profile, project, measure) |
Measure for sequential Phragmén |
All measure functions return an int (or None if the measure is not defined) and accept an optional tie_breaking: ProjectComparator. The measure argument is one of (see Boehmer et al. for formal definitions):
Measure value |
Name in paper |
|---|---|
Measure.COST_REDUCTION |
cost-red |
Measure.ADD_APPROVAL_OPTIMIST |
optimist-add |
Measure.ADD_APPROVAL_PESSIMIST |
pessimist-add |
Measure.ADD_SINGLETON |
singleton-add |
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pabumeasures-0.2.2.tar.gz.
File metadata
- Download URL: pabumeasures-0.2.2.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bbd8c404dd37fea5d75304dd578bf213880be5627dfb2992ecc407b3ddb19c7
|
|
| MD5 |
7513b848ffee3e80acc96ebae3631deb
|
|
| BLAKE2b-256 |
b50f64e5a6f03d6a25775d7b299e868cf317f288eb3be28b76887a3ddd6cc20b
|
Provenance
The following attestation bundles were made for pabumeasures-0.2.2.tar.gz:
Publisher:
release.yml on mdbrnowski/pabumeasures
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pabumeasures-0.2.2.tar.gz -
Subject digest:
3bbd8c404dd37fea5d75304dd578bf213880be5627dfb2992ecc407b3ddb19c7 - Sigstore transparency entry: 1059724525
- Sigstore integration time:
-
Permalink:
mdbrnowski/pabumeasures@60d9b5317af9e39767edc954ab3d00fce693e523 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/mdbrnowski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60d9b5317af9e39767edc954ab3d00fce693e523 -
Trigger Event:
push
-
Statement type: