Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent results between runs #2

Open
manuca opened this issue Sep 26, 2014 · 2 comments
Open

Inconsistent results between runs #2

manuca opened this issue Sep 26, 2014 · 2 comments

Comments

@manuca
Copy link

manuca commented Sep 26, 2014

Hi thanks for this great gem, I've been using it for a contest and I'm having inconsistencies for a specific election where I elect 4 seats and there are 3 always elected and the 4th rotates randomly between 3 options. This is the only case where this happens and in all other tests I've made the results are consistent with the Droop Python package. Droop in meek mode systematically elects candidates 9, 13, 14 and 19 Meekster always elects 9, 13 and 19 and sometimes elects 14 as Droop but also 2 and 10.

I believe this is a rounding error of some kind, hope you can give me a hand with this issue.

I tested running several times run_election

def run_election
  bf = Meekster::BallotFile.new(filename: "ballot.blt")
  e = Meekster::Election.new(ballot_file: bf)
  e.run!
  e.candidates.select {|c| c.state == :elected }.map {|c| c.name.to_i }.sort
end

Here is the ballot.blt file

32 4
6 19 0
7 9 0
1 15 2 4 14 0
1 11 7 2 9 0
3 10 0
1 13 30 0
3 13 0
1 13 14 0
2 30 0
1 13 8 9 0
1 2 30 3 0
3 2 0
1 3 4 0
1 4 5 30 1 0
3 3 0
1 19 17 0
1 14 9 19 0
1 13 12 14 4 0
1 10 2 9 14 0
1 12 30 4 13 0
1 15 4 26 31 0
1 31 6 11 9 0
1 14 19 3 8 0
1 9 12 0
1 14 3 10 31 0
1 14 9 13 10 0
1 9 3 6 0
1 10 13 0
1 29 0
1 4 0
1 3 10 26 0
1 6 4 19 0
1 9 13 30 0
1 9 10 2 6 0
1 14 0
1 20 28 15 24 0
1 19 9 0
1 6 0
1 6 30 0
1 20 3 25 5 0
1 10 20 30 15 0
1 14 7 10 11 0
1 14 29 0
1 2 4 5 17 0
1 12 17 0
0
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
"10"
"11"
"12"
"13"
"14"
"15"
"16"
"17"
"18"
"19"
"20"
"21"
"22"
"23"
"24"
"25"
"26"
"27"
"28"
"29"
"30"
"31"
"32"
"Elects 9, 13, 19 (sometimes 2, 10 and 14)"
@manuca
Copy link
Author

manuca commented Sep 27, 2014

I'm almost sure this has to do with the tie-breaking method used in both packages. Droop seems to defeat ties always picking the first in the list of ties while Meekster picks it randomly. If I change this line in round.rb

  def tiebreaker_select(array)
    array[0]
  end

Meekster behaves as Droop and I get the exact same results.

Having an option to enable this kind of tie-breaking behaviour might be interesting to get deterministic results.

I'm interested in knowing your opinions on this topic.

@chrismear
Copy link
Member

Thanks for looking into this. I agree that making the results deterministic would be preferable as a default, and maybe we can keep the current random tie-breaking as a configurable option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants