File List


Known Issues

Build Environment



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.

(current version is 2.21.1d)

Pre-compiled versions are available for Linux, Mac OS X and Windows
(For HPUX, Solaris and older versions for Windows, see version 2.21.1).

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.


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.


  • 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


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. (See update below.*)

In addition, version 3.0b4 and later of MATPOWER provides a workaround to this bug when called via the wrapper functions mp_qp(), mp_lp() or qps_matpower() by including a feasibility check after the call to bp(). If bp() has returned an infeasible solution, it attempts to solve the problem using a different solver.

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.

*Update: It has since been discovered that there are still circumstances under which BPMPD_MEX 2.21.1 returns incorrect (infeasible) solutions. Therefore, it is strongly recommended that you upgrade to BPMPD_MEX 2.21.1 or later and MATPOWER 3.0 or later and only invoke it via one of the wrapper functions mentioned above.

Build Environment

HP-UX built Wed, Feb 2, 2005
  HP 9000 Model 735 ?
HP-UX 10.2
MATLAB 6.0 (R12)
Linux_old (<= R2007a, 7.4) built Fri, Apr 3, 2009
  VMware Fusion 2.0.2 VM on MacBook Pro
Red Hat 7.3 (Linux kernel 2.4.18)
MATLAB 6.5.1 (R13sp1)
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
g77 version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
(from FSF-g77 version 0.5.26 20000731 (Red Hat Linux 7.3 2.96-110)
Linux (>= R2007a, 7.4) built Fri, Apr 3, 2009
  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-10)
g95 - gcc version 4.0.3 (g95 0.90!) Jul 27 2006
Mac OS X (Intel) built Wed, Apr 1, 2009
  MacBook Pro, Intel Core 2 Duo, 2.33 GHz
Mac OS X 10.5.6 (Leopard)
MATLAB 7.8 (R2009a)
gcc version 4.0.1 (Apple Inc. build 5490)
g95 - gcc version 4.0.3 (g95 0.91!) Apr 18 2008 installed via fink
Mac OS X (PPC) built Fri, Apr 3, 2009
  PowerBook G4, 1 GHz
Mac OS X 10.4.11 (Tiger)
MATLAB 7.2 (R2006a)
gcc version 4.0.1 (Apple Computer, Inc. build 5367)
GNU Fortran (GCC) 3.4.3  (installed via fink: g77 3.4.3-1)
f2c (version 20030320)  (installed via fink: f2c 20030428-2)
Solaris built Wed, Feb 2, 2005
  Sparc 5 ?
Solaris 2.7
MATLAB 6.0 (R12)
Windows R2006b+ built Wed, Apr 1, 2009
  Parallels Desktop 4.0 VM on MacBook Pro
Windows XP Pro, SP3
MATLAB 7.5 (R2007b)
Microsoft Visual Studio 2005 Pro, SP2, Version 8.0.50727.762
Intel Visual Fortran 10.1.011
Windows built Wed, Feb 2, 2005
Windows ?
Digital Visual Fortran 6.0?
Windows R11 built Tue, Feb 1, 2005
Windows ?
MATLAB 5.3 (R11)
Digital Visual Fortran 6.0?

Frequently Asked Questions

Q: When will 64-bit versions of BPMPD_MEX be made available?

A: We currently have no plans to distribute 64-bit versions of BPMPD_MEX. Porting this code to 64-bits turns out to be a bigger task that we have time for. On 64-bit platforms, you may want to try the qps_mips function included in MATPOWER 4.

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:

Copyright © 1997-2017 PSERC
Wed, Nov 15, 2017