#[non_exhaustive]pub struct Goals {
pub objectives: Vec<f64>,
pub violation: f64,
}Expand description
What a model gives for one design: its goals, each to be made as small as it can be, and by how much it breaks the constraints, zero if it keeps them all.
A design the model can’t evaluate (a flight that fails) is Goals::failed: its violation
is +∞, so every design that could be evaluated dominates it. Infinite values serialize as
none, a JSON null.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.objectives: Vec<f64>The goals’ values, in the order the model gives them.
violation: f64The total violation, Σ max(0, gⱼ) over constraints written gⱼ ≤ 0: zero if the design
keeps them all, +∞ if it failed.
Implementations§
Source§impl Goals
impl Goals
Sourcepub fn constrained(objectives: Vec<f64>, constraints: &[f64]) -> Self
pub fn constrained(objectives: Vec<f64>, constraints: &[f64]) -> Self
Goals under constraints gⱼ(x) ≤ 0, given as the numbers gⱼ: the violation is
Σ max(0, gⱼ), as for Evaluation::constrained, whose
advice on scaling the constraints holds here too.
Sourcepub fn failed() -> Self
pub fn failed() -> Self
A design the model can’t evaluate: no goals, and a violation of +∞, behind every other.
Sourcepub fn is_feasible(&self) -> bool
pub fn is_feasible(&self) -> bool
Whether the design keeps every constraint.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Goals
impl<'de> Deserialize<'de> for Goals
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>,
impl StructuralPartialEq for Goals
Auto Trait Implementations§
impl Freeze for Goals
impl RefUnwindSafe for Goals
impl Send for Goals
impl Sync for Goals
impl Unpin for Goals
impl UnsafeUnpin for Goals
impl UnwindSafe for Goals
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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