LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
sn_set_routing.m
1%{ @file sn_set_routing.m
2 % @brief Sets the routing matrix
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Sets the routing matrix for stateful nodes
9 %
10 % @details
11 % Replaces the rt matrix in NetworkStruct.
12 %
13 % @par Syntax:
14 % @code
15 % sn = sn_set_routing(sn, rt)
16 % sn = sn_set_routing(sn, rt, autoRefresh)
17 % @endcode
18 %
19 % @par Parameters:
20 % <table>
21 % <tr><th>Name<th>Description
22 % <tr><td>sn<td>Network structure
23 % <tr><td>rt<td>New routing matrix (nstateful*nclasses x nstateful*nclasses)
24 % <tr><td>autoRefresh<td>If true, refresh visit ratios (default false)
25 % </table>
26 %
27 % @par Returns:
28 % <table>
29 % <tr><th>Name<th>Description
30 % <tr><td>sn<td>Modified network structure
31 % </table>
32%}
33function sn = sn_set_routing(sn, rt, autoRefresh)
34
35if nargin < 3 || isempty(autoRefresh)
36 autoRefresh = false;
37end
38
39% Update rt matrix
40sn.rt = rt;
41
42% Auto-refresh visit ratios if requested
43if autoRefresh
44 sn = sn_refresh_visits(sn, sn.chains, sn.rt, sn.rtnodes);
45end
46
47end
Definition mmt.m:92