Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cstv algorithm and tests. #29

Merged
merged 102 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
9a754d1
Added CSTV algorithm to the library
tjhv10 May 19, 2024
8439659
Inserted the CSTV folder into the right place
tjhv10 May 19, 2024
563fa22
ok
tjhv10 May 19, 2024
deb7e33
progress
tjhv10 May 27, 2024
185df62
with regular update donations
tjhv10 May 27, 2024
f51c956
good
tjhv10 May 27, 2024
8e3a55a
first two working perfectly
tjhv10 May 28, 2024
643fa40
update
tjhv10 May 30, 2024
ad0910b
good
tjhv10 May 30, 2024
80e7555
changed the doctests
tjhv10 May 30, 2024
341474f
final for 4
tjhv10 May 30, 2024
469c239
working but with bad project
tjhv10 May 30, 2024
b747946
updated with new projects and doners
tjhv10 May 30, 2024
12869d8
Update CSTV.py
tjhv10 May 30, 2024
d9493aa
ok
tjhv10 Jun 2, 2024
b94d339
Merge branch 'main' of https://github.com/tjhv10/pabutools
tjhv10 Jun 2, 2024
eb17120
added function still doesnt work
tjhv10 Jun 2, 2024
a88b1cf
good
tjhv10 Jun 2, 2024
50f6837
almost working
tjhv10 Jun 2, 2024
8ddde3d
very good
tjhv10 Jun 2, 2024
6debb84
final
tjhv10 Jun 3, 2024
737db53
good for assignment 6
tjhv10 Jun 3, 2024
706040a
changed name for tests
tjhv10 Jun 3, 2024
9239768
fix bug
tjhv10 Jun 3, 2024
70bd815
final for matala 6
tjhv10 Jun 6, 2024
1289637
final for matala 6
tjhv10 Jun 6, 2024
9ade66c
added more tests
tjhv10 Jun 9, 2024
bfa8c7b
almost perfect
tjhv10 Jun 9, 2024
493ee50
final
tjhv10 Jun 9, 2024
df30060
final
tjhv10 Jun 9, 2024
f74b8ad
final
tjhv10 Jun 9, 2024
5aa8e57
final
tjhv10 Jun 9, 2024
e85e313
final
tjhv10 Jun 9, 2024
85a8b81
final
tjhv10 Jun 9, 2024
d557b18
change doners to donors
tjhv10 Jun 9, 2024
a530bc4
final
tjhv10 Jun 9, 2024
f55dee8
final
tjhv10 Jun 10, 2024
974b5e6
good
tjhv10 Jun 13, 2024
9fb5d9e
made examples shorter
tjhv10 Jun 13, 2024
5b5fd41
ok
tjhv10 Jun 19, 2024
5dce611
c++ exp
tjhv10 Jun 19, 2024
2b93c9b
Update f.cpp
tjhv10 Jun 19, 2024
fa767de
Update f.cpp
tjhv10 Jun 19, 2024
ba60f54
good
tjhv10 Jun 20, 2024
1a9b2c0
ok
tjhv10 Jun 20, 2024
9dcb3ce
ok
tjhv10 Jun 20, 2024
e7ed67b
good
tjhv10 Jun 20, 2024
3c398ac
good for pres 3
tjhv10 Jun 20, 2024
1ac0f6c
update for cstv
tjhv10 Jun 20, 2024
1360007
canged expiremets fie name
tjhv10 Jun 20, 2024
db7ffd1
update
tjhv10 Jun 20, 2024
2646317
working for pres 6
tjhv10 Jun 20, 2024
b267b8c
ok
tjhv10 Jun 23, 2024
e4c944d
final
tjhv10 Jun 23, 2024
ec31c27
final for pres 6
tjhv10 Jun 23, 2024
001d807
final
tjhv10 Jun 23, 2024
7ef3a01
final
tjhv10 Jun 23, 2024
3835f3e
transferd vscode to gitignore
tjhv10 Jun 25, 2024
79fbe70
updated gitignore
tjhv10 Jun 25, 2024
c259fba
updated am
tjhv10 Jun 25, 2024
db996c5
ok
tjhv10 Jun 25, 2024
fd948ff
ok
tjhv10 Jun 25, 2024
d9a016f
updated cb
tjhv10 Jun 25, 2024
4208a59
updated cb
tjhv10 Jun 25, 2024
c429f17
ok
tjhv10 Jun 25, 2024
a8ba98a
updated instance
tjhv10 Jun 25, 2024
581e4f1
ok
tjhv10 Jun 25, 2024
09fa3f1
ok
tjhv10 Jun 25, 2024
583dc06
Update cumulativeballot.py
tjhv10 Jun 25, 2024
a123eae
Update instance.py
tjhv10 Jun 25, 2024
917bae1
Update fractions.py
tjhv10 Jun 25, 2024
152f4f0
Update __init__.py
tjhv10 Jun 25, 2024
7f11bd0
Update utils.py
tjhv10 Jun 25, 2024
0c48dae
Update pyproject.toml
tjhv10 Jun 25, 2024
cd4ee82
Update .gitignore
tjhv10 Jun 25, 2024
fbc3abd
Update CSTV.py
tjhv10 Jun 25, 2024
1b97560
better
tjhv10 Jun 25, 2024
4cfecec
added more description
tjhv10 Jun 25, 2024
8cf0ea9
Update and rename test_CSTV.py to test_cstv.py
tjhv10 Jun 25, 2024
fbc6c7d
Rename CSTV.py to cstv.py
tjhv10 Jun 25, 2024
600aa1f
better
tjhv10 Jun 26, 2024
735ee24
Merge branch 'main' of https://github.com/tjhv10/pabutools
tjhv10 Jun 26, 2024
7caf4d4
Update rules.rst
tjhv10 Jun 26, 2024
2075fac
Update rules.rst
tjhv10 Jun 26, 2024
c9b1c7f
Update test_cstv.py
tjhv10 Jun 26, 2024
1c43375
fixed mt problem
tjhv10 Jun 27, 2024
154f01b
good
tjhv10 Jun 27, 2024
031b86b
ok
tjhv10 Jun 30, 2024
2c7714c
good
tjhv10 Jun 30, 2024
e112b8f
ok
tjhv10 Jun 30, 2024
28164da
added tiebraking and the resultness parameter
tjhv10 Jun 30, 2024
a4420ac
ok for now
tjhv10 Jul 2, 2024
2b03157
add log
erelsgl Jul 2, 2024
4f8e857
ok
tjhv10 Jul 2, 2024
80c69f6
Merge branch 'main' of https://github.com/tjhv10/pabutools
tjhv10 Jul 2, 2024
21d3e64
best try for resulteness
tjhv10 Jul 2, 2024
d4bb21a
final
tjhv10 Jul 2, 2024
37a6647
final
tjhv10 Jul 2, 2024
35a3ee9
removed main from cstv.py
tjhv10 Jul 2, 2024
95fc11d
Update cstv.py
tjhv10 Jul 2, 2024
5f05acb
Removed main from cstv.py
tjhv10 Jul 3, 2024
37d17b4
Update test_cstv.py
tjhv10 Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,5 @@ cython_debug/
.idea/

