39 lines
1.5 KiB
Diff
39 lines
1.5 KiB
Diff
--- src/icm/harville.rs
|
|
+++ replace expand with ()
|
|
@@ -8,34 +8,17 @@
|
|
pub const MAX_FIELD: usize = 2_000;
|
|
/// Finishing orders drawn for a sampled field.
|
|
pub const SAMPLES: u32 = 20_000;
|
|
/// Fixed, so the same field gives the same equities and two fields are compared on the same
|
|
/// draws (common random numbers keep the difference of two evaluations smooth).
|
|
const SAMPLE_SEED: u64 = 0x1C4_5EED;
|
|
|
|
fn expand(stacks: &[f64], taken: &mut Vec<usize>, probability: f64, payouts: &[f64], out: &mut [f64]) {
|
|
- let place = taken.len();
|
|
- if place >= payouts.len() || probability <= 0.0 {
|
|
- return;
|
|
- }
|
|
- let left: f64 = stacks.iter().enumerate().filter(|(i, _)| !taken.contains(i)).map(|(_, s)| *s).sum();
|
|
- if left <= 0.0 {
|
|
- return;
|
|
- }
|
|
- for i in 0..stacks.len() {
|
|
- if taken.contains(&i) {
|
|
- continue;
|
|
- }
|
|
- let p = probability * stacks[i] / left;
|
|
- out[i] += p * payouts[place];
|
|
- taken.push(i);
|
|
- expand(stacks, taken, p, payouts, out);
|
|
- taken.pop();
|
|
- }
|
|
+ () /* ~ changed by cargo-mutants ~ */
|
|
}
|
|
|
|
/// Expected prize per player. Places beyond the paid ones pay nothing; more payouts than
|
|
/// players are cut to the field. The sum of the result is the sum of the paid prizes.
|
|
/// Exact up to `MAX_PLAYERS`, sampled above.
|
|
pub fn equities(stacks: &[f64], payouts: &[f64]) -> Vec<f64> {
|
|
if stacks.len() > MAX_PLAYERS {
|
|
return sampled_equities(stacks, payouts);
|