Skip to main content

ClosureObjective

Struct ClosureObjective 

Source
pub struct ClosureObjective<S, Fc, Fe, Fr = fn(&mut S), Fefs = fn(&mut S, &Array1<f64>) -> Result<EfsEval, EstimationError>, Feo = fn(&mut S, &Array1<f64>, OuterEvalOrder) -> Result<OuterEval, EstimationError>, Fsp = fn(&mut S, &Array1<f64>) -> Result<f64, EstimationError>, Fseed = fn(&mut S, &Array1<f64>) -> Result<SeedOutcome, EstimationError>> {
    pub state: S,
    /* private fields */
}
Expand description

Closure-based adapter for OuterObjective.

This allows any call site to construct an OuterObjective from closures without needing to define a wrapper struct or modify the state type. Each call site wraps its existing methods into closures and passes them here.

Fields§

§state: S

Implementations§

Source§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp> ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp>

Source

pub fn with_seed_inner_state<Fseed>( self, seed_fn: Fseed, ) -> ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>

Trait Implementations§

Source§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed> OuterObjective for ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>

Source§

fn capability(&self) -> OuterCapability

Declare what this objective can compute analytically.
Source§

fn eval_cost(&mut self, rho: &Array1<f64>) -> Result<f64, EstimationError>

Evaluate cost only for cost-based optimization paths.
Source§

fn eval_screening_proxy( &mut self, rho: &Array1<f64>, ) -> Result<f64, EstimationError>

Evaluate the seed-screening ranking proxy at this rho. Read more
Source§

fn eval(&mut self, rho: &Array1<f64>) -> Result<OuterEval, EstimationError>

Evaluate cost + gradient + (if capable) Hessian.
Source§

fn eval_with_order( &mut self, rho: &Array1<f64>, order: OuterEvalOrder, ) -> Result<OuterEval, EstimationError>

Evaluate the outer objective at the order requested by the active plan. Read more
Source§

fn eval_efs(&mut self, rho: &Array1<f64>) -> Result<EfsEval, EstimationError>

Evaluate cost + EFS step vector. Only needed when the plan selects Solver::Efs. The default returns an error indicating EFS is not supported by this objective.
Source§

fn seed_inner_state( &mut self, beta: &Array1<f64>, ) -> Result<SeedOutcome, EstimationError>

Seed the inner-solver iterate before the first eval, e.g. when the outer-iterate cache restored a (ρ, β) pair from a prior run, or when the continuation walk forwards OuterEval::inner_beta_hint from the previous step. Read more
Source§

fn allow_continuation_prewarm(&self) -> bool

Whether the objective can benefit from continuation pre-warm before the first solver eval at a candidate seed. Read more
Source§

fn reset(&mut self)

Restore to a clean baseline for the next multi-start candidate.
Source§

fn outer_device_admission(&self) -> Option<RemlOuterAdmission>

Optional opt-in to the device-resident outer REML BFGS-over-ρ driver (crate::gpu::reml_outer::run_reml_outer_on_device). Returns Some(adm) when the objective is a REML evaluator whose (spec, n, p, num_rho) admission predicate accepts the device path, and None otherwise. Read more
Source§

fn requires_continuation_path_entry(&self) -> bool

Whether every joint fit of this objective must ENTER through the crate::continuation_path::ContinuationPath (heavy-smoothing entry) rather than being solved cold at the seed ρ*. Read more
Source§

fn curvature_homotopy_entry( &mut self, rho: &Array1<f64>, ) -> Option<Result<bool, EstimationError>>

Run the objective’s certified curvature-homotopy entry leg, if it has one, leaving the inner state warm at the real (η = 1) objective. Read more
Source§

fn accept_seed_without_outer_iterations( &mut self, rho: &Array1<f64>, ) -> Result<Option<f64>, EstimationError>

Let an objective declare that a seed is already a terminal outer result. Used for objectives with a certified high-quality construction seed where the generic rho optimizer can only degrade the fitted state.
Source§

fn finalize_outer_result( &mut self, rho: &Array1<f64>, plan: &OuterPlan, ) -> Result<(), EstimationError>

Re-install the selected outer result into the mutable objective before callers consume objective-owned fitted state. Optimizers may evaluate rejected trial points after the best point was found; without this final synchronization, stateful objectives can report the last trial fit rather than the returned OuterResult::rho.

Auto Trait Implementations§

§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed> Freeze for ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>
where S: Freeze, Fc: Freeze, Fe: Freeze, Feo: Freeze, Fr: Freeze, Fefs: Freeze, Fsp: Freeze, Fseed: Freeze,

§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed> RefUnwindSafe for ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>

§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed> Send for ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>
where S: Send, Fc: Send, Fe: Send, Feo: Send, Fr: Send, Fefs: Send, Fsp: Send, Fseed: Send,

§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed> Sync for ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>
where S: Sync, Fc: Sync, Fe: Sync, Feo: Sync, Fr: Sync, Fefs: Sync, Fsp: Sync, Fseed: Sync,

§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed> Unpin for ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>
where S: Unpin, Fc: Unpin, Fe: Unpin, Feo: Unpin, Fr: Unpin, Fefs: Unpin, Fsp: Unpin, Fseed: Unpin,

§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed> UnsafeUnpin for ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>
where S: UnsafeUnpin, Fc: UnsafeUnpin, Fe: UnsafeUnpin, Feo: UnsafeUnpin, Fr: UnsafeUnpin, Fefs: UnsafeUnpin, Fsp: UnsafeUnpin, Fseed: UnsafeUnpin,

§

impl<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed> UnwindSafe for ClosureObjective<S, Fc, Fe, Fr, Fefs, Feo, Fsp, Fseed>
where S: UnwindSafe, Fc: UnwindSafe, Fe: UnwindSafe, Feo: UnwindSafe, Fr: UnwindSafe, Fefs: UnwindSafe, Fsp: UnwindSafe, Fseed: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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

Source§

fn by_ref(&self) -> &T

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> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

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

Source§

fn vzip(self) -> V