Threshold MES
-
@marcus-ogren said in Threshold MES:
I can't think of an example off the top of my head where the model of having individual utilities of each candidate and maximizing the sum over all the winners breaks down.
Not to start bikeshedding, but
Red (33%): A5 B0 C0 D2
Blue (33%): A0 B5 C0 D2
Green (33%): A0 B0 C5 D2To elect 3 candidates. To me, clearly ABC is the correct committee, and this is what TEA elects. However, with linearly additive utilities, one might be fooled into thinking that DDD is the correct committee (in fact, it Pareto dominates ABC !), and this is what AS or SSS or MES elects (with or without runoffs).
Otherwise yes I think it seems we both understand each other's viewpoint and still disagree; this is ok, such is the burden of judgement, as Rawls would put it.
-
@andy-dienes I agree with you about that example. That said, if there were 6 winners I'd go with ABCDDD, and if they all gave D a three instead of a two I'd prefer DDD to ABC. Yeah, I think we understand one another's positions pretty well now.
-
Added a Julia implementation to the electowiki page. If people want it in Python I can translate.
-
@andy-dienes said in Threshold MES:
Added a Julia implementation to the electowiki page. If people want it in Python I can translate.
My preference is python with heavy use of the pandas library. This should help it be short an clean. Or at leas shorter than what you have there. We do not really want production code but a very precise definition.
-
@keith-edmonds DataFrames.jl is essentially the same as pandas so unfortunately I do not think the logic can be made appreciably shorter (without golfing the code and making it harder to follow)
There are some pieces I could cut though if you just want it visually shorter
- cut whitespace & comments
- remove the isapprox checks---these in theory should not be necessary, but without them you can get bad results when some candidate gets precisely one quota (because of floating point imprecision)
- remove the option to allow clones
- remove the example with Tennessee capital cities
I'll put a Python version up and you let me know which components if any should be cut
-
Ok, I added a Python version as well. As requested, I made as liberal use of Pandas functionality as I could. Personally, I find the more spelled-out implementation easier to follow, but pd magic is undeniably concise in some places. It's probably a good idea regardless to have two very different implementations---this way we can validate them against each other to find errors.
-
@andy-dienes Awesome. Pandas definitely can make things concise if done right. There are lots of functions.