| Crates.io | ftsolve |
| lib.rs | ftsolve |
| version | 0.1.0 |
| created_at | 2025-04-15 20:24:56.349429+00 |
| updated_at | 2025-04-15 20:24:56.349429+00 |
| description | Solve a flow trading problem |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1635207 |
| size | 25,421 |
ftsolveThis crate is a light wrapper around fts-solver, providing a binary that can
read flow trading-based auctions from a standardized JSON input format and writes
their solution to stdout or a file.
The JSON format is very simple. Given the following type definitions:
type ProductId = string;
type PortfolioId = string;
type Portfolio = Record<ProductId, number> | Array<ProductId> | ProductId;
type Group = Record<PortfolioId, number> | Array<PortfolioId> | PortfolioId;
// The canonical types in Portfolio and Group are Records, but we implicitly
// transform arrays and values for convenience according to:
// X => { X: 1.0 },
// [X, Y, ...] => { X: 1.0, Y: 1.0, ...}
interface Point {
quantity: number,
price: number,
}
interface DemandCurve {
// If omitted, `domain` is computed from `points`.
// If provided, the points will be interpolated or extrapolated accordingly.
// Use `null` as a stand-in for ±∞
domain?: [number | null, number | null];
group: Group,
points: Array<Point>,
}
interface Submission {
portfolios: Record<PortfolioId, Portfolio>,
demand_curves: Array<DemandCurve>,
}
The JSON input format is simply anything that deserializes as
Record<BidderId, Submission>. Examples can be found in the fts-solver test suite.
To install, simply run cargo install ftsolve.
To build from source, cargo build --release --bin ftsolve.
Execute ftsolve --help to see options.