fairpy
An open-source library of fair division algorithms in Python
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.4%) to scientific vocabulary
Repository
An open-source library of fair division algorithms in Python
Basic Info
Statistics
- Stars: 37
- Watchers: 3
- Forks: 48
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
fairpy
fairpy is an open-source library of fair division algorithms in Python.
** NOTE: fairpyx is a newer library, that provides cleaner handling of fair allocation with constraints, e.g. course-seat allocation. Please visit there first. **
fairpy is designed for three target audiences:
- Laypeople, who want to use existing fair division algorithms for real-life problems.
- Researchers, who develop new fair division algorithms and want to quickly implement them and compare to existing algorithms.
- Students, who want to trace the execution of algorithms to understand how they work.
Installation
clone https://github.com/erelsgl/fairpy.git
cd fairpy
pip install -r requirements.txt
pip install -e .
To verify that everything was installed correctly, run one of the example programs, e.g.
python examples/items.py
python examples/cake.py
or run the tests:
pytest
Usage
The function fairpy.divide can be used to activate all fair division algorithms. For example:
import fairpy
valuations = {"Alice": {"w":11,"x":22,"y":44,"z":0}, "George": {"w":22,"x":11,"y":66,"z":33}}
### Allocating indivisible items using the Iterated Maximum Matching algorithm:
fairpy.divide(algorithm=fairpy.items.iterated_maximum_matching, input=valuations)
### Allocating divisible goods using the leximin algorithm:
fairpy.divide(fairpy.items.leximin, valuations)
### Dividing a cake using cut-and-choose:
from fairpy import PiecewiseConstantAgent
Alice = PiecewiseConstantAgent([33,33], "Alice")
George = PiecewiseConstantAgent([11,55], "George")
fairpy.divide(algorithm=fairpy.cake.cut_and_choose.asymmetric_protocol, input=[George, Alice])
Features and Examples
Item allocation algorithms, for both divisible and indivisible items;
Various input formats, to easily use by both researchers and end-users;
Optional logging, to learn and understand how the algorithms work.
Adding new algorithms
To add a new algorithm for item allocation, write a function that accepts one of the following parameters:
- AgentList - a list of Agent objects. See e.g. the implementation of Round Robin for usage example.
- ValuationMatrix - a matrix v where v[i,j] is the value of agent i to item j. See e.g. the implementation of Leximin for usage example.
Your function may accept any other custom parameters.
See also
Owner
- Name: Erel Segal-Halevi
- Login: erelsgl
- Kind: user
- Company: Ariel University
- Website: http://erelsgl.github.io
- Repositories: 64
- Profile: https://github.com/erelsgl
Lecturer at Ariel University
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: >-
fairpy - an open-source library of fair division
algorithms in Python
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Erel
family-names: Segal-Halevi
email: erelsgl@gmail.com
affiliation: Ariel University
orcid: 'https://orcid.org/0000-0002-7497-5834'
repository-code: 'https://github.com/erelsgl/fairpy'
license: GPL-3.0
date-released: '2023-12-31'
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 2
- Total pull requests: 64
- Average time to close issues: 2 days
- Average time to close pull requests: 29 days
- Total issue authors: 1
- Total pull request authors: 30
- Average comments per issue: 1.0
- Average comments per pull request: 1.03
- Merged pull requests: 51
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ifryed (1)
Pull Request Authors
- mor234 (3)
- TomLatin (2)
- noamya-sh (2)
- avivdan (2)
- shirFishbain (2)
- shlomog12 (2)
- Eyad-Amer (1)
- HelenYunes (1)
- ofeci (1)
- TahelZecharia (1)
- frieddv (1)
- Ishay1997 (1)
- AvihuuGoren (1)
- Asif-Rot (1)
- gidon285 (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- cmake *
- cvxpy_base >=1.1.17
- cvxpy_leximin >=0.4.4
- matplotlib *
- more_itertools *
- networkx *
- numpy >=1.21.3
- prtpy >=0.7.0
- pytest *
- repackage *
- scipy >=1.6.1
- scs *