ecclesia
Version:
Framework for political and electoral simulations
24 lines (21 loc) • 702 B
TypeScript
import { Counter } from '@gouvernathor/python/collections';
import { Simple } from '../ballots.js';
interface DisproportionMetric<Party> {
(p0: {
votes: Simple<Party>;
seats: Counter<Party>;
}): number;
}
/**
* Returns the mean value (across all candidates) of the absolute difference
* between the theoretical, (f)ra(c)tional number of seats and the allocated number of seats.
* The bigger, the less proportional.
*
* Compared to a sum or mean of absolute differences of percentage,
* this
*/
declare function defaultMetric<Party>({ votes, seats }: {
votes: Simple<Party>;
seats: Counter<Party>;
}): number;
export { type DisproportionMetric, defaultMetric };