A Julia implementation of this work: https://arxiv.org/pdf/2401.15745.pdf. All the source codes for the experiments in the above paper are included in this repo.
We are able to handle
- nonlinear discrete-time dynamics
- general cost functions of each player, which may be nonconvex but may require smoothness
- coupled nonlinear equality and inequality constraints, which could be nonconvex
- infeasible initializations, to some extent
- make sure julia version is 1.9.0 - 1.9.2
- git clone <this_repo>
- cd to FeedbackStackelbergGames.jl
- install the dependency package by running in the terminal:
- "julia --project"
- once the Julia REPL is openned, enter the package management mode by typing "]"
- type "instantiate", and then press "enter".
- wait for julia to finish installing the necessary packages
- cd to the folder /example
- run the following codes in the terminal: "julia --project highway.jl"
- wait, it may take a while to precompile the program, but after the precompilation, it will execute the algorithm super fast, returning a solution within a few seconds. (Test result generated by a home desktop equipped with an AMD 5950x CPU and 64 GB 3200mhz DDR4 memory.)
- data file and plots will be stored in a folder named after the date and time
Note that parameters of the PDIP algorithm, dynamics, costs, and constraints could be customized in the file /example/highway.jl
- The KKT conditions construction process (, e.g., in /src/lq_solvers/constrained_fbst_lq_solver.jl) has not been optimized. We can speed it up by using StaticArray.jl and automatically constructing the first-order KKT conditions approximation using automatic differentiation. However, in the current implementation, we manually programmed the KKT conditions.
- In the current implementation, we assume each player has the same state, control, and constraint dimension. However, it should be relaxed in the future.