Quadratic programs (QPs) arise in various domains such as machine learning, finance, and control.
Recently, learning-enhanced primal-dual hybrid gradient (PDHG) methods have shown great potential in addressing large-scale linear programs; however, this approach has not been extended to QPs.
In this work, we focus on unrolling "PDQP", a PDHG algorithm specialized for convex QPs. Specifically, we propose a neural network model called "PDQP-net" to learn optimal QP solutions. Theoretically, we demonstrate that a PDQP-net of polynomial size can align with the PDQP algorithm, returning optimal primal-dual solution pairs.
We propose an unsupervised method that incorporates KKT conditions into the loss function. Unlike the standard learning-to-optimize framework that requires optimization solutions generated by solvers, our unsupervised method adjusts the network weights directly from the evaluation of the primal-dual gap.
This method has two benefits over supervised learning: first, it helps generate better primal-dual gap since the primal-dual gap is in the objective function; second, it does not require solvers.
We show that PDQP-net trained in this unsupervised manner can effectively approximate optimal QP solutions.
Extensive numerical experiments confirm our findings, indicating that using PDQP-net predictions to warm-start PDQP can achieve up to
To generate datasets, you can use the script ./ins/src/gen_ins.py. The code provides detailed usage instructions.
After generating instances, you can use ./src/julia/PDQP.jl/gen_bat.py to generate a task file that collects training/testing samples from generated cases. The code provides detailed usage instructions. Then, please run ./src/extract_sample.py -t XXX to extract pickle files. (XXXX is the dataset name. For example, if you have gen_train_XXXX in your ins folder, you will use -t XXXX.)
Using ./src/train_new.py to train the unsupervised model, ./src/train_supervised.py to train the supervised model, and ./src/train_gnn.py for the mentioned GNNs model.
After training, you first need to generate predictions by running ./src/predict_*.py. Then, use ./src/julia/PDQP.jl/gen_bat.py to generate a batch file that runs the test.
TODO