Enum Problem
pub enum Problem {
Cartpole,
Rastrigin,
Ackley,
Rosenbrock,
Himmelblau,
ShiftedQuadratic,
Custom(Arc<Landscape>),
}Expand description
A minimization problem.
Variants§
Cartpole
CartPole-v1 balanced by a linear policy that Augmented Random Search
trains (D113): x = log10 step size and y = log10 exploration noise
on [-2.5, 0]², and the value is the run’s mean shortfall from 500
steps over its crate::training::STEPS epochs (the area above its
learning curve). 0 is a lower bound; no location of it is claimed.
Rastrigin
The 2-D Rastrigin function on [-5.12, 5.12]²; global minimum 0 at
the origin, surrounded by a regular grid of local minima.
Ackley
The 2-D Ackley function on [-5, 5]²; global minimum 0 at the origin,
in a narrow funnel on a nearly flat, rippled plateau.
Rosenbrock
The Rosenbrock function on [-2, 2] × [-1, 3]; global minimum 0 at
(1, 1), at the end of a long, flat, curved valley.
Himmelblau
Himmelblau’s function on [-5, 5]²; four global minima of value 0.
ShiftedQuadratic
(x - 1.25)² on [-5, 5]; minimum 0 at x = 1.25. A one-dimensional
regression fixture, not shown in the browser.
Custom(Arc<Landscape>)
A user formula on [-5, 5]² (D94).
Implementations§
§impl Problem
impl Problem
pub const BUILT_IN: [Self; 5]
pub const BUILT_IN: [Self; 5]
Every built-in problem the browser offers, in display order: cart-pole (the default), then the test functions.
pub const CARTPOLE_SLUG: &'static str = "cartpole"
pub const CARTPOLE_SLUG: &'static str = "cartpole"
The slug of Self::Cartpole.
pub const CUSTOM_SLUG: &'static str = "custom"
pub const CUSTOM_SLUG: &'static str = "custom"
The slug of Self::Custom.
pub fn new_with_custom(landscape: Landscape) -> Self
pub fn new_with_custom(landscape: Landscape) -> Self
The custom function of landscape.
pub const fn is_learner(&self) -> bool
pub const fn is_learner(&self) -> bool
Whether a trial trains a policy (Self::Cartpole) rather than
evaluating a formula.
pub fn from_slug(slug: &str) -> Option<Self>
pub fn from_slug(slug: &str) -> Option<Self>
Parses a Self::slug of a built-in problem.
pub fn formula(&self) -> Cow<'static, str>
pub fn formula(&self) -> Cow<'static, str>
The closed form, as the page prints it; for cart-pole, what a value is.
pub const fn expression(&self) -> Option<&'static str>
pub const fn expression(&self) -> Option<&'static str>
The closed form in the custom formula language, so a built-in function
can seed a custom one; None for cart-pole, the custom function itself
and the one-dimensional fixture.
pub fn description(&self) -> Cow<'static, str>
pub fn description(&self) -> Cow<'static, str>
One factual sentence on the function’s shape and minima; for Cart-pole, on what a trial trains and what its value is.
pub const fn optimum_is_known(&self) -> bool
pub const fn optimum_is_known(&self) -> bool
Whether Self::optimum is the exact global minimum value, rather
than the custom function’s lowest scanned value. For cart-pole the
value 0 is exact but Self::minimizers is empty: no location is
claimed (D113).
pub fn optimum(&self) -> f64
pub fn optimum(&self) -> f64
The known global minimum value; for the custom function, the lowest scanned value.
pub fn minimizers(&self) -> &[[f64; 2]]
pub fn minimizers(&self) -> &[[f64; 2]]
Every global minimizer of a two-parameter test function, or the custom function’s lowest scanned point; empty for cart-pole, whose best value is reached in a region of training runs the page does not claim, and for the one-dimensional fixture.
pub fn ceiling(&self) -> f64
pub fn ceiling(&self) -> f64
An upper bound of the function over its box: the loss a simulated
training run starts from (training), so every curve descends. For a
built-in function it is analytic (cart-pole’s value is at most 500);
for the custom function it is a margin above the highest scanned
value, and the controller still starts a trial no lower than its own
value.
pub fn shade(&self, value: f64) -> f64
pub fn shade(&self, value: f64) -> f64
Compresses a value for the heatmap’s color ramp. Rosenbrock and Himmelblau span three orders of magnitude, so they take a logarithm; the others (cart-pole included) a square root (of the height above the lowest scanned value, for the custom function), which keeps the shallow basins near the optimum distinguishable from the high ridges at the box edges.
pub fn evaluate(&self, params: &[f64]) -> f64
pub fn evaluate(&self, params: &[f64]) -> f64
Evaluates the objective at params (one value per Self::bounds
entry, in order). For cart-pole this is a whole fixed-seed training run
(cartpole::objective), a millisecond or so.
Trait Implementations§
impl StructuralPartialEq for Problem
Auto Trait Implementations§
impl Freeze for Problem
impl RefUnwindSafe for Problem
impl Send for Problem
impl Sync for Problem
impl Unpin for Problem
impl UnsafeUnpin for Problem
impl UnwindSafe for Problem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T, U> Imply<T> for U
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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