LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::uq::SolverUq< T > Class Template Reference

The ensemble surface of UQ: @UQ's EnsembleSolver implementation. More...

#include <line/solvers/uq/solver_uq.h>

Public Member Functions

 SolverUq (qn::Network< T > &n, const UqStageSolver< T > &s, const UqOptions &o=UqOptions())
void init ()
 UQ.init: resolve the design; the ensemble itself is expanded per point.
void pre (int)
 UQ.pre: nothing to seed – the design points are independent models.
const mva::AvgResult< T > & analyze (int, std::size_t e)
 UQ.analyze: solve design point e (1-BASED, as the reference indexes it).
void post (int)
 UQ.post: the prior-weighted expectation over the points solved so far.
void finish ()
 UQ.finish: nothing to release.
bool converged (int it) const
 UQ.converged: one iteration is all UQ needs, the design being fixed.
const UqSolution< T > & iterate ()
 UQ.runAnalyzer: the whole lifecycle, in the reference's order.
qn::Network< T > expand (std::size_t e) const
 self.ensemble{e}: the model of design point e (1-based), Prior gone.
bool has_prior_distribution () const
 UQ.hasPriorDistribution.
std::size_t get_num_alternatives () const
 UQ.getNumAlternatives: design points, 1 when the model carries no Prior.
std::size_t get_number_of_models () const
 UQ.getNumberOfModels: the same count, under the EnsembleSolver's name.
std::vector< T > get_probabilities () const
 UQ.getProbabilities: the design weights, from the DESIGN not the solve.
std::size_t get_uq_nodes () const
 UQ.getUQNodes: nodes per continuous Prior.
const std::string & get_uq_method () const
 UQ.getUQMethod: the RESOLVED design name.
const std::vector< mva::AvgResult< T > > & get_ensemble_avg () const
 UQ.getEnsembleAvg: the per-point results, in the order they were solved.
const mva::AvgResult< T > & get_avg () const
 UQ.getAvg: the aggregate.
const std::vector< PriorSite< T > > & get_prior_info () const
 Where the Priors were found, the reference's priorInfo.
const std::vector< UqDesignPoint< T > > & get_design () const
 The design itself, one entry per point.
const UqSolution< T > & get_solution () const
 Everything above in one value, which is what the CLI and the tests read.

Detailed Description

template<class T>
class line::uq::SolverUq< T >

The ensemble surface of UQ: @UQ's EnsembleSolver implementation.

WHY A CLASS AND NOT ONLY solver_uq_run_analyzer. The reference is an EnsembleSolver, and the lifecycle it implements – init, pre, analyze, post, converged, finish – is not decoration: it is the surface a caller uses to drive the design POINT BY POINT, to inspect the ensemble before solving it, to substitute its own stage solver per point, or to distribute the points and aggregate afterwards. A single run function can do none of those, so the port carried the numbers of UQ without the way UQ is meant to be driven. SolverEnv in env/solver_env.h keeps the same lifecycle for the same reason.

ONE DELIBERATE DEVIATION: the reference's init materializes the whole ensemble (self.ensemble{i} is a deep model copy per design point) and this one does not – expand(e) builds the copy for point e on demand, because a 4096-point design would otherwise hold 4096 Networks alive to solve them one at a time. The expansion is a pure function of the design, so a caller that wants the model of point e asks for it and gets exactly what the reference's self.ensemble{e} holds.

net is taken by non-const reference because the expansion COPIES it once per design point and each copy is then refreshed – get_struct() re-derives rates, chains and visits, which is exactly what changing a service process requires and is why the substitution is done on the model rather than on a struct.

Definition at line 431 of file solver_uq.h.

Constructor & Destructor Documentation

◆ SolverUq()

template<class T>
line::uq::SolverUq< T >::SolverUq ( qn::Network< T > & n,
const UqStageSolver< T > & s,
const UqOptions & o = UqOptions() )
inline

Definition at line 433 of file solver_uq.h.

References init(), and line::InputError::InputError().

Member Function Documentation

◆ analyze()

template<class T>
const mva::AvgResult< T > & line::uq::SolverUq< T >::analyze ( int ,
std::size_t e )
inline

UQ.analyze: solve design point e (1-BASED, as the reference indexes it).

The result is APPENDED to points, so driving the ensemble in order gives the same points vector iterate() builds. Calling it out of order is a caller's choice and the order of points then follows the calls, which is why weights is appended beside it rather than indexed into.

Definition at line 465 of file solver_uq.h.

References expand(), line::qn::Network< T >::get_struct(), and line::InputError::InputError().

Referenced by iterate().

◆ converged()

template<class T>
bool line::uq::SolverUq< T >::converged ( int it) const
inline

UQ.converged: one iteration is all UQ needs, the design being fixed.

Definition at line 483 of file solver_uq.h.

Referenced by iterate().

◆ expand()

