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 % Copyright (c) 2013-2015 by Power System Engineering Research Center (PSERC) 0030 % by Daniel Molzahn, PSERC U of Wisc, Madison 0031 % 0032 % $Id: combineCost.m 2644 2015-03-11 19:34:22Z ray $ 0033 % 0034 % This file is part of MATPOWER. 0035 % Covered by the 3-clause BSD License (see LICENSE file for details). 0036 % See http://www.pserc.cornell.edu/matpower/ for more info. 0037 0038 maxcliques1 = maxcliques{maxcliquesidx(1)}; 0039 maxcliques2 = maxcliques{maxcliquesidx(2)}; 0040 nintersect = sum(ismembc(maxcliques1, maxcliques2)); 0041 0042 elimmaxcliques(1) = length(maxcliques1); 0043 elimmaxcliques(2) = length(maxcliques2); 0044 lnewmaxcliques = sum(elimmaxcliques) - nintersect; 0045 0046 nvarafter = (lnewmaxcliques)*(2*lnewmaxcliques+1) - sum((elimmaxcliques).*(2*elimmaxcliques+1)); 0047 0048 ocostbefore = (nintersect)*(2*nintersect+1); 0049 0050 cost = nvarafter - ocostbefore;