Download

Installation

Notes

File List

Support

Known Issues

Build Environment

FAQ


BPMPD_MEX

A Matlab MEX Interface for the BPMPD Interior Point Solver

by Carlos E. Murillo-Sánchez


BPMPD_MEX is a Matlab MEX interface to BPMPD, an interior point solver for quadratic programming developed by Csaba Mészáros at the MTA SZTAKI, Computer and Automation Research Institute, Hungarian Academy of Sciences, Budapest, Hungary.

This MEX interface for BPMPD has been coded by Carlos E. Murillo-Sánchez, while he was at Cornell University. It does not provide all of the functionality of BPMPD, however. In particular, note that the stand-alone BPMPD program is designed to read and write results and data from MPS and QPS format files, but the MEX interface implementation does not allow reading data from these files into Matlab.

The current version of the MEX interface is based on version 2.21 of the BPMPD solver.


Download BPMPD_MEX

You will be asked to fill out a brief form the first time you download from this site.



BPMPD_MEX
(current version is 2.21.1)

Pre-compiled versions are available for HPUX, Linux, Mac OS X, Solaris and Windows.

As of Sept. 21, 2007, we now have builds for Intel Mac, and new builds that work on recent Linux and Windows versions of Matlab.

As of Apr 10, 2008, there is a new build for Intel Mac which should eliminate the crash-Matlab-after-10-minutes-of-use issue caused by a compiler bug.

Terms of Use

  • BPMPD_MEX is free of charge.
  • The use of BPMPD_MEX under this license is restricted to non-commercial academic/research use only. Commercial use requires licensing the software directly from the author of BPMPD.
  • We make no warranties, express or implied. Specifically, we make no guarantees regarding the correctness BPMPD_MEX's code or its fitness for any particular purpose.
  • Any publications derived from the use of BPMPD_MEX must acknowledge BPMPD. (Please cite: Cs. Mészáros, "Fast Cholesky Factorization for Interior Point Methods of Linear Programming", Computers & Mathematics with Applications, Vol. 31, No. 4/5, (1996), pp. 49-51.)
  • BPMPD_MEX may not be redistributed without written permission.
  • BPMPD_MEX may not be modified or reverse engineered.

Installation

If you are using a pre-compiled MEX file supplied for HPUX, Linux, Mac OS X, Solaris or Windows:

  1. Unzip the downloaded file.
  2. Place the *.m and bp.dll or bp.mex* files in a location on your Matlab path.

If you are compiling the interface:

  1. Unzip the downloaded file.
  2. Copy the 3 files in the src directory to the BPMPD source directory.
  3. Edit the makefile to select the choices appropriate for your platform.
  4. Type: make
  5. Run Matlab and try to execute the script called test5.m.
  6. If all is well, place the MEX file along with the *.m files in a location on your Matlab path.

If you do compile the interface for a platform other than the ones for which we provide pre-compiled versions, please let us know.


Notes

  • For help on the calling syntax, type: help bp.
  • For help on the options, type: help bpopt.
  • The file test5.m assumes that you have lp.m from the Optimization Toolbox Version 1.x/2.x.
  • The sign convention for the multipliers is different in BPMPD than in Matlab's Optimization Toolbox.
  • In writing the interface, I assumed that the fortran compiler being used supports the %VAL() construct. See the fortran section of the matlab external interface guide for more details. If your compiler does not support this construct, then you will have to modify bpg.f so that all input arguments are copied to local versions using the subroutines mxCopyPtrToReal8 and mxCopyReal8ToPtr. You may have to modify the dynamic allocation of memory as well and make it static.
  • The dynamic allocation is very conservative, and hopefully you will never find a problem where the needed memory was underestimated. If you do, then you have to recompile the MEX interface after setting the variable L in bpg.f to something larger, perhaps 20 or 30. On the other hand, if memory is a problem in your system you may want to decrease it to, say L=10 and see what happens. (Note: repeated calling of subroutine bp() with increasing values of L whenever bp() returns a not-enough-memory error should have been introduced by now; I have put it on hold because the default value of L has always worked for me). The default value of L used for the pre-compiled versions is 15.
  • The interface assumes that the quadratic objective matrix is symmetric, and passes only the lower triangular part of the input matrix to BPMPD. Thus, using Q or tril(Q) as data for BPMPD has the same effect.
  • The provided MEX file seems to work fine under versions 4.2c through 7.x of Matlab, though we haven't tested every version on every platform.
  • If you want to change some of the default parameters in the options vector, you will probably need to obtain BPMPD from Csaba Mészáros in order to have access to the complete documentation. There are 80 parameters that can be set by the user.

File List

