{ "info": { "author": "Julian Zucker", "author_email": "julian.zucker@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "#### socialchoice: a library for Social Choice Theory\n\nThis library implements [social choice mechanisms](https://en.wikipedia.org/wiki/Social_choice_theory).\n\n#### Install\nsocialchoice is on PyPI, so:\n``` \npip3 install socialchoice\n```\n\n#### A minimal example\nHere, we have two pairwise votes submitted, where `\"a\"` beat `\"b\"`, and `\"c\"` lost to `\"b\"`. We want to compute the [ranked pairs](https://en.wikipedia.org/wiki/Ranked_pairs) result for this vote set.\n```python\n>>> from socialchoice import PairwiseBallotBox, Election \n>>> pairwise_ballots = PairwiseBallotBox([(\"a\", \"b\", \"win\"), (\"c\", \"b\", \"loss\")])\n>>> election = Election(pairwise_ballots)\n>>> election.ranking_by_ranked_pairs()\n['a', 'b', 'c']\n\n```\n\n#### A slightly less minimal example\nLet's run a ranked choice election, using ranked pairs again.\n```python\n>>> from socialchoice import RankedChoiceBallotBox, Election \n>>> ranked_ballots = RankedChoiceBallotBox([[1,2,3,4], [1, {2,3}, 4]])\n>>> election = Election(ranked_ballots)\n>>> election.ranking_by_ranked_pairs()\n[1, 2, 3, 4]\n\n```\nNotice that ties are allowed - simply submit a set as one element of your ranking, and each of those will be counted as ties. Ranked choice ballots are converted into pairwise preferences, and then ranked pairs can be run on the result.\n\n#### Converting pairwise votes to orderings\nSuppose you've collected pairwise votes from several voters, and you want to run a position-based method like [Borda count](https://en.wikipedia.org/wiki/Borda_count). This is easy if each set of pairwise votes is transitive and complete - that is, the voters have consistent preferences (if A is preferred to B, and B is preferred to C, the voter doesn't also prefer C to A) and they have a preference submitted for each candidate pairing. Then, you can [topologically sort](https://en.wikipedia.org/wiki/Topological_sorting) the graph of their votes, and the resulting sorted list of candidates is their ordering. \n\nBut what if the vote set is intransitive or incomplete? If intransitive, you will have cycles, meaning there will be no clear ordering. If incomplete, the output will not contain each candidate. Both make it impossible to run position count directly. However, there are ways of making a vote set transitive, or filling in blanks in an ordering. \n\nHere is an example of removing an edge from a cycle.\n```python\n>>> from socialchoice import *\n>>> ballots = VoterTrackingPairwiseBallotBox([(1, 2, \"win\", 1), (2, 3, \"win\", 1), (3, 1, \"win\", 1)])\n>>> break_random_link = IntransitivityResolverFactory(ballots).make_break_random_link()\n>>> add_random_edges = IncompletenessResolverFactory(ballots).make_add_random_edges()\n\n>>> ballots.enable_ordering_based_methods(break_random_link, add_random_edges)\n>>> Election(ballots).ranking_by_borda_count() in [[1,2,3], [2,3,1], [3,1,2]]\nTrue\n\n```\nAs the names imply, this resolves intransitivity by breaking random links, and then ensures that the output is complete by adding random edges. This example resolves an intransitive set of votes (1 beats 2, 2 beats 3, 3 beats 1) to one of the three orderings listed on the last line.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/julian-zucker/socialchoice", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "socialchoice", "package_url": "https://pypi.org/project/socialchoice/", "platform": "", "project_url": "https://pypi.org/project/socialchoice/", "project_urls": { "Homepage": "https://github.com/julian-zucker/socialchoice" }, "release_url": "https://pypi.org/project/socialchoice/0.0.12/", "requires_dist": null, "requires_python": ">=3", "summary": "Social Choice Theory in Python", "version": "0.0.12" }, "last_serial": 5713153, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "bd46627628fc71a5754c357e27868725", "sha256": "a29ed67ed18d7590717336f855eb2a6d93ba16009cdef7ccc6bda0d56fa07c72" }, "downloads": -1, "filename": "socialchoice-0.0.0-py3.7.egg", "has_sig": false, "md5_digest": "bd46627628fc71a5754c357e27868725", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 41697, "upload_time": "2019-05-22T10:48:25", "url": "https://files.pythonhosted.org/packages/01/74/07de6a05b5836f2916650baf4aa8014d186747c464610ac0493be10cf75c/socialchoice-0.0.0-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "f03cbe08643eb61a780f250bf864a549", "sha256": "e51fa16f41bc9d7fe3b0e81494f0e55384e07576d7a54283ff3ce28b59f7fd9d" }, "downloads": -1, "filename": "socialchoice-0.0.0.tar.gz", "has_sig": false, "md5_digest": "f03cbe08643eb61a780f250bf864a549", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10740, "upload_time": "2019-05-22T10:48:27", "url": "https://files.pythonhosted.org/packages/92/0d/bbaae766ca1d0d538cd0247eebeb0f898e6d0ab4c1e2ddb8a72fd1d8f5a2/socialchoice-0.0.0.tar.gz" } ], "0.0.1": [ { "comment_text": "", "digests": { "md5": "80ae3ea0fe47a7b342e09d78032e82cf", "sha256": "7653a171ee0096f1e672d1aa3728944f83c36f170a49ffff734aeb1faca54f89" }, "downloads": -1, "filename": "socialchoice-0.0.1.tar.gz", "has_sig": false, "md5_digest": "80ae3ea0fe47a7b342e09d78032e82cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2467, "upload_time": "2019-05-22T10:54:41", "url": "https://files.pythonhosted.org/packages/e5/de/10857cbc94224ec3def5fee27a1cbfb00a4626ed6ea4d18c5391638648e0/socialchoice-0.0.1.tar.gz" } ], "0.0.10": [ { "comment_text": "", "digests": { "md5": "bcd84cfe0e86d6771154d1b6cf49aa33", "sha256": "30642e997f9fa8ddd8637ddee565a60b62b4b60fa983b45724bcb942878d1fef" }, "downloads": -1, "filename": "socialchoice-0.0.10.tar.gz", "has_sig": false, "md5_digest": "bcd84cfe0e86d6771154d1b6cf49aa33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2268, "upload_time": "2019-08-22T03:31:44", "url": "https://files.pythonhosted.org/packages/43/cc/8ee72123818f941b8426547139c4b6032f68b2da2f462f2e2be8e0f1bd9e/socialchoice-0.0.10.tar.gz" } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "c753aa4ff65eae31adb564147fc5cc8c", "sha256": "97b56b954fe77b40273cc4d29acf72451d78327cd4c911184df5fa8de96ecb6a" }, "downloads": -1, "filename": "socialchoice-0.0.11.tar.gz", "has_sig": false, "md5_digest": "c753aa4ff65eae31adb564147fc5cc8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2473, "upload_time": "2019-08-22T03:35:08", "url": "https://files.pythonhosted.org/packages/90/62/f901a5dd8c77e2a596222224844a534eb0802f1cded311a84ff3f2cfc518/socialchoice-0.0.11.tar.gz" } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "8a5458d2b4d6168b5cb62b3f31379820", "sha256": "92fc0458920fea1e2b9969416512f2e3028c01e6b39d8f773b38fac41664ddd3" }, "downloads": -1, "filename": "socialchoice-0.0.12.tar.gz", "has_sig": false, "md5_digest": "8a5458d2b4d6168b5cb62b3f31379820", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 14120, "upload_time": "2019-08-22T04:46:46", "url": "https://files.pythonhosted.org/packages/c9/c3/b6540461571213a8562bbabce25281b7402fce6c0aaf36850e4d260211bb/socialchoice-0.0.12.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "948cb3a36ec9b187d4d578c8180074d1", "sha256": "24160181207198c6dfe17d4cd35680c6c3d1bb508649721177c96d39bef32c85" }, "downloads": -1, "filename": "socialchoice-0.0.2-py3.7.egg", "has_sig": false, "md5_digest": "948cb3a36ec9b187d4d578c8180074d1", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 25860, "upload_time": "2019-05-22T11:14:11", "url": "https://files.pythonhosted.org/packages/18/c1/54f211481c6da17f42713894c0483537dc132a26360ded1e3b922cc4b647/socialchoice-0.0.2-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "4cf66b134e052b94dd011fe046c3aa80", "sha256": "552a717541208252a46b3836580e68cf9e83a79e72b749204ffe2dbba1ff5c7c" }, "downloads": -1, "filename": "socialchoice-0.0.2.tar.gz", "has_sig": false, "md5_digest": "4cf66b134e052b94dd011fe046c3aa80", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2845, "upload_time": "2019-05-22T10:59:34", "url": "https://files.pythonhosted.org/packages/6b/8d/62ed3671b52ed06ca941cb1d1f83cec9ac7961697c25d470892e3457f890/socialchoice-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "edf48ecef969bc2dcef0f262cf08722e", "sha256": "13f5879fbb35809f933c238512029bb133b19bf75e6b3e2658795a2bc30a3a70" }, "downloads": -1, "filename": "socialchoice-0.0.3.tar.gz", "has_sig": false, "md5_digest": "edf48ecef969bc2dcef0f262cf08722e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9803, "upload_time": "2019-05-22T11:14:12", "url": "https://files.pythonhosted.org/packages/ed/9f/6ee7c5b8a526eba362ae042122bce626a292816d2b7c11b007a8a16fd635/socialchoice-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "f5cd93fd7d06a0050ad7531402556a1e", "sha256": "50dd3e8c26e2dc5a7aaca8bc78c1aada206779ae48957c8b57f26234d966efad" }, "downloads": -1, "filename": "socialchoice-0.0.4.tar.gz", "has_sig": false, "md5_digest": "f5cd93fd7d06a0050ad7531402556a1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10436, "upload_time": "2019-05-27T13:29:16", "url": "https://files.pythonhosted.org/packages/45/eb/8939941cbe8cc16d282fbfe7b7652af7d9be1cd55055f2f8d6600f6b7195/socialchoice-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "7b2bf6b6e0956951ee5e8642aa0ae3d2", "sha256": "59f4602f7d55add9bb7d0acaf0938e65cbe29da186fd3f485ae25584b71d18be" }, "downloads": -1, "filename": "socialchoice-0.0.5.tar.gz", "has_sig": false, "md5_digest": "7b2bf6b6e0956951ee5e8642aa0ae3d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10447, "upload_time": "2019-05-27T13:32:46", "url": "https://files.pythonhosted.org/packages/b0/76/8ae78d945fb4e17c5ea490f402262ea9c8cbf16cb77f1c57ef42bd21c34b/socialchoice-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "c174ebc677e412fefabeafe25e5dfe9c", "sha256": "86e2a9739aeb54c3ebd8d39b91b5a509120b2c5eeccf9c4ac08a0e1a566b17cb" }, "downloads": -1, "filename": "socialchoice-0.0.6.tar.gz", "has_sig": false, "md5_digest": "c174ebc677e412fefabeafe25e5dfe9c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14156, "upload_time": "2019-08-18T15:10:25", "url": "https://files.pythonhosted.org/packages/8d/f3/80f84fc2353d7000ce7b04131208723975a3250a0037a77ea69ff2bb3d1c/socialchoice-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "7a46dca0e3992f9f5c14f4bd3a1200b5", "sha256": "607949f9fb55c153b578f44d9524a3a15037a2903ce83129e488d19fa53eb7c1" }, "downloads": -1, "filename": "socialchoice-0.0.7.tar.gz", "has_sig": false, "md5_digest": "7a46dca0e3992f9f5c14f4bd3a1200b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14186, "upload_time": "2019-08-22T02:59:22", "url": "https://files.pythonhosted.org/packages/01/32/e1acfa27814d4f9ecb2ccec8beec283a8e9c215b2d4f1d706ee4cd52a418/socialchoice-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "b80dce47cfbd55c54f9a3c038b66ed6a", "sha256": "1436b802cb1dc47c4464ab92e119603063757625e5f382aa331cfda45f75c72d" }, "downloads": -1, "filename": "socialchoice-0.0.8.tar.gz", "has_sig": false, "md5_digest": "b80dce47cfbd55c54f9a3c038b66ed6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2240, "upload_time": "2019-08-22T03:20:17", "url": "https://files.pythonhosted.org/packages/cc/52/b05751fe2b876cdf2671ecee2920c6cebc4b6b7362c53f64c4efabfc2b6f/socialchoice-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "fa1d4382b1debe6fd505e2576dff3a6b", "sha256": "a277af1a135dd12e704a34394812c670ec13f870b16aa2c55afa0a69e94ab7b4" }, "downloads": -1, "filename": "socialchoice-0.0.9.tar.gz", "has_sig": false, "md5_digest": "fa1d4382b1debe6fd505e2576dff3a6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12015, "upload_time": "2019-08-22T03:22:27", "url": "https://files.pythonhosted.org/packages/22/f1/d1a98e111647b7be4c3b1c4b8f57080bbcafaab02c0f8fa5825e3458a512/socialchoice-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8a5458d2b4d6168b5cb62b3f31379820", "sha256": "92fc0458920fea1e2b9969416512f2e3028c01e6b39d8f773b38fac41664ddd3" }, "downloads": -1, "filename": "socialchoice-0.0.12.tar.gz", "has_sig": false, "md5_digest": "8a5458d2b4d6168b5cb62b3f31379820", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 14120, "upload_time": "2019-08-22T04:46:46", "url": "https://files.pythonhosted.org/packages/c9/c3/b6540461571213a8562bbabce25281b7402fce6c0aaf36850e4d260211bb/socialchoice-0.0.12.tar.gz" } ] }