fts_solver/types/
demand.rs

1mod point;
2pub use point::Point;
3
4mod segment;
5pub use segment::Segment;
6
7mod disaggregate;
8pub use disaggregate::disaggregate;
9
10/// A demand curve represents utility via a piecewise linear function
11#[derive(Debug)]
12#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
13pub struct DemandCurve<Idx, A: IntoIterator<Item = (Idx, f64)>, B: IntoIterator<Item = Point>> {
14    /// Constrains the otherwise-infinite domain of the function to q ∈ 𝒟
15    pub domain: (f64, f64),
16    /// The sparse vector that combines in an inner product with the portfolio variables
17    pub group: A,
18    /// The points that define a piecewise-linear curve, extrapolated to q = ±∞ via the nearest price
19    pub points: B,
20}