Skip to main content

ModelCalibrator

Trait ModelCalibrator 

Source
pub trait ModelCalibrator: Send + Sync {
    // Required methods
    fn model_name(&self) -> &str;
    fn param_count(&self) -> usize;
    fn param_bounds(&self) -> &[(f64, f64)];
    fn evaluate_objective(&self, x: &[f64], data: &[MarketDataRow]) -> f64;
    fn price_options(
        &self,
        market_data: &[MarketDataRow],
        best_params: &[f64],
        config: &OptimizationConfig,
    ) -> Vec<PricingResult>;
    fn param_names(&self) -> Vec<&str>;
    fn as_any(&self) -> &dyn Any;

    // Provided methods
    fn set_prev_solution(&mut self, _prev_solution: Vec<f64>) { ... }
    fn set_temporal_reg_lambda(&mut self, _lambda: f64) { ... }
    fn expand_bounds_if_needed(
        &mut self,
        _params: &[f64],
        _proximity_threshold: f64,
        _expansion_factor: f64,
    ) -> bool { ... }
}
Expand description

Model calibrator trait for parameter optimization

Required Methods§

Source

fn model_name(&self) -> &str

Returns the name of the model (e.g., “svi”)

Source

fn param_count(&self) -> usize

How many parameters are in the model’s optimization vector

Source

fn param_bounds(&self) -> &[(f64, f64)]

Returns the vector of (min, max) bounds for each parameter

Source

fn evaluate_objective(&self, x: &[f64], data: &[MarketDataRow]) -> f64

Given a parameter vector x and data, returns the objective value

Source

fn price_options( &self, market_data: &[MarketDataRow], best_params: &[f64], config: &OptimizationConfig, ) -> Vec<PricingResult>

Price options using the calibrated parameters

Source

fn param_names(&self) -> Vec<&str>

Returns parameter names in the order they appear in the optimization vector

Source

fn as_any(&self) -> &dyn Any

Support for downcasting

Provided Methods§

Source

fn set_prev_solution(&mut self, _prev_solution: Vec<f64>)

Set the previous solution for temporal regularization

Source

fn set_temporal_reg_lambda(&mut self, _lambda: f64)

Set the lambda parameter for temporal regularization

Source

fn expand_bounds_if_needed( &mut self, _params: &[f64], _proximity_threshold: f64, _expansion_factor: f64, ) -> bool

Expand internal parameter bounds if parameters are near current bounds. Returns true if any bound was adjusted.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§