![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
SolverUQ: uncertainty quantification by expansion over a Prior. More...
#include <algorithm>#include <cstddef>#include <functional>#include <string>#include <utility>#include <vector>#include "line/api/pfqn/pfqn_mva_interval.h"#include "line/lang/lang_types.h"#include "line/lang/prior.h"#include "line/lang/qn/feature_set.h"#include "line/lang/qn/network_builder.h"#include "line/lang/qn/network_struct.h"#include "line/num/number.h"#include "line/solvers/mva/solver_mva_runner.h"#include "line/util/error.h"Go to the source code of this file.
Classes | |
| struct | line::uq::UqOptions |
| UQ.defaultOptions plus the stream the Monte Carlo design draws from. More... | |
| struct | line::uq::PriorSite< T > |
| Where a Prior sits in the model, MATLAB's priorInfo entry. More... | |
| struct | line::uq::UqDesignPoint< T > |
| One design point: a concrete distribution for every Prior, and its weight. More... | |
| struct | line::uq::UqSolution< T > |
| What solver_uq_run_analyzer returns. More... | |
| class | line::uq::SolverUq< T > |
| The ensemble surface of UQ: @UQ's EnsembleSolver implementation. More... | |
| struct | line::uq::UqMoments< T > |
| The weighted mean and variance of a metric over the design. More... | |
| struct | line::uq::UqEmpiricalCdf< T > |
| The weighted empirical law of a metric, sorted ascending; MATLAB's EmpiricalCDF. More... | |
| struct | line::uq::UqInterval< T > |
| UQ.getInterval: the RANGE of every metric over the support of the Priors. More... | |
Namespaces | |
| namespace | line |
| namespace | line::uq |
Typedefs | |
| template<class T> | |
| using | line::uq::UqStageSolver = std::function<mva::AvgResult<T>(const qn::NetworkStruct<T>&)> |
| What solves one design point: the C++ spelling of @(m) SolverXXX(m). | |
Functions | |
| std::string | line::uq::uq_resolve_method (const std::string &m) |
| UQ.getUQMethod: resolve the discretization method. | |
| std::vector< std::string > | line::uq::uq_list_valid_methods () |
| UQ.listValidMethods. | |
| qn::FeatureSet | line::uq::uq_feature_set () |
| UQ.getFeatureSet: the one construct UQ adds, and nothing else. | |
| template<class T> | |
| std::vector< PriorSite< T > > | line::uq::uq_detect_priors (const qn::NetworkStruct< T > &sn) |
| UQ.detectPriors: find every Prior, in node order and then class order. | |
| template<class T> | |
| std::vector< UqDesignPoint< T > > | line::uq::uq_build_design (const std::vector< PriorSite< T > > &sites, const UqOptions &opt) |
| UQ.buildDesign: reduce the detected Priors to weighted design points. | |
| template<class T> | |
| void | line::uq::uq_aggregate (UqSolution< T > &sol) |
| UQ.aggregateResults: the prior-weighted expectation of the solved points. | |
| template<class T> | |
| UqSolution< T > | line::uq::solver_uq_run_analyzer (qn::Network< T > &net, const UqStageSolver< T > &stage, const UqOptions &opt=UqOptions()) |
| UQ.runAnalyzer as a free call: expand, solve every design point, aggregate. | |
| template<class T> | |
| const Matrix< T > & | line::uq::uq_metric_matrix (const mva::AvgResult< T > &r, const std::string &metric) |
The metric matrix a name selects, MATLAB's res.Avg. | |
| template<class T> | |
| std::vector< T > | line::uq::uq_samples (const UqSolution< T > &sol, const std::string &metric, std::size_t ist, std::size_t r) |
| UQ.getSamples: the value of one metric at every design point, with weights. | |
| template<class T> | |
| UqMoments< T > | line::uq::uq_moments (const UqSolution< T > &sol, const std::string &metric, std::size_t ist, std::size_t r) |
| UQ.getMoments: the unconditional mean of Trivedi and Bobbio Eq. | |
| template<class T> | |
| UqEmpiricalCdf< T > | line::uq::uq_posterior_cdf (const UqSolution< T > &sol, const std::string &metric, std::size_t ist, std::size_t r) |
| UQ.getPosteriorDist: the posterior law of a metric across the design. | |
| template<class T> | |
| std::pair< T, T > | line::uq::uq_credible_interval (const UqSolution< T > &sol, const std::string &metric, std::size_t ist, std::size_t r, double level=0.95) |
| UQ.getCredibleInterval: the equal-tailed interval of the weighted empirical law at coverage level. | |
| template<class T> | |
| std::pair< T, T > | line::uq::uq_prior_mean_range (const lang::Distrib< T > &prior, std::size_t n) |
| UQ.priorMeanRange: the range of a Prior's MEAN over its alternatives. | |
| template<class T> | |
| std::pair< bool, std::string > | line::uq::uq_qualifies_for_interval_mva (const qn::NetworkStruct< T > &sn, const std::vector< PriorSite< T > > &sites) |
| UQ.qualifiesForIntervalMVA: whether the monotonicity theorems behind pfqn_mva_interval hold for this model. | |
| template<class T> | |
| UqInterval< T > | line::uq::uq_interval_by_mva (const qn::NetworkStruct< T > &sn, const std::vector< PriorSite< T > > &sites, std::size_t nodes) |
| UQ.intervalByMVA: the exact hull through pfqn_mva_interval. | |
| template<class T> | |
| UqInterval< T > | line::uq::uq_interval_by_sampling (const UqSolution< T > &sol) |
| UQ.intervalBySampling: the range of each metric across the design points that were actually solved. | |
| template<class T> | |
| UqInterval< T > | line::uq::uq_interval (const UqSolution< T > &sol, const qn::NetworkStruct< T > &sn) |
| UQ.getInterval: the exact hull where the monotonicity theorems apply, the sampled range otherwise. | |
| template<class T> | |
| UqInterval< T > | line::uq::uq_interval_run (qn::Network< T > &net, const UqStageSolver< T > &stage, const UqOptions &opt=UqOptions()) |
| getInterval from the model, running the ensemble ONLY when it is needed. | |
Variables | |
| constexpr std::size_t | line::uq::kMaxDesignPoints = 4096 |
| The cap on the tensor-product design, MATLAB UQ.MaxDesignPoints. | |
SolverUQ: uncertainty quantification by expansion over a Prior.
Port of matlab/src/solvers/UQ/@@UQ/UQ.m. The model carries one or more Prior distributions (lang/prior.h); UQ reduces them to a set of weighted DESIGN POINTS, each of which is a concrete model with every Prior replaced by one alternative, solves each with an ordinary solver, and reports the prior-weighted expectation of every metric together with the per-point results the expectation was formed from.
WHAT THE WEIGHTS MEAN. E[Q] = sum_l w_l Q(theta_l) is the unconditional expectation of Trivedi and Bobbio (2017), Eq. (3.68): an average over MODELS, not over jobs. Its spread – uq_moments, uq_credible_interval – is the epistemic uncertainty in the answer, and it is the reason the per-point table is kept rather than reduced away: a mean of 4.2 over points at 1.1 and 12.4 is a different statement from a mean of 4.2 over points at 4.1 and 4.3, and only the design carries the difference.
THE DESIGN, and why it is a tensor product. Each Prior is discretized on its own and the design is the product of the per-Prior alternative sets, so the joint weight is the product of the marginal weights. That is the product-density case of f(theta_1, ..., theta_l) in Eq. (3.67) and it ASSUMES THE PRIORS ARE INDEPENDENT; a joint prior over several parameters is not expressible here, in this port or in the reference. The size is capped at kMaxDesignPoints because a design point is a full solver run, and beyond the cap the Monte Carlo design – whose cost does not grow with the number of Priors – is the right tool. The cap REFUSES rather than truncating: a design silently cut to 4096 of 20000 points would report an expectation against a prior nobody wrote.
WHAT SOLVES A DESIGN POINT is supplied by the caller as a UqStageSolver, the C++ spelling of the reference's solverFactory argument (UQ(model, @@SolverMVA)). There is no default: the inner solver decides both the accuracy and the admissible feature set of every number reported here, and choosing one silently would answer a question the caller did not ask. uq_dispatch.h builds one from a solver name.
THE FEATURE GATE IS THE INNER SOLVER'S. UQ itself declares only Prior (uq_feature_set) and applies no feature gate of its own; what UQ.supports decides is only whether the model carries a Prior at all. The real check happens per design point, inside the stage solver, on a model from which the Prior has already been removed; that is what makes "SolverMVA cannot solve this model" reach the caller as SolverMVA's own refusal instead of a UQ paraphrase of it.
Definition in file solver_uq.h.