Skip to main content

Problem

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

pub const SHOWN: [Self; 4]

The test functions the browser offers, in display order, after Cart-pole.

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"

The slug of Self::Cartpole.

pub const CUSTOM_SLUG: &'static str = "custom"

The slug of Self::Custom.

pub fn new_with_custom(landscape: Landscape) -> Self

The custom function of landscape.

pub const fn slug(&self) -> &'static str

The stable identifier used in URLs and form values.

pub fn landscape(&self) -> Option<&Arc<Landscape>>

The custom function’s landscape.

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>

Parses a Self::slug of a built-in problem.

pub const fn label(&self) -> &'static str

The display name.

pub const fn name(&self) -> &'static str

The study name used for this problem.

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>

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>

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 bounds(&self) -> &'static [Bound]

The declared parameters, in suggestion order.

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

The known global minimum value; for the custom function, the lowest scanned value.

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

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

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

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 Clone for Problem

§

fn clone(&self) -> Problem

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Problem

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl PartialEq for Problem

§

fn eq(&self, other: &Problem) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for Problem

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more