UNPKG

ecclesia

Version:

Framework for political and electoral simulations

62 lines (61 loc) 2.65 kB
import { type Simple } from "../tally"; import { type Attribution, type HasNSeats } from "../attribution"; import { type DivisorMethod, type Proportional, type RankIndexMethod } from "./proportionalBase"; export declare function jefferson<Party>({ nSeats }: { nSeats: number; }): DivisorMethod<Party> & HasNSeats; export declare const dHondt: typeof jefferson; export declare function webster<Party>({ nSeats }: { nSeats: number; }): DivisorMethod<Party> & HasNSeats; export declare const sainteLague: typeof webster; export declare function hamilton<Party>({ nSeats }: { nSeats: number; }): Proportional<Party> & HasNSeats; export declare const hareLargestRemainders: typeof hamilton; /** * This attribution method required some creativity and tweaks, * since the standard divisor won't work without an initial seats value, * causing a division by 0. * As a result, a threshold is required in this case. * * In a situation where the candidates are already limited by other means, * (for instance when distributing representatives between a fixed number of states) * to be less or equal to the number of seats, then a threhold of 0 can be passed. * In that case, the method will allocate one seat to each candidate * until all candidates have a seat, * or (but that would be a bug) all seats are allocated. * * The order in which the first seats are allocated is an implementation detail. */ export declare function huntingtonHill<Party>({ nSeats, threshold }: { nSeats: number; threshold: 0; }): DivisorMethod<Party> & HasNSeats; export declare function huntingtonHill<Party>({ nSeats, threshold, contingency }: { nSeats: number; threshold: number; contingency?: DivisorMethod<Party> | null; }): DivisorMethod<Party> & HasNSeats; export declare function huntingtonHill<Party>({ nSeats, threshold, contingency }: { nSeats: number; threshold: number; contingency?: RankIndexMethod<Party> | null; }): RankIndexMethod<Party> & HasNSeats; export declare function huntingtonHill<Party>({ nSeats, threshold, contingency }: { nSeats: number; threshold: number; contingency?: Attribution<Party, Simple<Party>> | null; }): Attribution<Party, Simple<Party>> & HasNSeats; /** * Creates a highest-averages proportional attribution method. * * The exact method used is an implementation detail and may change between versions. */ export declare const highestAverages: typeof webster; /** * Creates a largest-remainders proportional attribution method. * * Implementation detail: the quota used is the Hare/Hamilton quota. */ export declare const largestRemainders: typeof hamilton;