![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
#include <line/lang/qn/environment.h>
Classes | |
| struct | Reliability |
| getReliabilityTable: MTTF, MTTR, MTBF and availability of an environment built out of node breakdowns. More... | |
Public Member Functions | |
| Environment (const std::string &nm, std::size_t nstages) | |
| std::size_t | nstages () const |
| const std::string & | name () const |
| void | set_stage (std::size_t e, const std::string &nm, const std::string &type, const qn::NetworkStruct< T > &model) |
| addStage: name the stage and give it its network. | |
| void | set_lqn_stage (std::size_t e, const std::string &nm, const std::string &type, const lqn::LqnStruct< T > &model) |
| addStage with a LayeredNetwork: the stage holds a LAYERED model. | |
| bool | is_lqn (std::size_t e) const |
| True when stage e holds a LayeredNetwork rather than a flat network. | |
| bool | has_lqn_stages () const |
| True when ANY stage holds a LayeredNetwork. | |
| void | reject_lqn_stages (const std::string &who, const std::string &why) const |
| Refuse an environment carrying a LayeredNetwork stage, by name. | |
| void | add_transition (std::size_t e, std::size_t h, const lang::Distrib< T > &d, const ResetMarginal &reset=ResetMarginal()) |
| addTransition: enable e -> h with a distribution and a reset policy. | |
| const EnvStage< T > & | stage (std::size_t e) const |
| const EnvArc< T > & | arc (std::size_t e, std::size_t h) const |
| void | set_env_rate_reset (std::size_t e, std::size_t h, const ResetEnvRates< T > &f) |
| resetEnvRatesFun{e,h}: make the e -> h transition depend on the state the stage is left in. | |
| void | set_transition_dist (std::size_t e, std::size_t h, const lang::Distrib< T > &d) |
| Replace the distribution of an arc that is already declared. | |
| std::size_t | find_stage (const std::string &nm) const |
| The index of the stage called nm, or nstages() when there is none. | |
| void | set_reset (std::size_t e, std::size_t h, const ResetMarginal &reset) |
| Install a reset policy on an arc that is already declared. | |
| const std::vector< NodeFailure< T > > & | node_failures () const |
| nodeFailures, the declarative record of the breakdowns declared here. | |
| std::size_t | find_node_failure (const std::string &nm) const |
| findNodeFailure: the descriptor for nm, or node_failures().size(). | |
| void | add_node_breakdown (std::size_t up, std::size_t down, const qn::NetworkStruct< T > &base, const std::string &node_name, const lang::Distrib< T > &breakdown, const lang::Distrib< T > &down_service, const std::string &reset_policy="keep") |
| Port of addNodeBreakdown, on a FIXED stage count. | |
| void | add_node_repair (const std::string &node_name, const lang::Distrib< T > &repair, const std::string &reset_policy="keep") |
| Port of addNodeRepair: the DOWN_<node> -> UP arc and its policy. | |
| void | add_node_failure_repair (std::size_t up, std::size_t down, const qn::NetworkStruct< T > &base, const std::string &node_name, const lang::Distrib< T > &breakdown, const lang::Distrib< T > &repair, const lang::Distrib< T > &down_service, const std::string &breakdown_reset="keep", const std::string &repair_reset="keep") |
| addNodeFailureRepair: the two calls above, in order. | |
| void | register_node_failure (const std::string &node_name, const lang::Distrib< T > &breakdown, const lang::Distrib< T > &down_service, bool has_repair, const lang::Distrib< T > &repair, const std::string &breakdown_reset, const std::string &repair_reset) |
| Port of registerNodeFailure: attach a breakdown descriptor, and its reset policies, to stages that ALREADY exist. | |
| void | init () |
| Port of Environment.init(). | |
| Reliability | reliability () const |
Static Public Member Functions | |
| static std::string | down_stage_name (const std::string &nm) |
| The name addNodeBreakdown gives the stage in which nm is down. | |
Public Attributes | |
| std::vector< std::vector< mam::Mmap< double > > > | proc |
| proc[e][h] | |
| std::vector< mam::Mmap< double > > | hold_time |
| holdTime[e] | |
| std::vector< double > | prob_env |
| probEnv | |
| Matrix< double > | prob_orig |
| probOrig(h, e) | |
| Matrix< double > | pemb |
| the embedded jump chain | |
| std::vector< double > | rate |
| 1/E[holding time] | |
Definition at line 228 of file environment.h.
|
inline |
Definition at line 230 of file environment.h.
References line::InputError::InputError(), and nstages().
|
inline |
Port of addNodeBreakdown, on a FIXED stage count.
The reference grows its stage graph as breakdowns are declared; this environment is sized at construction, exactly as set_stage is, so the caller says which slot is UP and which is the DOWN stage of this node. Everything else is the reference's: the UP stage holds the base model and is named UP, the DOWN stage holds the degraded copy and is named DOWN_<node>, and the UP -> DOWN arc carries the breakdown time and the breakdown reset policy.
Definition at line 409 of file environment.h.
References add_transition(), line::env::NodeFailure< T >::breakdown, line::env::NodeFailure< T >::breakdown_reset, line::env::NodeFailure< T >::down_service, down_stage_name(), line::env::env_degraded_model(), line::env::env_reset_policy(), line::InputError::InputError(), line::env::NodeFailure< T >::node, and set_stage().
Referenced by add_node_failure_repair().
|
inline |
addNodeFailureRepair: the two calls above, in order.
Definition at line 455 of file environment.h.
References add_node_breakdown(), and add_node_repair().
|
inline |
Port of addNodeRepair: the DOWN_<node> -> UP arc and its policy.
Definition at line 432 of file environment.h.
References add_transition(), down_stage_name(), line::env::env_reset_policy(), find_node_failure(), find_stage(), and line::InputError::InputError().
Referenced by add_node_failure_repair().
|
inline |
addTransition: enable e -> h with a distribution and a reset policy.
Definition at line 308 of file environment.h.
Referenced by add_node_breakdown(), add_node_repair(), line::io::build_environment_from_json(), and line::io::map2renv().
|
inline |
Definition at line 321 of file environment.h.
Referenced by line::env::env_compress(), and line::env::env_rate_matrix().
|
inlinestatic |
The name addNodeBreakdown gives the stage in which nm is down.
Definition at line 396 of file environment.h.
Referenced by add_node_breakdown(), add_node_repair(), line::io::build_environment_from_json(), and register_node_failure().
|
inline |
findNodeFailure: the descriptor for nm, or node_failures().size().
Definition at line 389 of file environment.h.
Referenced by add_node_repair().
|
inline |
The index of the stage called nm, or nstages() when there is none.
Definition at line 359 of file environment.h.
References name().
Referenced by add_node_repair(), register_node_failure(), and reliability().
|
inline |
True when ANY stage holds a LayeredNetwork.
Definition at line 281 of file environment.h.
|
inline |
Port of Environment.init().
Superpose the outgoing transitions of each stage, read the embedded jump chain off the per-destination rates, and solve the resulting semi-Markov process for its stationary stage probabilities.
Definition at line 511 of file environment.h.
References line::mc::ctmc_solve_reducible(), hold_time, line::InputError::InputError(), line::mam::Mmap< T >::map(), line::mam::map_mean(), line::mam::mmap_count_lambda(), pemb, prob_env, prob_orig, proc, rate, and line::UnsupportedError::UnsupportedError().
Referenced by line::io::map2renv().
|
inline |
True when stage e holds a LayeredNetwork rather than a flat network.
Definition at line 275 of file environment.h.
|
inline |
Definition at line 236 of file environment.h.
Referenced by line::env::env_compress(), find_stage(), reject_lqn_stages(), reliability(), set_env_rate_reset(), set_reset(), and set_transition_dist().
|
inline |
nodeFailures, the declarative record of the breakdowns declared here.
Definition at line 386 of file environment.h.
|
inline |
Definition at line 235 of file environment.h.
Referenced by line::env::env_apply_macro_probabilities(), line::env::env_compress(), line::env::env_rate_matrix(), and Environment().
|
inline |
Port of registerNodeFailure: attach a breakdown descriptor, and its reset policies, to stages that ALREADY exist.
This is the read path of an environment saved in its expanded form: the UP and DOWN_<node> stages and their two arcs came off the wire, and the only thing the wire could not carry is the pair of policies, which is what this installs.
Definition at line 474 of file environment.h.
References line::env::NodeFailure< T >::breakdown, line::env::NodeFailure< T >::breakdown_reset, line::env::NodeFailure< T >::down_service, down_stage_name(), line::env::env_reset_policy(), find_stage(), line::env::NodeFailure< T >::has_repair, line::InputError::InputError(), line::env::NodeFailure< T >::node, line::env::NodeFailure< T >::repair, line::env::NodeFailure< T >::repair_reset, and set_reset().
Referenced by line::io::build_environment_from_json().
|
inline |
Refuse an environment carrying a LayeredNetwork stage, by name.
Shared by every consumer that reads stage(e).model directly – the state-vector coupling, the closed-form limits, the compression – so that each says the same thing about the same gap rather than reading an EMPTY NetworkStruct and reporting a confident answer about a model that is not there. who names the caller and why says what about it needs a flat stage.
Definition at line 297 of file environment.h.
References name(), and line::UnsupportedError::UnsupportedError().
Referenced by line::env::env_compress().
|
inline |
Definition at line 598 of file environment.h.
References line::env::Environment< T >::Reliability::availability, find_stage(), line::InputError::InputError(), line::env::Environment< T >::Reliability::mtbf, line::env::Environment< T >::Reliability::mttf, line::env::Environment< T >::Reliability::mttr, name(), and prob_env.
|
inline |
resetEnvRatesFun{e,h}: make the e -> h transition depend on the state the stage is left in.
Only method = "statedep" reads it.
Definition at line 331 of file environment.h.
References line::InputError::InputError(), and name().
|
inline |
addStage with a LayeredNetwork: the stage holds a LAYERED model.
The environment itself does nothing with the difference – probEnv, probOrig and the holding times are read off the ARCS and never off a stage model – so the whole content of this overload is that the stage records which kind of model it carries and SolverEnv runs the matching stage solver. What the two kinds must still agree on is the (station, class) SHAPE of the metrics being blended, and for a layered stage that shape is the block-diagonal union of its layers; SolverEnv::init is where the shapes are compared, because only there is a SolverLN built and the layer blocks known.
Definition at line 263 of file environment.h.
|
inline |
Install a reset policy on an arc that is already declared.
The arc must exist: a reset on a disabled arc is a policy for a switch the environment cannot make, and it would sit there reporting nothing. The reference reaches this through setBreakdownResetPolicy, which likewise errors when the stages it names are absent.
Definition at line 373 of file environment.h.
References line::InputError::InputError(), and name().
Referenced by register_node_failure().
|
inline |
addStage: name the stage and give it its network.
Definition at line 239 of file environment.h.
Referenced by add_node_breakdown(), line::io::build_environment_from_json(), and line::io::map2renv().
|
inline |
Replace the distribution of an arc that is already declared.
This is what the state-dependent method writes back each iteration; every other caller declares the arc once through add_transition. init() must be rerun afterwards, because the superposed holding times and the stage probabilities are all derived from these distributions.
Definition at line 349 of file environment.h.
References line::InputError::InputError(), and name().
|
inline |
Definition at line 317 of file environment.h.
Referenced by line::env::env_compress().
| std::vector<mam::Mmap<double> > line::env::Environment< T >::hold_time |
| Matrix<double> line::env::Environment< T >::pemb |
| std::vector<double> line::env::Environment< T >::prob_env |
probEnv
Definition at line 652 of file environment.h.
Referenced by line::env::env_apply_macro_probabilities(), init(), and reliability().
| Matrix<double> line::env::Environment< T >::prob_orig |
probOrig(h, e)
Definition at line 653 of file environment.h.
Referenced by line::env::env_apply_macro_probabilities(), and init().
| std::vector<std::vector<mam::Mmap<double> > > line::env::Environment< T >::proc |
| std::vector<double> line::env::Environment< T >::rate |