Function is_feasible
pub fn is_feasible(constraints: &[f64]) -> boolExpand description
Whether every constraint value is satisfied — the feasibility test.
Satisfied means ≤ 0. A NaN is not satisfied: NaN <= 0.0 is false
in IEEE arithmetic, which happens to be the answer we want, and it is
asserted rather than left to luck — a constraint that could not be evaluated
must never read as met. -∞ is satisfied (it is a legitimate “very much
inside the feasible region”).
An empty slice is vacuously feasible; callers that need to distinguish
“declared nothing” from “declared and satisfied” use
Point::constraints, which is None in
the first case.
use atune_core::pareto::is_feasible;
assert!(is_feasible(&[-1.0, 0.0]));
assert!(!is_feasible(&[-1.0, 0.5]));
assert!(!is_feasible(&[f64::NAN]), "an unevaluated constraint is not met");
assert!(is_feasible(&[]), "nothing to violate");