template<class T>
qn::Network< T > line::uq::SolverUq< T >::expand ( std::size_t e) const
inline

self.ensemble{e}: the model of design point e (1-based), Prior gone.

The reference names each copy <model>_alt<e>; this port keeps the copy's name because a qn::Network name is read back by the JSON writer and the LQN bridge, and renaming it would put a name no model file carries into whatever a caller does next with the expanded model.

Definition at line 506 of file solver_uq.h.

References line::uq::PriorSite< T >::arrival, line::uq::PriorSite< T >::cls, line::InputError::InputError(), line::uq::PriorSite< T >::node, line::qn::Network< T >::set_arrival(), and line::qn::Network< T >::set_service().

Referenced by analyze().

◆ finish()

template<class T>
void line::uq::SolverUq< T >::finish ( )
inline

UQ.finish: nothing to release.

Definition at line 480 of file solver_uq.h.

Referenced by iterate().

◆ get_avg()

template<class T>
const mva::AvgResult< T > & line::uq::SolverUq< T >::get_avg ( ) const
inline

UQ.getAvg: the aggregate.

Valid once post() has run.

Definition at line 549 of file solver_uq.h.

◆ get_design()

template<class T>
const std::vector< UqDesignPoint< T > > & line::uq::SolverUq< T >::get_design ( ) const
inline

The design itself, one entry per point.

Definition at line 555 of file solver_uq.h.

◆ get_ensemble_avg()

template<class T>
const std::vector< mva::AvgResult< T > > & line::uq::SolverUq< T >::get_ensemble_avg ( ) const
inline

UQ.getEnsembleAvg: the per-point results, in the order they were solved.

Definition at line 546 of file solver_uq.h.

◆ get_num_alternatives()

template<class T>
std::size_t line::uq::SolverUq< T >::get_num_alternatives ( ) const
inline

UQ.getNumAlternatives: design points, 1 when the model carries no Prior.

Definition at line 526 of file solver_uq.h.

◆ get_number_of_models()

template<class T>
std::size_t line::uq::SolverUq< T >::get_number_of_models ( ) const
inline

UQ.getNumberOfModels: the same count, under the EnsembleSolver's name.

Definition at line 529 of file solver_uq.h.

◆ get_prior_info()

template<class T>
const std::vector< PriorSite< T > > & line::uq::SolverUq< T >::get_prior_info ( ) const
inline

Where the Priors were found, the reference's priorInfo.

Definition at line 552 of file solver_uq.h.

◆ get_probabilities()

template<class T>
std::vector< T > line::uq::SolverUq< T >::get_probabilities ( ) const
inline

UQ.getProbabilities: the design weights, from the DESIGN not the solve.

Definition at line 532 of file solver_uq.h.

◆ get_solution()

template<class T>
const UqSolution< T > & line::uq::SolverUq< T >::get_solution ( ) const
inline

Everything above in one value, which is what the CLI and the tests read.

Definition at line 558 of file solver_uq.h.

◆ get_uq_method()

template<class T>
const std::string & line::uq::SolverUq< T >::get_uq_method ( ) const
inline

UQ.getUQMethod: the RESOLVED design name.

Definition at line 543 of file solver_uq.h.

◆ get_uq_nodes()

template<class T>
std::size_t line::uq::SolverUq< T >::get_uq_nodes ( ) const
inline

UQ.getUQNodes: nodes per continuous Prior.

Definition at line 540 of file solver_uq.h.

◆ has_prior_distribution()

template<class T>
bool line::uq::SolverUq< T >::has_prior_distribution ( ) const
inline

UQ.hasPriorDistribution.

Definition at line 523 of file solver_uq.h.

◆ init()

template<class T>
void line::uq::SolverUq< T >::init ( )
inline

UQ.init: resolve the design; the ensemble itself is expanded per point.

Definition at line 445 of file solver_uq.h.

References line::uq::uq_build_design(), line::uq::uq_detect_priors(), and line::uq::uq_resolve_method().

Referenced by iterate(), and SolverUq().

◆ iterate()

template<class T>
const UqSolution< T > & line::uq::SolverUq< T >::iterate ( )
inline

UQ.runAnalyzer: the whole lifecycle, in the reference's order.

Definition at line 486 of file solver_uq.h.

References analyze(), converged(), finish(), init(), line::NumericError::NumericError(), post(), and pre().

Referenced by line::uq::solver_uq_run_analyzer().

◆ post()

template<class T>
void line::uq::SolverUq< T >::post ( int )
inline

UQ.post: the prior-weighted expectation over the points solved so far.

Definition at line 477 of file solver_uq.h.

References line::uq::uq_aggregate().

Referenced by iterate().

◆ pre()

template<class T>
void line::uq::SolverUq< T >::pre ( int )
inline

UQ.pre: nothing to seed – the design points are independent models.

Definition at line 455 of file solver_uq.h.

Referenced by iterate().


The documentation for this class was generated from the following file: