COMBINECOST Calculate the cost of combining two maximal cliques. [COST] = COMBINECOST(MAXCLIQUES,MAXCLIQUEIDX) Calculate the cost of combining two maximal cliques in terms of the number of scalar variables and linking constraints that will be required after combining the maximal cliques specified in maxcliquesidx. This is the clique combination heuristic described in [1]. Negative costs indicate that the heuristic predicts decreased computational costs after combining the specified maximal cliques. Inputs: MAXCLIQUES : Cell array containing the buses contained in each maximal clique. MAXCLIQUESIDX : Vector of length two with elements corresponding to the candidate maximal cliques. Outputs: COST : Scalar indicating the cost, as defined by the heuristic in [1] of combining the specified maximal cliques. [1] D.K. Molzahn, J.T. Holzer, B.C. Lesieutre, and C.L. DeMarco, "Implementation of a Large-Scale Optimal Power Flow Solver Based on Semidefinite Programming," IEEE Transactions on Power Systems, vol. 28, no. 4, pp. 3987-3998, November 2013.
0001 function [cost] = combineCost(maxcliques,maxcliquesidx) 0002 %COMBINECOST Calculate the cost of combining two maximal cliques. 0003 % [COST] = COMBINECOST(MAXCLIQUES,MAXCLIQUEIDX) 0004 % 0005 % Calculate the cost of combining two maximal cliques in terms of the 0006 % number of scalar variables and linking constraints that will be 0007 % required after combining the maximal cliques specified in 0008 % maxcliquesidx. This is the clique combination heuristic described in 0009 % [1]. Negative costs indicate that the heuristic predicts 0010 % decreased computational costs after combining the specified maximal 0011 % cliques. 0012 % 0013 % Inputs: 0014 % MAXCLIQUES : Cell array containing the buses contained in each 0015 % maximal clique. 0016 % MAXCLIQUESIDX : Vector of length two with elements corresponding to 0017 % the candidate maximal cliques. 0018 % 0019 % Outputs: 0020 % COST : Scalar indicating the cost, as defined by the heuristic in 0021 % [1] of combining the specified maximal cliques. 0022 % 0023 % [1] D.K. Molzahn, J.T. Holzer, B.C. Lesieutre, and C.L. DeMarco, 0024 % "Implementation of a Large-Scale Optimal Power Flow Solver Based on 0025 % Semidefinite Programming," IEEE Transactions on Power Systems, 0026 % vol. 28, no. 4, pp. 3987-3998, November 2013. 0027 0028 % MATPOWER 0029 % $Id: combineCost.m 2280 2014-01-17 23:28:37Z ray $ 0030 % by Daniel Molzahn, PSERC U of Wisc, Madison 0031 % Copyright (c) 2013-2014 by Power System Engineering Research Center (PSERC) 0032 % 0033 % This file is part of MATPOWER. 0034 % See http://www.pserc.cornell.edu/matpower/ for more info. 0035 % 0036 % MATPOWER is free software: you can redistribute it and/or modify 0037 % it under the terms of the GNU General Public License as published 0038 % by the Free Software Foundation, either version 3 of the License, 0039 % or (at your option) any later version. 0040 % 0041 % MATPOWER is distributed in the hope that it will be useful, 0042 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0043 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0044 % GNU General Public License for more details. 0045 % 0046 % You should have received a copy of the GNU General Public License 0047 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0048 % 0049 % Additional permission under GNU GPL version 3 section 7 0050 % 0051 % If you modify MATPOWER, or any covered work, to interface with 0052 % other modules (such as MATLAB code and MEX-files) available in a 0053 % MATLAB(R) or comparable environment containing parts covered 0054 % under other licensing terms, the licensors of MATPOWER grant 0055 % you additional permission to convey the resulting work. 0056 0057 maxcliques1 = maxcliques{maxcliquesidx(1)}; 0058 maxcliques2 = maxcliques{maxcliquesidx(2)}; 0059 nintersect = sum(ismembc(maxcliques1, maxcliques2)); 0060 0061 elimmaxcliques(1) = length(maxcliques1); 0062 elimmaxcliques(2) = length(maxcliques2); 0063 lnewmaxcliques = sum(elimmaxcliques) - nintersect; 0064 0065 nvarafter = (lnewmaxcliques)*(2*lnewmaxcliques+1) - sum((elimmaxcliques).*(2*elimmaxcliques+1)); 0066 0067 ocostbefore = (nintersect)*(2*nintersect+1); 0068 0069 cost = nvarafter - ocostbefore;