Home > matpower5.1 > @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-2015 by Power System Engineering Research Center (PSERC)
0010 %   by Ray Zimmerman, PSERC Cornell
0011 %
0012 %   $Id: display.m 2644 2015-03-11 19:34:22Z ray $
0013 %
0014 %   This file is part of MATPOWER.
0015 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0016 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0017 
0018 if om.var.NS
0019     fprintf('\n%-17s %12s %8s %8s %8s\n', 'VARIABLES', 'name', 'i1', 'iN', 'N');
0020     fprintf('%-17s %12s %8s %8s %8s\n', '=========', '------', '-----', '-----', '------');
0021     idx = om.var.idx;
0022     for k = 1:om.var.NS
0023         name = om.var.order(k).name;
0024         if isempty(om.var.order(k).idx)
0025             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0026         else
0027             vsidx = om.var.order(k).idx;
0028             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0029             s = substruct('.', name, '()', vsidx);
0030             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0031             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0032                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0033         end
0034     end
0035     fprintf('%10d = var.NS%29d = var.N\n', om.var.NS, om.var.N);
0036 %     for k = 1:om.var.NS
0037 %         name = om.var.order(k).name;
0038 %         if isscalar(idx.N.(name))
0039 %             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0040 %         else
0041 %             d = size(idx.N.(name));     %% dimensions of this named set
0042 %             nn = prod(d);               %% total number of blocks in named set
0043 %             temp = cell(size(d));
0044 %             [temp{end:-1:1}] = ind2sub(d(end:-1:1), (1:nn)');
0045 %             ss = num2cell([temp{:}]);   %% table of indices
0046 %             str = '%d'; for m = 2:length(d), str = [str ',%d']; end
0047 %             for i = 1:nn
0048 %                 s = substruct('.', name, '()', {ss{i,:}});
0049 %                 nname = sprintf(['%s(' str, ')'], name, ss{i,:});
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 %     end
0055 %     fprintf('%10s%38s\n', sprintf('var.NS = %d', om.var.NS), sprintf('var.N = %d', om.var.N));
0056     fprintf('\n');
0057 else
0058     fprintf('%s  :  <none>\n', 'VARIABLES');
0059 end
0060 if om.nln.NS
0061     fprintf('\n%-17s %12s %8s %8s %8s\n', 'NON-LINEAR CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0062     fprintf('%-17s %12s %8s %8s %8s\n', '======================', '------', '-----', '-----', '------');
0063     idx = om.nln.idx;
0064     for k = 1:om.nln.NS
0065         name = om.nln.order(k).name;
0066         fprintf('%15d:%12s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0067     end
0068     fprintf('%10d = nln.NS%29d = nln.N\n', om.nln.NS, om.nln.N);
0069     fprintf('\n');
0070 else
0071     fprintf('%s  :  <none>\n', 'NON-LINEAR CONSTRAINTS');
0072 end
0073 if om.lin.NS
0074     fprintf('\n%-17s %12s %8s %8s %8s\n', 'LINEAR CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0075     fprintf('%-17s %12s %8s %8s %8s\n', '==================', '------', '-----', '-----', '------');
0076     idx = om.lin.idx;
0077     for k = 1:om.lin.NS
0078         name = om.lin.order(k).name;
0079         if isempty(om.lin.order(k).idx)
0080             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0081         else
0082             vsidx = om.lin.order(k).idx;
0083             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0084             s = substruct('.', name, '()', vsidx);
0085             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0086             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0087                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0088         end
0089     end
0090     fprintf('%10d = lin.NS%29d = lin.N\n', om.lin.NS, om.lin.N);
0091     fprintf('\n');
0092 else
0093     fprintf('%s  :  <none>\n', 'LINEAR CONSTRAINTS');
0094 end
0095 if om.cost.NS
0096     fprintf('\n%-17s %12s %8s %8s %8s\n', 'COSTS', 'name', 'i1', 'iN', 'N');
0097     fprintf('%-17s %12s %8s %8s %8s\n', '=====', '------', '-----', '-----', '------');
0098     idx = om.cost.idx;
0099     for k = 1:om.cost.NS
0100         name = om.cost.order(k).name;
0101         if isempty(om.cost.order(k).idx)
0102             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0103         else
0104             vsidx = om.cost.order(k).idx;
0105             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0106             s = substruct('.', name, '()', vsidx);
0107             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0108             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0109                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0110         end
0111     end
0112     fprintf('%10d = cost.NS%28d = cost.N\n', om.cost.NS, om.cost.N);
0113     fprintf('\n');
0114 else
0115     fprintf('%s  :  <none>\n', 'COSTS');
0116 end
0117 
0118 fprintf('  userdata = ');
0119 if ~isempty(fieldnames(om.userdata))
0120     fprintf('\n');
0121 end
0122 if have_fcn('octave')
0123     fprintf('    <scalar struct>\n');
0124 else
0125     display(om.userdata);
0126 end

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005