Home > matpower5.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 %   $Id: display.m 2067 2012-07-20 20:33:34Z cvs $
0010 %   by Ray Zimmerman, PSERC Cornell
0011 %   Copyright (c) 2008-2012 by Power System Engineering Research Center (PSERC)
0012 %
0013 %   This file is part of MATPOWER.
0014 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0015 %
0016 %   MATPOWER is free software: you can redistribute it and/or modify
0017 %   it under the terms of the GNU General Public License as published
0018 %   by the Free Software Foundation, either version 3 of the License,
0019 %   or (at your option) any later version.
0020 %
0021 %   MATPOWER is distributed in the hope that it will be useful,
0022 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0023 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0024 %   GNU General Public License for more details.
0025 %
0026 %   You should have received a copy of the GNU General Public License
0027 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0028 %
0029 %   Additional permission under GNU GPL version 3 section 7
0030 %
0031 %   If you modify MATPOWER, or any covered work, to interface with
0032 %   other modules (such as MATLAB code and MEX-files) available in a
0033 %   MATLAB(R) or comparable environment containing parts covered
0034 %   under other licensing terms, the licensors of MATPOWER grant
0035 %   you additional permission to convey the resulting work.
0036 
0037 if om.var.NS
0038     fprintf('\n%-17s %12s %8s %8s %8s\n', 'VARIABLES', 'name', 'i1', 'iN', 'N');
0039     fprintf('%-17s %12s %8s %8s %8s\n', '=========', '------', '-----', '-----', '------');
0040     idx = om.var.idx;
0041     for k = 1:om.var.NS
0042         name = om.var.order(k).name;
0043         if isempty(om.var.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.var.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 = var.NS%29d = var.N\n', om.var.NS, om.var.N);
0055 %     for k = 1:om.var.NS
0056 %         name = om.var.order(k).name;
0057 %         if isscalar(idx.N.(name))
0058 %             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0059 %         else
0060 %             d = size(idx.N.(name));     %% dimensions of this named set
0061 %             nn = prod(d);               %% total number of blocks in named set
0062 %             temp = cell(size(d));
0063 %             [temp{end:-1:1}] = ind2sub(d(end:-1:1), (1:nn)');
0064 %             ss = num2cell([temp{:}]);   %% table of indices
0065 %             str = '%d'; for m = 2:length(d), str = [str ',%d']; end
0066 %             for i = 1:nn
0067 %                 s = substruct('.', name, '()', {ss{i,:}});
0068 %                 nname = sprintf(['%s(' str, ')'], name, ss{i,:});
0069 %                 fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0070 %                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0071 %             end
0072 %         end
0073 %     end
0074 %     fprintf('%10s%38s\n', sprintf('var.NS = %d', om.var.NS), sprintf('var.N = %d', om.var.N));
0075     fprintf('\n');
0076 else
0077     fprintf('%s  :  <none>\n', 'VARIABLES');
0078 end
0079 if om.nln.NS
0080     fprintf('\n%-17s %12s %8s %8s %8s\n', 'NON-LINEAR CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0081     fprintf('%-17s %12s %8s %8s %8s\n', '======================', '------', '-----', '-----', '------');
0082     idx = om.nln.idx;
0083     for k = 1:om.nln.NS
0084         name = om.nln.order(k).name;
0085         fprintf('%15d:%12s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0086     end
0087     fprintf('%10d = nln.NS%29d = nln.N\n', om.nln.NS, om.nln.N);
0088     fprintf('\n');
0089 else
0090     fprintf('%s  :  <none>\n', 'NON-LINEAR CONSTRAINTS');
0091 end
0092 if om.lin.NS
0093     fprintf('\n%-17s %12s %8s %8s %8s\n', 'LINEAR CONSTRAINTS', 'name', 'i1', 'iN', 'N');
0094     fprintf('%-17s %12s %8s %8s %8s\n', '==================', '------', '-----', '-----', '------');
0095     idx = om.lin.idx;
0096     for k = 1:om.lin.NS
0097         name = om.lin.order(k).name;
0098         if isempty(om.lin.order(k).idx)
0099             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0100         else
0101             vsidx = om.lin.order(k).idx;
0102             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0103             s = substruct('.', name, '()', vsidx);
0104             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0105             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0106                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0107         end
0108     end
0109     fprintf('%10d = lin.NS%29d = lin.N\n', om.lin.NS, om.lin.N);
0110     fprintf('\n');
0111 else
0112     fprintf('%s  :  <none>\n', 'LINEAR CONSTRAINTS');
0113 end
0114 if om.cost.NS
0115     fprintf('\n%-17s %12s %8s %8s %8s\n', 'COSTS', 'name', 'i1', 'iN', 'N');
0116     fprintf('%-17s %12s %8s %8s %8s\n', '=====', '------', '-----', '-----', '------');
0117     idx = om.cost.idx;
0118     for k = 1:om.cost.NS
0119         name = om.cost.order(k).name;
0120         if isempty(om.cost.order(k).idx)
0121             fprintf('%10d:%19s %8d %8d %8d\n', k, name, idx.i1.(name), idx.iN.(name), idx.N.(name));
0122         else
0123             vsidx = om.cost.order(k).idx;
0124             str = '%d'; for m = 2:length(vsidx), str = [str ',%d']; end
0125             s = substruct('.', name, '()', vsidx);
0126             nname = sprintf(['%s(' str, ')'], name, vsidx{:});
0127             fprintf('%10d:%19s %8d %8d %8d\n', k, nname, ...
0128                     subsref(idx.i1, s), subsref(idx.iN, s), subsref(idx.N, s));
0129         end
0130     end
0131     fprintf('%10d = cost.NS%28d = cost.N\n', om.cost.NS, om.cost.N);
0132     fprintf('\n');
0133 else
0134     fprintf('%s  :  <none>\n', 'COSTS');
0135 end
0136 
0137 fprintf('  userdata = ');
0138 if ~isempty(fieldnames(om.userdata))
0139     fprintf('\n');
0140 end
0141 if have_fcn('octave')
0142     fprintf('    <scalar struct>\n');
0143 else
0144     display(om.userdata);
0145 end

Generated on Mon 26-Jan-2015 15:21:31 by m2html © 2005