iconEuler Reference

D'Hondt and Hare-Niemeyer

D'Hondt and Hare-Niemeyer algorithm.

Load with "load hondt".

function hondt (v,n)
  Distributions of seats with d'Hondt
  
  Compute the distribution of seats s[1],...s[k], which corresonds
  to v[1],...,v[k], such that sum s[i] = n, using d'Hondt.
  
  See: 
hnbest (D'Hondt and Hare-Niemeyer)
function hnbest (v,n)
  Best distribution of seats with Hare-Niemeyer
  
  Compute the distribution of seats s[1],...s[k], which corresonds
  to v[1],...,v[k], such that sum s[i] = n, using closest fit.
  The method minimizes the sum of absolute errors and is
  often called Hare-Niemeyer method.
  
  See: 
hondt (D'Hondt and Hare-Niemeyer)

Documentation Homepage