mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Accept new Phragmén solutions if they are epsilon better + Better pre-inclusion checks. (#6173)
* part1: Accept inly epsilon better solutions * Fix pre-dispatch check * Fix build * review grumbles * Epsilon -> Threshold
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
|
||||
/// converts x into the range [a, b] in a pseudo-fair way.
|
||||
pub fn to_range(x: usize, a: usize, b: usize) -> usize {
|
||||
// does not work correctly if b < 2*a
|
||||
assert!(b > 2 * a);
|
||||
// does not work correctly if b < 2 * a
|
||||
assert!(b >= 2 * a);
|
||||
let collapsed = x % b;
|
||||
if collapsed >= a {
|
||||
collapsed
|
||||
|
||||
@@ -131,7 +131,7 @@ fn main() {
|
||||
return;
|
||||
}
|
||||
|
||||
let enhance = is_score_better(initial_score, final_score);
|
||||
let enhance = is_score_better(final_score, initial_score, Perbill::zero());
|
||||
|
||||
println!(
|
||||
"iter = {} // {:?} -> {:?} [{}]",
|
||||
@@ -140,6 +140,7 @@ fn main() {
|
||||
final_score,
|
||||
enhance,
|
||||
);
|
||||
|
||||
// if more than one iteration has been done, or they must be equal.
|
||||
assert!(enhance || initial_score == final_score || i == 0)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user