Open mbflex opened 4 years ago
It's the constellation which is described in NÖ Gemeinderatswahlordnung in §53 paragraph 6): Wenn nach dieser Rechnung zwei Parteien oder mehrere Parteien auf das letzte zur Verteilung gelangende Mandat denselben Anspruch haben, so entscheidet zwischen ihnen das Los. (If, according to this calculation, two or more parties have the same claim to the last mandate to be distributed, the decision between them shall be made by lot.) It seems that any result of the dHondt function should be marked as "unique" or "not unique" to make this point even more clear.
another (real life) example:
dHondt(c(397, 327, 274, 109), c("A","B","C","D"), n_seats=19) [1] 7 6 5 1 dHondt(c(397, 327, 274, 109), c("A","B","C","D"), nseats=19) **[1] 7 5 5 2_ dHondt(c(397, 327, 274, 109), c("A","B","C","D"), n_seats=19) [1] 7 5 5 2** dHondt(c(397, 327, 274, 109), c("A","B","C","D"), n_seats=19) [1] 7 6 5 1 dHondt(c(397, 327, 274, 109), c("A","B","C","D"), n_seats=19)
probably a result of
m.mat <- m.mat[rank(m.mat$value, ties.method = "random") <= n_seats, ]
ties in the calculation of ranks are split randomly. But you should get same results if you set a seed before the calculation.
probably a result of
m.mat <- m.mat[rank(m.mat$value, ties.method = "random") <= n_seats, ]
ties in the calculation of ranks are split randomly. But you should get same results if you set a seed before the calculation.
This might be the technical explanation. I personally would prefer to know whether a dHondt result is unique or not.
I guess I could store the info as an attribute of the return object, would that help? In the bigger scope, I think it doesn't matter, because for the calculation of the coalition probabilities and other quantities, we usually make the calculation a couple hundred of times.
The result of the dHondt procedure is sometimes unique, sometimes not. In my opinion any implementation of the procedure should appreciate this feature. E.g. by the function returning a list. If the dHondt-method has a unique result at a given input, then the list should have exactly one element, namely the determined distribution - which itself is a list. If the dHondt procedure leads to n equivalent distributions, then the result list should have n entries - namely all n valid distributions.
(tested with latest version)