Skip to content

Voting Methods

Original Condorcet Method (Winner / Loser)

Condorcet Basic gives you the natural winner or loser according to Condorcet's method, if there is one. (This method is the only core method, you cannot remove it)

php
// Will return the strict natural Condorcet Winner candidate. Or null if there isn't one.
$electionWithVotes->getCondorcetWinner();
// Will return the strict natural Condorcet Loser candidate. Or null if there isn't one.
$electionWithVotes->getCondorcetLoser();

Advanced Voting Methods

These advanced methods offer alternatives to address the absence of a natural Condorcet winner or loser in the event of a Condorcet paradox. They also provide a comprehensive ranking, which the original method of the Marquis de Condorcet does not.

Most of these methods cannot contradict the result of the original method of the Marquis de Condorcet. They complete it with a full ranking, and provide an alternative if the original method does not achieve a result (Condorcet's paradox). Some methods do not follow the Condorcet criteria.

php
$electionWithVotes->getWinner('Schulze Winning');
$electionWithVotes->getLoser('Copeland');
$electionWithVotes->getResult('Ranked Pairs Winning');

=> Methods List & Explanations

Configure default methods

Get information

php
use CondorcetPHP\Condorcet\Condorcet;

$electionWithVotes->getResult(); // Uses Schulze Winning, the default method

Condorcet::getDefaultMethod(); // returns 'CondorcetPHP\Condorcet\Algo\Methods\Schulze\SchulzeWinning'
Condorcet::setDefaultMethod('Ranked Pairs');

$electionWithVotes->getResult(); // Uses Ranked Pairs Winning, the new default method
php
// Get an array of authorized methods to use with the correct string to use as parameter.

use CondorcetPHP\Condorcet\Condorcet;

Condorcet::getAuthMethods();

Released under the MIT License.