LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::lal::decl_detail Namespace Reference

Classes

struct  BuiltNetwork
 A network build plus the name maps the environment compiler needs. More...

Functions

std::vector< std::string > shell_words (const std::string &line)
 shlex.split(line, comments=True): POSIX words with '...', "..." and backslash escapes, adjacent pieces concatenated, # outside quotes ending the line.
std::vector< Declaration > split_rows (const std::string &text)
 The nonblank lines of text, numbered from 1 as str.splitlines() numbers them.
double to_float (const std::string &s)
 Python float(token): the whole word must be a number (inf and nan included).
long to_int (const std::string &s)
 Python int(token): an optionally signed run of decimal digits.
std::size_t to_count (const std::string &s, const std::string &what)
 A nonnegative count, int(token) then checked for a sign.
lang::SchedStrategy sched_by_name (const std::string &name)
 getattr(SchedStrategy, name) over the strategies this port enumerates.
lang::RoutingStrategy routing_by_name (const std::string &name)
 getattr(RoutingStrategy, name).
lang::ReplacementStrategy replacement_by_name (const std::string &name)
 getattr(ReplacementStrategy, name).
std::filesystem::path repo_root ()
 The LINE repository root, the base a relative trace path falls back to: $LINE_ROOT when set, else five levels above this header (cpp/include/line/lang/lal/), which is the reference's parents[3] of python/line_solver/lal/network.py.
std::string trace_path (const std::string &name)
 _trace_path: as given, else relative to the repository root; then made absolute.
lang::Distrib< double > replayer_fit_aph (const std::string &path)
 Replayer(path).fit_aph(): the population mean and variance and the bias-corrected sample skewness (scipy skew(bias=False)) of the trace, matched by APH.fitCentral.
std::vector< double > linspace (double lo, double hi, std::size_t count)
 numpy.linspace(lo, hi, count), endpoint included and pinned.
void unsupported (const std::string &kind, const std::string &what)
 The refusal of a construct this port does not carry: LINE:unsupported:LAL_<kind>.
nlohmann::json json_arg (const std::string &token)
 A vector or matrix argument written as JSON, e.g.
std::vector< double > vector_arg (const std::string &token)
Matrix< double > matrix_arg (const std::string &token)
template<class Numeric>
std::optional< lang::Distrib< double > > markovian_distribution (const std::string &dist, const std::vector< std::string > &args, Numeric numeric)
 Build one of the Markovian laws LAL admits from a declaration (markovian_distribution): exp RATE, erlang RATE PHASES, erlang_mean_order MEAN PHASES, hyperexp P RATE1 RATE2, ph ALPHA T, aph ALPHA T, coxian RATES PROBS, map D0 D1, mmpp2 L0 L1 S0 S1, mmap D0 D1 D11 ... D1K, bmap D0 D1 ... DB, mph ALPHA S EXITS, immediate now and disabled.
template<class Map>
std::size_t lookup (const Map &m, const std::string &name, const char *what)
template<class Map>
std::size_t lookup (const Map &m, const std::pair< std::string, std::string > &key, const char *what)
 Mode lookup, keyed by (transition, mode); the message names the pair.
BuiltNetwork build_network_impl (const NetworkSpec &spec, const std::map< std::string, double > &parameters)

Function Documentation

◆ build_network_impl()

BuiltNetwork line::lal::decl_detail::build_network_impl ( const NetworkSpec & spec,
const std::map< std::string, double > & parameters )
inline

Definition at line 432 of file network_decl.h.

