0% found this document useful (0 votes)
157 views35 pages

MIPS Manual PDF

Uploaded by

Prasad Narvaneni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
157 views35 pages

MIPS Manual PDF

Uploaded by

Prasad Narvaneni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Matpower Interior Point Solver

MIPS 1.4
User’s Manual
Ray D. Zimmerman Hongye Wang
October 8, 2020

© 2009–2020 Power Systems Engineering Research Center (PSerc)


All Rights Reserved
Contents
1 Introduction 5
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 License and Terms of Use . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Citing MIPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 MIPS Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2 Getting Started 8
2.1 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3 MIPS – Matpower Interior Point Solver 10


3.1 Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.3 Primal-Dual Interior Point Algorithm . . . . . . . . . . . . . . . . . . 17
3.3.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.3.2 Problem Formulation and Lagrangian . . . . . . . . . . . . . . 18
3.3.3 First Order Optimality Conditions . . . . . . . . . . . . . . . 19
3.3.4 Newton Step . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4 Other Functions 22
4.1 Linear System Solver - mplinsolve . . . . . . . . . . . . . . . . . . . 22
4.2 Quadratic Programming Solver - qps mips . . . . . . . . . . . . . . . 22
4.3 Private Feature Detection Functions . . . . . . . . . . . . . . . . . . . 23
4.3.1 have feature lu vec . . . . . . . . . . . . . . . . . . . . . . . 23
4.3.2 have feature pardiso legacy . . . . . . . . . . . . . . . . . 23
4.3.3 have feature pardiso object . . . . . . . . . . . . . . . . . 23
4.3.4 have feature pardiso . . . . . . . . . . . . . . . . . . . . . . 24

5 Acknowledgments 25

Appendix A MIPS Files and Functions 26

Appendix B PARDISO – Parallel Sparse Direct and Multi-Recursive


Iterative Linear Solvers 27

2
Appendix C Release History 28
C.1 Version 1.0 – released Feb 7, 2011 . . . . . . . . . . . . . . . . . . . . 28
C.2 Version 1.0.1 – released Apr 30, 2012 . . . . . . . . . . . . . . . . . . 28
C.3 Version 1.0.2 – released Nov 5, 2013 . . . . . . . . . . . . . . . . . . . 28
C.4 Version 1.1 – released Dec 17, 2014 . . . . . . . . . . . . . . . . . . . 29
C.5 Version 1.2 – released Mar 20, 2015 . . . . . . . . . . . . . . . . . . . 29
C.6 Version 1.2.1 – released Jun 1, 2016 . . . . . . . . . . . . . . . . . . . 30
C.7 Version 1.2.2 – released Dec 16, 2016 . . . . . . . . . . . . . . . . . . 30
C.8 Version 1.3 – released Oct 30, 2018 . . . . . . . . . . . . . . . . . . . 31
C.9 Version 1.3.1 – released Jun 20, 2019 . . . . . . . . . . . . . . . . . . 32
C.10 Version 1.4 – released Oct 8, 2020 . . . . . . . . . . . . . . . . . . . . 32

References 34

3
List of Tables
3-1 Input Arguments for mips . . . . . . . . . . . . . . . . . . . . . . . . 11
3-2 Output Arguments for mips . . . . . . . . . . . . . . . . . . . . . . . 12
3-3 Options for mips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
A-1 MIPS Files and Functions . . . . . . . . . . . . . . . . . . . . . . . . 26

4
1 Introduction
1.1 Background
Matpower Interior Point Solver (MIPS) is a package of Matlab language M-files1
for solving non-linear programming problems (NLPs) using a primal dual interior
point method. The MIPS project page can be found at:

https://github.com/MATPOWER/mips

MIPS is based on code written in C language [1] by Hongye Wang as a gradu-


ate student at Cornell University for optimal power flow applications [2, 3]. It was
later ported to the Matlab language by Ray D. Zimmerman of PSerc2 at Cornell
University for use in Matpower [4, 5].
Up until version 6 of Matpower, MIPS was distributed only as an integrated
part of Matpower. After the release of Matpower 6, MIPS was split out into
a separate project, though it is still included with Matpower as its default AC
optimal power flow solver.

1
Also compatible with GNU Octave [7].
2
http://pserc.org/

5
1.2 License and Terms of Use
The code in MIPS is distributed under the 3-clause BSD license3 [8]. The full text
of the license can be found in the LICENSE file at the top level of the distribution or at
https://github.com/MATPOWER/mips/blob/master/LICENSE and reads as follows.

Copyright (c) 1996-2016, Power Systems Engineering Research Center


(PSERC) and individual contributors (see AUTHORS file for details).
All rights reserved.

Redistribution and use in source and binary forms, with or without


modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright


notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright


notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS


"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

3
Versions 1.0 through 1.1 of MIPS were distributed under version 3.0 of the GNU General Public
License (GPL) [9] with an exception added to clarify our intention to allow MIPS to interface with
Matlab as well as any other Matlab code or MEX-files a user may have installed, regardless of
their licensing terms. The full text of the GPL can be found at https://www.gnu.org/licenses/
gpl-3.0.txt.

6
1.3 Citing MIPS
We request that publications derived from the use of MIPS explicitly acknowledge
that fact by citing the following 2007 paper [2].

H. Wang, C. E. Murillo-Sánchez, R. D. Zimmerman, and R. J. Thomas, “On Compu-


tational Issues of Market-Based Optimal Power Flow,” Power Systems, IEEE Trans-
actions on, vol. 22, no. 3, pp. 1185–1193, August 2007.
doi: 10.1109/TPWRS.2007.901301

The Matpower Interior Point Solver (MIPS) User’s Manual [6] should also be
cited explicitly in work that refers to or is derived from its content. The citation and
DOI can be version-specific or general, as appropriate. For version 1.4, use:

