1function QN = solveMeansForStruct(self, sn)
2% QN = SOLVEMEANSFORSTRUCT(SN) Mean queue lengths of a perturbed structure,
3% under
this solver
's own method.
5% This is the mean-value oracle behind the numerical-derivative path of
6% getMomentTable, getMomentChainTable and getMomentStationTable. The moment
7% identity Cov[n,n] = L dQ/dL does not care HOW the mean queue lengths were
8% obtained, only that they are the means of a product-form model as a function
9% of its demands. So rather than hand-differentiating each algorithm, the solver
10% is re-run on a perturbed structure and differentiated numerically.
12% Running THIS solver, rather than one chosen algorithm, is what makes the path
13% general: it covers every method of every solver, including the
14% normalizing-constant methods of SolverNC (comom, ca, le, mom, ...) and the
15% summation methods of SolverMVA (sum, esum), none of which any
16% hand-differentiated implementation reaches. Restricting the oracle to one
17% analyzer would restrict the moments to that analyzer's methods
for no
20% The perturbed SN
is injected by copying
the model and overwriting its cached
21% structure, then constructing a fresh solver of
this class with this solver's
22% options. The copy matters: Network
is a handle object (Model < Copyable <
23% handle), so writing sn on
the caller
's model would corrupt it, and the fresh
24% solver matters because a solver caches its results and would otherwise return
25% the unperturbed answer.
27% See also: getMomentStationTable, getMomentChainTable, getMomentTable.
29model = self.model.copy;
31model.hasStruct = true; % the copy must not regenerate and discard the perturbation
33solver = feval(class(self), model, self.getOptions);
34QN = solver.getAvgQLen();