References line::qn::Network< T >::add_cache(), line::qn::Network< T >::add_closed_class(), line::qn::Network< T >::add_delay(), line::qn::Network< T >::add_mode(), line::qn::Network< T >::add_open_class(), line::qn::Network< T >::add_place(), line::qn::Network< T >::add_queue(), line::qn::Network< T >::add_region(), line::qn::Network< T >::add_router(), line::qn::Network< T >::add_sink(), line::qn::Network< T >::add_source(), line::qn::Network< T >::add_transition(), build_network_impl(), line::lal::check_network(), line::lal::decl_detail::BuiltNetwork::classes, line::lal::NetworkSpec::declarations, line::lang::Distrib< T >::discrete_sampler(), line::lang::DROP, line::lang::Distrib< T >::exp_rate(), line::lang::IMMEDIATE, line::qn::Network< T >::init_routing_matrix(), line::qn::CacheParam< T >::itemcap, line::qn::Network< T >::link(), linspace(), lookup(), markovian_distribution(), line::lal::decl_detail::BuiltNetwork::model, line::lal::NetworkSpec::name, line::qn::CacheParam< T >::nitems, line::lal::decl_detail::BuiltNetwork::nodes, line::lang::prior_discrete(), line::lang::RAND, line::qn::Network< T >::raw_struct(), replacement_by_name(), line::qn::CacheParam< T >::replacestrat, replayer_fit_aph(), routing_by_name(), sched_by_name(), line::qn::RoutingMatrix< T >::set(), line::qn::Network< T >::set_arrival(), line::qn::Network< T >::set_cache_hit_class(), line::qn::Network< T >::set_cache_miss_class(), line::qn::Network< T >::set_cache_read(), line::qn::Network< T >::set_class_completes(), line::qn::Network< T >::set_enabling_conditions(), line::qn::Network< T >::set_firing_outcome(), line::qn::Network< T >::set_firing_weight(), line::qn::Network< T >::set_inhibiting_conditions(), line::qn::Network< T >::set_initial_marking(), line::qn::Network< T >::set_mode_distribution(), line::qn::Network< T >::set_mode_timing(), line::qn::Network< T >::set_number_of_servers(), line::qn::Network< T >::set_retrieval_system(), line::qn::Network< T >::set_routing(), line::qn::Network< T >::set_service(), to_count(), to_float(), to_int(), trace_path(), unsupported(), line::lal::value_error(), line::lang::WAITQ, and line::lang::Distrib< T >::zipf().

Referenced by line::lal::build_environment(), and build_network_impl().

◆ json_arg()

nlohmann::json line::lal::decl_detail::json_arg ( const std::string & token)
inline

A vector or matrix argument written as JSON, e.g.

[[-2,1],[0,-3]] (_matrix_arg).

Definition at line 307 of file network_decl.h.

References json_arg(), and line::lal::value_error().

Referenced by json_arg(), matrix_arg(), and vector_arg().

◆ linspace()

std::vector< double > line::lal::decl_detail::linspace ( double lo,
double hi,
std::size_t count )
inline

numpy.linspace(lo, hi, count), endpoint included and pinned.

Definition at line 288 of file network_decl.h.

References linspace().

Referenced by build_network_impl(), and linspace().

◆ lookup() [1/2]

template<class Map>
std::size_t line::lal::decl_detail::lookup ( const Map & m,
const std::pair< std::string, std::string > & key,
const char * what )

Mode lookup, keyed by (transition, mode); the message names the pair.

Definition at line 425 of file network_decl.h.

References lookup(), and line::lal::value_error().

◆ lookup() [2/2]

template<class Map>
std::size_t line::lal::decl_detail::lookup ( const Map & m,
const std::string & name,
const char * what )

◆ markovian_distribution()

template<class Numeric>
std::optional< lang::Distrib< double > > line::lal::decl_detail::markovian_distribution ( const std::string & dist,
const std::vector< std::string > & args,
Numeric numeric )

Build one of the Markovian laws LAL admits from a declaration (markovian_distribution): exp RATE, erlang RATE PHASES, erlang_mean_order MEAN PHASES, hyperexp P RATE1 RATE2, ph ALPHA T, aph ALPHA T, coxian RATES PROBS, map D0 D1, mmpp2 L0 L1 S0 S1, mmap D0 D1 D11 ... D1K, bmap D0 D1 ... DB, mph ALPHA S EXITS, immediate now and disabled.

Matrices are JSON. Nullopt for any other declaration.

Definition at line 355 of file network_decl.h.

References line::lang::Distrib< T >::bmap(), line::Matrix< T >::cols(), line::lang::Distrib< T >::disabled_dist(), line::lang::dist_refresh_moments(), line::lang::erlang_fit_mean_order(), line::lang::Distrib< T >::exp_rate(), line::lang::Distrib< T >::immediate(), line::lang::Distrib< T >::map_dist(), markovian_distribution(), matrix_arg(), line::lang::Distrib< T >::mmap(), line::lang::MMPP2, line::lang::Distrib< T >::mph(), line::Matrix< T >::rows(), to_count(), and vector_arg().

Referenced by build_network_impl(), and markovian_distribution().

◆ matrix_arg()

Matrix< double > line::lal::decl_detail::matrix_arg ( const std::string & token)
inline

Definition at line 326 of file network_decl.h.

References json_arg(), matrix_arg(), and line::lal::value_error().

Referenced by markovian_distribution(), and matrix_arg().