R. D. Zimmerman, H. Wang. Matpower Interior Point Solver (MIPS) User’s


Manual, Verision 1.4. 2020. [Online]. Available: https://matpower.org/docs/
MIPS-manual-1.4.pdf
doi: 10.5281/zenodo.4073324

For a version non-specific citation, use the following citation and DOI, with <YEAR>
replaced by the year of the most recent release:

R. D. Zimmerman, H. Wang. Matpower Interior Point Solver (MIPS) User’s Man-


ual. <YEAR>. [Online]. Available: https://matpower.org/docs/MIPS-manual.
pdf
doi: 10.5281/zenodo.3236506

A list of versions of the User’s Manual with release dates and version-specific DOI’s
can be found via the general DOI at https://doi.org/10.5281/zenodo.3236506.

1.4 MIPS Development


Following the release of MIPS 1.2.2 (with Matpower 6.0), the MIPS project moved
to an open development paradigm, hosted on the MIPS GitHub project page:

https://github.com/MATPOWER/mips

The MIPS GitHub project hosts the public Git code repository as well as a public
issue tracker for handling bug reports, patches, and other issues and contributions.
There are separate GitHub hosted repositories and issue trackers for Matpower,
MOST, MP-Opt-Model and the testing framework used by all of them, MP-Test, all
available from https://github.com/MATPOWER/.

7
2 Getting Started
2.1 System Requirements
To use MIPS 1.4 you will need:

• Matlab® version 7 (R14) or later4 , or

• GNU Octave version 3.4 or later5

• MP-Test version 7.1 or later.6

For the hardware requirements, please refer to the system requirements for the
version of Matlab7 or Octave that you are using.
In this manual, references to Matlab usually apply to Octave as well.

2.2 Installation
Note to Matpower users: MIPS and its prerequisite, MP-Test, are included when
you install Matpower. There is generally no need to install them separately. You
can skip directly to step 3 to verify.

Installation and use of MIPS requires familiarity with the basic operation of
Matlab or Octave, including setting up your Matlab path.

Step 1: Clone the repository or download and extract the zip file of the MIPS
distribution from the MIPS project page8 to the location of your choice.
The files in the resulting mips or mipsXXX directory, where XXX depends on
the version of MIPS, should not need to be modified, so it is recommended
that they be kept separate from your own code. We will use <MIPS> to
denote the path to this directory.

