pub struct MultiObjectiveSolution {
pub variables: Array1<f64>,
pub objectives: Array1<f64>,
pub constraint_violation: f64,
pub rank: usize,
pub crowding_distance: f64,
pub metadata: HashMap<String, f64>,
}
Expand description
Represents a solution in multi-objective optimization
Fields§
§variables: Array1<f64>
Decision variables
objectives: Array1<f64>
Objective function values
constraint_violation: f64
Constraint violation (0.0 if feasible)
rank: usize
Rank in the population (for NSGA-II/III)
crowding_distance: f64
Crowding distance (for NSGA-II)
metadata: HashMap<String, f64>
Additional metadata
Implementations§
Source§impl MultiObjectiveSolution
impl MultiObjectiveSolution
Sourcepub fn new_with_constraints(
variables: Array1<f64>,
objectives: Array1<f64>,
constraint_violation: f64,
) -> Self
pub fn new_with_constraints( variables: Array1<f64>, objectives: Array1<f64>, constraint_violation: f64, ) -> Self
Create a new solution with constraint violation
Sourcepub fn is_dominated_by(&self, other: &Self) -> bool
pub fn is_dominated_by(&self, other: &Self) -> bool
Check if this solution is dominated by another
Sourcepub fn is_non_dominated_with(&self, other: &Self) -> bool
pub fn is_non_dominated_with(&self, other: &Self) -> bool
Check if solutions are non-dominated with respect to each other
Sourcepub fn objective_distance(&self, other: &Self) -> f64
pub fn objective_distance(&self, other: &Self) -> f64
Calculate distance to another solution in objective space
Sourcepub fn variable_distance(&self, other: &Self) -> f64
pub fn variable_distance(&self, other: &Self) -> f64
Calculate distance to another solution in variable space
Sourcepub fn n_objectives(&self) -> usize
pub fn n_objectives(&self) -> usize
Get number of objectives
Sourcepub fn n_variables(&self) -> usize
pub fn n_variables(&self) -> usize
Get number of variables
Sourcepub fn is_feasible(&self) -> bool
pub fn is_feasible(&self) -> bool
Check if solution is feasible
Sourcepub fn set_metadata(&mut self, key: String, value: f64)
pub fn set_metadata(&mut self, key: String, value: f64)
Set metadata value
Sourcepub fn get_metadata(&self, key: &str) -> Option<f64>
pub fn get_metadata(&self, key: &str) -> Option<f64>
Get metadata value
Sourcepub fn with_objectives(&self, objectives: Array1<f64>) -> Self
pub fn with_objectives(&self, objectives: Array1<f64>) -> Self
Clone with new objectives (useful for constraint handling)
Sourcepub fn with_variables(&self, variables: Array1<f64>) -> Self
pub fn with_variables(&self, variables: Array1<f64>) -> Self
Clone with new variables
Trait Implementations§
Source§impl Clone for MultiObjectiveSolution
impl Clone for MultiObjectiveSolution
Source§fn clone(&self) -> MultiObjectiveSolution
fn clone(&self) -> MultiObjectiveSolution
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MultiObjectiveSolution
impl Debug for MultiObjectiveSolution
Source§impl<'de> Deserialize<'de> for MultiObjectiveSolution
impl<'de> Deserialize<'de> for MultiObjectiveSolution
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for MultiObjectiveSolution
impl PartialEq for MultiObjectiveSolution
Auto Trait Implementations§
impl Freeze for MultiObjectiveSolution
impl RefUnwindSafe for MultiObjectiveSolution
impl Send for MultiObjectiveSolution
impl Sync for MultiObjectiveSolution
impl Unpin for MultiObjectiveSolution
impl UnwindSafe for MultiObjectiveSolution
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.