Skip to main content
Three bidders each submit up to two weakly decreasing marginal bids for three identical units. The Machine ranks the eligible unit bids, awards the top three, and charges every winning unit the highest rejected eligible bid, or the reserve when no eligible bid is rejected. It then settles cash and inventory atomically. This chapter uses the highest-rejected-bid convention for uniform pricing. The term also covers other conventions; see Roughgarden’s mechanism-design notes. This is not a multi-unit Vickrey payment rule. A bidder’s own rejected unit can set the price it pays on its winning units; the executable variation below demonstrates that distinction. The demo bids are A: [90, 65], B: [80, 60], and C: [70, 50]. Each wins one unit, the rejected bid 65 sets the price, and the seller receives 195.

Build and run the complete example

Execute the following four Python blocks in order in one session, or concatenate them into a script. Use an EDSL build with the Machine and Runner APIs documented in this manual. Everything is defined here: only EDSL and the Python standard library are required, with no repository example imports and no model API calls.

1. Define the Machine

Nested folds flatten bounded marginal bids into unit tickets. A general sorting reducer ranks them; let binds the ranked list, winning list, and settlement price once. All behavior is serialized in the Machine, with no auction callback.

2. Construct the single-pass Survey

Each roster member answers the fixed bid questions once. Integer multiple-choice options make the small demo grid explicit; bids must still pass the Machine budget and ordering checks. An invalid bid produces a “not accepted” receipt, and the example does not ask again. Zero means no demand for a unit. settle_if_ready is a no-op until every roster member has submitted. The last submission settles the market. Earlier respondents retain their “pending” receipts: a single pass does not revisit them after settlement. The final host Results evidence contains the full settlement.

3. Define the scripted respondents

Stable IDs and the turn trait establish the demonstration order. These direct answers bypass model calls while exercising actual question rendering and rules.

4. Run and inspect settlement

Expected final accounts:

Try the boundary cases

The remaining blocks reuse this page’s build_machine and run directly under an empty Runtime() registry after JSON transport.

A winner’s rejected unit can set its price

Bid and settlement conventions

  • Money and bids are nonnegative integers; the reserve is a positive integer.
  • Bids below the reserve never win or set the price. With no eligible bids, price is None, allocations and payments are zero, and supply stays unsold.
  • Equal bids use a seeded bidder priority, then lexical bidder ID on a hash collision, then marginal unit index. The seed is public and the host must assign trusted stable IDs. Arrival order does not break ties. Use a different Machine seed when markets should have different priorities.
  • A bidder can submit once. Identical retries are no-ops even after settlement; changed bids are rejected. Empty lists are explicit abstentions in the Machine; the Survey uses zero-valued bids.
  • Every roster member must submit before automatic settlement. A host may invoke close to settle a partial roster; there is no wall-clock deadline or automatic dropout handling.
  • The sum of a bidder’s marginal bids must fit its dedicated initial balance. These funds cannot be spent by another command before settlement. This is a conservative budget check, not a shared-wallet escrow service.

What this probes, and what remains

The construction combines sealed respondent views, bounded nested folds, seeded ties, an explicit close operation, and atomic settlement. It needs no new auction-specific Machine primitive and uses the existing Survey navigation API. The current view exposes only the caller’s own bid list, cash, and payment before settlement. This is a presentation boundary, not authentication or cryptographic sealing: the host controls bidder identity, and full backend state and Results provenance contain all bids. Do not distribute those host artifacts as private respondent receipts. This example supplies neither commit/reveal nor audit-proof randomness. The Survey’s fixed integer choice grid is suitable for a small teaching example; large budgets need a different input design. Sorting scales with the roster times maximum demand, and the resulting expression runs under the usual Machine work and data-size limits. The code does not establish economic incentive properties. All balances are simulated dedicated accounts; the example does not move real money or authenticate account owners. Combining these markets through a common wallet would require a deliberate reservation/settlement contract.

Verification

The executable tests check independent allocation and price references, cash and unit conservation, admission rejections without partial mutation, repeated settlement, concurrent SQLite commands, reopen/replay, scope isolation, fresh interpreter transport, actual Survey choices, and Results serialization. The canonical page is also executed in a fresh process with repository example imports blocked. Optional maintainer commands, from a repository checkout:
See the primitive corpus for related mechanisms and the Machine manual for execution and rejection semantics.