Home > matpower4.0 > LPrelax.m

LPrelax

PURPOSE ^

------------------------------ deprecated ------------------------------

SYNOPSIS ^

function [x2, duals_rlx, idx_workc, idx_bindc] = LPrelax(a, f, b, nequs, vlb, vub, idx_workc, mpopt)

DESCRIPTION ^

------------------------------  deprecated  ------------------------------
   OPF solvers based on LPCONSTR to be removed in a future version.
--------------------------------------------------------------------------
LPRELAX
   [X2, DUALS_RLX, IDX_WORKC, IDX_BINDC] = ...
       LPRELAX(A, F, B, NEQUS, VLB, VUB, IDX_WORKC, MPOPT)

   See also LPOPF_SOLVER, MP_LP.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [x2, duals_rlx, idx_workc, idx_bindc] = LPrelax(a, f, b, nequs, vlb, vub, idx_workc, mpopt)
0002 %------------------------------  deprecated  ------------------------------
0003 %   OPF solvers based on LPCONSTR to be removed in a future version.
0004 %--------------------------------------------------------------------------
0005 %LPRELAX
0006 %   [X2, DUALS_RLX, IDX_WORKC, IDX_BINDC] = ...
0007 %       LPRELAX(A, F, B, NEQUS, VLB, VUB, IDX_WORKC, MPOPT)
0008 %
0009 %   See also LPOPF_SOLVER, MP_LP.
0010 
0011 %   MATPOWER
0012 %   $Id: LPrelax.m,v 1.17 2010/11/23 14:34:40 cvs Exp $
0013 %   by Deqiang (David) Gan, PSERC Cornell & Zhejiang University
0014 %   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC)
0015 %
0016 %   This file is part of MATPOWER.
0017 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0018 %
0019 %   MATPOWER is free software: you can redistribute it and/or modify
0020 %   it under the terms of the GNU General Public License as published
0021 %   by the Free Software Foundation, either version 3 of the License,
0022 %   or (at your option) any later version.
0023 %
0024 %   MATPOWER is distributed in the hope that it will be useful,
0025 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0027 %   GNU General Public License for more details.
0028 %
0029 %   You should have received a copy of the GNU General Public License
0030 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0031 %
0032 %   Additional permission under GNU GPL version 3 section 7
0033 %
0034 %   If you modify MATPOWER, or any covered work, to interface with
0035 %   other modules (such as MATLAB code and MEX-files) available in a
0036 %   MATLAB(R) or comparable environment containing parts covered
0037 %   under other licensing terms, the licensors of MATPOWER grant
0038 %   you additional permission to convey the resulting work.
0039 
0040 %% options
0041 alg     = mpopt(11);
0042 
0043 if alg == 320       %% dense LP
0044     idx_workc = find(b < 0.001);
0045 end
0046 
0047 
0048 converged = 0;
0049 while converged == 0
0050 
0051     atemp = a(idx_workc, :);
0052     btemp = b(idx_workc);
0053 
0054     %% solve via BPMPD_MEX
0055     [x2, duals] = mp_lp(f, atemp, btemp, vlb, vub, [], nequs, -1, 100);
0056 
0057     diffs = b - a * x2;                 % diffs should be normalized by what means? under development
0058     idx_bindc = find(diffs < 1.0e-8);
0059     
0060     if isempty(find(diffs < -1.0e-8))
0061         converged = 1;
0062     else
0063         flag = zeros(length(b), 1);         % set up flag from scratch
0064         flag(idx_workc) = ones(length(idx_workc), 1);   % enforce historical working constraints
0065 
0066 
0067         idx_add = find(diffs < 0.001);
0068         flag(idx_add) = ones(length(idx_add), 1);   % enforce violating constraints
0069 
0070 
0071 
0072         flag(1:nequs) = ones(nequs, 1);         % enforce original equality constraints
0073         idx_workc_new = find(flag);
0074 
0075         if length(idx_workc) == length(idx_workc_new)   % safeguard step
0076             if isempty(find(idx_workc - idx_workc_new))
0077                 converged = 1;
0078             end
0079         end
0080         idx_workc = idx_workc_new;
0081 
0082     end
0083 
0084 end
0085 
0086 duals_rlx = zeros(length(b), 1);
0087 duals_rlx(idx_workc) = duals(1:length(btemp));
0088

Generated on Mon 26-Jan-2015 14:56:45 by m2html © 2005