Build an Auction Engine: Winner Determination, VCG and an Independent Verifier (in Python, on OR-Tools CP-SAT): a Localpane Lab Kit
Build a working combinatorial auction engine in Python, one tested step at a time. You start with a second-price auction, write a brute-force oracle, watch a greedy rule lose to it, then model winner determination as a 0-1 integer program for Google's CP-SAT solver. You add a certified tie-break, VCG payments from exact counterfactual re-solves, an independent verifier that catches four planted payment bugs, and receipts that reject tampering. Every step has a starter with marked TODOs, tests that fail until your code works, plain explanations and hints. All markets are synthetic. The complete solution is included.
What's inside
- WORKBOOK.md: 8 steps, each with the goal, key concepts in plain words, where the starter code is, the tests that must pass, hints and a check command
- 8 starter projects (steps/step-01 to step-08): earlier steps solved, the current one stubbed
- The finished solution: about 2,300 lines of Python (you write roughly 280 of them, the core of each step) and about 800 lines of tests
- 67 graded tests, and 7 tests for the code the kit provides; the whole suite runs in seconds
- check.sh to check one step and everything before it
- Nine fictional preset markets and a small command line (run, issue, reproduce)
The 8 steps:
- The second-price auction: reserve, ties and the truth
- Brute force: every allocation, exhaustively
- Greedy allocation, and why it is only a baseline
- Winner determination as an integer program (CP-SAT)
- Certified tie-breaking: a second exact stage
- VCG payments from counterfactual re-solves
- An independent verifier
- Receipts: canonical hashes, cold reproduction, tamper rejection
Who it's for
CS and economics students who have met auctions or mechanism design in a course and want to see the ideas run, and engineers curious about how allocation and pricing rules are computed and checked: anyone who wants to understand why VCG charges what it charges, what makes winner determination hard, and how to test an optimiser with something other than itself.
Not for: anyone looking to run real auctions or handle payments (everything is synthetic and single-machine), or for a course on writing a MIP/SAT solver (the kit uses OR-Tools CP-SAT for solving and has you build the models and mechanisms around it).
Prerequisites
- Python 3.12; tested on macOS (Apple Silicon) with OR-Tools 9.15.6755. Linux, Windows and newer Python versions not yet tested.
- Comfortable with Python functions, dicts, sets, recursion and pytest
- No prior auction theory or optimisation needed
- About 8 to 10 hours
Licence
Single-developer licence: use and modify the code, including in your own products; no redistribution and no public repositories. Free updates within 1.x.
Licence summary: payhip.com/u1791141470733132530294/licences