1%{ @file sn_set_population.m
2 % @brief Sets the number of jobs
for a closed
class
4 % @author LINE Development Team
8 % @brief Sets the number of jobs
for a closed
class
11 % Directly modifies the job population in NetworkStruct and recalculates
16 % sn = sn_set_population(sn, classIdx, nJobs)
17 % sn = sn_set_population(sn, classIdx, nJobs, autoRefresh)
22 % <tr><th>Name<th>Description
23 % <tr><td>sn<td>Network structure
24 % <tr><td>classIdx<td>Class index (1-based)
25 % <tr><td>nJobs<td>Number of jobs (non-negative)
26 % <tr><td>autoRefresh<td>If
true, refresh visit ratios (
default false)
31 % <tr><th>Name<th>Description
32 % <tr><td>sn<td>Modified network structure
35function sn = sn_set_population(sn, classIdx, nJobs, autoRefresh)
37if nargin < 4 || isempty(autoRefresh)
42sn.njobs(classIdx) = nJobs;
44% Recalculate nclosedjobs
45sn.nclosedjobs = sum(sn.njobs(isfinite(sn.njobs)));
47% Auto-refresh visit ratios if requested
49 [~, ~, sn] = sn_refresh_visits(sn, sn.chains, sn.rt, sn.rtnodes);