◆ replacement_by_name()

lang::ReplacementStrategy line::lal::decl_detail::replacement_by_name ( const std::string & name)
inline

◆ replayer_fit_aph()

lang::Distrib< double > line::lal::decl_detail::replayer_fit_aph ( const std::string & path)
inline

Replayer(path).fit_aph(): the population mean and variance and the bias-corrected sample skewness (scipy skew(bias=False)) of the trace, matched by APH.fitCentral.

Definition at line 265 of file network_decl.h.

References line::lang::aph_fit_central(), replayer_fit_aph(), and line::lal::value_error().

Referenced by build_network_impl(), and replayer_fit_aph().

◆ repo_root()

std::filesystem::path line::lal::decl_detail::repo_root ( )
inline

The LINE repository root, the base a relative trace path falls back to: $LINE_ROOT when set, else five levels above this header (cpp/include/line/lang/lal/), which is the reference's parents[3] of python/line_solver/lal/network.py.

Definition at line 241 of file network_decl.h.

References repo_root().

Referenced by repo_root(), and trace_path().

◆ routing_by_name()

lang::RoutingStrategy line::lal::decl_detail::routing_by_name ( const std::string & name)
inline

◆ sched_by_name()

lang::SchedStrategy line::lal::decl_detail::sched_by_name ( const std::string & name)
inline

getattr(SchedStrategy, name) over the strategies this port enumerates.

Definition at line 191 of file network_decl.h.

References line::lang::HOL, line::lang::LAS, sched_by_name(), line::lang::sched_to_text(), and line::lal::value_error().

Referenced by line::lal::build_layered(), build_network_impl(), and sched_by_name().

◆ shell_words()

std::vector< std::string > line::lal::decl_detail::shell_words ( const std::string & line)
inline

shlex.split(line, comments=True): POSIX words with '...', "..." and backslash escapes, adjacent pieces concatenated, # outside quotes ending the line.

Throws value_error with shlex's own messages.

Definition at line 73 of file network_decl.h.

References shell_words(), and line::lal::value_error().

Referenced by shell_words(), and split_rows().

◆ split_rows()

std::vector< Declaration > line::lal::decl_detail::split_rows ( const std::string & text)
inline

The nonblank lines of text, numbered from 1 as str.splitlines() numbers them.

Definition at line 131 of file network_decl.h.

References shell_words(), split_rows(), and line::lal::value_error().

Referenced by line::lal::build_environment(), line::lal::build_layered(), line::lal::parse_network(), and split_rows().

◆ to_count()

std::size_t line::lal::decl_detail::to_count ( const std::string & s,
const std::string & what )
inline

A nonnegative count, int(token) then checked for a sign.

Definition at line 184 of file network_decl.h.

References to_count(), to_int(), and line::lal::value_error().

Referenced by build_network_impl(), markovian_distribution(), and to_count().

◆ to_float()

double line::lal::decl_detail::to_float ( const std::string & s)
inline

Python float(token): the whole word must be a number (inf and nan included).

Definition at line 155 of file network_decl.h.

References to_float(), and line::lal::value_error().

Referenced by line::lal::build_environment(), line::lal::build_layered(), build_network_impl(), and to_float().

◆ to_int()

long line::lal::decl_detail::to_int ( const std::string & s)
inline

Python int(token): an optionally signed run of decimal digits.

Definition at line 170 of file network_decl.h.

References to_int(), and line::lal::value_error().

Referenced by line::lal::build_layered(), build_network_impl(), to_count(), and to_int().

◆ trace_path()

std::string line::lal::decl_detail::trace_path ( const std::string & name)
inline

_trace_path: as given, else relative to the repository root; then made absolute.

Definition at line 250 of file network_decl.h.

References repo_root(), and trace_path().

Referenced by build_network_impl(), and trace_path().

◆ unsupported()

void line::lal::decl_detail::unsupported ( const std::string & kind,
const std::string & what )
inline

The refusal of a construct this port does not carry: LINE:unsupported:LAL_<kind>.

Definition at line 302 of file network_decl.h.

References line::ErrorKind::ErrorKind(), unsupported(), and line::UnsupportedError::UnsupportedError().

Referenced by build_network_impl(), and unsupported().

◆ vector_arg()

std::vector< double > line::lal::decl_detail::vector_arg ( const std::string & token)
inline

Definition at line 316 of file network_decl.h.

References json_arg(), line::lal::value_error(), and vector_arg().

Referenced by markovian_distribution(), and vector_arg().