Module sp_npos_elections::balancing
source · Expand description
Balancing algorithm implementation.
Given a committee A
and an edge weight vector w
, a balanced solution is one that
- it maximizes the sum of member supports, i.e
Argmax { sum(support(c)) }
. for allc
inA
. - it minimizes the sum of supports squared, i.e
Argmin { sum(support(c).pow(2)) }
for allc
inA
.
See balance
for more information.
Functions§
- Balance the weight distribution of a given
voters
at mostiterations
times, or up until the point where the biggest difference created per iteration of all stakes istolerance
. If this is called withtolerance = 0
, then exactlyiterations
rounds will be executed, except if no change has been made (difference = 0
).tolerance
anditerations
are part of theBalancingConfig
struct.