4
Matlab is available from The MathWorks, Inc. (https://www.mathworks.com/). Matlab
is a registered trademark of The MathWorks, Inc.
5
GNU Octave [7] is free software, available online at https://www.gnu.org/software/octave/.
MIPS 1.4 may work on earlier versions of Octave, but it has not been tested on versions prior to
3.4.
6
MP-Test is available at https://github.com/MATPOWER/mptest.
7
https://www.mathworks.com/support/sysreq/previous_releases.html
8
https://github.com/MATPOWER/mips

8
Step 2: Add the following directories to your Matlab or Octave path:

• <MIPS>/lib – core MIPS functions


• <MIPS>/lib/t – test scripts for MIPS

Step 3: At the Matlab prompt, type test mips to run the test suite and verify that
MIPS is properly installed and functioning.9 The result should resemble the
following:

>> test_mips
t_mplinsolve......ok (6 of 66 skipped)
t_mips............ok
t_mips_pardiso....ok (60 of 60 skipped)
t_qps_mips........ok
All tests successful (192 passed, 66 skipped of 258)
Elapsed time 0.05 seconds.

2.3 Documentation
There are two primary sources of documentation for MIPS. The first is this manual,
which gives an overview of the capabilities and structure of MIPS and describes
the formulations behind the code. It can be found in your MIPS distribution at
<MIPS>/docs/MIPS-manual.pdf and the latest version is always available at: https:
//matpower.org/docs/MIPS-manual.pdf.
And second is the built-in help command. As with the built-in functions and
toolbox routines in Matlab and Octave, you can type help followed by the name
of a command or M-file to get help on that particular function. All of the M-files in
MIPS have such documentation and this should be considered the main reference for
the calling options for each function. See Appendix A for a list of MIPS functions.

9
The tests require a functioning installation of MP-Test.

9
3 MIPS – Matpower Interior Point Solver
MIPS, that is, the Matpower Interior Point Solver, is a primal-dual interior point
solver implemented in pure Matlab code, derived from the MEX implementation
of the algorithms included in TSPOPF [1] and described in [2, 3].
This solver has application to general nonlinear optimization problems of the
following form:
min f (x) (3.1)
x

subject to

g(x) = 0 (3.2)
h(x) ≤ 0 (3.3)
l ≤ Ax ≤ u (3.4)
xmin ≤ x ≤ xmax (3.5)

where f : Rn → R, g : Rn → Rm and h : Rn → Rp .
The solver is implemented by the mips function, which can be called as follows,

[x, f, exitflag, output, lambda] = ...


mips(f_fcn, x0, A, l, u, xmin, xmax, gh_fcn, hess_fcn, opt);

where the input and output arguments are described in Tables 3-1 and 3-2, respec-
tively. Alternatively, the input arguments can be packaged as fields in a problem
struct and passed in as a single argument, where all fields except f fcn and x0 are
optional.

[x, f, exitflag, output, lambda] = mips(problem);

The calling syntax is nearly identical to that used by fmincon from Matlab’s
Optimization Toolbox. The primary difference is that the linear constraints are
specified in terms of a single doubly-bounded linear function (l ≤ Ax ≤ u) as opposed
to separate equality constrained (Aeq x = beq ) and upper bounded (Ax ≤ b) functions.
Internally, equality constraints are handled explicitly and determined at run-time
based on the values of l and u.
The user-defined functions for evaluating the objective function, constraints and
Hessian are identical to those required by fmincon, with one exception described
below for the Hessian evaluation function. Specifically, f fcn should return f as the
scalar objective function value f (x), df as an n × 1 vector equal to ∇f and, unless

10
Table 3-1: Input Arguments for mips†

name description
f fcn Handle to a function that evaluates the objective function, its gradients and Hessian‡
for a given value of x. Calling syntax for this function:
[f, df, d2f] = f fcn(x)
x0 Starting value of optimization vector x.
A, l, u Define the optional linear constraints l ≤ Ax ≤ u. Default values for the elements of
l and u are -Inf and Inf, respectively.
xmin, xmax Optional lower and upper bounds on the x variables, defaults are -Inf and Inf,
respectively.
gh fcn Handle to function that evaluates the optional nonlinear constraints and their gra-
dients for a given value of x. Calling syntax for this function is:
[h, g, dh, dg] = gh fcn(x)
where the columns of dh and dg are the gradients of the corresponding elements of
h and g, i.e. dh and dg are transposes of the Jacobians of h and g, respectively.
hess fcn Handle to function that computes the Hessian‡ of the Lagrangian for given values
of x, λ and µ, where λ and µ are the multipliers on the equality and inequality
constraints, g and h, respectively. The calling syntax for this function is:
Lxx = hess fcn(x, lam, cost mult),
where λ = lam.eqnonlin, µ = lam.ineqnonlin and cost mult is a parameter used
to scale the objective function
opt Optional options structure with fields, all of which are also optional, described in
Table 3-3.
problem Alternative, single argument input struct with fields corresponding to arguments
above.
† All inputs are optional except f fcn and x0.
‡ If gh fcn is provided then hess fcn is also required. Specifically, if there are nonlinear constraints, the Hessian
information must be provided by the hess fcn function and it need not be computed in f fcn.

gh fcn is provided and the Hessian is computed by hess fcn, d2f as an n × n matrix
2
equal to the Hessian ∂∂xf2 . Similarly, the constraint evaluation function gh fcn must
return the m × 1 vector of nonlinear equality constraint violations g(x), the p × 1
vector of nonlinear inequality constraint violations h(x) along with their gradients
in dg and dh. Here dg is an n × m matrix whose j th column is ∇gj and dh is n × p,
with j th column equal to ∇hj . Finally, for cases with nonlinear constraints, hess fcn
2
returns the n × n Hessian ∂∂xL2 of the Lagrangian function

L(x, λ, µ, σ) = σf (x) + λT g(x) + µT h(x) (3.6)

for given values of the multipliers λ and µ, where σ is the cost mult scale factor for
the objective function. Unlike fmincon, mips passes this scale factor to the Hessian
evaluation function in the 3rd input argument.

11
Table 3-2: Output Arguments for mips

name description
x solution vector
f final objective function value
exitflag exit flag
1 – first order optimality conditions satisfied
0 – maximum number of iterations reached
-1 – numerically failed
output output struct with fields
iterations number of iterations performed
hist struct array with trajectories of the following: feascond,
gradcond, compcond, costcond, gamma, stepsize, obj, alphap,
alphad
message exit message
lambda struct containing the Langrange and Kuhn-Tucker multipliers on the con-
straints, with fields:
eqnonlin nonlinear equality constraints
ineqnonlin nonlinear inequality constraints
mu l lower (left-hand) limit on linear constraints
mu u upper (right-hand) limit on linear constraints
lower lower bound on optimization variables
upper upper bound on optimization variables

The use of nargout in f fcn and gh fcn is recommended so that the gradients
and Hessian are only computed when required.

12
Table 3-3: Options for mips

name default description


opt.verbose 0 controls level of progress output displayed
0 – print no progress info
1 – print a little progress info
2 – print a lot of progress info
3 – print all progress info
opt.linsolver '' linear system solver for solving update steps (3.42), i.e. solver
input to mplinsolve
'' – default, same as '\'
'\' – use built-in \ operator
'LU' – use lu to explicitly factor matrix, followed by
back-substitution
'PARDISO' – use optional third-party PARDISO solver†
opt.feastol 10−6 termination tolerance for feasibility condition
opt.gradtol 10−6 termination tolerance for gradient condition
opt.comptol 10−6 termination tolerance for complementarity condition
opt.costtol 10−6 termination tolerance for cost condition
opt.max it 150 maximum number of iterations
opt.step control 0 set to 1 to enable step-size control
opt.sc.red it 20 max number of step-size reductions if step-control is on
opt.cost mult 1 cost multiplier used to scale the objective function for improved
conditioning. Note: This value is also passed as the 3rd argu-
ment to the Hessian evaluation function so that it can appro-
priately scale the objective function term in the Hessian of the
Lagrangian.
opt.xi 0.99995 ξ constant used in α updates in (3.43) and (3.44)
opt.sigma 0.1 centering parameter σ used in γ update in (3.49)
opt.z0 1 used to initialize elements of slack variable Z
opt.alpha min 10−8 algorithm returns “Numerically Failed” if the αp or αd from
(3.43) and (3.44) become smaller than this value
opt.rho min 0.95 lower bound on ρt corresponding to 1 − η in Fig. 5 in [2]
opt.rho max 1.05 upper bound on ρt corresponding to 1 + η in Fig. 5 in [2]
opt.mu threshold 10−5 Kuhn-Tucker multipliers smaller than this value for non-binding
constraints are forced to zero
opt.max stepsize 1010 algorithm returns “Numerically Failed” if the 2-norm of the New-
∆X
ton step from (3.42) exceeds this value
∆λ
† Requires the installation of an optional package. See Appendix B for details.

13
3.1 Example 1
The following code, included as mips example1.m in <MIPS>lib/t, shows a simple
example of using mips to solve a 2-dimensional unconstrained optimization of Rosen-
brock’s “banana” function10

f (x) = 100(x2 − x21 )2 + (1 − x1 )2 . (3.7)

First, create a Matlab function that will evaluate the objective function, its
gradients and Hessian, for a given value of x. In this case, the coefficient of the first
term is defined as a paramter a.

function [f, df, d2f] = banana(x, a)


f = a*(x(2)-x(1)^2)^2+(1-x(1))^2;
if nargout > 1 %% gradient is required
df = [ 4*a*(x(1)^3 - x(1)*x(2)) + 2*x(1)-2;
2*a*(x(2) - x(1)^2) ];
if nargout > 2 %% Hessian is required
d2f = 4*a*[ 3*x(1)^2 - x(2) + 1/(2*a), -x(1);
-x(1) 1/2 ];
end
end

Then, create a handle to the function, defining the value of the paramter a to be
100, set up the starting value of x, and call the mips function to solve it.

>> f_fcn = @(x)banana(x, 100);


>> x0 = [-1.9; 2];
>> [x, f] = mips(f_fcn, x0)

x =

1
1

f =

10
https://en.wikipedia.org/wiki/Rosenbrock_function

14
3.2 Example 2
The second example11 solves the following 3-dimensional constrained optimization,
printing the details of the solver’s progress:

min f (x) = −x1 x2 − x2 x3 (3.8)


x

subject to

x21 − x22 + x23 − 2 ≤ 0 (3.9)


x21 + x22 + x23 − 10 ≤ 0. (3.10)

First, create a Matlab function to evaluate the objective function and its gra-
dients,12

function [f, df, d2f] = f2(x)


f = -x(1)*x(2) - x(2)*x(3);
if nargout > 1 %% gradient is required
df = -[x(2); x(1)+x(3); x(2)];
if nargout > 2 %% Hessian is required
d2f = -[0 1 0; 1 0 1; 0 1 0]; %% actually not used since
end %% 'hess_fcn' is provided
end

one to evaluate the constraints, in this case inequalities only, and their gradients,

function [h, g, dh, dg] = gh2(x)


h = [ 1 -1 1; 1 1 1] * x.^2 + [-2; -10];
dh = 2 * [x(1) x(1); -x(2) x(2); x(3) x(3)];
g = []; dg = [];

and another to evaluate the Hessian of the Lagrangian.

function Lxx = hess2(x, lam, cost_mult)


if nargin < 3, cost_mult = 1; end %% allows to be used with 'fmincon'
mu = lam.ineqnonlin;
Lxx = cost_mult * [0 -1 0; -1 0 -1; 0 -1 0] + ...
[2*[1 1]*mu 0 0; 0 2*[-1 1]*mu 0; 0 0 2*[1 1]*mu];

11
From https://en.wikipedia.org/wiki/Nonlinear_programming#3-dimensional_example.
12
Since the problem has nonlinear constraints and the Hessian is provided by hess fcn, this
function will never be called with three output arguments, so the code to compute d2f is actually
not necessary.

15
Then create a problem struct with handles to these functions, a starting value for x
and an option to print the solver’s progress. Finally, pass this struct to mips to solve
the problem and print some of the return values to get the output below.
function mips_example2
problem = struct( ...
'f_fcn', @(x)f2(x), ...
'gh_fcn', @(x)gh2(x), ...
'hess_fcn', @(x, lam, cost_mult)hess2(x, lam, cost_mult), ...
'x0', [1; 1; 0], ...
'opt', struct('verbose', 2) ...
);
[x, f, exitflag, output, lambda] = mips(problem);
fprintf('\nf = %g exitflag = %d\n', f, exitflag);
fprintf('\nx = \n');
fprintf(' %g\n', x);
fprintf('\nlambda.ineqnonlin =\n');
fprintf(' %g\n', lambda.ineqnonlin);

>> mips_example2
MATPOWER Interior Point Solver -- MIPS, Version 1.4, 08-Oct-2020
(using built-in linear solver)
it objective step size feascond gradcond compcond costcond
---- ------------ --------- ------------ ------------ ------------ ------------
0 -1 0 1.5 5 0
1 -5.3250167 1.6875 0 0.894235 0.850653 2.16251
2 -7.4708991 0.97413 0.129183 0.00936418 0.117278 0.339269
3 -7.0553031 0.10406 0 0.00174933 0.0196518 0.0490616
4 -7.0686267 0.034574 0 0.00041301 0.0030084 0.00165402
5 -7.0706104 0.0065191 0 1.53531e-05 0.000337971 0.000245844
6 -7.0710134 0.00062152 0 1.22094e-07 3.41308e-05 4.99387e-05
7 -7.0710623 5.7217e-05 0 9.84879e-10 3.41587e-06 6.05875e-06
8 -7.0710673 5.6761e-06 0 9.73527e-12 3.41615e-07 6.15483e-07
Converged!

f = -7.07107 exitflag = 1

x =
1.58114
2.23607
1.58114

lambda.ineqnonlin =
0
0.707107

16
This example can be found in mips example2.m. More example problems for mips
can be found in t mips.m, both in <MIPS>lib/t.

3.3 Primal-Dual Interior Point Algorithm


This section provides some details on the primal-dual interior point algorithm used
by MIPS and described in [2, 3].

3.3.1 Notation
 T
For a scalar function f : Rn → R of a real vector X = x1 x2 · · · xn , we use
the following notation for the first derivatives (transpose of the gradient):
∂f h
∂f ∂f ∂f
i
fX = = ∂x1 ∂x2 · · · ∂xn . (3.11)
∂X
The matrix of second partial derivatives, the Hessian of f , is:
 
∂2f 2f

T ∂x21
· · · ∂x∂1 ∂x n
2
 
∂ f ∂ ∂f  .. ... .. 
fXX = = =  . . . (3.12)
∂X 2 ∂X ∂X 
∂2f ∂2f

∂xn ∂x1
··· ∂x2n

n m
For a vector function F : R → R of a vector X, where
 T
F (X) = f1 (X) f2 (X) · · · fm (X) (3.13)
the first derivatives form the Jacobian matrix, where row i is the transpose of the
gradient of fi  ∂f1 ∂f1

∂x1
· · · ∂xn
∂F
FX = =  ... ... ..  . (3.14)

∂X . 
∂fm ∂fm
∂x1
· · · ∂xn
In these derivations, the full 3-dimensional set of second partial derivatives of F will
not be computed. Instead a matrix of partial derivatives will be formed by computing
the Jacobian of the vector function obtained by multiplying the transpose of the
Jacobian of F by a vector λ, using the following notation

FX T λ .

FXX (λ) = (3.15)
∂X
Please note also that [A] is used to denote a diagonal matrix with vector A on
the diagonal and e is a vector of all ones.

17
3.3.2 Problem Formulation and Lagrangian
The primal-dual interior point method used by MIPS solves a problem of the form:
min f (X) (3.16)
X

subject to
G(X) = 0 (3.17)
H(X) ≤ 0 (3.18)
where the linear constraints and variable bounds from (3.4) and (3.5) have been
incorporated into G(X) and H(X). The approach taken involves converting the ni
inequality constraints into equality constraints using a barrier function and vector of
positive slack variables Z.
" ni
#
X
min f (X) − γ ln(Zm ) (3.19)
X
m=1

subject to
G(X) = 0 (3.20)
H(X) + Z = 0 (3.21)
Z>0 (3.22)
As the parameter of perturbation γ approaches zero, the solution to this problem
approaches that of the original problem.
For a given value of γ, the Lagrangian for this equality constrained problem is
ni
X
γ T T
L (X, Z, λ, µ) = f (X) + λ G(X) + µ (H(X) + Z) − γ ln(Zm ). (3.23)
m=1

Taking the partial derivatives with respect to each of the variables yields:
LγX (X, Z, λ, µ) = fX + λT GX + µT HX (3.24)
LγZ (X, Z, λ, µ) = µT − γeT [Z]−1 (3.25)
Lγλ (X, Z, λ, µ) = GT (X) (3.26)
Lγµ (X, Z, λ, µ) = H T (X) + Z T . (3.27)
And the Hessian of the Lagrangian with respect to X is given by
LγXX (X, Z, λ, µ) = fXX + GXX (λ) + HXX (µ). (3.28)

18
3.3.3 First Order Optimality Conditions
The first order optimality (Karush-Kuhn-Tucker) conditions for this problem are
satisfied when the partial derivatives of the Lagrangian above are all set to zero:
F (X, Z, λ, µ) = 0 (3.29)
Z>0 (3.30)
µ>0 (3.31)
where
LγX T fX T + GX T λ + HX T µ
   
 [µ] Z − γe   [µ] Z − γe 
F (X, Z, λ, µ) = 
 G(X)  = 
  . (3.32)
G(X) 
H(X) + Z H(X) + Z

3.3.4 Newton Step


The first order optimality conditions are solved using Newton’s method. The Newton
update step can be written as follows:
 
∆X
   ∆Z 
FX FZ Fλ Fµ   ∆λ  = −F (X, Z, λ, µ) (3.33)

∆µ
 γ
LXX 0 GX T HX T LγX T
    
∆X
  ∆Z  = −  [µ] Z − γe  .
 0 [µ] 0 [Z]     
 (3.34)
 GX 0 0 0   ∆λ   G(X) 
HX I 0 0 ∆µ H(X) + Z
This set of equations can be simplified and reduced to a smaller set of equations
by solving explicitly for ∆µ in terms of ∆Z and for ∆Z in terms of ∆X. Taking the
2nd row of (3.34) and solving for ∆µ we get
[µ] ∆Z + [Z] ∆µ = − [µ] Z + γe
[Z] ∆µ = − [Z] µ + γe − [µ] ∆Z
∆µ = −µ + [Z]−1 (γe − [µ] ∆Z). (3.35)
Solving the 4th row of (3.34) for ∆Z yields
HX ∆X + ∆Z = −H(X) − Z
∆Z = −H(X) − Z − HX ∆X. (3.36)

19
Then, substituting (3.35) and (3.36) into the 1st row of (3.34) results in

LγXX ∆X + GX T ∆λ + HX T ∆µ = −LγX T
LγXX ∆X + GX T ∆λ + HX T (−µ + [Z]−1 (γe − [µ] ∆Z)) = −LγX T
LγXX ∆X + GX T ∆λ
+ HX T (−µ + [Z]−1 (γe − [µ] (−H(X) − Z − HX ∆X))) = −LγX T
LγXX ∆X + GX T ∆λ − HX T µ + HX T [Z]−1 γe
+ HX T [Z]−1 [µ] H(X) + HX T [Z]−1 [Z] µ + HX T [Z]−1 [µ] HX ∆X = −LγX T
(LγXX + HX T [Z]−1 [µ] HX )∆X + GX T ∆λ
+ HX T [Z]−1 (γe + [µ] H(X)) = −LγX T
M ∆X + GX T ∆λ = −N (3.37)

where

M ≡ LγXX + HX T [Z]−1 [µ] HX (3.38)


= fXX + GXX (λ) + HXX (µ) + HX T [Z]−1 [µ] HX (3.39)

and

N ≡ LγX T + HX T [Z]−1 (γe + [µ] H(X)) (3.40)


= fX T + GX T λ + HX T µ + HX T [Z]−1 (γe + [µ] H(X)). (3.41)

Combining (3.37) and the 3rd row of (3.34) results in a system of equations of
reduced size:
M GX T
    
∆X −N
= . (3.42)
GX 0 ∆λ −G(X)
The Newton update can then be computed in the following 3 steps:

1. Compute ∆X and ∆λ from (3.42).

2. Compute ∆Z from (3.36).

3. Compute ∆µ from (3.35).

In order to maintain strict feasibility of the trial solution, the algorithm truncates
the Newton step by scaling the primal and dual variables by αp and αd , respectively,

20
where these scale factors are computed as follows:
   
Zm
αp = min ξ min − ,1 (3.43)
∆Zm <0 ∆Zm
   
µm
αd = min ξ min − ,1 (3.44)
∆µm <0 ∆µm

resulting in the variable updates below.

X ← X + αp ∆X (3.45)
Z ← Z + αp ∆Z (3.46)
λ ← λ + αd ∆λ (3.47)
µ ← µ + αd ∆µ (3.48)

The parameter ξ is a constant scalar with a value slightly less than one. In MIPS,
ξ is set to 0.99995.
In this method, during the Newton-like iterations, the perturbation parameter γ
must converge to zero in order to satisfy the first order optimality conditions of the
original problem. MIPS uses the following rule to update γ at each iteration, after
updating Z and µ:
Z Tµ
γ←σ (3.49)
ni
where σ is a scalar constant between 0 and 1. In MIPS, σ is set to 0.1.

21
4 Other Functions
4.1 Linear System Solver - mplinsolve
The mplinsolve function provides a common interface to several different methods
for solving a system of linear equations of the form Ax = b.
x = mplinsolve(A, b);
x = mplinsolve(A, b, solver);
x = mplinsolve(A, b, solver, opt);

The solver argument can be one of the following:


• '' – default, same as '\'
• '\' – use built-in \ operator, i.e. x = A \ b
• 'LU' – use built-in lu function to explicitly factor A, then solve for x via back-
substitution
• 'PARDISO' – use optional third-party PARDISO solver13
See help mplinsolve for more details.
Note that MIPS uses mplinsolve to solve the Newton update step in (3.42).

4.2 Quadratic Programming Solver - qps mips


A convenience wrapper function called qps mips is provided to make it trivial to set
up and solve linear programming (LP) and quadratic programming (QP) problems
of the following form:
1
min xT Hx + cT x (4.1)
x 2

subject to

l ≤ Ax ≤ u (4.2)
xmin ≤ x ≤ xmax . (4.3)

Instead of a function handle, the objective function is specified in terms of the


paramters H and c of quadratic cost coefficients. Internally, qps mips passes mips
the handle of a function that uses these paramters to evaluate the objective function,
gradients and Hessian.
The calling syntax for qps mips is similar to that used by quadprog from the
Matlab Optimization Toolbox.
13
Requires the installation of an optional package. See Appendix B for details.

22
[x, f, exitflag, output, lambda] = qps_mips(H, c, A, l, u, xmin, xmax, x0, opt);

Alternatively, the input arguments can be packaged as fields in a problem struct and
passed in as a single argument, where all fields except H, c, A and l are optional.

[x, f, exitflag, output, lambda] = qps_mips(problem);

Aside from H and c, all input and output arguments correspond exactly to the same
arguments for mips as described in Tables 3-1 and 3-2.
As with mips and fmincon, the primary difference between the calling syntax
for qps mips and quadprog is that the linear constraints are specified in terms of a
single doubly-bounded linear function (l ≤ Ax ≤ u) as opposed to separate equality
constrained (Aeq x = beq ) and upper bounded (Ax ≤ b) functions.
Several examples of using qps mips to solve LP and QP problems can be found
in t qps mips.m.

4.3 Private Feature Detection Functions


The following are private functions that implement detection of specific optional
functionality. They are not intended to be called directly, but rather are used to
extend the capabilities of have feature, a function included in MP-Test and described
in the MP-Test README file.

4.3.1 have feature lu vec


This function implements the 'lu vec' tag for have feature to detect support for
the lu(..., 'vector') syntax.

4.3.2 have feature pardiso legacy


This function implements the 'pardiso legacy' tag for have feature to detect sup-
port for the legacy (v5.x) PARDISO interface, with individual MEX files for factor,
solve, etc.

4.3.3 have feature pardiso object


This function implements the 'pardiso object' tag for have feature to detect sup-
port for the object-oriented (v6.x and later) PARDISO interface.

23
4.3.4 have feature pardiso
This function implements the 'pardiso' tag for have feature to detect availabil-
ity/version of PARDISO, Parallel Sparse Direct and Multi-Recursive Iterative Linear
Solvers, available from https://pardiso-project.org. See also Appendix B.

24
5 Acknowledgments
The authors would like to acknowledge the support of the research grants and con-
tracts that have contributed directly and indirectly to the development of MIPS. This
includes funding from the Power Systems Engineering Research Center (PSerc), the
U.S. Department of Energy,14 and the National Science Foundation.15

14
Supported in part by the Consortium for Electric Reliability Technology Solutions (Certs)
and the Office of Electricity Delivery and Energy Reliability, Transmission Reliability Program of
the U.S. Department of Energy under the National Energy Technology Laboratory Cooperative
Agreement No. DE-FC26-09NT43321.
15
This material is based upon work supported in part by the National Science Foundation under
Grant Nos. 0532744, 1642341 and 1931421. Any opinions, findings, and conclusions or recommen-
dations expressed in this material are those of the author(s) and do not necessarily reflect the views
of the National Science Foundation.

25
Appendix A MIPS Files and Functions
This appendix lists all of the files and functions that MIPS provides. In most cases,
the function is found in a Matlab M-file in the lib directory of the distribution,
where the .m extension is omitted from this listing. For more information on each,
at the Matlab prompt, simply type help followed by the name of the function. For
documentation and other files, the filename extensions are included.

Table A-1: MIPS Files and Functions

name description
AUTHORS list of authors and contributors
CHANGES MIPS change history
CITATION info on how to cite MIPS
CONTRIBUTING.md notes on how to contribute to the MIPS project
LICENSE MIPS license (3-clause BSD license)
README.md basic introduction to MIPS
docs/
MIPS-manual.pdf MIPS User’s Manual
src/MIPS-manual/
MIPS-manual.tex LaTeX source for MIPS User’s Manual
lib/
have feature lu vec* support for lu(..., 'vector') syntax
have feature pardiso legacy* PARDISO v5, individual MEX files for factor, solve, etc.
have feature pardiso object* PARDISO v6 and later, object interface
have feature pardiso* PARDISO, Parallel Sparse Direct & Iterative Linear
Solver, https://pardiso-project.org
mips Matpower Interior Point Solver – primal/dual interior
point solver for NLP
mipsver prints version information for MIPS
mplinsolve common linear system solver interface, used by MIPS
qps mips common QP/LP solver interface to MIPS-based solver
t/
mips example1 implements example 1 from MIPS User’s Manual
mips example2 implements example 2 from MIPS User’s Manual
test mips runs full MIPS test suite
t mips runs tests for MIPS NLP solver
t mips pardiso runs tests for MIPS NLP solver, using PARDISO as linear
solver†
t mplinsolve tests for mplinsolve
t qps mips runs tests for qps mips
* These functions implement new tags and the detection of the corresponding features for have feature which
is part of MP-Test.
† Requires the installation of an optional package. See Appendix B for details.

26
Appendix B PARDISO – Parallel Sparse Direct
and Multi-Recursive Iterative Linear
Solvers
The PARDISO package is a thread-safe, high-performance, robust, memory efficient
and easy to use software for solving large sparse symmetric and non-symmetric lin-
ear systems of equations on shared-memory and distributed-memory multiprocessor
systems [10, 11]. More information is available at https://pardiso-project.org.
When the Matlab interface to PARDISO is installed, PARDISO’s solvers can
be used to replace the built-in \ operator for solving for the Newton update step in
MIPS by setting the linsolver option equal to 'PARDISO'. The mplinsolve function
can also be called directly to solve Ax = b problems via PARDISO or the built-
in solver, depending on the arguments supplied. This interface also gives access
to the full range of PARDISO’s options. For details, see help mplinsolve and the
PARDISO User’s Manual at https://pardiso-project.org/manual/manual.pdf.

27
Appendix C Release History
The full release history can be found in CHANGES.md or online at https://github.
com/MATPOWER/mips/blob/master/CHANGES.md.

C.1 Version 1.0 – released Feb 7, 2011


Documentation found in Appendix A of the Matpower 4.0 User’s Manual, available
online.16

Changes
• Licensed under the GNU General Public License (GPL).

• Added compatibility with GNU Octave, a free, open-source Matlab clone.

• MIPS (Matpower Interior Point Solver), a new a pure-Matlab implemen-


tation of the primal-dual interior point methods from the optional package
TSPOPF.

C.2 Version 1.0.1 – released Apr 30, 2012


Documentation found in Appendix A of the Matpower 4.0 User’s Manual, available
online.17

Bug Fixed
• Fixed fatal bug in MIPS for unconstrained, scalar problems. Thanks to Han
Na Gwon.

C.3 Version 1.0.2 – released Nov 5, 2013


Documentation found in Appendix A of the Matpower 4.0 User’s Manual, available
online.18
16
https://matpower.org/docs/MATPOWER-manual-4.0.pdf
17
https://matpower.org/docs/MATPOWER-manual-4.0.pdf
18
https://matpower.org/docs/MATPOWER-manual-4.0.pdf

28
Bug Fixed
• Fixed a bug in MIPS where a near-singular matrix could produce an extremely
large Newton step, resulting in incorrectly satisfying the relative feasibility
criterion for successful termination.

C.4 Version 1.1 – released Dec 17, 2014


Documentation found in Appendix A of the Matpower 5.0 User’s Manual, available
online.19

New Features
• Many new user-settable options.

Incompatible Changes
• The name of the mips() option used to specify the maximum number of step-
size reductions with step control on was changed from max red to sc.red it
for consistency with other Matpower options.

C.5 Version 1.2 – released Mar 20, 2015


Documentation found in Appendix A of the Matpower 5.1 User’s Manual, available
online.20

New License
• Switched to the more permissive 3-clause BSD license from the previously used
GNU General Public License (GPL) v3.0.

New Documentation
• Added an online function reference to the Matpower website at http://www.
pserc.cornell.edu/matpower/docs/ref/.
19
https://matpower.org/docs/MATPOWER-manual-5.0.pdf
20
https://matpower.org/docs/MATPOWER-manual-5.1.pdf

29
New Features
• Added support for using PARDISO (https://pardiso-project.org/) as lin-
ear solver for computing interior-point update steps in MIPS, resulting in dra-
matic improvements in computation time and memory use for very large-scale
problems.

• New functions:

– mplinsolve() provides unified interface for linear system solvers, including


PARDISO and built-in backslash operator

C.6 Version 1.2.1 – released Jun 1, 2016


Documentation found in Appendix A of the Matpower 6.0b1 User’s Manual, avail-
able online.21

Bug Fixed
• Fixed issue where default value of 'feastol' option was not being set correctly
in mips() when called directly (or via qps mips()) with 'feastol' = 0.

C.7 Version 1.2.2 – released Dec 16, 2016


Documentation found in the MIPS 1.2.2 User’s Manual22 or in Appendix A of the
Matpower 6.0 User’s Manual, available online.23

New Open Development Model


• MIPS development has moved to GitHub! The code repository is now publicly
available to clone and submit pull requests.24

• Public issue tracker for reporting bugs, submitting patches, etc.25


21
https://matpower.org/docs/MATPOWER-manual-6.0b1.pdf
22
https://matpower.org/docs/MIPS-manual-1.2.2.pdf
23
https://matpower.org/docs/MATPOWER-manual-6.0.pdf
24
https://github.com/MATPOWER/mips
25
https://github.com/MATPOWER/mips/issues

30
Other Changes
• Renamed from Matlab Interior Point Solver to Matpower Interior Point
Solver.

• Remove dependence of t mpsolve() on presence of have fcn() (from Mat-


power) to detect PARDISO installation.

C.8 Version 1.3 – released Oct 30, 2018


The MIPS 1.3 User’s Manual is available online.26

New Features
• Support for PARDISO 6.x.

• New mplinsolve solver option 'LU' for explicit LU decomposition with back
substitution, with options in opt.lu for specifying the number of output ar-
guments in call to lu (opt.lu.nout), whether to use permutation vectors or
matrices (opt.lu.vec) and pivot threshold options (opt.lu.thresh). The fol-
lowing values for the solver argument act as shortcuts for specifying various
combinations of options: 'LU3', 'LU3a', 'LU4', 'LU5', 'LU3m', 'LU3am', 'LU4m',
'LU5m'. See help mplinsolve for details. Thanks to Jose Luis Marı́n.

Bugs Fixed
• Fix bug preventing pardiso.dparm options from being set.

Other Changes
• LATEX source code for MIPS User’s Manual included in docs/src.

• Move mplinsolve PARDISO options to opt.pardiso in preparation for adding


options for other solvers.

26
https://matpower.org/docs/MIPS-manual-1.3.pdf

31
C.9 Version 1.3.1 – released Jun 20, 2019
The MIPS 1.3.1 User’s Manual is available online.27

Changes
• Add CITATION file.

• Other miscellaneous documentation updates, e.g. Matpower website links


updated to https://matpower.org.

C.10 Version 1.4 – released Oct 8, 2020


The MIPS 1.4 User’s Manual is available online.28

New Features
• Support for have feature() from MP-Test to detect availability and version in-
formation for optional functionality. This is a modular, extensible replacement
for have fcn() from Matpower and MP-Opt-Model.

• Feature detection functions for lu() and PARDISO, defining tags 'lu vec',
'pardiso legacy', 'pardiso object' and 'pardiso' for have feature().

• New functions:

– have feature lu vec detects support for the lu(..., 'vector') syntax.
– have feature pardiso legacy detects support for the legacy (v5.x) PAR-
DISO interface, with individual MEX files for factor, solve, etc.
– have feature pardiso object detects support for the object-oriented (v6.x
and later) PARDISO interface.
– have feature pardiso detects availability/version of PARDISO.

Bugs Fixed
• Silence inadvertent output from mplinsolve() when called without solver in-
put argument.
27
https://matpower.org/docs/MIPS-manual-1.3.1.pdf
28
https://matpower.org/docs/MIPS-manual-1.4.pdf

32
• Fix fatal errors when mplinsolve() is called with 'LU' solver and dense A
matrix.

Other Changes
• Requires MP-Test 7.1 or later.

• Remove have fcn() dependencies in mips(), t mips pardiso() and t qps mips().

Incompatible Changes
• Calling mips() with opt.linsolver set to 'PARDISO' now results in a fatal
error if PARDISO is not installed, rather than warning and continuing with
the default linear solver.

33
References
[1] TSPOPF. [Online]. Available: http://www.pserc.cornell.edu/tspopf/. 1.1,
3

[2] H. Wang, C. E. Murillo-Sánchez, R. D. Zimmerman, and R. J. Thomas,


“On Computational Issues of Market-Based Optimal Power Flow,” Power Sys-
tems, IEEE Transactions on, vol. 22, no. 3, pp. 1185–1193, August 2007.
doi: 10.1109/TPWRS.2007.901301 1.1, 1.3, 3, 3-3, 3.3

[3] H. Wang, On the Computation and Application of Multi-period Security-


constrained Optimal Power Flow for Real-time Electricity Market Operations,
Ph.D. thesis, Electrical and Computer Engineering, Cornell University, May
2007. 1.1, 3, 3.3

[4] R. D. Zimmerman, C. E. Murillo-Sánchez, and R. J. Thomas, “Matpower:


Steady-State Operations, Planning and Analysis Tools for Power Systems Re-
search and Education,” Power Systems, IEEE Transactions on, vol. 26, no. 1,
pp. 12–19, Feb. 2011. doi: 10.1109/TPWRS.2010.2051168 1.1

[5] R. D. Zimmerman, C. E. Murillo-Sánchez (2019). Matpower


[Software]. Available: https://matpower.org
doi: 10.5281/zenodo.3236535 1.1

[6] R. D. Zimmerman, H. Wang. Matpower Interior Point Solver (MIPS)


User’s Manual. 2020. [Online]. Available: https://matpower.org/docs/
MIPS-manual.pdf
doi: 10.5281/zenodo.3236506 1.3

[7] John W. Eaton, David Bateman, Søren Hauberg, Rik Wehbring (2015). GNU
Octave version 4.0.0 manual: a high-level interactive language for numeri-
cal computations. Available: https://www.gnu.org/software/octave/doc/
interpreter/. 1, 5

[8] The BSD 3-Clause License. [Online]. Available: https://opensource.org/


licenses/BSD-3-Clause. 1.2

[9] GNU General Public License. [Online]. Available: https://www.gnu.org/


licenses/. 3

34
[10] O. Shenk and K. Gärtner, “Solving unsymmetric sparse systems of linear
equations with PARDISO,” Journal of Future Generation Computer Systems,
20(3):475–487, 2004. B

[11] A. Kuzmin, M. Luisier and O. Shenk, “Fast methods for computing selected
elements of the Greens function in massively parallel nanoelectronic device sim-
ulations,” in F. Wolf, B. Mohr and D. Mey, editors, Euro-Par 2013 Parallel Pro-
cessing, Vol. 8097, Lecture Notes in Computer Science, pp. 533–544, Springer
Berlin Heidelberg, 2013. B

35

You might also like