solvers.ENV
- solver_env_statevec_analyzer(self, phase, it, e)
SOLVER_ENV_STATEVEC_ANALYZER Full state-vector coupling for SolverENV.
Alternative to the mean-field analyzer (solver_env_meanfield_analyzer). Instead of collapsing each stage to marginal mean queue lengths and re-seeding the next stage with initFromMarginal, this analyzer carries the entire state probability vector across environment switches and propagates it with the CTMC transient (matrix-exponential action) on the per-stage generator.
For each stage e with infinitesimal generator Q_e (supplied by a SolverCTMC inner solver) and entry distribution pi_enter{e}, one iteration computes the transient pi(t) = pi_enter{e} * exp(Q_e t) over the stage time span, then:
the exit distribution toward each destination h, pi_exit{e}{h}, as the expectation of pi(t) at the (random) e->h transition time, weighted by the increments of the e->h transition CDF proc{e}{h};
the sojourn-end distribution pi_timeavg{e}, weighted by the overall stage holding-time CDF holdTime{e}, used in the environment-averaged blend.
- Entry distributions are chained as
pi_enter{e} = sum_h probOrig(h,e) * resetStateFun{h,e}(pi_exit{h}{e}),
renormalised, and iterated to an L1 fixed point. The blend reuses the discipline-aware CTMC marginal mapping (solver_ctmc_avg_from_pi).
This weighting scheme is identical to solver_env_meanfield_analyzer; the sole difference is that the full joint distribution is propagated and chained rather than its marginal means, so the two agree when the marginal collapse is exact and differ when inter-class/inter-station correlations matter.
Backend: requires a SolverCTMC inner solver (an explicit enumerated generator and state space). MAM/LDQBD backends are not yet supported.
- Phase dispatch (called by the SolverENV EnsembleSolver hooks):
‘pre’ pre_(self,it) -> [] ‘analyze’ analyze_(self,it,e) -> [results_e, runtime] ‘post’ post_(self,it) -> [] ‘finish’ finish_(self) -> [] ‘converged’ converged_(self,it) -> bool
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- solver_env_meanfield_analyzer(self, phase, it, e)
SOLVER_ENV_MEANFIELD_ANALYZER Mean-field (marginal mean queue-length) coupling for SolverENV.
This analyzer implements the default (and historical) SolverENV coupling: every stage is solved transiently and reduced to its marginal mean queue lengths, which are carried across environment switches via initFromMarginal. This mean-field collapse discards the joint state distribution at the handoff; see solver_env_statevec_analyzer for the full state-vector alternative. It is the default analyzer (options.method other than ‘statevec’).
METHOD ‘meancov’ RUNS HERE TOO, and carries a COVARIANCE beside the mean. The propagation is the mean-field one – same sojourn average, same probOrig mixture, same fixed point – so it lives here rather than in an analyzer of its own, which would fork the whole exit/mixture/reseed path to change only the object being carried. What is added at each step:
- exit Cov[Q(T)] = E_T[Cov(Q(t)|t)] + Cov_T[E(Q(t)|t)], the law of total
variance over the random sojourn T. The first term is the WITHIN-STAGE covariance, taken from the stage solver when it integrates one (getTranAvgVar, i.e. SolverFLD ‘kp’ or ‘dae’) and zero otherwise; the second is the TIMING variance, which the sojourn law contributes whatever the stage solver is. A deterministic sojourn has no timing variance and the exit covariance is C(d).
- mixture over the origins h of a switch into e, again by the law of total
variance: sum_h p_h (C_h + m_h m_h’) - m m’. A convex combination of the C_h ALONE is wrong and silently so: it drops the spread of the per-origin means, which is most of the variance when the stages differ, and the answer still looks like a covariance.
- reseed options.config.init_qlen / init_qcov on the stage solver, beside the
usual initFromMarginal. Both are in the (station,class) index space ir = (r-1)*M+i, so this analyzer never builds a phase-layout object: the lift into phases belongs to the stage solver that owns the layout (solver_fluid_kp).
A stage solver that reports no covariance and reads no seed still runs, and then ‘meancov’ returns the ‘meanfield’ means with the environment-induced second moment reported beside them (SolverENV.getAvgQLenCov).
- Phase dispatch (called by the SolverENV EnsembleSolver hooks):
‘pre’ pre_(self,it) -> [] ‘analyze’ analyze_(self,it,e) -> [results_e, runtime] ‘post’ post_(self,it) -> [] ‘finish’ finish_(self) -> [] ‘converged’ converged_(self,it) -> bool
Copyright (c) 2012-2026, Imperial College London All rights reserved.