Skip to main content

SamplerConfig

Struct SamplerConfig 

pub struct SamplerConfig { /* private fields */ }
Expand description

A sampler kind plus the settings it departs from its default with.

SamplerConfig::new carries none, and then build_for is exactly SamplerKind::build_for, so a recipe without opt-ins or opt-outs keeps its seeded output bit for bit.

Implementations§

§

impl SamplerConfig

pub const fn new(kind: SamplerKind) -> Self

kind with its sampler’s default settings.

pub fn with_opt_in(self, opt_in: OptIn) -> Result<Self, String>

Switches opt_in on. Repeating a setting is a no-op, and so is a setting the sampler already turns on: it is not recorded, so the configuration stays the default.

§Errors

When opt_in belongs to another sampler kind, when it was also opted out, or when the combination is one the sampler refuses (CMA-ES separable with margin, as in Optuna).

pub fn with_opt_out(self, opt_out: OptIn) -> Result<Self, String>

Switches the on-by-default setting opt_out off, restoring that part of the sampler’s earlier default. Repeating a setting is a no-op.

§Errors

When opt_out belongs to another sampler kind or is off by default already, or when the combination is one the sampler refuses. (An earlier --opt-in of the same setting recorded nothing, so this call cannot see it; SolverArgs::parse refuses that pair from the command line.)

pub fn conflict(setting: OptIn) -> String

The message for a setting both opted in and out.

pub fn with_gp_cost_budget(self, budget: u64) -> Result<Self, String>

Switches OptIn::GpCostBudget on with an explicit per-ask budget in [atune::auto_sampler::gp_ask_cost] units.

§Errors

When the kind is not SamplerKind::Auto.

pub const fn kind(&self) -> SamplerKind

The sampler kind.

pub fn opt_ins(&self) -> impl Iterator<Item = OptIn> + '_

The off-by-default settings switched on, in OptIn::ALL order.

pub fn opt_outs(&self) -> impl Iterator<Item = OptIn> + '_

The on-by-default settings switched off, in OptIn::ALL order.

pub fn has(&self, setting: OptIn) -> bool

Whether setting is on in the configured sampler: opted in, or on by default and not opted out.

pub fn opt_out_label(&self) -> Option<String>

The opt-out labels joined by ,, or None when there are none.

pub fn opt_in_label(&self) -> Option<String>

The opt-in labels joined by ,, or None when there are none; with an explicit routing budget, gp-cost-budget=<n>.

pub fn tpe(&self) -> Tpe

The configured TPE (meaningful for SamplerKind::Tpe).

pub fn qmc(&self, seed: u64) -> Qmc

The configured QMC sampler for a study seeded seed (meaningful for SamplerKind::Sobol); seed is read only by scramble.

pub fn gp(&self) -> GpEi

The configured GP-EI (meaningful for SamplerKind::Gp).

pub fn cmaes(&self) -> Result<Cmaes, String>

A fresh configured CMA-ES (meaningful for SamplerKind::Cmaes).

§Errors

The sampler’s refusal of separable with margin.

pub fn auto_settings(&self) -> AutoSamplerSettings

The configured auto settings (meaningful for SamplerKind::Auto).

pub fn build_for( &self, space: &SpaceSchema, budget: &Budget, directions: &[Direction], seed: u64, ) -> Result<Arc<dyn Sampler>, String>

Builds a fresh sampler for a study of this shape seeded seed.

Without opt-ins or opt-outs this is SamplerKind::build_for itself, so the default path cannot drift. seed is read only by scramble.

§Errors

The CMA-ES refusal cmaes reports, which with_opt_in already rejects up front.

Trait Implementations§

§

impl Clone for SamplerConfig

§

fn clone(&self) -> SamplerConfig

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 SamplerConfig

§

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

Formats the value using the given formatter. Read more
§

impl Eq for SamplerConfig

§

impl PartialEq for SamplerConfig

§

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

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

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

Inequality operator !=. Read more
§

impl StructuralPartialEq for SamplerConfig

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
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> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

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