pub enum ObjectiveSense {
Minimize,
Maximize,
}Expand description
The direction in which an objective is optimised.
This is the typed direction primitive that reconciles the library’s maximise-native engine with cost objectives (the benchmark landscapes). See the module documentation for the two-space model.
Variants§
Minimize
Lower is better (cost, loss, error, distance-to-target).
Maximize
Higher is better (reward, fitness, accuracy, score).
Implementations§
Source§impl ObjectiveSense
impl ObjectiveSense
Sourcepub fn to_canonical(self, raw: f32) -> f32
pub fn to_canonical(self, raw: f32) -> f32
Maps a raw user-space objective value into the engine’s maximise-native canonical space.
Maximize passes the value through unchanged; Minimize negates it so a
cost surface is optimised as −cost by the maximise-native engine.
Applied once, at the harness / fitness-adapter boundary.
use rlevo_core::objective::ObjectiveSense;
assert_eq!(ObjectiveSense::Maximize.to_canonical(3.0), 3.0);
assert_eq!(ObjectiveSense::Minimize.to_canonical(3.0), -3.0);Sourcepub fn from_canonical(self, canonical: f32) -> f32
pub fn from_canonical(self, canonical: f32) -> f32
Inverse of to_canonical: maps an engine-space
(canonical, maximise) value back to the user’s declared sense for
reporting (best_fitness, records, showcases).
Because the mapping is an involution (negate iff Minimize), this is the
same operation as to_canonical.
use rlevo_core::objective::ObjectiveSense;
// A Minimize landscape optimised as -cost in canonical space reads back
// as its natural cost.
let canonical = ObjectiveSense::Minimize.to_canonical(2.5); // -2.5
assert_eq!(ObjectiveSense::Minimize.from_canonical(canonical), 2.5);Trait Implementations§
Source§impl Clone for ObjectiveSense
impl Clone for ObjectiveSense
Source§fn clone(&self) -> ObjectiveSense
fn clone(&self) -> ObjectiveSense
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ObjectiveSense
Source§impl Debug for ObjectiveSense
impl Debug for ObjectiveSense
Source§impl<'de> Deserialize<'de> for ObjectiveSense
impl<'de> Deserialize<'de> for ObjectiveSense
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 Eq for ObjectiveSense
Source§impl Hash for ObjectiveSense
impl Hash for ObjectiveSense
Source§impl PartialEq for ObjectiveSense
impl PartialEq for ObjectiveSense
Source§impl Serialize for ObjectiveSense
impl Serialize for ObjectiveSense
impl StructuralPartialEq for ObjectiveSense
Auto Trait Implementations§
impl Freeze for ObjectiveSense
impl RefUnwindSafe for ObjectiveSense
impl Send for ObjectiveSense
impl Sync for ObjectiveSense
impl Unpin for ObjectiveSense
impl UnsafeUnpin for ObjectiveSense
impl UnwindSafe for ObjectiveSense
Blanket Implementations§
impl<T> Boilerplate for T
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
impl<T> CacheKey for T
impl<T> CacheValue for T
Source§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CompilationArg for T
impl<T> CompilationArg for T
Source§fn dynamic_cast<Arg>(&self) -> Argwhere
Arg: CompilationArg,
fn dynamic_cast<Arg>(&self) -> Argwhere
Arg: CompilationArg,
impl<T> CubeComptime for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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