{"id":44636360,"url":"https://github.com/akazukin5151/electoral-systems","last_synced_at":"2026-02-14T17:32:47.703Z","repository":{"id":54842809,"uuid":"246698407","full_name":"akazukin5151/electoral-systems","owner":"akazukin5151","description":"Simulating different electoral systems","archived":false,"fork":false,"pushed_at":"2023-02-17T21:47:56.000Z","size":650,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-21T03:40:48.538Z","etag":null,"topics":["approval-voting","borda","elections","electoral-system-visualization","electoral-systems","first-past-the-post","irv","julia","range-voting","simulation","visualization"],"latest_commit_sha":null,"homepage":null,"language":"Julia","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/akazukin5151.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,"governance":null}},"created_at":"2020-03-11T23:11:20.000Z","updated_at":"2023-02-17T16:34:31.000Z","dependencies_parsed_at":"2023-09-24T09:04:33.158Z","dependency_job_id":null,"html_url":"https://github.com/akazukin5151/electoral-systems","commit_stats":{"total_commits":25,"total_committers":1,"mean_commits":25.0,"dds":0.0,"last_synced_commit":"530e403afe0a0604258e203cf1fa64f51390fff7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akazukin5151/electoral-systems","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akazukin5151%2Felectoral-systems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akazukin5151%2Felectoral-systems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akazukin5151%2Felectoral-systems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akazukin5151%2Felectoral-systems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akazukin5151","download_url":"https://codeload.github.com/akazukin5151/electoral-systems/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akazukin5151%2Felectoral-systems/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29450885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["approval-voting","borda","elections","electoral-system-visualization","electoral-systems","first-past-the-post","irv","julia","range-voting","simulation","visualization"],"created_at":"2026-02-14T17:32:47.175Z","updated_at":"2026-02-14T17:32:47.695Z","avatar_url":"https://github.com/akazukin5151.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Electoral Systems [![Preview](https://img.shields.io/badge/preview-nbconvert-orange)](https://nbviewer.jupyter.org/github/akazukin5151/electoral-systems/blob/master/run_elections.ipynb) [![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.txt) [![status](https://img.shields.io/badge/status-inactive-green)](https://img.shields.io/badge/status-inactive-green)\n\n\u003e **Note** also see: Yee diagrams for proportional representation methods: https://github.com/akazukin5151/approportionment\n\n![Preview](https://raw.githubusercontent.com/akazukin5151/electoral-systems/master/Julia%20Ideal.png)\n\nSimulates virtual elections under different electoral systems. Voters and candidates are distributed on a 2D plane  corresponding to their ideology. For more details read below\n\nInspired by Ka Yee-Ping's [Voting Simulation Visualizations](http://zesty.ca/voting/sim/) and Nicky Case's [To build a better ballot](https://ncase.me/ballot/)\n\n![Approval bullet](https://github.com/akazukin5151/electoral-systems/blob/master/approval_bullet_ideal.png)\n\nThe above is a preview of approval_bullet(). It simulates when some voters under approval voting cast insincere ballots and bullet vote. That means they only approve their top candidate, even though they might approve of others. The title of each graph corresponds to the proportion of voters that are bullet voting.\n\nIf everyone is bullet voting, then the election should be exactly the same as under FPTP. However, it appears that bullet voting under approval voting actually is more effect than FPTP in suppressing the third candidate. Or there's something very wrong with my implementation\n\nThis is a Julia re-write of a previous version that was written in Python. Python is too slow for the number crunching needed here, and actually Altair fails to plot the graph anyway. So Julia it is.\n\n## Note: the first run on both JupyterLab and .jl/REPL is extremely slow, because all the dependencies have to be compiled\n\nSlow in the scale of minutes.\n\nLook at PackageCompiler to precompile them. Precompiling JuliaPlots by following [this](https://julialang.github.io/PackageCompiler.jl/dev/examples/plots/) worked for me.\n\n# Usage (with JupyterLab, recommended)\n\n1. Unfortunately, Binder is stuck on an ancient version of iJulia, so you need to install JupyterLab yourself and just open `run_elections.ipynb`\n2. Run all cells\n\n# Usage (with .jl file)\n\n1. Make sure `elections.jl` and `testing.jl` are in the same folder\n2. Run with `julia \"path_to_folder/run_elections.jl\"`\n\nYou can those functions for other purposes as well:\n\n1. Inside Julia (REPL), type `push!(LOAD_PATH, \"path_of_your_folder\")`. You may want to add it to your startup.jl as well\n2. In a new .jl file, put `using elections` in the top\n3. Just use the functions like `fptp(...)`\n\nTo get the \"ideal\" image shown above, change the `0.1` to `0.01` in [this line](https://github.com/akazukin5151/electoral-systems/blob/6a8141f6ee995b46fcc8bfc80a951d82d6c9308f/run_elections.jl#L6). **Warning: will use lots of memory and take minutes.**\n\n# Testing\n\nUnit tests require `Test` and `InteractiveUtils` to be installed. The latter doesn't need to be explicitly `using`'ed if you're running the tests the Jupyter notebook\n\n1. Make sure `elections.jl` and `testing.jl` are in the same folder\n2. Run with `julia \"path_to_folder/testing.jl\"`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakazukin5151%2Felectoral-systems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakazukin5151%2Felectoral-systems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakazukin5151%2Felectoral-systems/lists"}