Adjust costs of edges in position ranking rule

To ensure good performance
This commit is contained in:
Loïc Lecrenier 2023-05-08 13:06:35 +02:00
parent 65ad8cce36
commit f6524a6858

View File

@ -111,23 +111,16 @@ impl RankingRuleGraphTrait for PositionGraph {
fn cost_from_position(sum_positions: u32) -> u32 { fn cost_from_position(sum_positions: u32) -> u32 {
match sum_positions { match sum_positions {
0 | 1 | 2 | 3 => sum_positions, 0 => 0,
4 | 5 => 4, 1 => 1,
6 | 7 => 5, 2..=4 => 2,
8 | 9 => 6, 5..=7 => 3,
10 | 11 => 7, 8..=11 => 4,
12 | 13 => 8, 12..=16 => 5,
14 | 15 => 9, 17..=24 => 6,
16 | 17..=24 => 10, 25..=64 => 7,
25..=32 => 11, 65..=256 => 8,
33..=64 => 12, 257..=1024 => 9,
65..=128 => 13, _ => 10,
129..=256 => 14,
257..=512 => 15,
513..=1024 => 16,
1025..=2048 => 17,
2049..=4096 => 18,
4097..=8192 => 19,
_ => 20,
} }
} }