pub trait NposSolver {
type AccountId: IdentifierT;
type Accuracy: PerThing128;
type Error: Debug + PartialEq;
// Required methods
fn solve(
to_elect: usize,
targets: Vec<Self::AccountId>,
voters: Vec<(Self::AccountId, VoteWeight, impl IntoIterator<Item = Self::AccountId>)>,
) -> Result<ElectionResult<Self::AccountId, Self::Accuracy>, Self::Error>;
fn weight<T: WeightInfo>(
voters: u32,
targets: u32,
vote_degree: u32,
) -> Weight;
}
Expand description
Something that can compute the result to an NPoS solution.
Required Associated Types§
sourcetype AccountId: IdentifierT
type AccountId: IdentifierT
The account identifier type of this solver.
sourcetype Accuracy: PerThing128
type Accuracy: PerThing128
The accuracy of this solver. This will affect the accuracy of the output.
Required Methods§
sourcefn solve(
to_elect: usize,
targets: Vec<Self::AccountId>,
voters: Vec<(Self::AccountId, VoteWeight, impl IntoIterator<Item = Self::AccountId>)>,
) -> Result<ElectionResult<Self::AccountId, Self::Accuracy>, Self::Error>
fn solve( to_elect: usize, targets: Vec<Self::AccountId>, voters: Vec<(Self::AccountId, VoteWeight, impl IntoIterator<Item = Self::AccountId>)>, ) -> Result<ElectionResult<Self::AccountId, Self::Accuracy>, Self::Error>
Solve an NPoS solution with the given voters
, targets
, and select to_elect
count
of targets
.
Object Safety§
This trait is not object safe.