johnh865 / election_sim

Election simulator and election implementation for scored methods, ranked Condorcet methods, IRV, multi-winner, and more.
MIT License
11 stars 1 forks source link

Document one example carefully #2

Open dfrankow opened 3 years ago

dfrankow commented 3 years ago

This is a feature request.

The code in the "sims" subdirectory looks daunting. It has many files, I'd have to read a lot of stuff. I'm just trying to figure out if I want to use this library to compute common concepts in Condorcet voting: Condorcet winner, Smith set, Copeland algorithm, etc. I'm not yet sure if it has that stuff.

Picking one example, and writing a brief narration would be very helpful in letting me understand what exactly this library does.

johnh865 commented 3 years ago

dfrankow, Unfortunately I don't think you will get everything you want here, and the documentation is not particularly good right now, but some stuff (for example smith set) is computed in a file at

https://github.com/johnh865/election_sim/blob/master/votesim/votemethods/condcalcs.py

I also don't have Copeland implemented yet.

I recommend you look at the votesim/votemethods subpackage for voting method implementation while I slowly add useable docs. Most of the functions have numpy-style documentation strings written in them, and all voting methods have the same function input parameters.

To use this package as a voting method implementation, there is a "master class" that handles all the voting methods at votesim.votemethods.eRunner. Keep in mind that this thing was written as a simulator, not something with a easy to use human interface.

For examples, most of the voting methods have tests in votesim/votemethods/tests

I will slowly add in the requested features. Thanks for your interest in the package!

dfrankow commented 3 years ago

I appreciate your thoughtful response.

I will continue to look around for a simple library with an API. I am surprised there isn't one after all this time (Llull invented some version 1299!), but I haven't found it yet.