LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pfqn_nrp.m
1%{
2%{
3 % @file pfqn_nrp.m
4 % @brief Normalizing constant via Normal Radius-Probit (NRP) approximation.
5%}
6%}
7
8%{
9%{
10 % @brief Normalizing constant via Normal Radius-Probit (NRP) approximation.
11 % @fn pfqn_nrp(L, N, Z, alpha, options)
12 % @param L Service demand matrix.
13 % @param N Population vector.
14 % @param Z Think time vector.
15 % @param alpha Load-dependent rate matrix.
16 % @param options Solver options.
17 % @return lG Logarithm of normalizing constant.
18%}
19%}
20function [lG] = pfqn_nrp(L,N,Z,alpha,options)
21if sum(N)<0
22 lG=-Inf;
23 return
24end
25if sum(N)==0
26 lG=0;
27 return
28end
29[M,R]=size(L);
30Nt = sum(N);
31if sum(Z)>0
32 L = [L;Z];
33 alpha(end+1,1:Nt)=1:Nt;
34end
35if M==1 && sum(Z)==0
36 [~,lG] = pfqn_gld(L,N,alpha);
37 return
38else
39 Lmax = max(L);
40end
41L = L./repmat(Lmax,size(L,1),1); % scale demands in [0,1]
42x0 = zeros(1,R);
43[~,~,lG] = laplaceapprox(@(x) infradius_hnorm(x, L, N,alpha),x0);
44lG = real(lG + N*log(Lmax'));
45end