Home > matpower7.0 > lib > @opt_model > display.m

display

PURPOSE ^

DISPLAY Displays the object.

SYNOPSIS ^

function display(om)

DESCRIPTION ^

DISPLAY  Displays the object.
   Called when semicolon is omitted at the command-line. Displays the details
   of the variables, constraints, costs included in the model.

   See also OPT_MODEL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function display(om)
0002 %DISPLAY  Displays the object.
0003 %   Called when semicolon is omitted at the command-line. Displays the details
0004 %   of the variables, constraints, costs included in the model.
0005 %
0006 %   See also OPT_MODEL.
0007 
0008 %   MATPOWER
0009 %   Copyright (c) 2008-2017, Power Systems Engineering Research Center (PSERC)
0010 %   by Ray Zimmerman, PSERC Cornell
0011 %
0012 %   This file is part of MATPOWER.
0013 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0014 %   See https://matpower.org for more info.
0015 
0016 if om.var.NS
0017     fprintf('\n%-17s %12s %8s %8s %8s\n', 'VARIABLES', 'name', 'i1', 'iN', 'N');
0018     fprintf('%-17s %12s %8s %8s %8s\n', '=========', '------', '-----', '-----', '------');
0019     idx = om.var.idx;
0020     for k = 1:om.var.NS
0021         name = om.var.order(k).name;
0022         if isempty(om.var.order(k).idx)
0023             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0024         else
0025             vsidx = om.var.order(k).idx;
0026             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0027             s = substruct('.', name, '()', vsidx);
0028             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0029             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0030                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0031         end
0032     end
0033     fprintf('%10d = var.NS%29d = var.N\n\n', om.var.NS, om.var.N);
0034 else
0035     fprintf('%s  :  <none>\n', 'VARIABLES');
0036 end
0037 if om.nle.NS
0038     fprintf('\n%-21s %8s %8s %8s %8s\n', 'NONLIN EQ CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0039     fprintf('%-21s %8s %8s %8s %8s\n', '=====================', '------', '-----', '-----', '------');
0040     idx = om.nle.idx;
0041     for k = 1:om.nle.NS
0042         name = om.nle.order(k).name;
0043         if isempty(om.nle.order(k).idx)
0044             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0045         else
0046             vsidx = om.nle.order(k).idx;
0047             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0048             s = substruct('.', name, '()', vsidx);
0049             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0050             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0051                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0052         end
0053     end
0054     fprintf('%10d = nle.NS%29d = nle.N\n\n', om.nle.NS, om.nle.N);
0055 else
0056     fprintf('%s  :  <none>\n', 'NONLIN EQ CONSTRAINTS');
0057 end
0058 if om.nli.NS
0059     fprintf('\n%-23s %6s %8s %8s %8s\n', 'NONLIN INEQ CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0060     fprintf('%-23s %6s %8s %8s %8s\n', '=======================', '------', '-----', '-----', '------');
0061     idx = om.nli.idx;
0062     for k = 1:om.nli.NS
0063         name = om.nli.order(k).name;
0064         if isempty(om.nli.order(k).idx)
0065             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0066         else
0067             vsidx = om.nli.order(k).idx;
0068             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0069             s = substruct('.', name, '()', vsidx);
0070             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0071             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0072                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0073         end
0074     end
0075     fprintf('%10d = nli.NS%29d = nli.N\n\n', om.nli.NS, om.nli.N);
0076 else
0077     fprintf('%s  :  <none>\n', 'NONLIN INEQ CONSTRAINTS');
0078 end
0079 if om.lin.NS
0080     fprintf('\n%-18s %11s %8s %8s %8s\n', 'LINEAR CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0081     fprintf('%-18s %11s %8s %8s %8s\n', '==================', '------', '-----', '-----', '------');
0082     idx = om.lin.idx;
0083     for k = 1:om.lin.NS
0084         name = om.lin.order(k).name;
0085         if isempty(om.lin.order(k).idx)
0086             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0087         else
0088             vsidx = om.lin.order(k).idx;
0089             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0090             s = substruct('.', name, '()', vsidx);
0091             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0092             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0093                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0094         end
0095     end
0096     fprintf('%10d = lin.NS%29d = lin.N\n\n', om.lin.NS, om.lin.N);
0097 else
0098     fprintf('%s  :  <none>\n', 'LINEAR CONSTRAINTS');
0099 end
0100 if om.qdc.NS
0101     fprintf('\n%-17s %12s %8s %8s %8s\n', 'QUADRATIC COSTS', 'name', 'i1', 'iN', 'N');
0102     fprintf('%-17s %12s %8s %8s %8s\n', '===============', '------', '-----', '-----', '------');
0103     idx = om.qdc.idx;
0104     for k = 1:om.qdc.NS
0105         name = om.qdc.order(k).name;
0106         if isempty(om.qdc.order(k).idx)
0107             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0108         else
0109             vsidx = om.qdc.order(k).idx;
0110             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0111             s = substruct('.', name, '()', vsidx);
0112             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0113             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0114                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0115         end
0116     end
0117     fprintf('%10d = qdc.NS%28d = qdc.N\n\n', om.qdc.NS, om.qdc.N);
0118 else
0119     fprintf('%s  :  <none>\n', 'QUADRATIC COSTS');
0120 end
0121 if om.nlc.NS
0122     fprintf('\n%-17s %12s %8s %8s %8s\n', 'GEN NONLIN COSTS', 'name', 'i1', 'iN', 'N');
0123     fprintf('%-17s %12s %8s %8s %8s\n', '================', '------', '-----', '-----', '------');
0124     idx = om.nlc.idx;
0125     for k = 1:om.nlc.NS
0126         name = om.nlc.order(k).name;
0127         if isempty(om.nlc.order(k).idx)
0128             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0129         else
0130             vsidx = om.nlc.order(k).idx;
0131             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0132             s = substruct('.', name, '()', vsidx);
0133             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0134             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0135                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0136         end
0137     end
0138     fprintf('%10d = nlc.NS%28d = nlc.N\n\n', om.nlc.NS, om.nlc.N);
0139 else
0140     fprintf('%s  :  <none>\n', 'GEN NONLIN COSTS');
0141 end
0142 if om.cost.NS
0143     fprintf('\n%-17s %12s %8s %8s %8s\n', 'LEGACY COSTS', 'name', 'i1', 'iN', 'N');
0144     fprintf('%-17s %12s %8s %8s %8s\n', '============', '------', '-----', '-----', '------');
0145     idx = om.cost.idx;
0146     for k = 1:om.cost.NS
0147         name = om.cost.order(k).name;
0148         if isempty(om.cost.order(k).idx)
0149             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0150         else
0151             vsidx = om.cost.order(k).idx;
0152             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0153             s = substruct('.', name, '()', vsidx);
0154             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0155             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0156                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0157         end
0158     end
0159     fprintf('%10d = cost.NS%28d = cost.N\n\n', om.cost.NS, om.cost.N);
0160 else
0161     fprintf('%s  :  <none>\n', 'LEGACY COSTS');
0162 end
0163 
0164 fprintf('  userdata = ');
0165 if ~isempty(fieldnames(om.userdata))
0166     fprintf('\n');
0167 end
0168 if have_fcn('octave')
0169     fprintf('    <scalar struct>\n');
0170 else
0171     display(om.userdata);
0172 end

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005