![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Classes | |
| struct | ProcSpec |
| One (station, class) process, reduced to what QN2MATLAB / QN2JAVA decide on. More... | |
| struct | Route |
| The (k, c, i, m, p) of every positive sn.rtnodes entry, in QN2MATLAB's loop order, 0-based. More... | |
Functions | |
| std::string | mfmt (const char *spec, double x) |
| f, e or g as MATLAB's fprintf prints it: C's text, with Inf / NaN spelt MATLAB's way. | |
| std::string | fmt_f (double x) |
| std::string | fmt_g (double x) |
| std::string | fmt_d (double x) |
| MATLAB d of a double: the integer when it is one, else MATLAB's e override. | |
| std::string | fmt_d (std::size_t x) |
| std::string | fmt_d (int x) |
| std::string | sched_property (lang::SchedStrategy s) |
| SchedStrategy.toProperty(SchedStrategy.toText(s)): the enum constant name. | |
| std::string | sched_feature (lang::SchedStrategy s) |
| strrep(SchedStrategy.toFeature(s),'_','.
| |
| template<class T> | |
| ProcSpec | proc_spec (const qn::NetworkStruct< T > &sn, std::size_t i, std::size_t k) |
| The branch of QN2MATLAB's process block for station i, class k (0-based). | |
| template<class T> | |
| std::size_t | fork_of (const qn::NetworkStruct< T > &sn, std::size_t j) |
| find(sn.fj(:,j)): the 1-based Fork node the 1-based Join node j closes. | |
| template<class T> | |
| std::size_t | empty_class_ref (const qn::NetworkStruct< T > &sn, std::size_t k) |
| zeroPopRefNode(sn, k) of QN2MATLAB / QN2JAVA: the NODE index (1-based) of the reference station of zero-population closed class k (0-based). | |
| template<class T> | |
| void | check_node_types (const qn::NetworkStruct< T > &sn, const char *who) |
| Refuses a node type neither MATLAB generator has a statement for. | |
| template<class T> | |
| std::vector< Route > | routes (const qn::NetworkStruct< T > &sn) |
| std::ofstream | open_out (const std::string &path) |
| Opens path for writing or throws, naming it. | |
| std::string | j_num (double v) |
| jnum: a Java double literal at the shortest spelling that reads back as v. | |
| template<class T> | |
| std::string | j_num_t (const T &v) |
| template<class T> | |
| std::string | j_arr (const std::vector< T > &v) |
| jarr: a new double[]{...} literal. | |
| template<class T> | |
| std::string | j_mat_row (const std::vector< T > &v) |
| jmat of a row vector: new Matrix(new double[][]{{a, b}}). | |
| template<class T> | |
| std::string | j_mat (const Matrix< T > &m) |
| jmat of a matrix, row by row. | |
| std::string | j_round (double v) |
| template<class T> | |
| std::string | java_dist (const lang::Distrib< T > &d) |
| javaDist: the Java constructor call rebuilding d with the same parameters. | |
| template<class T> | |
| std::vector< std::vector< bool > > | reply_graph (const lqn::LqnModel< T > &m, const lqn::LqnStruct< T > &sn) |
| sn.replygraph: (nacts+1) x (nentries+1), 1-based, true where the activity replies to the entry. | |
| template<class T> | |
| std::size_t | and_join_quorum (const lqn::LqnModel< T > &m, std::size_t tslot, const std::string &post_name) |
| The quorum of the AND-join into post_name on task slot tslot, 0 when it declares none. | |
| std::string | upper_nospace (const std::string &s) |
| std::string | m_scalar (double v) |
| scalar2code: a double at the shortest of 15..17 significant digits that reads back as itself. | |
| template<class T> | |
| std::string | m_scalar_t (const T &v) |
| template<class T> | |
| std::string | m_row (const std::vector< T > &v) |
| num2code of a row vector: [a, b], a scalar when it has one element, [] when empty. | |
| template<class T> | |
| std::string | m_matrix (const Matrix< T > &M) |
| num2code of a matrix: [a, b; c, d]. | |
| std::string | m_quote (const std::string &s) |
| q(str): a MATLAB single-quoted literal. | |
| std::string | m_cellstr (const std::vector< std::string > &c) |
| cellstr2code: {'a', 'b'}. | |
| std::string | m_repl (lang::ReplacementStrategy r) |
| template<class T> | |
| std::string | m_dist (const lang::Distrib< T > &d) |
| dist2code: the constructor call that rebuilds d from its parameters, which this port keeps in MATLAB getParam order. | |
| template<class T> | |
| bool | m_default_time (const lang::Distrib< T > &d) |
| True for a think / setup / delay-off time left at its constructor default. | |
| template<class T> | |
| std::string | m_prec (const lqn::detail::RawPrecedence< T > &ap) |
| The ActivityPrecedence expression of one declared precedence (precCode). | |
| template<class T> | |
| void | m_server_extras (std::ostream &os, const std::string &v, const std::string &owner, const Matrix< T > *A, const std::vector< T > *b, const std::vector< lqn::detail::RawLinConRow< T > > *rows, const std::vector< T > *lld, bool has_cd, bool has_jd, const std::vector< lqn::detail::RawServerPool< T > > *pools) |
| emitServerExtras: admission constraints, load dependence and server pools of a host or task. | |
| std::string | json_model_name (const std::string &path, const std::string &fallback) |
| The name of the model in a model.json envelope, fallback when it has none. | |
| std::size_t line::io::code_gen_detail::and_join_quorum | ( | const lqn::LqnModel< T > & | m, |
| std::size_t | tslot, | ||
| const std::string & | post_name ) |
The quorum of the AND-join into post_name on task slot tslot, 0 when it declares none.
Definition at line 713 of file code_gen.h.
References and_join_quorum(), line::lang::PRE_AND, and line::lqn::LqnModel< T >::tasks.
Referenced by and_join_quorum().
| void line::io::code_gen_detail::check_node_types | ( | const qn::NetworkStruct< T > & | sn, |
| const char * | who ) |
Refuses a node type neither MATLAB generator has a statement for.
Definition at line 218 of file code_gen.h.
References check_node_types(), line::lang::ClassSwitch, line::lang::Delay, line::lang::Fork, line::lang::Join, line::lang::node_type_to_text(), line::lang::Queue, line::lang::Router, line::lang::Sink, line::lang::Source, and line::UnsupportedError::UnsupportedError().
Referenced by check_node_types().
| std::size_t line::io::code_gen_detail::empty_class_ref | ( | const qn::NetworkStruct< T > & | sn, |
| std::size_t | k ) |
zeroPopRefNode(sn, k) of QN2MATLAB / QN2JAVA: the NODE index (1-based) of the reference station of zero-population closed class k (0-based).
It is the refstat of the first populated closed class of k's chain (k's own refstat if there is none), else the first station whose sn.proc{i}{k}{1} has a nonzero entry, NaN counting as nonzero under nnz, so a disabled pair qualifies.
Definition at line 183 of file code_gen.h.
References line::mam::Map< T >::D0, line::lang::Distrib< T >::disabled, line::lang::dist_to_map(), empty_class_ref(), and line::lang::Join.
Referenced by empty_class_ref().
|
inline |
|
inline |
Definition at line 96 of file code_gen.h.
References fmt_d().
|
inline |
Definition at line 95 of file code_gen.h.
References fmt_d().
|
inline |
|
inline |
| std::size_t line::io::code_gen_detail::fork_of | ( | const qn::NetworkStruct< T > & | sn, |
| std::size_t | j ) |
find(sn.fj(:,j)): the 1-based Fork node the 1-based Join node j closes.
Definition at line 168 of file code_gen.h.
References fork_of(), and line::InputError::InputError().
Referenced by fork_of().
| std::string line::io::code_gen_detail::j_arr | ( | const std::vector< T > & | v | ) |
jarr: a new double[]{...} literal.
Definition at line 583 of file code_gen.h.
References j_arr(), and j_num_t().
Referenced by j_arr(), and java_dist().
| std::string line::io::code_gen_detail::j_mat | ( | const Matrix< T > & | m | ) |
jmat of a matrix, row by row.
Definition at line 599 of file code_gen.h.
References line::Matrix< T >::cols(), j_mat(), j_num_t(), and line::Matrix< T >::rows().
Referenced by j_mat(), and java_dist().
| std::string line::io::code_gen_detail::j_mat_row | ( | const std::vector< T > & | v | ) |
jmat of a row vector: new Matrix(new double[][]{{a, b}}).
Definition at line 591 of file code_gen.h.
References j_mat_row(), and j_num_t().
Referenced by j_mat_row(), and java_dist().
|
inline |
jnum: a Java double literal at the shortest spelling that reads back as v.
Definition at line 561 of file code_gen.h.
References j_num().
Referenced by j_num(), j_num_t(), and java_dist().
| std::string line::io::code_gen_detail::j_num_t | ( | const T & | v | ) |
Definition at line 577 of file code_gen.h.
References j_num(), and j_num_t().
Referenced by j_arr(), j_mat(), j_mat_row(), j_num_t(), and java_dist().
|
inline |
Definition at line 609 of file code_gen.h.
References j_round().
Referenced by j_round(), and java_dist().
| std::string line::io::code_gen_detail::java_dist | ( | const lang::Distrib< T > & | d | ) |
javaDist: the Java constructor call rebuilding d with the same parameters.
A law with no Java constructor listed here is written as an APH fitted to its mean and SCV, where MATLAB also warns.
Definition at line 622 of file code_gen.h.
References line::lang::Distrib< T >::D0, line::lang::Distrib< T >::D1, line::lang::Distrib< T >::disabled, j_arr(), j_mat(), j_mat_row(), j_num(), j_num_t(), j_round(), java_dist(), line::lang::Distrib< T >::mean, line::lang::Distrib< T >::params, line::lang::process_to_text(), line::lang::Distrib< T >::scv, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::trace_file, line::lang::Distrib< T >::type, and line::UnsupportedError::UnsupportedError().
Referenced by java_dist().
|
inline |
The name of the model in a model.json envelope, fallback when it has none.
Definition at line 1501 of file code_gen.h.
References line::InputError::InputError(), and json_model_name().
Referenced by json_model_name(), and line::io::line2java_json().
|
inline |
cellstr2code: {'a', 'b'}.
Definition at line 1085 of file code_gen.h.
References m_cellstr(), and m_quote().
Referenced by m_cellstr(), m_prec(), and m_server_extras().
| bool line::io::code_gen_detail::m_default_time | ( | const lang::Distrib< T > & | d | ) |
True for a think / setup / delay-off time left at its constructor default.
Definition at line 1174 of file code_gen.h.
References line::lang::DISABLED, line::lang::Distrib< T >::disabled, line::lang::IMMEDIATE, m_default_time(), and line::lang::Distrib< T >::type.
Referenced by m_default_time().
| std::string line::io::code_gen_detail::m_dist | ( | const lang::Distrib< T > & | d | ) |
dist2code: the constructor call that rebuilds d from its parameters, which this port keeps in MATLAB getParam order.
A law with no constructor spelling here is written as the APH fit of its moments, as MATLAB does for a class it does not know.
Definition at line 1111 of file code_gen.h.
References line::lang::Distrib< T >::cox_scalar_form, line::lang::Distrib< T >::D0, line::lang::Distrib< T >::D1, line::lang::Distrib< T >::disabled, m_dist(), m_matrix(), m_quote(), m_row(), m_scalar(), m_scalar_t(), line::lang::Distrib< T >::mean, line::lang::Distrib< T >::params, line::lang::process_to_text(), line::lang::Distrib< T >::scv, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::trace_file, line::lang::Distrib< T >::type, and line::UnsupportedError::UnsupportedError().
Referenced by m_dist().
| std::string line::io::code_gen_detail::m_matrix | ( | const Matrix< T > & | M | ) |
num2code of a matrix: [a, b; c, d].
Definition at line 1063 of file code_gen.h.
References line::Matrix< T >::cols(), m_matrix(), m_scalar_t(), and line::Matrix< T >::rows().
Referenced by m_dist(), m_matrix(), and m_server_extras().
| std::string line::io::code_gen_detail::m_prec | ( | const lqn::detail::RawPrecedence< T > & | ap | ) |
The ActivityPrecedence expression of one declared precedence (precCode).
Definition at line 1180 of file code_gen.h.
References m_cellstr(), m_prec(), m_quote(), m_row(), and m_scalar().
Referenced by m_prec().
|
inline |
q(str): a MATLAB single-quoted literal.
Definition at line 1075 of file code_gen.h.
References m_quote().
Referenced by m_cellstr(), m_dist(), m_prec(), m_quote(), and m_server_extras().
|
inline |
Definition at line 1091 of file code_gen.h.
References line::lang::CLIMB, line::lang::FIFO, line::lang::HLRU, line::lang::LRU, m_repl(), line::lang::QLRU, line::lang::RR, and line::lang::SFIFO.
Referenced by m_repl().
| std::string line::io::code_gen_detail::m_row | ( | const std::vector< T > & | v | ) |
num2code of a row vector: [a, b], a scalar when it has one element, [] when empty.
Definition at line 1053 of file code_gen.h.
References m_row(), and m_scalar_t().
Referenced by m_dist(), m_prec(), m_row(), and m_server_extras().
|
inline |
scalar2code: a double at the shortest of 15..17 significant digits that reads back as itself.
Definition at line 1030 of file code_gen.h.
References m_scalar().
Referenced by m_dist(), m_prec(), m_scalar(), m_scalar_t(), and m_server_extras().
| std::string line::io::code_gen_detail::m_scalar_t | ( | const T & | v | ) |
Definition at line 1047 of file code_gen.h.
References m_scalar(), and m_scalar_t().
Referenced by m_dist(), m_matrix(), m_row(), m_scalar_t(), and m_server_extras().
| void line::io::code_gen_detail::m_server_extras | ( | std::ostream & | os, |
| const std::string & | v, | ||
| const std::string & | owner, | ||
| const Matrix< T > * | A, | ||
| const std::vector< T > * | b, | ||
| const std::vector< lqn::detail::RawLinConRow< T > > * | rows, | ||
| const std::vector< T > * | lld, | ||
| bool | has_cd, | ||
| bool | has_jd, | ||
| const std::vector< lqn::detail::RawServerPool< T > > * | pools ) |
emitServerExtras: admission constraints, load dependence and server pools of a host or task.
Definition at line 1230 of file code_gen.h.
References line::Matrix< T >::cols(), m_cellstr(), m_matrix(), m_quote(), m_row(), m_scalar(), m_scalar_t(), m_server_extras(), line::Matrix< T >::rows(), and line::UnsupportedError::UnsupportedError().
Referenced by m_server_extras().
|
inline |
|
inline |
Opens path for writing or throws, naming it.
Definition at line 264 of file code_gen.h.
References line::InputError::InputError(), and open_out().
Referenced by line::io::line2java(), line::io::line2matlab(), line::io::line2matlab(), line::io::lqn2java(), line::io::lqn2matlab(), open_out(), line::io::qn2java(), and line::io::qn2matlab().
| ProcSpec line::io::code_gen_detail::proc_spec | ( | const qn::NetworkStruct< T > & | sn, |
| std::size_t | i, | ||
| std::size_t | k ) |
The branch of QN2MATLAB's process block for station i, class k (0-based).
The Replayer test is MATLAB's isprop(station,'serviceProcess'), a property only Queue and its Delay subclass declare, so a trace at a Source goes down the moment path and is written as the fit of its moments, as in MATLAB.
Definition at line 130 of file code_gen.h.
References line::io::code_gen_detail::ProcSpec::APH, line::io::code_gen_detail::ProcSpec::arrival, line::lang::GlobalConstants::CoarseTol, line::lang::Delay, line::io::code_gen_detail::ProcSpec::DISABLED, line::lang::Distrib< T >::disabled, line::lang::dist_to_map(), line::io::code_gen_detail::ProcSpec::ERLANG, line::io::code_gen_detail::ProcSpec::EXP, line::lang::EXT, line::io::code_gen_detail::ProcSpec::file, line::io::code_gen_detail::ProcSpec::IMMEDIATE, line::lang::Join, line::io::code_gen_detail::ProcSpec::kind, line::mam::map_mean(), line::mam::map_scv(), line::io::code_gen_detail::ProcSpec::mean, line::io::code_gen_detail::ProcSpec::nphases, proc_spec(), line::lang::Queue, line::io::code_gen_detail::ProcSpec::REPLAYER, line::lang::REPLAYER, line::io::code_gen_detail::ProcSpec::scv, line::lang::Distrib< T >::trace_file, line::lang::Distrib< T >::type, and line::UnsupportedError::UnsupportedError().
Referenced by proc_spec().
| std::vector< std::vector< bool > > line::io::code_gen_detail::reply_graph | ( | const lqn::LqnModel< T > & | m, |
| const lqn::LqnStruct< T > & | sn ) |
sn.replygraph: (nacts+1) x (nentries+1), 1-based, true where the activity replies to the entry.
Declared replies, plus the implicit leaf replies of getStruct.m for an entry that declares none.
Definition at line 694 of file code_gen.h.
References reply_graph().
Referenced by reply_graph().
| std::vector< Route > line::io::code_gen_detail::routes | ( | const qn::NetworkStruct< T > & | sn | ) |
Definition at line 246 of file code_gen.h.
References routes(), line::lang::Sink, and line::lang::Source.
Referenced by routes().
|
inline |
strrep(SchedStrategy.toFeature(s),'_','.
'), the layered generator's spelling.
Definition at line 110 of file code_gen.h.
References sched_feature(), and sched_property().
Referenced by sched_feature().
|
inline |
SchedStrategy.toProperty(SchedStrategy.toText(s)): the enum constant name.
Definition at line 99 of file code_gen.h.
References sched_property(), line::lang::sched_to_text(), and line::UnsupportedError::UnsupportedError().
Referenced by sched_feature(), and sched_property().
|
inline |
Definition at line 725 of file code_gen.h.
References upper_nospace().
Referenced by upper_nospace().