SPECIAL NOTE. It is imperative that the environment variable LOQODIR be set according to the instructions you received at the time of downloading loqo. If it is not, then invoking loqo from within MATLAB will result in matlab exiting with the possible loss of many hours of unsaved work. You should test the loqo executable program using an MPS or AMPL input file to make sure it is installed correctly before attempting this MATLAB interface.
First, you need to download five files:
mex -O loqosoclp.c printf.c -I$LOQODIR $LOQODIR/libloqo.a
to create an executable that MATLAB can invoke when loqo is called from within MATLAB. Here, $LOQODIR refers to the directory where the LOQO subroutine library, libloqo.a, is located.
NOTE FOR PC USERS. On PCs, libloqo.a is called loqo.lib. The library loqo.lib was compiled using gcc under Mingw. Therefore, to make the Loqo/Matlab interface, you will need to install Mingw (go to http://www.mingw.org/ for instructions) on your machine. Then, you will need to install gnumex (go to http://gnumex.sourceforge.net/ for instructions). Once you have your matlab system set up and correctly compiling simple test programs, loqolpqp.c is compiled by putting loqo.lib into the same folder with loqolpqp.c and typing
mex loqosoclp.c printf.c loqo.lib
from within Matlab at the Matlab prompt.
After the compilation is successful, to solve a problem
Minimize c^T x + 1/2 x^T H x
Ax = b
Ax <= b
||A_ix+b_i|| <= c_i^Tx+d_i, i=1,...,nsocp
l <= x <= u,
use the following syntax:
[x,lambda_lin,lambda_cone] = loqosoclp(C,H,c,A,b,l,u,x0,neqcstr,hookfn,loqo_options);
Here, H and A must be sparse matrices, x0 is an initial guess for the primal solution, neqcstr denotes the number of constraints that are in fact equality constraints (these are assumed to come first), hookfn is an optional string containing the name of a function that can be invoked at each iteration with the current solution (primarily, for the purpose of algorithm animation), and loqo_options is an optional string containing the solver options for LOQO. C is a cell array, consisting of a matrix for each SOCP constraint (there are nsocp of them). Each C_i looks like
|b_i A_i |
and must be a sparse matrix.
The output vector x denotes the solution vector, and lambda denotes the vector of dual variables (aka Lagrange multipliers).
Reasonable defaults are assumed for missing fields. In particular, C defaults to the cell-array consisting of one sparse zero matrix (of appropriate dimension), H defaults to the sparse zero matrix (of appropriate dimension), l defaults to the minus-infinity vector, u defaults to the infinity vector. and x0 defaults to a vector of ones.
Give it a try. Comments welcome.