Skip to main content

RootOracle

Trait RootOracle 

Source
pub trait RootOracle<T: Float + FromPrimitive + Debug> {
    // Required method
    fn evaluate(&mut self, x: T) -> T;

    // Provided methods
    fn root_side(
        &self,
        objective_sign: ObjectiveSign,
        slope_sign: ObjectiveSign,
    ) -> RootSide { ... }
    fn slope_sign(
        &mut self,
        domain: &Range<T>,
        confidence_level: ConfidenceLevel<T>,
        max_iter: usize,
    ) -> Result<Option<ObjectiveSign>, RootError> { ... }
    fn objective_sign(
        &mut self,
        x: T,
        confidence_level: ConfidenceLevel<T>,
        max_iter: usize,
    ) -> Result<Option<ObjectiveSign>, RootError> { ... }
}

Required Methods§

Source

fn evaluate(&mut self, x: T) -> T

Evaluate the objective function at x.

Implementations may be stochastic: repeated calls with the same x may return different values. The returned value is interpreted only through its sign by [RootOracle::sign].

Provided Methods§

Source

fn root_side( &self, objective_sign: ObjectiveSign, slope_sign: ObjectiveSign, ) -> RootSide

Source

fn slope_sign( &mut self, domain: &Range<T>, confidence_level: ConfidenceLevel<T>, max_iter: usize, ) -> Result<Option<ObjectiveSign>, RootError>

Source

fn objective_sign( &mut self, x: T, confidence_level: ConfidenceLevel<T>, max_iter: usize, ) -> Result<Option<ObjectiveSign>, RootError>

Estimate the sign of the objective at x to the requested confidence level.

The objective is assumed to be observable only through noisy evaluations. This method repeatedly evaluates the objective at x, converts each non-zero observation to its sign, and accumulates the resulting random walk.

Sampling stops once the curved-boundary test is crossed. If the boundary is not crossed within max_iter evaluations, the method returns RootError::MaxIterExceeded.

Exact zero observations are treated as non-informative and do not contribute to the random walk.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§