Commit 8606b6f
feat(metrics): add
Adds a thin constructor for the "restrict any metric to changeless solutions"
pattern. The previous workaround was the verbose tuple combinator
`((metric, 1.0), (Changeless { target, change_policy }, 0.0))`, which is
how the new method is implemented:
Changeless { target, change_policy }
.restrict(LowestFee { target, long_term_feerate, change_policy });
For metrics like `LowestFee` whose bounds happen not to differ per-regime on
changeless selections, this is equivalent in BnB round counts to a dedicated
`Changeless<Lowest>Fee` metric — see the
`benches/changeless_dedicated_vs_tuple` data. For `Waste`-shape metrics with
genuinely cross-regime bounds, the dedicated `ChangelessWaste` is much
tighter; the rustdoc on `restrict` documents this trade-off.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>Changeless::restrict for tuple-combinator ergonomics1 parent 4a0acc8 commit 8606b6f
1 file changed
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
13 | 43 | | |
14 | 44 | | |
15 | 45 | | |
| |||
0 commit comments