bp.dll MEX file for Windows (before R2006b)
bp.m Help for the MEX file
bp.mexglx MEX file for Linux
bp.mexhp7 MEX file for HPUX
bp.mexmac MEX file for Mac OS X (PowerPC)
bp.mexmaci MEX file for Mac OS X (Intel)
bp.mexsol MEX file for Solaris
bp.mexw32 MEX file for Windows (R2006b and later)
bpopt.m Default options vector for BPMPD
bpver.m Prints or returns version information
CHANGES A detailed change history, with Unix line endings
CHANGES.txt A detailed change history, with DOS line endings (for Windows users)
README The README file with Unix line endings
README.txt The README file with DOS line endings (for Windows users)
test5.m A small test; assumes you have Optimization Toolbox 1.x/2.x
writemps.m Implements basic MPS writing capability
writeqps.m Implements basic QPS writing capability
extras/lp.m Mimics lp.m in Optimization Toolbox 1.x/2.x using BPMPD
extras/qp.m Mimics qp.m in Optimization Toolbox 1.x/2.x using BPMPD
src/bp.f Interface source code
src/bpg.f Gateway routine source code
src/makefile

Support

General questions about BPMPD should be addressed to Csaba Mészáros.

Questions specific to the MEX interface should be addressed to Carlos E. Murillo-Sánchez via the MATPOWER mailing list.

MATPOWER is a power system simulation package which can take advantage of BPMPD_MEX.


Known Issues

It appears that there may be a bug in version 2.21 of the BPMPD solver in the presolve option which aggregates to eliminate free variables. This option was turned on by default in version 2.21 of the MEX interface. The effect of the bug is to sometimes give incorrect (infeasible) solutions to DC OPF problems in MATPOWER. This is the only context in which we have observed this bug in the course of several years of using BPMPD_MEX.

Turning off this presolve option, by unsetting the 9th bit of bpopt(64), appears to eliminate the problem of incorrect DC OPF solutions. Version 2.21.1 of this MEX interface now has this option turned off by default and so should not exhibit the problem.

In addition, version 3.0b4 and later of MATPOWER provides a workaround to this bug by including a feasibility check following the call to bp() in the wrapper functions mp_qp() and mp_lp(). If bp() has returned an infeasible solution, it attempts to solve the problem using the appropriate solver from the Optimization Toolbox (quadprog, linprog, qp or lp) instead.

While we have never encountered the bug in the context of sqppf() in the MINOPF solver, version 3.0b4 of the MINOPF package eliminates direct calls to bp() and instead uses the wrapper function mp_qp() with its post-solution feasibility check.

It is strongly recommended that you upgrade to BPMPD_MEX 2.21.1 or later, MATPOWER 3.0b4 or later, and MINOPF 3.0b4 or later, especially if you use MATPOWER with BPMPD for solving DC optimal power flow problems.


Build Environment

HP-UX built Wed, Feb 2, 2005
  HP 9000 Model 735 ?
HP-UX 10.2
Matlab 6.0 (R12)
<compiler>?
Linux built Fri, Feb 25, 2005
  IBM Netfinity 5100, dual Intel Pentium III 933 MHz
Red Hat 6.2 (Linux kernel 2.2.22)
Matlab 6.1 (R12.1)
gcc version 2.95.3 20010315
GNU Fortran 0.5.25 20010315 (release)
Linux R2007+ built Thu, Sep 20, 2007
  Dell Optiplex G260, Intel Pentium 4, 3.06 GHz
Red Hat Enterprise Linux 4 (Linux kernel 2.6.9)
Matlab 7.5 (R2007b)
gcc version 3.4.6 20060404 (Red Hat 3.4.6-8)
g95 - gcc version 4.0.3 (g95 0.90!) Jul 27 2006
Mac OS X built Wed, Jan 26, 2005
  PowerBook G4, 1 GHz
Mac OS X 10.3.7 (Panther)
Matlab 7.0.1 (R14sp1)
gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1671)
GNU Fortran (GCC) 3.4.3  (installed via fink: g77 3.4.3-1)
f2c (version 20030320)  (installed via fink: f2c 20030428-2)
Mac OS X (Intel) built Thu, Apr 10, 2008
  MacBook Pro, Intel Core 2 Duo, 2.33 GHz
Mac OS X 10.5.2 (Leopard)
Matlab 7.6 (R2008a)
gcc version 4.3.0 (GCC)
gfortran - part of gcc-4.3 installed via fink
Solaris built Wed, Feb 2, 2005
  Sparc 5 ?
Solaris 2.7
Matlab 6.0 (R12)
<compiler>?
Windows R2006b+ built Fri, Sep 14, 2007
  Parallels Desktop 3.0 VM on MacBook Pro
Windows XP Pro, SP2
Matlab 7.5 (R2007b)
Microsoft Visual Studio 2005 Pro, SP1, Version 8.0.50727.762
Intel Visual Fortran 10.0.027
Windows built Wed, Feb 2, 2005
  <hardware>
Windows ?
Matlab ? (R?)
Digital Visual Fortran 6.0?
Windows R11 built Tue, Feb 1, 2005
  <hardware>
Windows ?
Matlab 5.3 (R11)
Digital Visual Fortran 6.0?

Frequently Asked Questions

Q: Why am I getting the following error when running on Windows?
Invalid MEX-file 'C:\bpmpdmex2.21.1_w32\bp.mexw32': This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

A: You need to install the latest Microsoft Visual C++ 2005 Redistributable, available from:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647


PSERC Logo BPMPD_MEX
Copyright © 1997-2007 PSERC
Fri, Sep 21, 2007