Sorry for the title, but I can not think of a better one.
Starting informally, monotonicity says that if the number of votes for i is greater that the number of votes for j, the number of seats for i must be greater or equal to the number of seats for j.
Suppose the vector of votes is v = {70, 20, 10} and that we have three vectors of seats in a list, i.e., z = {{1, 0, 1}, {1, 1, 0}, {2, 0, 0}}.
I observe that:
70 > 20 and 1 > 0 70 > 20 and 1 = 1 70 > 20 and 2 > 0
70 > 10 and 1 = 1 70 > 10 and 1 = 1 70 > 10 and 2 > 0
20 > 10 and 0 < 1 20 > 10 and 1 > 0 10 > 10 and 1 = 0
which shows that only the first vector must be discarded because it does not respect monotonicity. I have tried the following command but obviously it does not fit.
Table[
(v[[i]] < v[[j]] && z[[k, i]] <= z[[k, j]]) ||
(v[[i]] > v[[j]] && z[[k, i]] >= z[[k, j]]),
{i, Length[z] - 1}, {j, i + 1, Length[z]}, {k, Length[z]}]
which gives
{{{True, True, True}, {True, True, True}}, {{False, True, True}}}
I need some help, perhaps an explanation on how to fix the bracketing in my poor attempt.
v = {20, 10, 10}? – kglr Jul 12 '17 at 14:00