LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
sn_print_routing_matrix.m
1%{ @file sn_print_routing_matrix.m
2 % @brief Prints the routing matrix of the network
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Prints the routing matrix of the network
9 %
10 % @details
11 % This function displays the routing probabilities between nodes and classes
12 % in a human-readable format.
13 %
14 % @par Syntax:
15 % @code
16 % sn_print_routing_matrix(sn)
17 % sn_print_routing_matrix(sn, onlyclass)
18 % @endcode
19 %
20 % @par Parameters:
21 % <table>
22 % <tr><th>Name<th>Description
23 % <tr><td>sn<td>Network structure
24 % <tr><td>onlyclass<td>(Optional) Filter printing for a specific class
25 % </table>
26%}
27function sn_print_routing_matrix(sn, onlyclass)
28
29node_names = sn.nodenames;
30classnames = sn.classnames;
31rtnodes = sn.rtnodes;
32nnodes = sn.nnodes;
33nclasses = sn.nclasses;
34for i=1:nnodes
35 for r=1:nclasses
36 for j=1:nnodes
37 for s=1:nclasses
38 if rtnodes((i-1)*nclasses+r,(j-1)*nclasses+s)>0
39 if sn.nodetype(i) == NodeType.Cache
40 pr = 'state-dependent';
41 elseif sn.nodetype(i) == NodeType.Sink
42 continue
43 else
44 if sn.routing(i,r) == RoutingStrategy.DISABLED
45 %pr = 'Disabled';
46 continue
47 else
48 pr = num2str(rtnodes((i-1)*nclasses+r,(j-1)*nclasses+s),'%f');
49 end
50 end
51 if nargin==1
52 line_printf('\n%s [%s] => %s [%s] : Pr=%s',node_names{i}, classnames{r}, node_names{j}, classnames{s}, pr);
53 else
54 if strcmpi(classnames{r},onlyclass.name) || strcmpi(classnames{s},onlyclass.name)
55 line_printf('\n%s [%s] => %s [%s] : Pr=%s',node_names{i}, classnames{r}, node_names{j}, classnames{s}, pr);
56 end
57 end
58 end
59 end
60 end
61 end
62end
63line_printf('\n');
64end
Definition mmt.m:92