votes
    Preparing search index...

    Class MajorityJudgment<C>

    Ranks by majority grade, ties broken by Balinski–Laraki's majority value.

    Type Parameters

    • C extends string

    Hierarchy

    • Method<C>
      • MajorityJudgment
    Index
    • Type Parameters

      • C extends string

      Parameters

      • i: {
            ballots: readonly Ballot<C>[];
            candidates: readonly C[];
            clampGrades?: boolean;
            countBlank?: boolean;
            grades?: number;
            unrankedLast?: boolean;
        }
        • ballots: readonly Ballot<C>[]
        • candidates: readonly C[]
        • OptionalclampGrades?: boolean

          Whether a ballot ranked past the worst grade gives its ranks from the worst grade on that grade (default false: it throws).

        • OptionalcountBlank?: boolean

          Whether a ballot that grades no one gives everyone the worst grade too, with unrankedLast (default false).

        • Optionalgrades?: number

          Number of grades, best first (default 6). A ballot tier's index is its grade.

        • OptionalunrankedLast?: boolean

          Whether a ballot that grades someone gives the candidates it leaves out the worst grade (default true). Pass false to count only given grades.

      Returns MajorityJudgment<C>

    candidates: C[]
    grades: number
    isRandom: boolean = false
    label: "MajorityJudgment" = 'MajorityJudgment'
    • Ranking built by repeated wins instead of the method's own full ranking: run the method, record the winning tier, then re-run it restricted to the remaining candidates for the next place, and so on.

      Differs from ranking() whenever the method's full ranking disagrees with how it ranks subsets — e.g. instant runoff orders losers by elimination time, while iterating re-elects a winner at every place.

      Returns C[][]

    • Result of the vote. The first item lists the winners of the vote.

      For example this ranking means that Bear wins, Sheep is second and Lion third [ [ 'Bear' ], [ 'Sheep' ], [ 'Lion' ] ]

      Returns C[][]

    • The same grades, among candidates only: unlike other ballot methods, it does not count afresh, as a grade does not depend on who else runs. With unrankedLast, those a ballot left out keep its worst grade, even if it graded none of candidates.

      Parameters

      • candidates: readonly C[]

      Returns this

    • The method as an Election method, with options for its constructor and mode or label.

      Type Parameters

      Parameters

      • this: T
      • options: PropsOf<T> & { label?: string; mode?: "restricted" | "full" | "recursive" }
        • Optionallabel?: string

          Name in traces (TieBreakStep.name, StepResult.name) instead of the method's label.

        • Optionalmode?: "restricted" | "full" | "recursive"

          Which candidates the method ranks a tie among: the tied ones ('restricted', default), everyone ('full'), or the tied ones, then those of each tie that leaves, until none splits ('recursive').

      Returns readonly [
          T,
          PropsOf<T> & { label?: string; mode?: "restricted" | "full" | "recursive" },
      ]

      new Election({
      candidates,
      ballots,
      methods: [Copeland, Borda.with({ mode: 'full' })],
      })