{"id":17252083,"url":"https://github.com/ppetr/least-squares-electric-voting","last_synced_at":"2025-03-26T07:23:10.253Z","repository":{"id":146160465,"uuid":"310225614","full_name":"ppetr/least-squares-electric-voting","owner":"ppetr","description":"(Possibly novel) electoral system that orders candidates by assigning each one a potential in such a way that it minimizes the sum of squares of differences of each voter’s intent.","archived":false,"fork":false,"pushed_at":"2021-09-21T14:48:51.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-31T08:44:23.545Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ppetr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"docs/code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-05T07:49:51.000Z","updated_at":"2021-09-21T14:48:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"9191be5e-1527-4882-bf95-d2b2fc565c7a","html_url":"https://github.com/ppetr/least-squares-electric-voting","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fleast-squares-electric-voting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fleast-squares-electric-voting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fleast-squares-electric-voting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fleast-squares-electric-voting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppetr","download_url":"https://codeload.github.com/ppetr/least-squares-electric-voting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245606528,"owners_count":20643194,"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","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":[],"created_at":"2024-10-15T06:52:59.306Z","updated_at":"2025-03-26T07:23:10.230Z","avatar_url":"https://github.com/ppetr.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Least squares (“electric”) voting system\n\n_Disclaimer: This is not an official Google product._\n\n[![Build Status](https://travis-ci.com/ppetr/least-squares-electric-voting.svg?branch=main)](https://travis-ci.com/ppetr/least-squares-electric-voting)\n\n## Objective\n\nDescribe and explore [properties](https://en.wikipedia.org/wiki/Comparison_of_electoral_systems) of a novel (to the best author’s knowledge) [electoral system](https://en.wikipedia.org/wiki/Electoral_system). It’s intuition is based on simple electrical circuits. It orders candidates by assigning each one a potential in such a way that it minimizes the sum of squares of differences of each voter’s intent.\n\n\n## Background\n\nBasic knowledge of simple electrical circuits is required to describe the intuition behind this system. In particular, static circuits with ideal voltage sources and resistors, satisfying [Kirchhoff's circuit laws](https://en.wikipedia.org/wiki/Kirchhoff%27s_circuit_laws). However it’s not necessary for understanding the derived mathematical properties.\n\n\n## Electrical intuition\n\nEach voter orders candidates according to their preferences. Then an electrical circuit is created where nodes correspond to candidates, and where for each consecutive pair of candidates from the voter’s list, an [ideal 1V voltage source](https://en.wikipedia.org/wiki/Voltage_source) in series with a 1𝛺 resistor is placed between the corresponding nodes. The voltage source represents the voter’s **intent** that one candidate’s potential is ideally 1V higher than the next one’s potential. The resistor represents the voter’s **ability to influence** the outcome.\n\nThis way a chain circuit is formed connecting the candidates from the top-selected one to the last one. In such a circuit the potential of _i-_th candidate is _(i-1)_ V (volts) below the top-selected one.\n\nThen the circuits from all candidates are merged together, sharing the nodes corresponding to candidates. This combined circuit stabilizes in a configuration that is in balance with respect to the voltage sources and resistors. The relative potential of all the candidates then determines their overall ranking.\n\n\n### Energy\n\nLet’s focus on a single edge of a combined circuit added on behalf of a particular voter between candidates _i_ and _j_, intending _i’_s potential_ _to be 1V higher than _j’_s. Thermal energy dissipated by its resistor is determined by _((V\u003csub\u003ei\u003c/sub\u003e-V\u003csub\u003ej\u003c/sub\u003e)-U)\u003csup\u003e2\u003c/sup\u003eG_ where _V\u003csub\u003ei\u003c/sub\u003e_ and V\u003csub\u003ej\u003c/sub\u003e are the final, balanced potentials of the candidates, _U_ is 1V and G is 1𝛺\u003csup\u003e-1\u003c/sup\u003e [conductance](https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance) of the resistor.\n\nWe can see that the energy corresponds to the **square of the deviation** from the voter’s intent. Informally we can say that the more heat the resistor dissipates, the more unhappy the voter is with the outcome for this particular preference.\n\nIt can be shown that the circuit stabilizes in a configuration where the total sum of dissipated energy is minimized, and that this property is equivalent to the [Kirchhoff's current law](https://en.wikipedia.org/wiki/Kirchhoff%27s_circuit_laws#Kirchhoff's_current_law). That is, the **candidate’s potentials minimize the sum of squares** of the deviations from all voters’ intents.\n\n\n## Mathematical definition\n\n[To be done.]\n\n\n## Properties\n\n[To be done.]\n\n\n## Contributions and future plans\n\nPlease see [Code of Conduct](docs/code-of-conduct.md) and [Contributing](docs/contributing.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppetr%2Fleast-squares-electric-voting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppetr%2Fleast-squares-electric-voting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppetr%2Fleast-squares-electric-voting/lists"}