blprs/solving.rs
1//! Contraction solver configuration and diagnostics.
2
3/// Configuration for the BLP fixed-point contraction that recovers mean utilities.
4#[derive(Clone, Debug)]
5pub struct ContractionOptions {
6 /// Supremum norm tolerance for convergence.
7 pub tolerance: f64,
8 /// Maximum number of iterations allowed before aborting.
9 pub max_iterations: usize,
10 /// Damping factor applied to the log-share update (1.0 is standard BLP).
11 pub damping: f64,
12 /// Lower bound enforced on predicted shares to avoid taking `ln(0)`.
13 pub minimum_share: f64,
14}
15
16impl Default for ContractionOptions {
17 fn default() -> Self {
18 Self {
19 tolerance: 1e-9,
20 max_iterations: 1_000,
21 damping: 1.0,
22 minimum_share: 1e-16,
23 }
24 }
25}
26
27/// Diagnostics returned alongside the contracted mean utilities.
28#[derive(Clone, Debug)]
29pub struct ContractionSummary {
30 /// Number of iterations performed.
31 pub iterations: usize,
32 /// Maximum absolute change observed in the final iteration.
33 pub max_gap: f64,
34}