pub struct SbxCrossover {
pub eta: f64,
pub crossover_probability: f64,
pub exchange_probability: f64,
}Expand description
Simulated Binary Crossover (SBX)
SBX generates offspring from parents using a spread factor that simulates single-point crossover for binary strings.
§Two distinct probabilities
SBX involves two conceptually separate probabilities that used to be conflated into a single field (audit EV-72):
crossover_probability— the per-pair probability that the operator is applied at all. This is the quantity reported byCrossoverOperator::crossover_probabilityand consumed by the driving algorithm (e.g.SimpleGA,NSGA-II) to decide, once per parent pair, whether to recombine. Canonical default:0.9.exchange_probability— the per-gene probability, used inside SBX, that an individual variable is recombined via the spread factor (otherwise the children inherit the parents’ values unchanged for that variable). Deb’s canonical NSGA-II code uses0.5.
§Bounds handling
When bounds are supplied (via BoundedCrossoverOperator) the operator
uses Deb & Agrawal’s bounds-aware spread factor: for each variable the
spread is drawn from the polynomial SBX distribution truncated to the
distance to each bound, so offspring land inside [min, max] by
construction with no probability mass piled onto the boundaries (audit
EV-71). The unbounded path uses the classic (untruncated) spread factor.
Reference: Deb, K., & Agrawal, R. B. (1995). Simulated Binary Crossover
for Continuous Search Space. Bounds-aware variant: Deb, K. (2001),
NSGA-II crossover.c.
Fields§
§eta: f64Distribution index (typically 2-20) Higher values = offspring closer to parents
crossover_probability: f64Per-pair probability that the operator is applied (reported by
CrossoverOperator::crossover_probability). Default: 0.9.
exchange_probability: f64Per-gene exchange probability used inside SBX. Default: 0.5
(canonical). This is a distinct quantity from
crossover_probability.
Implementations§
Source§impl SbxCrossover
impl SbxCrossover
Sourcepub fn with_probability(self, probability: f64) -> Self
pub fn with_probability(self, probability: f64) -> Self
Set the per-pair crossover probability reported by
CrossoverOperator::crossover_probability.
This is the probability the driving algorithm uses to decide, once per
parent pair, whether to apply the operator. It is not the per-gene
exchange rate — for that see with_exchange_probability.
Sourcepub fn with_exchange_probability(self, probability: f64) -> Self
pub fn with_exchange_probability(self, probability: f64) -> Self
Set the per-gene exchange probability used inside SBX (canonical: 0.5).
Trait Implementations§
Source§impl BoundedCrossoverOperator<RealVector> for SbxCrossover
impl BoundedCrossoverOperator<RealVector> for SbxCrossover
Source§fn crossover_bounded<R: Rng>(
&self,
parent1: &RealVector,
parent2: &RealVector,
bounds: &MultiBounds,
rng: &mut R,
) -> OperatorResult<(RealVector, RealVector)>
fn crossover_bounded<R: Rng>( &self, parent1: &RealVector, parent2: &RealVector, bounds: &MultiBounds, rng: &mut R, ) -> OperatorResult<(RealVector, RealVector)>
Source§impl Clone for SbxCrossover
impl Clone for SbxCrossover
Source§fn clone(&self) -> SbxCrossover
fn clone(&self) -> SbxCrossover
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CrossoverOperator<RealVector> for SbxCrossover
impl CrossoverOperator<RealVector> for SbxCrossover
Source§fn crossover<R: Rng>(
&self,
parent1: &RealVector,
parent2: &RealVector,
rng: &mut R,
) -> OperatorResult<(RealVector, RealVector)>
fn crossover<R: Rng>( &self, parent1: &RealVector, parent2: &RealVector, rng: &mut R, ) -> OperatorResult<(RealVector, RealVector)>
Source§fn crossover_probability(&self) -> f64
fn crossover_probability(&self) -> f64
Auto Trait Implementations§
impl Freeze for SbxCrossover
impl RefUnwindSafe for SbxCrossover
impl Send for SbxCrossover
impl Sync for SbxCrossover
impl Unpin for SbxCrossover
impl UnsafeUnpin for SbxCrossover
impl UnwindSafe for SbxCrossover
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.