feat(traits): add Repair<D> trait + ClampToBounds and ProjectToSimplex impls
Spec §22 Round 4-D listed bounded mutation / repair operators as future
work; this is the second piece of that. A `Repair<D>` trait that nudges
infeasible decisions back to feasibility, intended to be called from a
user's Variation operator (or a CompositeVariation pipeline) when
projection-style constraint handling is preferred over the
penalty-style `constraint_violation` approach.
Trait:
pub trait Repair<D> {
fn repair(&mut self, decision: &mut D);
}
Provided impls:
- `ClampToBounds` — clamps each variable of a Vec<f64> to per-axis bounds
- `ProjectToSimplex` — projects a Vec<f64> onto the (clipped) probability
simplex (Σ x_i = total, x_i ≥ 0), useful for portfolio-style problems
and reference-direction normalization
Both stay in the existing `operators` module (alongside Variation
operators) since they share the same "transforms decisions" theme. Re-
exported from the prelude.
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
pub mod initializer;
|
||||
pub mod optimizer;
|
||||
pub mod repair;
|
||||
pub mod variation;
|
||||
|
||||
pub use initializer::*;
|
||||
pub use optimizer::*;
|
||||
pub use repair::*;
|
||||
pub use variation::*;
|
||||
|
||||
Reference in New Issue
Block a user