pub enum DemandCurve {
Pwl(PwlCurve),
Constant(ConstantCurve),
}
Expand description
A demand curve expressing a bidder’s willingness to pay at different rates.
The solver uses these curves to find optimal allocations that maximize total welfare. All curves must include rate=0 in their domain to allow for zero trade scenarios.
Variants§
Pwl(PwlCurve)
Piecewise linear curve defined by a series of points
Constant(ConstantCurve)
Constant price curve over a rate interval
Implementations§
Source§impl DemandCurve
impl DemandCurve
Sourcepub unsafe fn new_unchecked(value: DemandCurveDto) -> Self
pub unsafe fn new_unchecked(value: DemandCurveDto) -> Self
Creates a demand curve without validation
§Safety
The caller must ensure the data represents a valid curve. Invalid curves may cause undefined behavior in the solver.
Trait Implementations§
Source§impl Clone for DemandCurve
impl Clone for DemandCurve
Source§fn clone(&self) -> DemandCurve
fn clone(&self) -> DemandCurve
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DemandCurve
impl Debug for DemandCurve
Source§impl From<ConstantCurve> for DemandCurve
impl From<ConstantCurve> for DemandCurve
Source§fn from(value: ConstantCurve) -> Self
fn from(value: ConstantCurve) -> Self
Converts to this type from the input type.
Source§impl From<PwlCurve> for DemandCurve
impl From<PwlCurve> for DemandCurve
Source§impl Into<DemandCurveDto> for DemandCurve
impl Into<DemandCurveDto> for DemandCurve
Source§fn into(self) -> DemandCurveDto
fn into(self) -> DemandCurveDto
Converts this type into the (usually inferred) input type.
Source§impl TryFrom<ConstantCurveDto> for DemandCurve
impl TryFrom<ConstantCurveDto> for DemandCurve
Source§type Error = ConstantCurveError
type Error = ConstantCurveError
The type returned in the event of a conversion error.
Source§impl TryFrom<DemandCurveDto> for DemandCurve
impl TryFrom<DemandCurveDto> for DemandCurve
Source§fn try_from(value: DemandCurveDto) -> Result<Self, Self::Error>
fn try_from(value: DemandCurveDto) -> Result<Self, Self::Error>
Creates a demand curve from a DTO, validating all constraints
Source§type Error = DemandCurveError
type Error = DemandCurveError
The type returned in the event of a conversion error.
Source§impl TryFrom<PwlCurveDto> for DemandCurve
impl TryFrom<PwlCurveDto> for DemandCurve
Source§type Error = PwlCurveError
type Error = PwlCurveError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for DemandCurve
impl RefUnwindSafe for DemandCurve
impl Send for DemandCurve
impl Sync for DemandCurve
impl Unpin for DemandCurve
impl UnwindSafe for DemandCurve
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more