pub struct QuantumLearnedOptimizer<T>{ /* private fields */ }Expand description
A learned-interface adapter over the quantum-inspired core optimizers.
QuantumLearnedOptimizer wraps one of the QuantumBackend variants and
implements AdvancedOptimizer, tracking the step count and an
exponential moving average of the gradient L2 norm so the learned stack can
query optimizer health via AdvancedOptimizer::get_state.
Implementations§
Source§impl<T> QuantumLearnedOptimizer<T>
impl<T> QuantumLearnedOptimizer<T>
Sourcepub fn annealing(learning_rate: T) -> Self
pub fn annealing(learning_rate: T) -> Self
Create a quantum-annealing-backed learned optimizer.
The learning_rate scales the perturbation magnitude of the underlying
QuantumAnnealing optimizer.
Sourcepub fn variational(learning_rate: T) -> Self
pub fn variational(learning_rate: T) -> Self
Create a variational-quantum (SPSA) backed learned optimizer.
The learning_rate is the SPSA gain numerator a of the underlying
VariationalQuantumOptimizer.
Sourcepub fn hybrid(learning_rate: T, switch_step: usize) -> Self
pub fn hybrid(learning_rate: T, switch_step: usize) -> Self
Create a hybrid quantum-classical backed learned optimizer.
The first switch_step updates are produced by quantum annealing; later
updates are produced by the classical Adam refinement phase of the
underlying HybridQuantumClassical optimizer.
Sourcepub fn norm_ema_decay(&self) -> T
pub fn norm_ema_decay(&self) -> T
Returns the decay coefficient used for the gradient-norm EMA.
Sourcepub fn set_norm_ema_decay(&mut self, decay: T) -> Result<()>
pub fn set_norm_ema_decay(&mut self, decay: T) -> Result<()>
Override the gradient-norm EMA decay coefficient.
§Errors
Returns OptimError::InvalidConfig unless decay lies in the open
interval (0, 1); a decay outside that range would make the EMA either
ignore new observations entirely or diverge.
Sourcepub fn backend(&self) -> &QuantumBackend<T>
pub fn backend(&self) -> &QuantumBackend<T>
Immutable access to the underlying backend (useful for diagnostics).
Sourcepub fn step_count(&self) -> usize
pub fn step_count(&self) -> usize
Current step count.
Trait Implementations§
Source§impl<T> AdvancedOptimizer<T> for QuantumLearnedOptimizer<T>
impl<T> AdvancedOptimizer<T> for QuantumLearnedOptimizer<T>
Source§fn step(
&mut self,
params: &Array1<T>,
gradients: &Array1<T>,
) -> Result<Array1<T>>
fn step( &mut self, params: &Array1<T>, gradients: &Array1<T>, ) -> Result<Array1<T>>
Source§fn get_learning_rate(&self) -> T
fn get_learning_rate(&self) -> T
Source§fn set_learning_rate(&mut self, lr: T)
fn set_learning_rate(&mut self, lr: T)
Source§fn get_state(&self) -> OptimizerStateInfo<T>
fn get_state(&self) -> OptimizerStateInfo<T>
Auto Trait Implementations§
impl<T> Freeze for QuantumLearnedOptimizer<T>
impl<T> RefUnwindSafe for QuantumLearnedOptimizer<T>
impl<T> Send for QuantumLearnedOptimizer<T>where
QuantumBackend<T>: Send,
impl<T> Sync for QuantumLearnedOptimizer<T>where
QuantumBackend<T>: Sync,
impl<T> Unpin for QuantumLearnedOptimizer<T>
impl<T> UnsafeUnpin for QuantumLearnedOptimizer<T>
impl<T> UnwindSafe for QuantumLearnedOptimizer<T>
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.