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