analysis/Pabulib

.vscode/
25 changes: 25 additions & 0 deletions docs-source/source/usage/rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,31 @@ performances, one should use the following:
)


CSTV Algorithm
--------------

:py:func:`~pabutools.rules.cstv.cstv`

The `cstv` function implements the Cost-Sensitive Approval Voting algorithm for participatory budgeting. It takes into account both voter preferences and project costs to allocate budgets efficiently.

.. code-block:: python

from pabutools.election import Instance, Project, ApprovalProfile, ApprovalBallot
from pabutools.rules import cstv

projects = Instance(Project("Project A", 35), Project("Project B", 30))
instance = Instance(projects)

donors = Profile([CumulativeBallot({"Project A": 5, "Project B": 10), CumulativeBallot({"Project A": 5, "Project B": 10), CumulativeBallot({"Project A": 0, "Project B": 15), CumulativeBallot({"Project A": 8, "Project B": 7}), CumulativeBallot({"Project A": 10, "Project B": 5)])
alg_str = "ewt" # Look in the paper that is the insperation for this code in section 5.6
outcome1 = cstv_budgeting_combination(instance, donors, alg_str)

Details for the Budget Allocation Rule
--------------------------------------

The `cstv` function returns a :py:class:`~pabutools.rules.budgetallocation.BudgetAllocation` object, which includes information about the allocated budget and can be used for further analysis or visualization.


Exhaustion Methods
------------------

Expand Down
25 changes: 25 additions & 0 deletions docs/_sources/usage/rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,31 @@ performances, one should use the following:
)


CSTV Algorithm
--------------

:py:func:`~pabutools.rules.cstv.cstv`

The `cstv` function implements the Cost-Sensitive Approval Voting algorithm for participatory budgeting. It takes into account both voter preferences and project costs to allocate budgets efficiently.

.. code-block:: python

from pabutools.election import Instance, Project, ApprovalProfile, ApprovalBallot
from pabutools.rules import cstv

projects = Instance(Project("Project A", 35), Project("Project B", 30))
instance = Instance(projects)

donors = Profile([CumulativeBallot({"Project A": 5, "Project B": 10), CumulativeBallot({"Project A": 5, "Project B": 10), CumulativeBallot({"Project A": 0, "Project B": 15), CumulativeBallot({"Project A": 8, "Project B": 7}), CumulativeBallot({"Project A": 10, "Project B": 5)])
alg_str = "ewt" # Look in the paper that is the insperation for this code in section 5.6
outcome1 = cstv_budgeting_combination(instance, donors, alg_str)

Details for the Budget Allocation Rule
--------------------------------------

The `cstv` function returns a :py:class:`~pabutools.rules.budgetallocation.BudgetAllocation` object, which includes information about the allocated budget and can be used for further analysis or visualization.


Exhaustion Methods
------------------

Expand Down
Loading
Loading