Skip to main content

OptimizeBlock

Struct OptimizeBlock 

Source
pub struct OptimizeBlock {
    pub method: String,
    pub objective: String,
    pub servo: Vec<String>,
    pub max_evals: usize,
    pub seed: u64,
    pub params: HashMap<String, f64>,
}
Expand description

SRD-86 — a phase optimize: block. The optimizer maximizes the objective wire by writing the axes input wires on the phase kernel.

Fields§

§method: String

Registered optimizer name (cmaes, nelder_mead, … — see nmbrs describe optimizers). Defaults to sweep (the identity: evaluate every coordinate and report the best), so a plain “find the best by sweeping” search omits this field; set an adaptive method to search a large or continuous space without enumerating it.

§objective: String

The objective the optimizer maximizes (SRD-86 §10). Two forms: a bare wire reference — a single identifier naming a phase-kernel output (a bindings: entry), read directly; or an inline polydat expression (anything with operators / calls, e.g. objective: "0 - metricsql_scalar(\"sum(rate(errors_total[3s]))\")"), which is lowered to a synthesized __objective binding on the phase kernel (scope::objective_wire) so no separate bindings: entry is needed. An objective reading a windowed/live metric settles per setting; a deterministic one takes the one-shot read.

§servo: Vec<String>

Search axes to actuate as live controls — servoed (retargeted without restarting the phase) rather than stepped through by re-running the phase (SRD-86 §4). Every axis is a coordinate (step-through / re-run) by default; naming one here opts it into servoing. Accepts a single name (servo: concurrency) or a list (servo: [concurrency, rate]). A servoed var resolves to a control either directly (its name IS a control — servo: concurrency / servo: rate) or indirectly (it feeds one via a {var} bind — concurrency: "{conc}", then servo: conc). It is validated: it must resolve to a control AND the objective must be a windowed metric the servo can settle — else a clear error, never a silent downgrade.

§max_evals: usize§seed: u64§params: HashMap<String, f64>

Optimizer-specific knobs (e.g. { lambda: 8 }).

Implementations§

Source§

impl OptimizeBlock

Source

pub fn from_yaml_value(v: &Value) -> Result<OptimizeBlock, Error>

Parse a phase optimize: value from already-parsed JSON, applying the string sugar (a bare string ≡ { objective: <string> }). Used by the hand-rolled phase parser, which builds WorkloadPhase field-by-field rather than through the derive (so it doesn’t see [de_optimize]).

Branches explicitly rather than going through the untagged [OptimizeSpec] so a malformed map keeps its precise serde error (e.g. missing field 'objective') instead of the untagged enum’s generic “did not match any variant”.

Trait Implementations§

Source§

impl Clone for OptimizeBlock

Source§

fn clone(&self) -> Self

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

impl Debug for OptimizeBlock

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OptimizeBlock

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for OptimizeBlock

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

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

Source§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.