3 % @file pfqn_mmsample2.m
4 % @brief Monte Carlo sampling
for repairman models
using McKenna-Mitra form.
10 % @brief Monte Carlo sampling
for repairman models
using McKenna-Mitra form.
11 % @fn pfqn_mmsample2(L, N, Z, samples)
12 % @param L Service demand vector.
13 % @param N Population vector.
14 % @param Z Think time vector.
15 % @param samples Number of samples.
16 % @
return G Normalizing constant estimate.
17 % @
return lG Logarithm of normalizing constant.
20function [G,lG] = pfqn_mmsample2(L,N,Z,samples)
21% [G,LG] = PFQN_MMSAMPLE2(L,N,Z,SAMPLES)
23% Monte carlo sampling
for normalizing constant of a repairmen model
24% based on McKenna-Mitra integral form
26% Scale so that all coefficients are >=1.
27scaleFactor = 1e-7 + min([L(:);Z(:)]);
31v = [rand(1,ceil(c*samples)),logspace(0,5,ceil(samples*(1-c)))]; % sample more below the mean of the exponential
34ZL = log(repmat(Z+L(1,1:R),size(u,1),1).*u);
36lG = max(lG) - sum(factln(N)); % get largest
37lG = lG + sum(N)*log(scaleFactor); % rescale