- Overview
- Dependencies
- Code Architecture
- Theory and Implementations
- Results and Discussion
- Future Directions
- Acknowledgments
This project is designed for researchers and practitioners interested in the intersection of numerical optimization and game-theoretic analysis. It provides a structured framework for analyzing equilibrium conditions and optimal allocations in strategic settings using continuous optimization techniques. The repository presents a collection of optimization-driven implementations for three classical game-theoretic problems:
-
Auction Design: Optimizing revenue in auctions by allocating a divisible good among multiple bidders while enforcing individual rationality and allocation constraints.
-
Congestion on Networks: Modeling route-choice behavior among drivers with congestion-dependent latency functions to determine an equilibrium distribution.
-
Stable Matching: Formulating a continuous relaxation of the assignment problem to compute near-optimal matchings between two sets (e.g., men and women) while enforcing one-to-one pairing constraints.
Each problem is formulated as a continuous optimization task where objective functions are minimized using numerical techniques—primarily the Steepest Descent and Newton's Methods. Analytical solutions or benchmarks (such as the Hungarian algorithm for stable matching) are used to validate the numerical results.
| Package | Version |
|---|---|
| Python | ≥3.8 |
| NumPy | ≥1.21.0 |
| SciPy | ≥1.7.0 |
| pandas | ≥2.0.0 |
| Matplotlib | ≥2.2.3 |
To install all required packages, run:
pip install -r requirements.txt./
├── auction_game.py # Auction design implementation
├── congestion_game.py # Congestion on networks implementation
├── main.py # The driver code for the results
├── matching_game.py # Stable matching implementation
├── optimization.py # Shared optimization routines
├── README.md # Project documentation
├── requirements.txt # Project requirements
└── visualization.py # Visualization toolsThe main.py script serves as the central driver for the project, coordinating the execution of different game-theoretic experiments based on command-line arguments. It directs the flow of execution by calling the appropriate optimization routines from optimization.py and subsequently invokes visualization.py to generate convergence plots and other relevant visual outputs. This modular design ensures a reproducible workflow and facilitates a clear demonstration of the algorithmic performance across various problem settings.
We consider an auction setting where an auctioneer allocates a divisible good to
Since conventional optimization routines are designed for minimization, the problem is reformulated by minimizing the negative revenue with added penalty terms to enforce feasibility constraints:
where
The design also imposes key constraints:
-
Allocation Constraints: Each allocation
$x_i$ must be in$[0,1]$ . -
Total Allocation Constraint: The total allocation must satisfy
$\sum_{i=1}^{n} x_i \leq 1$ .
The analytical optimal solution is obtained by allocating the entire good to the bidder with the highest valuation, i.e., if
Numerical optimization is performed using both the Steepest Descent and Newton’s Methods. These routines iteratively minimize the potential function, with parameters such as the step size (alpha), convergence tolerance (tol), and maximum iterations adjusted to ensure reliable convergence. The numerical solution is then compared against the analytical optimal allocation to evaluate performance.
Execute the script from the command line. For example, to run the auction design for three bidders with valuations 10, 20, and 15, use:
python main.py auction --valuations "10,20,15"Command-line arguments include:
--valuations: Comma-separated list of bidder valuations (e.g.,"10,20,15").--mu: Penalty coefficient (default:10.0).--alpha: Step size for steepest descent (default:0.001).--tol: Convergence criterion (default:1e-6).--max_iter: Maximum iterations for steepest descent (default:1000).--max_iter_newton: Maximum iterations for Newton’s method (default:100).
For example, to use custom parameters, run:
python main.py auction --valuations "15,25,30" --mu 200 --alpha 0.005 --tol 1e-8We consider a congestion game with two routes, each having latency functions:
Drivers are allocated between these routes, and equilibrium is determined by minimizing:
where
and therefore,
The potential function is minimized using numerical optimization techniques—specifically, the Steepest Descent and Newton’s Methods—to determine the optimal distribution of drivers. As with the auction design, penalty functions and convergence parameters (alpha, tol, max_iter, etc.) are tuned to ensure that the algorithm converges to the analytical equilibrium. The computed equilibrium distribution is then compared with the expected analytical result.
Run the congestion game script from the terminal. For example, to simulate 100 drivers with specified latency parameters, execute:
python main.py congestion --N 100 --a1 1.0 --b1 0.0 --a2 2.0 --b2 10.0Command-line arguments include:
--N: Number of drivers (default:100).--a1,--b1: Parameters for Route 1's latency function.--a2,--b2: Parameters for Route 2's latency function.--alpha: Step size for steepest descent (default:0.01).--tol: Convergence tolerance (default:1e-8).--max_iter: Maximum iterations for steepest descent (default:1000).--max_iter_newton: Maximum iterations for Newton’s method (default:100).
We consider a matching market with n men and n women. A cost matrix
where
The potential function for the stable matching problem is minimized using numerical optimization techniques—Steepest Descent and Newton’s Methods. The implementation integrates penalty terms to enforce the assignment and bound constraints, and uses a regularization parameter scipy.optimize.linear_sum_assignment).
Run the stable matching script from the command line. For instance, to run with a randomly generated
python main.py matchingTo run with a custom cost matrix from a CSV file (where each row represents a man and each column a woman), use:
python main.py matching --n 4 --cost_file cost_matrix.csvAn example cost_matrix.csv might contain:
3.2, 1.5, 4.8, 2.0
2.1, 3.0, 1.2, 4.5
4.5, 2.3, 3.7, 1.8
1.0, 4.2, 2.5, 3.3
Additional command-line arguments include:
--n: Number of men/women (matrix size, default:5).--cost_file: Path to a CSV file containing the cost matrix.--mu: Penalty parameter enforcing assignment constraints (default:1000.0).--lam: Regularization parameter ensuring strict convexity (default:0.01).--alpha: Step size for steepest descent (default:0.001).--tol: Convergence tolerance (default:1e-6).--max_iter: Maximum iterations for steepest descent (default:2000).--max_iter_newton: Maximum iterations for Newton’s method (default:100).--seed: Random seed for reproducibility (default:42).
For example, to adjust parameters, run:
python matching_game.py --n 6 --mu 2000 --lam 0.2 --alpha 0.0005 --max_iter 5000To improve numerical stability and solution feasibility, we have introduced the following enhancements:
-
Backtracking Line Search in Steepest Descent: This dynamically adjusts the step size to ensure descent and avoid instability.
-
Projection in Steepest Descent and Newton’s Method: This ensures that the iterates remain within feasible bounds, improving convergence behavior.
-
Regularization in Newton’s Method: When the Hessian is not invertible, a small regularization term is added to improve numerical stability and ensure well-conditioned updates.
These modifications result in improved convergence rates, better constraint satisfaction, and enhanced robustness in optimization problems with ill-conditioned Hessians.
For the auction design problem, our initial implementation using the standard steepest descent method on a vector containing both allocations and payments resulted in a high error rate, while Newton’s method failed due to the Hessian matrix being non-invertible.
To resolve these issues:
- We removed the payments from the optimization vector, avoiding redundancy and unnecessary constraints.
- We added a regularization term to the Hessian to ensure invertibility.
- We applied a projection technique after each optimization step to maintain feasibility.
These improvements significantly enhanced performance. Newton’s method successfully reached the optimal solution, and steepest descent achieved a near-optimal solution with minimal error.
| Method | Iterations | Error (%) |
|---|---|---|
| Steepest Descent | 202 | 19.45 |
| Newton's Method | max_iter | 0.00 |
In the congestion game, both methods successfully converged to the expected equilibrium. However, Newton’s method required significantly fewer iterations compared to steepest descent.
| Method | Iterations | Error (%) |
|---|---|---|
| Steepest Descent | 590 | 0.000007 |
| Newton's Method | 11 | 0.000007 |
Initially, the steepest descent method struggled to maintain feasibility, often producing values outside the valid range [0,1]. To address this:
- We increased the penalty coefficient
musignificantly (around 100) to enforce feasibility. - We implemented a backtracking algorithm to dynamically adjust the step size
alpha. - For Newton’s method, we added a projection technique after each step to ensure solutions remain feasible.
Despite these improvements, convergence was slow, particularly for steepest descent, which required a large number of iterations.
| Method | Iterations | Error (%) |
|---|---|---|
| Steepest Descent | max_iter | 70.16 |
| Newton's Method | max_iter | 21.42 |
Our experiments demonstrate the strengths and weaknesses of each optimization technique across different game-theoretic problems:
- Newton’s method generally converged faster but required modifications (regularization and projection) to ensure stability and feasibility.
- Steepest descent was more robust but slower, often requiring parameter tuning (e.g., backtracking step size adjustment).
- Projection techniques improved feasibility in constrained optimization problems, particularly in the stable matching and auction design problems.
These results underscore the importance of tailoring optimization methods to problem structure, using problem-specific adjustments to enhance convergence and solution quality.
Advancing the current framework can be approached along several complementary axes:
-
Parameter Tuning: Future work will explore adaptive strategies for dynamically adjusting penalty parameters (
$\mu$ ) and regularization terms ($\lambda$ ). Such adaptive schemes could automatically balance the trade-off between constraint enforcement and objective minimization, thereby enhancing convergence rates and solution accuracy. -
Algorithmic Enhancements: The incorporation of advanced optimization techniques is a promising avenue. Implementing quasi-Newton methods (e.g., BFGS and L-BFGS) and integrating trust-region frameworks could provide improved convergence behavior, particularly in problems where the Hessian information is unreliable. Additionally, exploring variants of stochastic gradient descent may prove beneficial in handling large-scale or noisy optimization scenarios.
-
Model Extensions: Extending the current models to more complex real-world applications is an important direction. Potential extensions include multi-item auctions with combinatorial bids, network games that involve multiple origin-destination pairs, and many-to-many matching markets. Moreover, developing robust post-processing methods to round continuous solutions into feasible binary assignments will enhance the practical applicability of the matching framework.
-
Computational Enhancements: To address scalability issues, future efforts could focus on parallel implementations and GPU acceleration (e.g., using CuPy) to manage large-scale problems more efficiently. Such computational improvements would allow the framework to be applied to higher-dimensional and more computationally intensive problems without compromising performance.
This structured optimization framework provides a foundation for analyzing equilibrium problems with numerical techniques, bridging the gap between game theory and optimization.
We would like to sincerely thank Professor Kasra Alishahi for their insightful teaching and support throughout the course. The concepts explored and discussions in class played a crucial role in shaping this project and enhancing our understanding of optimization techniques.





