Open hhirtz opened 2 years ago
Can you obtain a reproducer ?
fn main() {
use coupe::Partition;
let weights = [
504.51144132994574,
504.51144132994574,
3.4558264683830705e-14,
];
let mut partition = [0, 1, 1];
println!("partitioning");
coupe::VnBest.partition(&mut partition, weights).unwrap();
}
imbalance 5.684341886080802e-14
-> nearest weight is 3.4558264683830705e-14
-> part_loads before [504.51144132994574, 504.5114413299458]
-> part_loads after [504.5114413299458, 504.51144132994574]
So we have a weight W strictly smaller than imbalance, but doesn't change the imbalance due to float imprecision.
Changing this line
to
if part_loads[underweight_part] + imbalance <= part_loads[underweight_part] + nearest_weight
|| nearest_weight.is_zero()
fixes the issue...
Using
num-part
with thebeta,0.2,0.2
distribution makes vnbest hang sometimes, esp with runs with more than 1000 weights.