This is the implementation oft the MPC article "Exploiting sparsity for the min k-partition problem".
https://doi.org/10.5281/zenodo.3252476
Authors: Guanglei Wang and Hassan Hijazi
Affiliations: The Australian National University, ACTON 2601, Canberra, Australia; Los Alamos National Laboratory, New Mexico, USA.
We have successfully compiled and tested our minimum-k partition (MkP) code on both Mac OS and Ubuntu. So users are advised to use our code on Mac OS or Ubuntu.
For numerical tests of the MkP formulations in the paper Exploiting sparsity for the min k-partition problem
, you need to install and set the following solvers:
- CPLEX: Academic users can download it from cplex-url.
-
MOSEK: Download Mosek 8 from mosek-url. Refer to mosek-setup for general setup and license.
-
Install and setup Mosek Fusion API for C++ by following instructions in fusion-url.
-
Additionally, you need to set the enviroment variable
MOSEK_ROOT_DIR
andDYLD_LIBRARY_PATH
for your operating system. For instance, if you install MOSEK 8 underDIR/mosek8/
in a linux platform, you need to add the following to your.bashrc
file:export MOSEK_ROOT_DIR = DIR/mosek/8/tools/platform/linux64x86/
export DYLD_LIBRARY_PATH= DIR/mosek/8/tools/platform/linux64x86/bin:$DYLD_LIBRARY_PATH
Follow the steps below to compile the executable file.
- Download and unzip the file
Gravity.zip
and go to the folderGravity
. - Create a build directory by typing:
mkdir build
. - Enter this directory in order to perform the compilation:
cd build
- Type:
cmake ..
. - Compile the MkP executable program by typing:
make min_k_part
. - Find the executable file
min_k_part
in the folder../bin/
.
You are now ready to perform numerical tests stated in the paper.
-
All test instances mentioned in the paper can be found in the folder
Gravity/data_sets/Minkcut/
and they are in.txt
format. -
For each problem instance, they are generally named by
graph_type + the number of vertices in the graph
. For instance,spinglass2g_1010.txt
refers to thespinglass2g
problem instance with10 x 10
vertices.- Since the size of the generated
band
graphs are also related to the partition parameterk
. We additionally add_3
or_4
to specify the instance is used for min-3 partition or min-4 partition test instances.
- Since the size of the generated
The executable file min_k_part
takes four ordered input arguments, namely:
- the input graph data
*.txt
- the integer parameter
k
(k > 2, we tested k = 3, 4 in our numerical tests) - the formulation name (
MIP
orNode_edge
orMIP_tree
orSDP
orSDP_tree
) - the boolean type for continuous relaxation (
true
for relax,false
for integer program).
Note that MIP
corresponds to Model 1 in the paper, Node_edge
to Model 2, SDP
to Model 3, MIP_tree
to Model 4, SDP_tree
to Model 5.
All the numerical tests results will also be outputed to the file MkP_result.txt
.
Assum that you are in the folder Gravity/build
and want to valid the result of spinglass2g
with k = 3
and |V|= 6 x 6
in Table 1, you need to type the following to get results for Model 1
../bin/min_k_part ../data_sets/Minkcut/spinglass2g_66.txt 3 MIP true
../bin/min_k_part ../data_sets/Minkcut/spinglass2g_66.txt 3 MIP false
and
../bin/min_k_part ../data_sets/Minkcut/spinglass2g_66.txt 3 MIP_tree true
../bin/min_k_part ../data_sets/Minkcut/spinglass2g_66.txt 3 MIP_tree false
to get results for Model 4.
You should get similar results as below in Gravity/build/MkP_result.txt
:
3, 36, 12.1644, -2.14607e+06
3, 36, 12.9085, -2.14607e+06
3, 36, 0.159482, -2.14607e+06
3, 36, 0.368595, -2.14607e+06
Each row shows the corresponding result of each command line above. Thus we have four rows. The first column is parameter k; the second is the number of nodes which is 6x6=36
; the third column is the CPU time in seconds; the fourth is the optimal value, by which you can calculate the optimality gap (0 for this test instance) for their continuous relaxations.
Since the data in MkP_result.txt
is separated by comma, you can open this csv (comma-separated-value)
file using MS Excel and calculate the optimality gap easily.
We illustrate tests of ISDP formulations (Model 3 and Model 5 in our paper) with instance (4, 11x11), spinglass2g
in Table 3. You need to type the following to get results for Model 3:
../bin/min_k_part ../data_sets/Minkcut/spinglass2g_1111.txt 4 SDP true
and
../bin/min_k_part ../data_sets/Minkcut/spinglass2g_1111.txt 4 SDP_tree true
for Model 5.
You should get similar results as below in Gravity/build/MkP_result.txt
:
4,121,145.845, -8.44258e+06
4,121,1.12703, -8.45322e+06
If you want to run multiple the problem instances in the paper, you can use the bash script called exp.sh
that we provided in folder Gravity
.
-
Copy the
exp.sh
file to your build folder. -
Modify the content of the
exp.sh
file to run corresponding set of numerical experiments. -
In your build folder, type
./exp.sh
. -
check the result in
MkP_result.txt
.
Guanglei Wang: [email protected]
Hassan Hijazi: [email protected]