majority_judgment

Last updated:

0 purchases

majority_judgment Image
majority_judgment Images
Add to Cart

Description:

majority judgment

Majority Judgment for Dart #






This Dart package helps to resolve polls using Majority Judgment.
Features #

Efficient Majority Judgment algorithm, scales well to billions of participants
Configure whether to favor adhesion or contestation (default)
Balance proposal tallies using a static default grade or the median grade1
Room for Central Judgment and Usual Judgment
Unit-tested (run dart test)

Get started #

import 'package:majority_judgment/majority_judgment.dart';

void main() {

final pollTally = PollTally([
[1, 2, 4, 2, 1], // Proposal A, from "worst" grade to "best" grade
[1, 2, 4, 1, 2], // Proposal B
[3, 1, 3, 1, 2], // Proposal C
[1, 2, 4, 2, 1], // Proposal D (equal to A)
]);
final mj = MajorityJudgmentResolver();
final result = mj.resolve(pollTally);

print(result.proposalsResults.map((ProposalResult p) => p.rank));
//> (2, 1, 4, 2)

print(result.sortedProposalsResults.map((ProposalResult p) => p.index));
//> (1, 0, 3, 2)

}

copied to clipboard
Contribute #
Usual git flow: clone, tinker, request a merge.
Authors #
This package was made by MieuxVoter, a french nonprofit.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.