GOBNILP is a C program which uses SCIP ( http://scip.zib.de/ ) to learn Bayesian network structure from complete discrete data (or precomputed local scores). The version of GOBNILP that exists in this git repo is only guaranteed to work with SCIP 5.0.1. (It has yet to be 'tuned' to account for the changes between SCIP 4.0.0 and SCIP 5.0.1, so performance is typically worse than was the case with SCIP 4.0.0.) This repo also includes simple_gobnilp.py a simplified Python version of GOBNILP which works with Gurobi.
When installing SCIP 5.0.1 install it using "make" rather than "cmake". GOBNILP cannot make use of the new symmetry breaking methods available in SCIP 5.0.1 so the following assumes you have not installed a version of SCIP which has access to these new methods. (If, however, you do install SCIP 5.0.1 with the "SYM=bliss" option you can still use GOBNILP with it, you will just be obliged to add the "SYM=bliss" option when making GOBNILP.)
Let us suppose you have installed SCIP in the directory ~/local/src/scipoptsuite-5.0.1/scip. GOBNILP can either be installed to learn from discrete data (and pre-computed local scores) only or to additionally learn Gaussian networks using BGe scoring. In the latter case it is necessary to have the BLAS, LAPACK and LAPACKE libraries installed. Some advice about how to install these libraries is given below, but first here is how to install GOBNILP to learn only from discrete data. Just do:
git clone https://bitbucket.org/jamescussens/gobnilp.git cd gobnilp/ ./configure.sh ~/local/src/scipoptsuite-5.0.1/scip make
The 'configure.sh' script mentioned just above copies (and alters) files from SCIP which cannot be included in this repo for licensing reasons. If you have CPLEX installed (and accessible to SCIP) be sure to do 'make LPS=cpx' instead of plain 'make' since this will lead to considerably faster solving. (Note that if you have installed SCIP with the option "SYM=bliss" then you will need to do 'make SYM=bliss' (or 'make SYM=bliss LPS=cpx').)
To learn Gaussian networks GOBNILP uses BGe scoring to compute local scores using the BLAS, LAPACK and LAPACKE libraries. We have found installing OpenBLAS from source the easiest option (we have only tried with Linux). Note that OpenBLAS includes LAPACK and LAPACKE which is particularly convenient.
First go to https://www.openblas.net/ and download the source. At time of writing this gets you the file OpenBLAS-0.2.20.tar.gz. Then to install the libraries in, say, "/home/james/local/" do the following:
tar zxvf OpenBLAS-0.2.20.tar.gz cd OpenBLAS-0.2.20 make make install PREFIX=/home/james/local
This will put the header file lapacke.h into /home/james/local/include and libopenblas.a, the library itself, into /home/james/local/lib. Obviously replace "/home/james/local/" with whatever directory is convenient for you. Once you have done all this you can install GOBNILP as follows:
git clone https://bitbucket.org/jamescussens/gobnilp.git cd gobnilp/ ./configure.sh ~/local/src/scipoptsuite-5.0.1/scip /home/james/local make
where again, of course, you can replace "/home/james/local/" with a directory of your choice. This use of configure.sh alters the GOBNILP Makefile to work with OpenBLAS installed as above. If you have a different installation of BLAS, LAPACK and LAPACKE you will have to edit the Makefile yourself.
BGe scoring was implemented by Sam Vozza as a final-year project in the Dept of Computer Science, University of York.
For full details on GOBNILP (including installation instructions for the stable release), please consult the GOBNILP page:
The manual for the stable release is here:
The manual for development version in this git repo can be found (as LaTeX source) in the manual directory.
If you wish to extend GOBNILP in some way it is best to exploit SCIP's modular architecture to do so. For example,
To allow the user to add a new sort of constraint to GOBNILP you should add a new "constraint handler" to GOBNILP. See e.g. cons_dagcluster.c in the source, this implements the key acyclicity constraint. Also see cons_ci.c which implements user-defined conditional independence constraints. For general details on constraint handlers in SCIP, see: http://scip.zib.de/doc/html/CONS.php
To add a new heuristic algorithm (to generate better incumbent solutions ) you should add a "primal heuristic". GOBNILP currently has only one of these: heur_sinks.c. For general info on primal heuristics in SCIP see http://scip.zib.de/doc/html/HEUR.php
ONGOING DEVELOPMENT WORK
- Scott MacGregor has written an R package for GOBNILP which will be distributed at some point.
Here are some things which are missing from GOBNILP but which could be added:
- Adding a pricer so that "family variables" are created only if they loosen ( ie increase ) the dual bound, rather than all at once at the beginning of solving.