[−][src]Function sp_phragmen::equalize
pub fn equalize<Balance, AccountId, C, FS>(
assignments: Vec<(AccountId, Vec<PhragmenStakedAssignment<AccountId>>)>,
supports: &mut SupportMap<AccountId>,
tolerance: ExtendedBalance,
iterations: usize,
stake_of: FS
) where
C: Convert<Balance, u64> + Convert<u128, Balance>,
FS: Fn(&'r AccountId) -> Balance,
AccountId: Ord + Clone,
Performs equalize post-processing to the output of the election algorithm. This happens in rounds. The number of rounds and the maximum diff-per-round tolerance can be tuned through input parameters.
No value is returned from the function and the supports
parameter is updated.
assignments
: exactly the same is the output of phragmen.supports
: mutable reference to sSupportMap
. This parameter is updated.tolerance
: maximum difference that can occur before an early quite happens.iterations
: maximum number of iterations that will be processed.stake_of
: something that can return the stake stake of a particular candidate or voter.