Trait Solver

Source
pub trait Solver {
    type Settings;
    type Status: Debug;

    // Required methods
    fn new(settings: Self::Settings) -> Self;
    fn solve<T, BidderId: Eq + Hash + Clone + Ord, PortfolioId: Eq + Hash + Clone + Ord, ProductId: Eq + Hash + Clone + Ord>(
        &self,
        auction: &T,
    ) -> Result<AuctionOutcome<BidderId, PortfolioId, ProductId>, Self::Status>
       where for<'t> &'t T: IntoIterator<Item = (&'t BidderId, &'t Submission<PortfolioId, ProductId>)>;
}
Expand description

The Solver trait defines the interface for market-clearing solvers.

A Solver takes market participant submissions (bids/offers) and computes the optimal trades and market-clearing prices that maximize total welfare.

Implementations may use different optimization algorithms with varying performance and precision characteristics.

Required Associated Types§

Source

type Settings

The configuration type for this solver

Source

type Status: Debug

The status type (returned as Err when not successful)

Required Methods§

Source

fn new(settings: Self::Settings) -> Self

Create a new instance with the provided settings

Source

fn solve<T, BidderId: Eq + Hash + Clone + Ord, PortfolioId: Eq + Hash + Clone + Ord, ProductId: Eq + Hash + Clone + Ord>( &self, auction: &T, ) -> Result<AuctionOutcome<BidderId, PortfolioId, ProductId>, Self::Status>
where for<'t> &'t T: IntoIterator<Item = (&'t BidderId, &'t Submission<PortfolioId, ProductId>)>,

Solve the market clearing problem for the given auction submissions

§Parameters
  • auction - A slice of Submission objects representing all bids and offers
§Returns
  • AuctionOutcome - Contains the clearing prices and trades for each product and authorization

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§