{"id":21489354,"url":"https://github.com/reitzig/2015_apportionment","last_synced_at":"2025-07-23T19:34:21.136Z","repository":{"id":30783798,"uuid":"34340680","full_name":"reitzig/2015_apportionment","owner":"reitzig","description":"Implementations of several algorithms for proportional apportionment by divisor methods","archived":false,"fork":false,"pushed_at":"2022-10-20T09:18:11.000Z","size":161,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-17T10:52:57.685Z","etag":null,"topics":["algorithm","apportionment","divisor-methods","java","research"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reitzig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-21T17:07:46.000Z","updated_at":"2022-10-20T09:17:08.000Z","dependencies_parsed_at":"2023-01-14T17:40:28.256Z","dependency_job_id":null,"html_url":"https://github.com/reitzig/2015_apportionment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/reitzig/2015_apportionment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reitzig%2F2015_apportionment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reitzig%2F2015_apportionment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reitzig%2F2015_apportionment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reitzig%2F2015_apportionment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reitzig","download_url":"https://codeload.github.com/reitzig/2015_apportionment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reitzig%2F2015_apportionment/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266738345,"owners_count":23976417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","apportionment","divisor-methods","java","research"],"created_at":"2024-11-23T14:19:17.395Z","updated_at":"2025-07-23T19:34:21.115Z","avatar_url":"https://github.com/reitzig.png","language":"Java","readme":"## Algorithms for Divisor Methods of Apportionment\n\nThis repository contains implementations of algorithms for proportional \napportionment with divisor methods. Inspect and use at your own risk.\n\n * File\n     [`SandwichSelect.java`](https://github.com/reitzig/2015_apportionment/blob/master/src/de/unikl/cs/agak/appportionment/algorithms/SandwichSelect.java)\n   contains an implementation of the algorithm `SandwichSelect` we have presented in\n\n   \u003e Wild, S. and Reitzig, R.  \n   \u003e A Practical and Worst-Case Efficient Algorithm for Divisor Methods of Apportionment  \n   \u003e submitted  \n   \u003e [[preprint](http://arxiv.org/abs/1504.06475) (v3,2016)]\n   \n   Some variants exist.\n\n * In\n    [`ChengEppsteinSelect.java`](https://github.com/reitzig/2015_apportionment/blob/master/src/de/unikl/cs/agak/appportionment/algorithms/ChengEppsteinSelect.java)\n   we provide an implementation of the algorithm proposed in\n\n   \u003e Cheng, Z. and Eppstein, D.  \n   \u003e [Linear-time Algorithms for Proportional  Apportionment](http://link.springer.com/chapter/10.1007/978-3-319-13075-0_46)  \n   \u003e In: International Symposium on Algorithms and Computation (ISAAC) 2014.  \n   \u003e Springer (2014)  \n   \u003e [[preprint](http://arxiv.org/abs/1409.2603) (v1,2014)]\n\n * Furthermore, we implement the jump-and-step algorithm from\n\n   \u003e Pukelsheim, F.  \n   \u003e Proportional Representation  \n   \u003e Springer, 2014\n\n   in\n     [`PukelsheimPQ.java`](https://github.com/reitzig/2015_apportionment/blob/master/src/de/unikl/cs/agak/appportionment/algorithms/PukelsheimPQ.java)\n   with priority queues for determining the next party to modify, and in\n     [`PukelsheimLS.java`](https://github.com/reitzig/2015_apportionment/blob/master/src/de/unikl/cs/agak/appportionment/algorithms/PukelsheimLS.java)\n   using linear scan.\n\n * Finally, we give implementations of the naive iterative algorithms using\n   priority queues resp. a linear scan for finding maxima in\n     [`IterativeDMPQ.java`](https://github.com/reitzig/2015_apportionment/blob/master/src/de/unikl/cs/agak/appportionment/algorithms/IterativeDMPQ.java)\n   and\n     [`IterativeDMLS.java`](https://github.com/reitzig/2015_apportionment/blob/master/src/de/unikl/cs/agak/appportionment/algorithms/IterativeDMLS.java),\n   respectively.\n\nThe core algorithms start in the respective implementations of method `unitSize` resp. `apportion`.\n\nThe remaining files provide interfaces, shared algorithmic parts and utility code.\nSome files are taken or adapted from [Sedgewick/Wayne](http://algs4.cs.princeton.edu)\nwith our thanks; we re-release their files in agreement with their \nlicense statement (see Q + A [here](http://algs4.cs.princeton.edu/code/)).\n\n### Compilation\n\nExecute `ant compile`; you will need [`algs4.jar`](https://algs4.cs.princeton.edu/code/algs4.jar)\n(in folder `lib`) from the [book website of Sedgewick/Wayne](http://algs4.cs.princeton.edu/code/).\n\n### Usage\n\nRun `ant test` for testing correctness of the implementations.\nBesides rudimentary sanity checks, the test basically check Pukelsheim's \nMax-Min Inequality for *all* computed assignments, i.e. for all ways to resolve ties.\n\nCommand `ant run` executes a sample runtime experiment.\n\nRun your own experiments by defining the parameters in a space-separated file\n(see e.g. [arxiv2.experiment](https://github.com/reitzig/2015_apportionment/blob/master/arxiv2.experiment); those are the ones from the article)\nand passing it as parameter to [`run_experiments.rb`](https://github.com/reitzig/2015_apportionment/blob/master/run_experiments.rb).\nThat is, \n\n    ruby run_experiments.rb arxiv.experiments \n    \nruns the exact experiments used in [our article](http://arxiv.org/abs/1504.06475).\n\nIn case you can not get this to work, here is a workaround.\n\n 1. Open a terminal resp. command line in th repository and\n \texecute `ant compile`.\n\n 2. Create the following folder structure within the code respository:\n \n        my_experiment\n        |- data\n        |- plots\n        |   |- times\n        |   |- counters\n        |   |- scatter\n        |   |- averages\n        |- tmp\n        \n 3. Change directory to folder `my_experiment`.\n \n 4. For each non-comment line from `arxiv.experiment` (or your file), execute\n      \n        java -cp ../build de.unikl.csgak.appportionment.experiments.RunningTimeMain [line]\n        \n    If you use `LDM(x,y)` as divisor method, enclose this parameter in double-quotes.\n \n 5. Execute `gnuplot tmp/*.gp`.\n \n*Hint:* For plotting purposes,\nyou can use script `separate_by_alg` to split the `.tab`-files in `data` by algorithm. \nIf you need one file per input size, you can split *these* file using `separate_by_n`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freitzig%2F2015_apportionment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freitzig%2F2015_apportionment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freitzig%2F2015_apportionment/lists"}