![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
A LINE Network embedded as one agent per node (EmbeddedNetwork). More...
#include <line/lang/lal/embed.h>
Public Member Functions | |
| EmbeddedNetwork (std::shared_ptr< qn::Network< double > > network, const std::string &prefix, std::optional< double > cutoff) | |
| EmbeddedNetwork (const qn::NetworkStruct< double > &sn, const std::string &prefix, std::optional< double > cutoff) | |
| const std::string & | name () const override |
| The part name (the prefix, or the model name). | |
| const std::string & | prefix () const override |
| The embedding prefix, empty when none was given. | |
| std::size_t | initial () override |
| The global index of the initial state. | |
| const std::vector< NodeEvent > & | labels () override |
| Every node key an arc carries, in first-seen order. | |
| std::vector< EmbeddedArc > | outgoing (std::size_t s) override |
| Arcs leaving global state s. | |
| const std::vector< EmbeddedArc > & | arcs (std::size_t s) |
| bool | is_vanishing (std::size_t s) override |
| True when s is a vanishing state of the embedded model. | |
| bool | has_vanishing () override |
| True when the embedded model has any vanishing state. | |
| std::size_t | nstates () |
| const qn::NetworkStruct< double > & | sn () |
| const std::vector< qn::NetState< double > > & | space () |
| std::size_t | index_of (const qn::NetState< double > &state) |
| The global index of a network state, or npos. | |
| void | refresh () override |
| Re-read the embedded model on next use. | |
| void | set_injected (const std::set< std::string > &classes) override |
| Record the classes hand agents inject (names); a change invalidates the enumeration. | |
| std::vector< std::pair< std::size_t, double > > | inject (std::size_t s, const NodeEvent &key) override |
| Passive response of a node to an injected arrival in global state s (inject): [(target, probability)]; an empty list blocks the injection (no successor within LINE's enumerated space, e.g. | |
| void | check_injection (const NodeEvent &key) override |
| Refuse a key that a hand agent cannot drive. | |
| NodeEvent | resolve (const std::string &node, lang::EventType event, const std::optional< std::string > &jobclass, const std::optional< std::string > &mode) override |
| The key of a node action, validated against the model's names. | |
| std::string | node_name (std::size_t node) override |
| Name of the 1-based node index of the model. | |
| std::string | class_name (std::size_t cls) override |
| Name of the 1-based class index of the model. | |
| std::vector< std::pair< std::string, std::size_t > > | node_states () override |
| [(node name, isf)] of the stateful node agents (isf is 1-based). | |
| std::string | node_state_label (std::size_t s, std::size_t isf) override |
| The state row of stateful node isf in global state s, as [v1 v2 ...]. | |
| std::vector< double > | node_row (std::size_t s, const std::string &node) override |
| The state row of a stateful node in global state s. | |
| double | node_jobs (std::size_t s, const std::string &node, const std::string &jobclass) override |
| Jobs at a station in global state s: the total, or those of class jobclass when nonempty. | |
| const std::pair< Matrix< double >, std::vector< std::vector< std::vector< double > > > > & | queue_lengths (std::size_t x) |
| Station-by-class queue lengths and per-station service phases of global state x (memoized). | |
| const qn::NetworkStruct< double > & | model_struct () |
| The embedded model's own refreshed struct (network.get_struct()), without any enumeration. | |
| Public Member Functions inherited from line::lal::EmbeddedPart | |
| virtual | ~EmbeddedPart () |
| virtual bool | matches (const NodeEvent &key, const NodeEvent &pattern) const |
| True when key is pattern, or pattern leaves the index open. | |
| virtual bool | has_stages () |
| True for an embedded Environment, whose stage is an agent of its own. | |
| virtual std::size_t | stage_of (std::size_t) |
| The stage of global state s (Environment only). | |
| virtual std::vector< std::string > | stage_names () |
| The stage names (Environment only). | |
A LINE Network embedded as one agent per node (EmbeddedNetwork).
The agent record seen by the LAL core holds the network's global states (indices into LINE's enumerated space); node agents are projections of it used for the state table, the rewards and injection. The enumeration is LAZY: it is built on first use and dropped by refresh() or by a change of the injected classes.
The model is either a qn::Network (shared, so an lvalue added to a composition is held by reference and re-read on refresh()) or a finished qn::NetworkStruct (an Environment stage).
|
inline |
Definition at line 127 of file embed.h.
References line::lal::check_network(), and prefix().
|
inline |
Definition at line 133 of file embed.h.
References line::lal::check_network(), prefix(), and sn().
|
inline |
Definition at line 154 of file embed.h.
Referenced by line::lal::EmbeddedEnvironment::outgoing().
|
inlineoverridevirtual |
Refuse a key that a hand agent cannot drive.
Implements line::lal::EmbeddedPart.
Definition at line 227 of file embed.h.
References line::lang::ARV, line::qn::NetworkStruct< T >::classes, line::ErrorKind::ErrorKind(), line::lal::NodeEvent::event, line::lal::NodeEvent::index, line::InputError::InputError(), line::lal::NodeEvent::label(), line::qn::NetworkStruct< T >::njobs(), line::lal::NodeEvent::node, line::qn::NetworkStruct< T >::nodes, sn(), and line::lal::value_error().
|
inlineoverridevirtual |
Name of the 1-based class index of the model.
Implements line::lal::EmbeddedPart.
Definition at line 274 of file embed.h.
References line::qn::NetworkStruct< T >::classes, sn(), and line::lal::value_error().
|
inlineoverridevirtual |
True when the embedded model has any vanishing state.
Implements line::lal::EmbeddedPart.
|
inline |
|
inlineoverridevirtual |
The global index of the initial state.
Implements line::lal::EmbeddedPart.
|
inlineoverridevirtual |
Passive response of a node to an injected arrival in global state s (inject): [(target, probability)]; an empty list blocks the injection (no successor within LINE's enumerated space, e.g.
at the cutoff).
Implements line::lal::EmbeddedPart.
Definition at line 209 of file embed.h.
References line::qn::after_event(), line::lang::ARV, line::lal::NodeEvent::index, line::qn::NetState< T >::local, line::lal::NodeEvent::node, line::qn::EventOutcome< T >::prob, and line::qn::EventOutcome< T >::space.
|
inlineoverridevirtual |
True when s is a vanishing state of the embedded model.
Implements line::lal::EmbeddedPart.
|
inlineoverridevirtual |
Every node key an arc carries, in first-seen order.
Implements line::lal::EmbeddedPart.
|
inline |
|
inlineoverridevirtual |
The part name (the prefix, or the model name).
Implements line::lal::EmbeddedPart.
|
inlineoverridevirtual |
Jobs at a station in global state s: the total, or those of class jobclass when nonempty.
Implements line::lal::EmbeddedPart.
Definition at line 305 of file embed.h.
References line::qn::Marginal< T >::nir, line::lal::embed_detail::station_marginal(), and line::lal::value_error().
|
inlineoverridevirtual |
Name of the 1-based node index of the model.
Implements line::lal::EmbeddedPart.
Definition at line 269 of file embed.h.
References line::qn::NetworkStruct< T >::nodes, sn(), and line::lal::value_error().
|
inlineoverridevirtual |
The state row of a stateful node in global state s.
Implements line::lal::EmbeddedPart.
Definition at line 297 of file embed.h.
References line::lal::value_error().
|
inlineoverridevirtual |
The state row of stateful node isf in global state s, as [v1 v2 ...].
Implements line::lal::EmbeddedPart.
Definition at line 289 of file embed.h.
References line::lal::embed_detail::fmt_g().
|
inlineoverridevirtual |
[(node name, isf)] of the stateful node agents (isf is 1-based).
Implements line::lal::EmbeddedPart.
|
inlineoverridevirtual |
Arcs leaving global state s.
Implements line::lal::EmbeddedPart.
|
inlineoverridevirtual |
The embedding prefix, empty when none was given.
Implements line::lal::EmbeddedPart.
Definition at line 140 of file embed.h.
Referenced by EmbeddedNetwork(), and EmbeddedNetwork().
|
inline |
Station-by-class queue lengths and per-station service phases of global state x (memoized).
Definition at line 322 of file embed.h.
References line::qn::Marginal< T >::kir, line::qn::Marginal< T >::nir, line::lang::Source, and line::lal::embed_detail::station_marginal().
|
inlineoverridevirtual |
Re-read the embedded model on next use.
Implements line::lal::EmbeddedPart.
|
inlineoverridevirtual |
The key of a node action, validated against the model's names.
Implements line::lal::EmbeddedPart.
Definition at line 248 of file embed.h.
References line::qn::NetworkStruct< T >::classes, line::qn::JobClass::name, line::qn::NodeDef::name, line::qn::NetworkStruct< T >::nodes, sn(), and line::lal::value_error().
|
inlineoverridevirtual |
Record the classes hand agents inject (names); a change invalidates the enumeration.
Reimplemented from line::lal::EmbeddedPart.
|
inline |
Definition at line 170 of file embed.h.
Referenced by check_injection(), class_name(), EmbeddedNetwork(), node_name(), and resolve().
|
inline |