Home > matpower6.0 > @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-2016, 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 http://www.pserc.cornell.edu/matpower/ 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', om.var.NS, om.var.N);
0034 %     for k = 1:om.var.NS
0035 %         name = om.var.order(k).name;
0036 %         if isscalar(idx.N.(name))
0037 %             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0038 %         else
0039 %             d = size(idx.N.(name));     %% dimensions of this named set
0040 %             nn = prod(d);               %% total number of blocks in named set
0041 %             temp = cell(size(d));
0042 %             [temp{end:-1:1}] = ind2sub(d(end:-1:1), (1:nn)');
0043 %             ss = num2cell([temp{:}]);   %% table of indices
0044 %             str = '%d'; for m = 2:length(d), str = [str ',%d']; end
0045 %             for i = 1:nn
0046 %                 s = substruct('.', name, '()', {ss{i,:}});
0047 %                 nname = sprintf(['%s(' str, ')'], name, ss{i,:});
0048 %                 fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0049 %                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0050 %             end
0051 %         end
0052 %     end
0053 %     fprintf('%10s%38s\n', sprintf('var.NS = %d', om.var.NS), sprintf('var.N = %d', om.var.N));
0054     fprintf('\n');
0055 else
0056     fprintf('%s  :  <none>\n', 'VARIABLES');
0057 end
0058 if om.nln.NS
0059     fprintf('\n%-17s %12s %8s %8s %8s\n', 'NON-LINEAR CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0060     fprintf('%-17s %12s %8s %8s %8s\n', '======================', '------', '-----', '-----', '------');
0061     idx = om.nln.idx;
0062     for k = 1:om.nln.NS
0063         name = om.nln.order(k).name;
0064         fprintf('%15d:%12s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0065     end
0066     fprintf('%10d = nln.NS%29d = nln.N\n', om.nln.NS, om.nln.N);
0067     fprintf('\n');
0068 else
0069     fprintf('%s  :  <none>\n', 'NON-LINEAR CONSTRAINTS');
0070 end
0071 if om.lin.NS
0072     fprintf('\n%-17s %12s %8s %8s %8s\n', 'LINEAR CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0073     fprintf('%-17s %12s %8s %8s %8s\n', '==================', '------', '-----', '-----', '------');
0074     idx = om.lin.idx;
0075     for k = 1:om.lin.NS
0076         name = om.lin.order(k).name;
0077         if isempty(om.lin.order(k).idx)
0078             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0079         else
0080             vsidx = om.lin.order(k).idx;
0081             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0082             s = substruct('.', name, '()', vsidx);
0083             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0084             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0085                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0086         end
0087     end
0088     fprintf('%10d = lin.NS%29d = lin.N\n', om.lin.NS, om.lin.N);
0089     fprintf('\n');
0090 else
0091     fprintf('%s  :  <none>\n', 'LINEAR CONSTRAINTS');
0092 end
0093 if om.cost.NS
0094     fprintf('\n%-17s %12s %8s %8s %8s\n', 'COSTS', 'name', 'i1', 'iN', 'N');
0095     fprintf('%-17s %12s %8s %8s %8s\n', '=====', '------', '-----', '-----', '------');
0096     idx = om.cost.idx;
0097     for k = 1:om.cost.NS
0098         name = om.cost.order(k).name;
0099         if isempty(om.cost.order(k).idx)
0100             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0101         else
0102             vsidx = om.cost.order(k).idx;
0103             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0104             s = substruct('.', name, '()', vsidx);
0105             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0106             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0107                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0108         end
0109     end
0110     fprintf('%10d = cost.NS%28d = cost.N\n', om.cost.NS, om.cost.N);
0111     fprintf('\n');
0112 else
0113     fprintf('%s  :  <none>\n', 'COSTS');
0114 end
0115 
0116 fprintf('  userdata = ');
0117 if ~isempty(fieldnames(om.userdata))
0118     fprintf('\n');
0119 end
0120 if have_fcn('octave')
0121     fprintf('    <scalar struct>\n');
0122 else
0123     display(om.userdata);
0124 end

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005