Re: [PATCH proxmox v2 06/40] resource-scheduling: topsis: handle empty criteria without panics

Dominik Rusovac
2026-03-26T10:28:55Z

lgtm

On Tue Mar 24, 2026 at 7:29 PM CET, Daniel Kral wrote:

[snip]

> diff --git a/proxmox-resource-scheduling/src/topsis.rs b/proxmox-resource-scheduling/src/topsis.rs
> index 6d078aa6..ed5a9bd1 100644
> --- a/proxmox-resource-scheduling/src/topsis.rs
> +++ b/proxmox-resource-scheduling/src/topsis.rs
> @@ -145,8 +145,10 @@ impl<const N: usize> IdealAlternatives<N> {
> let min = fixed_criterion
> .clone()
> .min_by(|a, b| a.total_cmp(b))
> - .unwrap();
> - let max = fixed_criterion.max_by(|a, b| a.total_cmp(b)).unwrap();
> + .unwrap_or(f64::NEG_INFINITY);
> + let max = fixed_criterion
> + .max_by(|a, b| a.total_cmp(b))
> + .unwrap_or(f64::INFINITY);

that's a very nice idea!

[snip]