LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
cd_peak_scaling.m
1function bmax = cd_peak_scaling(beta, NK, K) %#ok<INUSD>
2% CD_PEAK_SCALING Peak of a class-dependence handle over the population lattice
3%
4% bmax = CD_PEAK_SCALING(beta, NK, K)
5%
6% Peak of the class-dependence handle over the reachable population lattice
7% 0 <= n(r) <= NK(r). The handle returns either a scalar (shared by every
8% class) or a length-K vector, so the peak is taken over both the states and
9% the classes: utilization is a per-station quantity, so the whole station
10% shares one normalizer, as it does for max(lldscaling(ist,:)).
11%
12% This is the single normalizer used to report utilization at stations with
13% limited class dependence, U = T*S/bmax, so that every solver follows the
14% same convention as solver_ncld does for lldscaling (U/max(lldscaling)).
15
16bmax = 0;
17n = pprod_init(NK);
18while n(1) >= 0
19 if sum(n) > 0
20 v = beta(n);
21 v = v(isfinite(v));
22 if ~isempty(v)
23 bmax = max(bmax, max(v));
24 end
25 end
26 n = pprod_next(n, NK);
27end
28end
29
30function n = pprod_init(N)
31n = zeros(size(N));
32end
33
34function n = pprod_next(n, N)
35R = length(N);
36if all(n == N)
37 n = -1 * ones(1, R);
38 return
39end
40s = R;
41while s > 0 && n(s) == N(s)
42 n(s) = 0;
43 s = s - 1;
44end
45if s > 0
46 n(s) = n(s) + 1;
47end
48end
Definition Station.m:245