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.

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.

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.

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.