This repository holds the code of the paper titled Distributed Primal Outer Approximation Algorithm for
Sparse Convex Programming with Separable Structures which introduces a distributed sparse convex optimization
algorithm, named, Distributed Primal
Outer Approximation Algorithm ( DiPOA
). DiPOA
is implemented within dccp
python package. In the
following, a general instruction to install and run dccp
is provided.
- Python Programming Language 3.7 or higher.
- Gurobi Optimizer with a license quick start guide
- Message Passing Interface - MPI
- GAMS with a license for solver comparison (optional) guide
- Git
- Ubuntu 21.10 or WSL2 (preferred).
- OSX
- Microsoft Windows 10.
run the following commands
sudo apt update
sudo apt install openmpi-bin
sudo apt install libopenmpi-dev
please read the instruction here.
make sure mpiexec
or mpirun
executables are in the PATH environment variable of your preferred OS.
-
Make sure
Gurobi
,MPI
, andPython
are installed properly. -
Install python3-dev for installed python version (if not already installed)
sudo apt install python3-dev
- Install python virtual environment
sudo apt install virtualenv
- Clone
dccp
repository by executing the following command
git clone http://www.github.com/Alirezalm/dccp.git
- Change directory to
dccp
and create a python virtual environment
cd dccp
python3 -m venv env
- Activate the virtual environment
source ./env/bin/activate
- Install python dependencies
pip install -r requirements.txt
Note: for the full list of requirements please see requirements.txt
file
-
Make sure
Gurobi
,MPI
, andPython
are installed properly. -
Clone
dccp
repository by executing the following command
git clone http://www.github.com/Alirezalm/dccp.git
- Change directory to
dccp
and create a python virtual environment
cd dccp
python -m venv env
- Activate the virtual environment
.\env\Scripts\activate
- Install python dependencies
pip install -r requirements.txt
dccp
package provides dipoa-cli.py
, a simple command-line interface (CLI), to
generate and solve random Distributed Sparse Logistic Regression (DSLR) and Distributed Sparse
Quadratically Constrained Programming (DSQCP) problems. dipoa-cli.py
consists of two sub-commands,
namely, dslr
and dsqcp
that are responsible for solving DSLR and DSQCP problems, respectively. Finally,
after the problem is solved successfully, a solution.json
file will be generated.
To generate and solve a DSLR problem, use the following command template
mpiexec -np <number-of-nodes> python dipoa-cli.py dslr <m> <n> <nz> --soc
where
m
is the number of rows per node.n
is the number of decision variables (e.g. columns in DSLR).nz
is the number of non-zero elements.--soc
is a flag to indicate whether a second order cut generation is used.
The following command generates and solves a DSLR problem with total 2000
rows per node, 50
variables with
5
non-zero elements, and 4
computational nodes (for this scenario, the total number of nodes is 8000
.)
As for the option --soc
are used.
mpiexec -np 4 python dipoa-cli.py dslr 2000 50 5 --soc
Command template
mpiexec -np <number-of-nodes> python dipoa-cli.py dsqcp <n> <nz> --soc
where
n
is the number of decision variables (e.g. columns in DSLR).nz
is the number of non-zero elements.--soc
is a flag to indicate whether a second order cut generation is used.
The following command generates and solves a DSQCP problem with 50
variables with
5
non-zero elements, and 4
computational nodes.
As for the option, --soc
are used.
mpiexec -np 4 python dipoa-cli.py dsqcp 50 5 --soc
- make sure
gams
executable is on OS PATH. - GAMS MINLP solvers are compared with
DiPOA
for DSLR problem instances. - To use gams MINLP solvers use the following command template
python gams-run.py <solver-name> <m> <n> <nz> <np>
where np
is the number of nodes.
The following command runs bonmin
for the DSLR problem with 1000
rows, 50
variables, 5
nonzero
elements and, 4
nodes.
python gams-run.py bonmin 1000 50 5 4
The MINLP solver that are used in the paper are
- bonmin
- dicopt
- knitro
- dicopt
- shot
The datasets used in the paper for both DSLR and DSQCP problems can are generated by executing
the generate_datasets.py
script as the following command shows.
python generate_datasets.py
generate_datasets.py
creates data
directory in the same directory that
generate_datasets.py
exists.
The following directory tree, shows the structure of the data
directory.
│── dslr
│ ├── sc_1
│ │ ├── data_10000_20.csv
│ │ ├── data_14000_20.csv
│ │ ├── data_18000_20.csv
│ │ ├── data_2000_20.csv
│ │ ├── data_22000_20.csv
│ │ ├── data_26000_20.csv
│ │ ├── data_30000_20.csv
│ │ ├── data_34000_20.csv
│ │ ├── data_38000_20.csv
│ │ ├── data_42000_20.csv
│ │ ├── data_46000_20.csv
│ │ ├── data_50000_20.csv
│ │ └── data_6000_20.csv
│ ├── sc_2
│ │ ├── data_50000_100.csv
│ │ ├── data_50000_120.csv
│ │ ├── data_50000_140.csv
│ │ ├── data_50000_160.csv
│ │ ├── data_50000_180.csv
│ │ ├── data_50000_200.csv
│ │ ├── data_50000_40.csv
│ │ ├── data_50000_60.csv
│ │ └── data_50000_80.csv
│ ├── sc_3
│ │ └── data_10000_20.csv
│ ├── sc_4
│ │ └── data_100000_200.csv
│ └── sc_5
│ └── data_300000_300.csv
└── dsqcp
├── sc_1
│ ├── ch.csv
│ ├── Ph.csv
│ ├── q.csv
│ └── Q.csv
└── sc_2
├── ch.csv
├── Ph.csv
├── q.csv
└── Q.csv
The dslr
directory holds the datasets used in DSLR problem instances and consists of five subdirectories. Each
directory holds the corresponding dataset for a specific scenario. Similarly, the dsqcp
directory keeps the
datasets of the scenarios used in DSQCP problem. All datasets are also generated in CSV format.