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

A queueing network under construction. More...

#include <line/lang/qn/network_builder.h>

Inheritance diagram for line::qn::Network< T >:

Public Member Functions

 Network (const std::string &nm)
std::size_t add_queue (const std::string &nm, SchedStrategy sched=SchedStrategy::FCFS)
 A queueing station.
std::size_t add_delay (const std::string &nm)
 An infinite-server station (a Delay, MATLAB's Delay / DelayStation).
std::size_t add_source (const std::string &nm)
 The external arrival station.
std::size_t add_sink (const std::string &nm)
 The external departure node.
std::size_t add_router (const std::string &nm)
 A stateless routing node.
std::size_t add_logger (const std::string &nm, const std::string &log_file=std::string())
 A Logger node: a pass-through that records every job crossing it.
void set_log_path (const std::string &path)
 Network.setLogPath: the directory every Logger of this model writes into.
std::size_t add_class_switch (const std::string &nm, const Matrix< T > &C)
 A ClassSwitch node carrying the (nclasses x nclasses) switching matrix.
std::size_t add_class_switch (const std::string &nm)
 A ClassSwitch node whose matrix is installed LATER, by set_class_switch_matrix.
void set_class_switch_matrix (std::size_t node, const Matrix< T > &C)
 Install the switching matrix of a ClassSwitch created without one.
std::size_t add_fork (const std::string &nm, double tasks_per_link=1.0)
 A Fork node.
void set_fork_tasks_per_link (std::size_t fork_node, std::size_t jobclass, double tasks, std::size_t dest_node=0)
 Variable forking levels on an existing Fork, the twin of MATLAB Fork.setTasksPerLink(jobclass, n), Fork.setTasksPerLinkDistribution(jobclass, dist [, destNode]) and Fork.setBranchProbability(jobclass, destNode, p).
void set_fork_tasks_per_link_dist (std::size_t fork_node, std::size_t jobclass, const lang::Distrib< T > &dist, std::size_t dest_node=0)
 A random jobs-per-link degree, redrawn per link and per forked job.
void set_fork_branch_probability (std::size_t fork_node, std::size_t jobclass, std::size_t dest_node, double prob)
 A branch that fires only with probability prob.
std::size_t add_join (const std::string &nm, std::size_t fork_node)
 A Join node, which IS a station: it serves at an infinite rate, and the synchronisation delay is supplied by the fork-join transform.
std::size_t add_join_unbound (const std::string &nm)
 The Join station on its own, with the fork left to bind_join.
void bind_join (std::size_t join_node, std::size_t fork_node)
 Record which Fork a Join created by add_join_unbound closes.
std::size_t add_place (const std::string &nm)
 A Place: an SPN token container.
std::size_t add_place (const std::string &nm, SchedStrategy sched)
 A Place whose EMBEDDED QUEUE is served under sched: the QUEUEING PLACE of a queueing Petri net, Place(model, name, schedStrategy) in MATLAB.
std::size_t add_transition (const std::string &nm, const TransitionParam< T > &par)
 A Transition: the firing rules of an SPN, as Transition in MATLAB.
std::size_t add_transition (const std::string &nm)
 A Transition with NO modes yet: Transition(model, name) as MATLAB, the JAR and Python spell it, with the modes declared afterwards.
std::size_t add_mode (std::size_t node, const std::string &nm)
 Transition.addMode(name): a new firing mode, returning its 1-based index.
void set_mode_distribution (std::size_t node, std::size_t mode, const Distrib< T > &d)
 Transition.setDistribution(mode, dist): the mode's firing law.
void set_mode_timing (std::size_t node, std::size_t mode, lang::TimingStrategy ts)
 Transition.setTimingStrategy(mode, strategy): TIMED or IMMEDIATE.
void set_mode_servers (std::size_t node, std::size_t mode, double n)
 Transition.setNumberOfServers(mode, n); GlobalConstants::MaxInt is infinite.
void set_firing_priority (std::size_t node, std::size_t mode, double prio)
 Transition.setFiringPriorities(mode, priority).
void set_firing_weight (std::size_t node, std::size_t mode, const T &w)
 Transition.setFiringWeights(mode, weight): the share among tied modes.
void set_mode_firing_dependence (std::size_t node, std::size_t mode, const std::function< T(const std::vector< T > &)> &g)
 Transition.setFiringRateDependence(mode, g): g(marking) scales the rate.
void set_enabling_conditions (std::size_t node, std::size_t mode, std::size_t cls, std::size_t place, const T &tokens)
 Transition.setEnablingConditions(mode, class, place, tokens): how many class-r tokens the mode needs at place before it may fire.
void set_inhibiting_conditions (std::size_t node, std::size_t mode, std::size_t cls, std::size_t place, const T &tokens)
 Transition.setInhibitingConditions(mode, class, place, tokens): the class-r count at place that BLOCKS the mode.
void set_firing_outcome (std::size_t node, std::size_t mode, std::size_t cls, std::size_t dest, const T &tokens)
 Transition.setFiringOutcome(mode, class, node, tokens): the class-r tokens the firing deposits.
void set_retrial (std::size_t node, std::size_t cls, const Distrib< T > &proc, const T &rate, int max_attempts=0)
 Queue.setRetrial(...): a station with an ORBIT instead of a waiting line.
void set_patience (std::size_t node, std::size_t cls, const Distrib< T > &dist, lang::ImpatienceType kind=lang::ImpatienceType::RENEGING)
 Queue.setPatience(class, dist, type): the abandonment timer of a job WAITING at the station, and which impatience rule the timer belongs to.
void set_orbit_impatience (std::size_t node, std::size_t cls, const Distrib< T > &dist)
 Queue.setOrbitImpatience(class, dist): abandonment from the retrial orbit.
void set_batch_reject (std::size_t node, std::size_t cls, const T &p)
 Queue.setBatchRejectProbability(class, p).
void set_balking (std::size_t node, std::size_t cls, lang::BalkingStrategy strategy, const std::vector< typename Station< T >::BalkingThreshold > &thresholds)
 Queue.setBalking(class, strategy, thresholds): an arrival that refuses to JOIN, on the state it finds.
void add_server_type (std::size_t node, const typename Station< T >::ServerType &stype)
 Queue.addServerType(...): one heterogeneous server pool of the station.
void set_server_parallelism (std::size_t node, std::size_t cls, std::size_t n)
 Queue.setServerParallelism(class, n): the servers a job seizes for the whole of its service.
void set_hetero_sched_policy (std::size_t node, lang::HeteroSchedPolicy policy)
 Queue.setHeteroSchedPolicy(...): how the server pools are picked among.
void set_arrival_batch (std::size_t node, std::size_t cls, const Distrib< T > &dist)
 Source.setArrivalBatch(class, dist): the batch-size law released at each arrival epoch.
void set_marked_classes (std::size_t node, const std::vector< std::size_t > &classes)
 Source.markedClasses: the 1-based class carried by each mark of an MMAP.
void set_departure_discipline (std::size_t node, std::size_t cls, lang::DepartureDiscipline rule)
 Place.setDepartureDiscipline(class, rule).
void set_initial_marking (std::size_t node, const std::vector< T > &tokens)
 Place.setState(marking): the initial token count of the place, per class.
void set_state_prior (std::size_t node, const Matrix< T > &space, const std::vector< T > &prior)
 StatefulNode.setStatePrior(space, prior): a distribution over the rows of a DECLARED state space.
void set_join_strategy (std::size_t node, lang::JoinStrategy strategy, double quorum=0.0)
 Join.setStrategy(...): STD waits for every sibling, PARTIAL for a quorum.
void set_routing_weights (std::size_t node, std::size_t cls, const std::map< std::size_t, double > &weights)
 The per-destination weights of a WRROBIN dispatcher, per (node, class).
void set_routing_param (std::size_t node, std::size_t cls, int d)
 The d of a power-of-d (SQ) dispatcher, per (node, class).
void set_setup_delayoff (std::size_t node, std::size_t cls, const Distrib< T > &setup, const Distrib< T > &delayoff)
 Queue.setDelayOff(class, setupTime, delayoffTime): the station powers down after sitting idle for the delay-off time, and the next arrival pays the setup time before service.
void set_breakdown (std::size_t node, const Distrib< T > &failure, const Distrib< T > &repair, const std::vector< Distrib< T > > &down_service=std::vector< Distrib< T > >())
 Queue.setBreakdown(failure, repair, downService): the server alternates up and down on the two clocks.
std::size_t add_cache (const std::string &nm, const CacheParam< T > &par)
 A Cache node with its item population, list capacities and popularity.
void set_item_read_classes (std::size_t cache_node, const std::vector< std::size_t > &read_classes, const std::vector< std::size_t > &hit_classes)
 Cache.setItemReadClasses(readClasses, hitClasses): declare that read_classes[i] is the request stream for item i at this cache.
std::vector< std::size_t > set_miss_cache (std::size_t cache_node, std::size_t next_cache, const std::vector< std::size_t > &hit_classes_at_next)
 Cache.setMissCache(readClass, nextCache, hitClassAtNext): send this cache's misses to next_cache preserving item identity, by minting one class per item there and making the miss class of item i here its read class for item i.
void set_item_miss_class (std::size_t cache_node, const std::vector< std::size_t > &miss_classes)
 Cache.setItemMissClass(readClass, missClasses): terminate a cache network, every per-item class of this cache reporting a miss as the matching entry of miss_classes, which the caller routes onward.
void set_retrieval_system (std::size_t cache_node, std::size_t read_class, std::size_t miss_class, const std::vector< std::size_t > &queue_nodes)
 Cache.setRetrievalSystem(readClass, missClass, queues): a delayed-hit cache whose misses are fetched by circulating a per-item retrieval class through queue_nodes and back to the cache.
std::size_t add_closed_class (const std::string &nm, double njobs, std::size_t refstat_node, int prio=0)
 A closed class of the given population, referencing a station node.
std::size_t add_open_class (const std::string &nm, int prio=0)
 An open class.
std::size_t add_self_looping_class (const std::string &nm, double njobs, std::size_t refstat_node, int prio=0)
 SelfLoopingClass(model, name, njobs, refstat, prio): a closed class whose jobs perpetually cycle at their reference station.
void set_reference_class (std::size_t cls)
 JobClass.setReferenceClass(true): sn.refclass(c) picks this class.
void set_class_deadline (std::size_t cls, double due)
 JobClass.deadline: the soft deadline EDD, EDF and JMT's tardiness use.
void set_class_spawn (std::size_t cls, std::size_t spawn_cls)
 JobClass.spawnClass (sn.classspawn): the class injected at the same station on every completion of cls.
void set_class_patience (std::size_t cls, const Distrib< T > &dist, lang::ImpatienceType kind=lang::ImpatienceType::RENEGING)
 JobClass.setPatience(kind, dist): the CLASS-WIDE abandonment law.
void set_reply_signal_class (std::size_t call_cls, std::size_t reply_cls)
 JobClass.setReplySignalClass(reply) (sn.syncreply), plus the sn.replyblock the state layer needs.
void set_service (std::size_t node, std::size_t cls, const Distrib< T > &d)
 station.setService(class, dist).
void set_arrival (std::size_t node, std::size_t cls, const Distrib< T > &d)
 source.setArrival(class, dist): the same table, at the Source.
void set_number_of_servers (std::size_t node, double n)
 queue.setNumberOfServers(n).
void set_capacity (std::size_t node, double k)
 station.setCapacity(k), the K of Kendall's notation.
void set_class_capacity (std::size_t node, std::size_t cls, double k)
 station.setChainCapacity(class, k).
void set_immediate_feedback (std::size_t node, std::size_t cls)
 queue.setImmediateFeedback(class): a completing job of that class is fed straight back into service, HOLDING THE SERVER, rather than being routed out and re-queued.
void set_class_immediate_feedback (std::size_t cls)
 jobclass.setImmediateFeedback(): the same property, class-wide.
void set_drop_rule (std::size_t node, std::size_t cls, DropStrategy rule)
 station.setDropRule(class, rule).
void set_service_rate_function (std::size_t node, const std::function< T(const std::vector< std::size_t > &)> &muFun, const Matrix< T > &swap_graph=Matrix< T >())
 Queue.setServiceRateFunction(muFun): the TOTAL service rate of a PAS or OI station as a function of the ordered microstate, a 1-based list of class indices in queue order.
void set_polling_type (std::size_t node, lang::PollingType rule, int par=0)
 Queue.setPollingType(rule, par): the polling discipline of a POLLING station, identical across all class buffers as the reference assumes.
void set_switchover (std::size_t node, std::size_t cls, const Distrib< T > &so)
 Queue.setSwitchover(jobclass, distrib): the switchover time of a class.
void set_switchover (std::size_t node, std::size_t from_cls, std::size_t to_cls, const Distrib< T > &so)
 Queue.setSwitchover(fromClass, toClass, distrib): the walk between two CLASSES at an ordinary station, the reference's (K x K) form.
void set_sched_param (std::size_t node, std::size_t cls, const T &weight)
 The DPS / GPS weight of a class at a station.
void set_load_dependence (std::size_t node, const std::vector< T > &alpha)
 station.setLoadDependence(alpha): the rate multiplier at population 1, 2, ... The vector is indexed from population one, as sn.lldscaling is, so entry 0 is the multiplier of a station holding one job.
void set_class_dependence (std::size_t node, const CdScaling< T > &fun, const std::vector< T > &peak=std::vector< T >())
 station.setClassDependence(beta, peakRatePerClass).
void set_joint_dependence (std::size_t node, const CdScaling< T > &fun, const std::vector< T > &peak)
 station.setJointDependence(eta, peakRatePerClass): MATLAB's Station.ljdScaling / ljdScalingPeak.
void set_global_dependence (const GdScaling< T > &fun, const std::vector< T > &peak)
 model.setGlobalDependence(phi, peak): MATLAB's Network.gdScaling.
void set_global_dependence (const GdScaling< T > &fun, const std::vector< T > &peak, int wire_cutoff)
 As above, with an explicit per-slot OPEN-class truncation used when phi is materialized onto the JSON wire (closed classes are tabulated up to their own population).
void set_routing (std::size_t node, std::size_t cls, RoutingStrategy rs)
 node.setRouting(class, strategy).
void set_state_dep_routing (std::size_t entry, std::size_t departure, const std::vector< std::vector< std::size_t > > &branches, const std::vector< std::size_t > &level, const std::vector< double > &C, const Matrix< double > &d, std::size_t cls=0)
 node.setStateDepRouting(class, departure, branches, level, C, d).
RoutingMatrix< T > init_routing_matrix () const
 An empty routing matrix, MATLAB's model.initRoutingMatrix.
RoutingMatrix< T > serial_routing (const std::vector< std::size_t > &nodes) const
 model.serialRouting(nodes): a unit-probability path through nodes.
void link (const RoutingMatrix< T > &Pm)
 model.link(P): install the routing.
const NetworkStruct< T > & get_struct ()
 The refreshed struct, MATLAB's model.getStruct().
NetworkStruct< T > & raw_struct ()
 The struct WITHOUT refreshing it, for a caller that is still building.
void set_pas (std::size_t node, const std::function< T(const std::vector< std::size_t > &)> &mu, const std::vector< std::vector< bool > > &swap_graph=std::vector< std::vector< bool > >())
 Queue.setService(@(c) ...) for a pass-and-swap / order-independent station: the total service rate mu(c) of an ordered list of 1-based class indices, and the swap graph saying which class may take another's place.
void pas_mirror (std::size_t ist, const std::function< T(const std::vector< std::size_t > &)> &mu, const Matrix< T > &swap_graph)
 Copy a PAS/OI declaration into sn.pasparam, the form the state-space layer reads.
void set_polling (std::size_t node, lang::PollingType ptype, const std::vector< Distrib< T > > &switchover=std::vector< Distrib< T > >(), std::size_t pk=1)
 Queue.setPollingType(...): the polling discipline of a POLLING station and the switchover walks between its buffers.
void set_sync_reply (std::size_t node, std::size_t call_cls, std::size_t reply_cls)
 Declare a SYNCHRONOUS call: a job of call_cls leaving node keeps its server until a job of the REPLY class reply_cls arrives back here.
std::size_t add_region (const std::vector< std::size_t > &nodes, const std::vector< double > &class_max_jobs, double global_max_jobs=-1.0, const std::vector< DropStrategy > &rule=std::vector< DropStrategy >(), const std::vector< double > &class_max_memory=std::vector< double >(), const std::vector< T > &class_size=std::vector< T >(), double global_max_memory=-1.0, const std::string &name=std::string())
 FiniteCapacityRegion(model, nodes): a cap on the jobs held ACROSS a set of stations.
void set_region_weights (std::size_t region, const std::vector< T > &weight)
 FiniteCapacityRegion.setClassWeight: the per-class weight the region's global cap counts a job against, defaulting to 1.
void set_region_constraint (std::size_t region, const Matrix< T > &A, const std::vector< T > &b)
 The optional linear constraint A n <= b a region may carry beyond its caps.
void set_reward (const std::string &nm, const std::function< T(const std::vector< T > &)> &fn, const std::string &kind=std::string(), std::size_t node=0, std::size_t cls=0)
 model.setReward(name, fn): a named reward evaluated on the AGGREGATE state row, the per-(station, class) job counts in (ist-1)*K + k order.
void set_signal (std::size_t cls, lang::SignalType type, lang::RemovalPolicy policy=lang::RemovalPolicy::RANDOM, std::size_t target=0, const std::vector< T > &remdist=std::vector< T >())
 Declare a class to be a G-network SIGNAL rather than a job.
std::size_t station_index (std::size_t node) const

Detailed Description

template<class T>
class line::qn::Network< T >

A queueing network under construction.

The object owns a NetworkStruct and hands out a refreshed reference to it. get_struct() runs the whole refresh chain each time it is called, because every setter can have moved a quantity the chain derives; a caller that changes nothing and asks twice pays for the second refresh, which is the same bargain MATLAB's hasStruct cache makes on the other side.

Definition at line 108 of file network_builder.h.

Constructor & Destructor Documentation

◆ Network()

template<class T>
line::qn::Network< T >::Network ( const std::string & nm)
inlineexplicit

Definition at line 110 of file network_builder.h.

Member Function Documentation

◆ add_cache()

template<class T>
std::size_t line::qn::Network< T >::add_cache ( const std::string & nm,
const CacheParam< T > & par )
inline

A Cache node with its item population, list capacities and popularity.

Definition at line 811 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ add_class_switch() [1/2]

template<class T>
std::size_t line::qn::Network< T >::add_class_switch ( const std::string & nm)
inline

A ClassSwitch node whose matrix is installed LATER, by set_class_switch_matrix.

FOR A FILE READER, which meets the nodes before the classes. A .jsimg and a .lqnx both list their nodes first, and a closed class names its reference STATION, so neither order can be satisfied without deferring one of the two – MATLAB's own ClassSwitch constructor stores the matrix without checking it against a class list that does not exist yet, which is the same deferral by another name.

THE MATRIX IS LEFT EMPTY, not filled with an identity: an identity is a valid switching matrix (every class keeps its own), so a caller who forgot to install the real one would get a plausible model instead of an error.

Definition at line 246 of file network_builder.h.

◆ add_class_switch() [2/2]

template<class T>
std::size_t line::qn::Network< T >::add_class_switch ( const std::string & nm,
const Matrix< T > & C )
inline

A ClassSwitch node carrying the (nclasses x nclasses) switching matrix.

The classes must exist before the node, since the matrix is indexed by them; that is also the order a MATLAB script writes.

Definition at line 220 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::io::read_jsim().

◆ add_closed_class()

template<class T>
std::size_t line::qn::Network< T >::add_closed_class ( const std::string & nm,
double njobs,
std::size_t refstat_node,
int prio = 0 )
inline

◆ add_delay()

template<class T>
std::size_t line::qn::Network< T >::add_delay ( const std::string & nm)
inline

◆ add_fork()

template<class T>
std::size_t line::qn::Network< T >::add_fork ( const std::string & nm,
double tasks_per_link = 1.0 )
inline

A Fork node.

It holds no jobs and is removed by the stochastic complement. tasks_per_link (Fork.output.tasksPerLink) defaults to 1.

Definition at line 269 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::io::read_jsim().

◆ add_join()

template<class T>
std::size_t line::qn::Network< T >::add_join ( const std::string & nm,
std::size_t fork_node )
inline

A Join node, which IS a station: it serves at an infinite rate, and the synchronisation delay is supplied by the fork-join transform.

Definition at line 343 of file network_builder.h.

Referenced by line::io::read_jsim().

◆ add_join_unbound()

template<class T>
std::size_t line::qn::Network< T >::add_join_unbound ( const std::string & nm)
inline

The Join station on its own, with the fork left to bind_join.

A Join IS a station, so creating it late shifts every station index after it, and the result document is indexed by station row. A reader that has to see the Fork first therefore declares the Join here, in the position the model gives it, and binds the pair once the Fork exists.

Definition at line 357 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ add_logger()

template<class T>
std::size_t line::qn::Network< T >::add_logger ( const std::string & nm,
const std::string & log_file = std::string() )
inline

A Logger node: a pass-through that records every job crossing it.

It holds no jobs and changes no routing probability, so it is eliminated by the same stochastic complement that removes a Router; what makes it a distinct node type is that used_lang_features emits Logger/LogTunnel from it, so a solver with no logging refuses the model by name rather than silently dropping the trace the user asked for.

Definition at line 199 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ add_mode()

template<class T>
std::size_t line::qn::Network< T >::add_mode ( std::size_t node,
const std::string & nm )
inline

Transition.addMode(name): a new firing mode, returning its 1-based index.

The defaults are the reference's own – one server, TIMED, priority one, weight one, and no firing law until set_mode_distribution gives it one.

Definition at line 471 of file network_builder.h.

Referenced by line::Transition::add_mode().

◆ add_open_class()

template<class T>
std::size_t line::qn::Network< T >::add_open_class ( const std::string & nm,
int prio = 0 )
inline

An open class.

Its reference station is the Source, which must exist: an open class with no arrival station has no reference for its visits.

Definition at line 1035 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::infer::infer_quick_model(), line::io::jmva2line(), line::io::read_jsim(), and line::api::sn_aggregate_chains().

◆ add_place() [1/2]

template<class T>
std::size_t line::qn::Network< T >::add_place ( const std::string & nm)
inline

A Place: an SPN token container.

Modelled as an INF-scheduled station so the marginal machinery treats its tokens as "in service", which is the encoding State.toMarginal folds the buffer slot back into.

Definition at line 386 of file network_builder.h.

Referenced by line::qn::Network< double >::add_place(), line::io::build_network_from_json(), line::io::pnml_load(), and line::io::read_jsim().

◆ add_place() [2/2]

template<class T>
std::size_t line::qn::Network< T >::add_place ( const std::string & nm,
SchedStrategy sched )
inline

A Place whose EMBEDDED QUEUE is served under sched: the QUEUEING PLACE of a queueing Petri net, Place(model, name, schedStrategy) in MATLAB.

A token arriving here is NOT immediately available to the output transitions. It joins the place's own queue, is served by the place's own servers, and only on completion does it reach the DEPOSITORY that the output arcs draw from. That is the whole of the construct, and it is why the discipline has to be declared at construction: MATLAB's installQueueServer picks the server SECTION from it, and the section is what decides the server count.

DECLARING THE DISCIPLINE DOES NOT YET MAKE IT A QUEUEING PLACE. is_queueing_place keys on a service process being present, which is Place.queueing being raised by setService and not by the constructor; a place built with a discipline and left without a service law is an ordinary pass-through place, exactly as in the reference.

The server count follows the section: one server for the queueing disciplines and infinitely many for INF, which is also the ordinary place's own shape, so add_place(nm) is this call at INF.

Definition at line 410 of file network_builder.h.

◆ add_queue()

template<class T>
std::size_t line::qn::Network< T >::add_queue ( const std::string & nm,
SchedStrategy sched = SchedStrategy::FCFS )
inline

A queueing station.

The default discipline is FCFS, as in MATLAB.

INF SCHEDULING BUILDS A DELAY. MATLAB's Queue constructor sets numberOfServers = Inf on that branch and getNodeTypes then reports the station as NodeType.Delay (the JAR does both with Integer.MAX_VALUE), and the analyzers partition the stations on those two fields: sn_get_product_form_chain_params splits by NODETYPE, so a Queue node left at one server was handed to the linearizer as a finite-server queue and reported utilization 1 and a saturated response time where the reference reports a delay (2.4494/19.5506 against 0.1253/21.8747 on a two-station closed model with 22 jobs).

Definition at line 129 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::fes::fes_aggregate(), line::api::infer_mlps(), line::infer::infer_quick_model(), line::io::jmva2line(), line::io::read_jsim(), and line::api::sn_aggregate_chains().

◆ add_region()

template<class T>
std::size_t line::qn::Network< T >::add_region ( const std::vector< std::size_t > & nodes,
const std::vector< double > & class_max_jobs,
double global_max_jobs = -1.0,
const std::vector< DropStrategy > & rule = std::vector<DropStrategy>(),
const std::vector< double > & class_max_memory = std::vector<double>(),
const std::vector< T > & class_size = std::vector<T>(),
double global_max_memory = -1.0,
const std::string & name = std::string() )
inline

FiniteCapacityRegion(model, nodes): a cap on the jobs held ACROSS a set of stations.

class_max_jobs[r] and global_max_jobs are -1 for unbounded, the reference's sentinel; the per-class cap is additionally tightened by floor(class_max_memory[r] / class_size[r]) when a memory budget is set, because a class whose footprint exceeds the budget cannot have as many jobs resident as its job cap alone would allow.

Parameters
nodes1-based node indices; each must be a station
class_max_jobs(K) per-class job cap inside the region, -1 for unbounded
global_max_jobscap on the total jobs inside the region, -1 for unbounded
rule(K) per-class drop strategy applied when the cap is reached
class_max_memory(K) per-class memory budget, -1 for unbounded
class_size(K) per-job memory footprint of each class
global_max_memorycap on the total memory inside the region, -1 for unbounded

Definition at line 1956 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ add_router()

template<class T>
std::size_t line::qn::Network< T >::add_router ( const std::string & nm)
inline

A stateless routing node.

Definition at line 184 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::read_jsim(), and line::api::sn_aggregate_chains().

◆ add_self_looping_class()

template<class T>
std::size_t line::qn::Network< T >::add_self_looping_class ( const std::string & nm,
double njobs,
std::size_t refstat_node,
int prio = 0 )
inline

SelfLoopingClass(model, name, njobs, refstat, prio): a closed class whose jobs perpetually cycle at their reference station.

Built as a closed class because that is all it is – the self-loop is in the routing, and SelfLoopingClass.m adds no state – with the subclass recorded so the wire type survives a round trip.

Definition at line 1058 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ add_server_type()

template<class T>
void line::qn::Network< T >::add_server_type ( std::size_t node,
const typename Station< T >::ServerType & stype )
inline

Queue.addServerType(...): one heterogeneous server pool of the station.

Definition at line 628 of file network_builder.h.

Referenced by line::Station::add_server_type(), and line::io::build_network_from_json().

◆ add_sink()

template<class T>
std::size_t line::qn::Network< T >::add_sink ( const std::string & nm)
inline

The external departure node.

It is NOT a station and holds no jobs.

Definition at line 175 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::infer::infer_quick_model(), line::io::jmva2line(), line::io::read_jsim(), and line::api::sn_aggregate_chains().

◆ add_source()

template<class T>
std::size_t line::qn::Network< T >::add_source ( const std::string & nm)
inline

The external arrival station.

It IS a station – its "service" process is the arrival process – with the EXT discipline and one server, exactly as MATLAB's Source is built.

Definition at line 161 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::infer::infer_quick_model(), line::io::jmva2line(), line::io::read_jsim(), and line::api::sn_aggregate_chains().

◆ add_transition() [1/2]

template<class T>
std::size_t line::qn::Network< T >::add_transition ( const std::string & nm)
inline

A Transition with NO modes yet: Transition(model, name) as MATLAB, the JAR and Python spell it, with the modes declared afterwards.

THE NODE IS REGISTERED FIRST, which is the whole point of this overload. A transition is itself a node, so the arc matrices of the form above are (nnodes x nclasses) over a node count that does not exist until the LAST transition has been added – a caller building a net through that overload has to hand-count the total and re-count it whenever the net gains a node. Here the arcs are held SPARSELY as (mode, node, class) triples and materialised against the finished model by get_struct(), so nothing has to be counted and nothing can be counted wrong.

Definition at line 457 of file network_builder.h.

◆ add_transition() [2/2]

template<class T>
std::size_t line::qn::Network< T >::add_transition ( const std::string & nm,
const TransitionParam< T > & par )
inline

A Transition: the firing rules of an SPN, as Transition in MATLAB.

A transition has MODES, not classes: each mode has its own enabling and inhibiting conditions over the places, its own firing effect, and its own firing process. The parameters are transcribed from the reference's refreshPetriNetNodes.m, so State.fromMarginal finds the fields it reads instead of a node it cannot decode.

Definition at line 432 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::pnml_load(), and line::io::read_jsim().

◆ bind_join()

template<class T>
void line::qn::Network< T >::bind_join ( std::size_t join_node,
std::size_t fork_node )
inline

Record which Fork a Join created by add_join_unbound closes.

Definition at line 370 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ get_struct()

◆ init_routing_matrix()

template<class T>
RoutingMatrix< T > line::qn::Network< T >::init_routing_matrix ( ) const
inline

An empty routing matrix, MATLAB's model.initRoutingMatrix.

Definition at line 1582 of file network_builder.h.

Referenced by line::infer::infer_quick_model(), and line::io::jmva2line().

◆ link()

template<class T>
void line::qn::Network< T >::link ( const RoutingMatrix< T > & Pm)
inline

model.link(P): install the routing.

The probabilities are stored as given. A node whose strategy is RAND needs only the CONNECTIONS – any positive entry marks one – and the refresh replaces them by the uniform split.

Definition at line 1611 of file network_builder.h.

Referenced by line::opt::ClassServiceMapping::apply(), line::io::build_network_from_json(), line::fes::fes_aggregate(), line::api::infer_mlps(), line::infer::infer_quick_model(), line::io::jmva2line(), line::io::pnml_load(), line::io::read_jsim(), and line::api::sn_aggregate_chains().

◆ pas_mirror()

template<class T>
void line::qn::Network< T >::pas_mirror ( std::size_t ist,
const std::function< T(const std::vector< std::size_t > &)> & mu,
const Matrix< T > & swap_graph )
inline

Copy a PAS/OI declaration into sn.pasparam, the form the state-space layer reads.

The (R x R) swap adjacency crosses as a boolean matrix because that is the shape after_event's swap walk indexes.

Definition at line 1872 of file network_builder.h.

◆ raw_struct()

◆ serial_routing()

template<class T>
RoutingMatrix< T > line::qn::Network< T >::serial_routing ( const std::vector< std::size_t > & nodes) const
inline

model.serialRouting(nodes): a unit-probability path through nodes.

A path ending at a Sink stays open. Every other path is closed back onto its first node, matching MATLAB's Network.serialRouting convention for closed models. The returned matrix is a one-class topology block and can be passed directly to link, or assigned to a class with P.set(cls, block).

Definition at line 1592 of file network_builder.h.

Referenced by line::io::jmva2line().

◆ set_arrival()

template<class T>
void line::qn::Network< T >::set_arrival ( std::size_t node,
std::size_t cls,
const Distrib< T > & d )
inline

◆ set_arrival_batch()

template<class T>
void line::qn::Network< T >::set_arrival_batch ( std::size_t node,
std::size_t cls,
const Distrib< T > & dist )
inline

Source.setArrivalBatch(class, dist): the batch-size law released at each arrival epoch.

The arrival process itself only spaces the epochs.

Definition at line 666 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::Source::set_arrival_batch().

◆ set_balking()

template<class T>
void line::qn::Network< T >::set_balking ( std::size_t node,
std::size_t cls,
lang::BalkingStrategy strategy,
const std::vector< typename Station< T >::BalkingThreshold > & thresholds )
inline

Queue.setBalking(class, strategy, thresholds): an arrival that refuses to JOIN, on the state it finds.

Distinct from reneging, which abandons a job that has already joined.

Definition at line 619 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_batch_reject()

template<class T>
void line::qn::Network< T >::set_batch_reject ( std::size_t node,
std::size_t cls,
const T & p )
inline

Queue.setBatchRejectProbability(class, p).

Definition at line 608 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_breakdown()

template<class T>
void line::qn::Network< T >::set_breakdown ( std::size_t node,
const Distrib< T > & failure,
const Distrib< T > & repair,
const std::vector< Distrib< T > > & down_service = std::vector<Distrib<T>>() )
inline

Queue.setBreakdown(failure, repair, downService): the server alternates up and down on the two clocks.

BOTH CLOCKS ARE REQUIRED. A server that fails and is never repaired is a different model – an absorbing one – and the reference declines to infer it from a missing repair time rather than treating it as infinite.

down_service is per class and OPTIONAL; an entry left disabled means the class gets no service while the server is down, which is the ordinary reading. A declared one must be EXPONENTIAL: a phase-type degraded service would need its own phase block in the joint chain and no codebase builds one, so it is refused by name rather than approximated by its mean.

Definition at line 779 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::Station::set_breakdown().

◆ set_capacity()

template<class T>
void line::qn::Network< T >::set_capacity ( std::size_t node,
double k )
inline

◆ set_class_capacity()

template<class T>
void line::qn::Network< T >::set_class_capacity ( std::size_t node,
std::size_t cls,
double k )
inline

station.setChainCapacity(class, k).

Definition at line 1194 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::read_jsim(), and line::Station::set_class_capacity().

◆ set_class_deadline()

template<class T>
void line::qn::Network< T >::set_class_deadline ( std::size_t cls,
double due )
inline

JobClass.deadline: the soft deadline EDD, EDF and JMT's tardiness use.

Definition at line 1071 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_class_dependence()

template<class T>
void line::qn::Network< T >::set_class_dependence ( std::size_t node,
const CdScaling< T > & fun,
const std::vector< T > & peak = std::vector<T>() )
inline

station.setClassDependence(beta, peakRatePerClass).

The peak is a scalar broadcast across the classes, or one value per class; it is the declared max_n beta_r(n) that utilization is normalized by, and the reference makes it mandatory because it cannot be recovered from beta without sweeping the whole lattice – a sweep that needs a bound the handle does not carry, and an open class has none.

An empty peak is accepted HERE and refused where it is READ, matching getLimitedClassDependencePeak. That contract is only worth anything if every reader honours it, and they do: SolverCTMC, solver_mva_run_analyzer, solver_nc_conv, both SSA engines and the LDES engine each throw by name. SolverMVA was the exception until 2026-08-19, silently writing a column of ZEROS into U instead. set_joint_dependence below takes the peak as a REQUIRED argument and refuses at declaration; both shapes end in an error.

Definition at line 1358 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::fes::fes_aggregate().

◆ set_class_immediate_feedback()

template<class T>
void line::qn::Network< T >::set_class_immediate_feedback ( std::size_t cls)
inline

jobclass.setImmediateFeedback(): the same property, class-wide.

Definition at line 1215 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_class_patience()

template<class T>
void line::qn::Network< T >::set_class_patience ( std::size_t cls,
const Distrib< T > & dist,
lang::ImpatienceType kind = lang::ImpatienceType::RENEGING )
inline

JobClass.setPatience(kind, dist): the CLASS-WIDE abandonment law.

The reference has no class-indexed patience in sn: refreshStruct reads it through Queue.getPatience, which falls back to the class setting wherever the station declares none, so the class-level law is materialized onto every Queue and Delay here for exactly that reason. A station-level setPatience therefore wins, as it does in MATLAB.

Definition at line 1095 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_class_spawn()

template<class T>
void line::qn::Network< T >::set_class_spawn ( std::size_t cls,
std::size_t spawn_cls )
inline

JobClass.spawnClass (sn.classspawn): the class injected at the same station on every completion of cls.

Definition at line 1079 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_class_switch_matrix()

template<class T>
void line::qn::Network< T >::set_class_switch_matrix ( std::size_t node,
const Matrix< T > & C )
inline

Install the switching matrix of a ClassSwitch created without one.

Definition at line 254 of file network_builder.h.

Referenced by line::ClassSwitch::ClassSwitch(), line::io::read_jsim(), and line::ClassSwitch::set_class_switching_matrix().

◆ set_departure_discipline()

template<class T>
void line::qn::Network< T >::set_departure_discipline ( std::size_t node,
std::size_t cls,
lang::DepartureDiscipline rule )
inline

Place.setDepartureDiscipline(class, rule).

Definition at line 678 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::Place::set_departure_discipline().

◆ set_drop_rule()

template<class T>
void line::qn::Network< T >::set_drop_rule ( std::size_t node,
std::size_t cls,
DropStrategy rule )
inline

station.setDropRule(class, rule).

Definition at line 1220 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::read_jsim(), and line::Station::set_drop_rule().

◆ set_enabling_conditions()

template<class T>
void line::qn::Network< T >::set_enabling_conditions ( std::size_t node,
std::size_t mode,
std::size_t cls,
std::size_t place,
const T & tokens )
inline

Transition.setEnablingConditions(mode, class, place, tokens): how many class-r tokens the mode needs at place before it may fire.

The CLASS IS NOT DECORATION: a mode needing two Class1 tokens must not be enabled by Class2 tokens sitting at the same place, so the arc is keyed by the (place, class) pair and not by the place alone.

Definition at line 529 of file network_builder.h.

Referenced by line::Transition::set_enabling_conditions().

◆ set_firing_outcome()

template<class T>
void line::qn::Network< T >::set_firing_outcome ( std::size_t node,
std::size_t mode,
std::size_t cls,
std::size_t dest,
const T & tokens )
inline

Transition.setFiringOutcome(mode, class, node, tokens): the class-r tokens the firing deposits.

The destination is any node the firing may reach, a Sink included, which is why it is not narrowed to a Place.

Definition at line 551 of file network_builder.h.

Referenced by line::Transition::set_firing_outcome().

◆ set_firing_priority()

template<class T>
void line::qn::Network< T >::set_firing_priority ( std::size_t node,
std::size_t mode,
double prio )
inline

Transition.setFiringPriorities(mode, priority).

Definition at line 506 of file network_builder.h.

Referenced by line::Transition::set_firing_priorities().

◆ set_firing_weight()

template<class T>
void line::qn::Network< T >::set_firing_weight ( std::size_t node,
std::size_t mode,
const T & w )
inline

Transition.setFiringWeights(mode, weight): the share among tied modes.

Definition at line 511 of file network_builder.h.

Referenced by line::Transition::set_firing_weights().

◆ set_fork_branch_probability()

template<class T>
void line::qn::Network< T >::set_fork_branch_probability ( std::size_t fork_node,
std::size_t jobclass,
std::size_t dest_node,
double prob )
inline

A branch that fires only with probability prob.

Definition at line 325 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_fork_tasks_per_link()

template<class T>
void line::qn::Network< T >::set_fork_tasks_per_link ( std::size_t fork_node,
std::size_t jobclass,
double tasks,
std::size_t dest_node = 0 )
inline

Variable forking levels on an existing Fork, the twin of MATLAB Fork.setTasksPerLink(jobclass, n), Fork.setTasksPerLinkDistribution(jobclass, dist [, destNode]) and Fork.setBranchProbability(jobclass, destNode, p).

The block is allocated lazily and only on a fork that actually declares an override, so a plain fork has no sn.forkparam entry at all and every consumer can tell the classic case from the variable one by asking sn.fork_param_of(f) for a null.

dest_node 0 means every outgoing link of that class. Classes and nodes are 1-based, as everywhere in this port.

An override is RECORDED and replayed when the routing is installed, so these may be called in either order with respect to link() – as the MATLAB, Java and Python setters may, which store the override on the Forker section and materialise it at refresh time. Recording rather than writing is what buys that: dest_node = 0 means "every link this class takes", a set that does not exist until the routing does.

Definition at line 297 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_fork_tasks_per_link_dist()

template<class T>
void line::qn::Network< T >::set_fork_tasks_per_link_dist ( std::size_t fork_node,
std::size_t jobclass,
const lang::Distrib< T > & dist,
std::size_t dest_node = 0 )
inline

A random jobs-per-link degree, redrawn per link and per forked job.

Definition at line 309 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_global_dependence() [1/2]

template<class T>
void line::qn::Network< T >::set_global_dependence ( const GdScaling< T > & fun,
const std::vector< T > & peak )
inline

model.setGlobalDependence(phi, peak): MATLAB's Network.gdScaling.

Declares a globally state-dependent rate scaling phi(n) whose argument is the FULL (nstations x nclasses) population matrix, row-major, rather than one station's slice. This is the Whittle primitive: when phi satisfies phi_s(n) phi_t(n-e_s) = phi_t(n) phi_s(n-e_t) the chain is reversible with pi(n) ~ Phi(n) prod rho_s^n_s and is insensitive; it also expresses bandwidth sharing, where a route holds several links at once.

phi returns one scalar (broadcast), one entry per station, or one entry per (station, class) in row-major order. The peak is MANDATORY for the same reason as set_class_dependence: utilization is reported as T*S/peak, at EVERY station once a handle is present, the delays among them. Only SolverCTMC, SolverSSA and SolverLDES honour the handle.

Definition at line 1419 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_global_dependence() [2/2]

template<class T>
void line::qn::Network< T >::set_global_dependence ( const GdScaling< T > & fun,
const std::vector< T > & peak,
int wire_cutoff )
inline

As above, with an explicit per-slot OPEN-class truncation used when phi is materialized onto the JSON wire (closed classes are tabulated up to their own population).

It plays no part in solving, and exists because a handle cannot cross a language boundary: the writer needs to know how far the lattice extends. Set it to the cutoff the model is solved at.

Definition at line 1430 of file network_builder.h.

◆ set_hetero_sched_policy()

template<class T>
void line::qn::Network< T >::set_hetero_sched_policy ( std::size_t node,
lang::HeteroSchedPolicy policy )
inline

Queue.setHeteroSchedPolicy(...): how the server pools are picked among.

Definition at line 658 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_immediate_feedback()

template<class T>
void line::qn::Network< T >::set_immediate_feedback ( std::size_t node,
std::size_t cls )
inline

queue.setImmediateFeedback(class): a completing job of that class is fed straight back into service, HOLDING THE SERVER, rather than being routed out and re-queued.

Node-scoped. set_class_immediate_feedback is the class-wide spelling; sn.immfeed is the OR of the two, as refreshStruct computes it.

Definition at line 1208 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_inhibiting_conditions()

template<class T>
void line::qn::Network< T >::set_inhibiting_conditions ( std::size_t node,
std::size_t mode,
std::size_t cls,
std::size_t place,
const T & tokens )
inline

Transition.setInhibitingConditions(mode, class, place, tokens): the class-r count at place that BLOCKS the mode.

Absent means never, which the materialised matrix spells as infinity.

Definition at line 540 of file network_builder.h.

Referenced by line::Transition::set_inhibiting_conditions().

◆ set_initial_marking()

template<class T>
void line::qn::Network< T >::set_initial_marking ( std::size_t node,
const std::vector< T > & tokens )
inline

Place.setState(marking): the initial token count of the place, per class.

Definition at line 686 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::pnml_load(), line::io::read_jsim(), and line::Place::set_initial_marking().

◆ set_item_miss_class()

template<class T>
void line::qn::Network< T >::set_item_miss_class ( std::size_t cache_node,
const std::vector< std::size_t > & miss_classes )
inline

Cache.setItemMissClass(readClass, missClasses): terminate a cache network, every per-item class of this cache reporting a miss as the matching entry of miss_classes, which the caller routes onward.

Definition at line 925 of file network_builder.h.

◆ set_item_read_classes()

template<class T>
void line::qn::Network< T >::set_item_read_classes ( std::size_t cache_node,
const std::vector< std::size_t > & read_classes,
const std::vector< std::size_t > & hit_classes )
inline

Cache.setItemReadClasses(readClasses, hitClasses): declare that read_classes[i] is the request stream for item i at this cache.

Use at the cache the exogenous requests enter, where the per-item classes are the caller's own; item popularity is then carried by the per-class request rates rather than by a popularity the cache draws from. This is what keeps a cache network free of arc-level class switching, so no class acquires a default route into the cache the model never intended. hit_classes is either one class shared by every item or one per item.

Definition at line 828 of file network_builder.h.

Referenced by line::Cache::set_item_read_classes().

◆ set_join_strategy()

template<class T>
void line::qn::Network< T >::set_join_strategy ( std::size_t node,
lang::JoinStrategy strategy,
double quorum = 0.0 )
inline

Join.setStrategy(...): STD waits for every sibling, PARTIAL for a quorum.

Definition at line 710 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::Join::set_strategy().

◆ set_joint_dependence()

template<class T>
void line::qn::Network< T >::set_joint_dependence ( std::size_t node,
const CdScaling< T > & fun,
const std::vector< T > & peak )
inline

station.setJointDependence(eta, peakRatePerClass): MATLAB's Station.ljdScaling / ljdScalingPeak.

The peak is MANDATORY, exactly as in Station.setJointDependence, and for the same reason as setClassDependence: utilization at a dependent station is reported as T*S/peak, and max_n eta_i(n) is not recoverable from the handle without sweeping the whole lattice.

Definition at line 1384 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_load_dependence()

template<class T>
void line::qn::Network< T >::set_load_dependence ( std::size_t node,
const std::vector< T > & alpha )
inline

station.setLoadDependence(alpha): the rate multiplier at population 1, 2, ... The vector is indexed from population one, as sn.lldscaling is, so entry 0 is the multiplier of a station holding one job.

Definition at line 1336 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::jmva2line(), and line::Station::set_load_dependence().

◆ set_log_path()

template<class T>
void line::qn::Network< T >::set_log_path ( const std::string & path)
inline

Network.setLogPath: the directory every Logger of this model writes into.

Definition at line 212 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_marked_classes()

template<class T>
void line::qn::Network< T >::set_marked_classes ( std::size_t node,
const std::vector< std::size_t > & classes )
inline

Source.markedClasses: the 1-based class carried by each mark of an MMAP.

Definition at line 673 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::Source::set_marked_arrival().

◆ set_miss_cache()

template<class T>
std::vector< std::size_t > line::qn::Network< T >::set_miss_cache ( std::size_t cache_node,
std::size_t next_cache,
const std::vector< std::size_t > & hit_classes_at_next )
inline

Cache.setMissCache(readClass, nextCache, hitClassAtNext): send this cache's misses to next_cache preserving item identity, by minting one class per item there and making the miss class of item i here its read class for item i.

Returns the minted classes. The cache-to-cache arc itself is registered here and injected by link(), so the caller routes only its own topology.

Definition at line 863 of file network_builder.h.

◆ set_mode_distribution()

template<class T>
void line::qn::Network< T >::set_mode_distribution ( std::size_t node,
std::size_t mode,
const Distrib< T > & d )
inline

Transition.setDistribution(mode, dist): the mode's firing law.

Definition at line 491 of file network_builder.h.

Referenced by line::Transition::set_distribution().

◆ set_mode_firing_dependence()

template<class T>
void line::qn::Network< T >::set_mode_firing_dependence ( std::size_t node,
std::size_t mode,
const std::function< T(const std::vector< T > &)> & g )
inline

Transition.setFiringRateDependence(mode, g): g(marking) scales the rate.

Definition at line 516 of file network_builder.h.

Referenced by line::Transition::set_firing_rate_dependence().

◆ set_mode_servers()

template<class T>
void line::qn::Network< T >::set_mode_servers ( std::size_t node,
std::size_t mode,
double n )
inline

Transition.setNumberOfServers(mode, n); GlobalConstants::MaxInt is infinite.

Definition at line 501 of file network_builder.h.

Referenced by line::Transition::set_number_of_servers().

◆ set_mode_timing()

template<class T>
void line::qn::Network< T >::set_mode_timing ( std::size_t node,
std::size_t mode,
lang::TimingStrategy ts )
inline

Transition.setTimingStrategy(mode, strategy): TIMED or IMMEDIATE.

Definition at line 496 of file network_builder.h.

Referenced by line::Transition::set_timing_strategy().

◆ set_number_of_servers()

template<class T>
void line::qn::Network< T >::set_number_of_servers ( std::size_t node,
double n )
inline

queue.setNumberOfServers(n).

IT IS A NO-OP ON AN INF-SCHEDULED STATION, which is what MATLAB does: the method switches on the discipline and ignores the request for SchedStrategy.INF. Lowering the multiplicity onto the station instead looks harmless and is not – utilization at a finite-server station is divided by the server count, so an inf-scheduled station would report a utilization a factor n too small.

Definition at line 1177 of file network_builder.h.

Referenced by line::opt::ServerAllocation::apply(), line::opt::StationReplicas::apply(), line::io::build_network_from_json(), line::fes::fes_aggregate(), line::api::infer_mlps(), line::infer::infer_quick_model(), line::io::jmva2line(), line::io::read_jsim(), line::Station::set_number_of_servers(), and line::api::sn_aggregate_chains().

◆ set_orbit_impatience()

template<class T>
void line::qn::Network< T >::set_orbit_impatience ( std::size_t node,
std::size_t cls,
const Distrib< T > & dist )
inline

Queue.setOrbitImpatience(class, dist): abandonment from the retrial orbit.

Definition at line 601 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_pas()

template<class T>
void line::qn::Network< T >::set_pas ( std::size_t node,
const std::function< T(const std::vector< std::size_t > &)> & mu,
const std::vector< std::vector< bool > > & swap_graph = std::vector<std::vector<bool>>() )
inline

Queue.setService(@(c) ...) for a pass-and-swap / order-independent station: the total service rate mu(c) of an ordered list of 1-based class indices, and the swap graph saying which class may take another's place.

An OI station is the special case of an empty swap graph.

Definition at line 1845 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_patience()

template<class T>
void line::qn::Network< T >::set_patience ( std::size_t node,
std::size_t cls,
const Distrib< T > & dist,
lang::ImpatienceType kind = lang::ImpatienceType::RENEGING )
inline

Queue.setPatience(class, dist, type): the abandonment timer of a job WAITING at the station, and which impatience rule the timer belongs to.

Definition at line 591 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_polling()

template<class T>
void line::qn::Network< T >::set_polling ( std::size_t node,
lang::PollingType ptype,
const std::vector< Distrib< T > > & switchover = std::vector<Distrib<T>>(),
std::size_t pk = 1 )
inline

Queue.setPollingType(...): the polling discipline of a POLLING station and the switchover walks between its buffers.

switchover[r-1] is the walk the server takes when LEAVING buffer r. An Immediate walk is folded rather than represented, so it costs no state.

Definition at line 1892 of file network_builder.h.

◆ set_polling_type()

template<class T>
void line::qn::Network< T >::set_polling_type ( std::size_t node,
lang::PollingType rule,
int par = 0 )
inline

Queue.setPollingType(rule, par): the polling discipline of a POLLING station, identical across all class buffers as the reference assumes.

Only K-limited carries a parameter; every other rule ignores it.

Definition at line 1274 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::Station::set_polling_type().

◆ set_reference_class()

template<class T>
void line::qn::Network< T >::set_reference_class ( std::size_t cls)
inline

JobClass.setReferenceClass(true): sn.refclass(c) picks this class.

Definition at line 1066 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_region_constraint()

template<class T>
void line::qn::Network< T >::set_region_constraint ( std::size_t region,
const Matrix< T > & A,
const std::vector< T > & b )
inline

The optional linear constraint A n <= b a region may carry beyond its caps.

Definition at line 2023 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_region_weights()

template<class T>
void line::qn::Network< T >::set_region_weights ( std::size_t region,
const std::vector< T > & weight )
inline

FiniteCapacityRegion.setClassWeight: the per-class weight the region's global cap counts a job against, defaulting to 1.

A weight of 2 makes one job of the class consume two of the region's slots.

Definition at line 2014 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_reply_signal_class()

template<class T>
void line::qn::Network< T >::set_reply_signal_class ( std::size_t call_cls,
std::size_t reply_cls )
inline

JobClass.setReplySignalClass(reply) (sn.syncreply), plus the sn.replyblock the state layer needs.

The reference derives the block rather than being told it (refreshLocalVars.m:340-386): a server is held at every non-Source, non-INF station the REPLY class can be routed INTO, and every such station must be FCFS because a held server is encoded as a per-class counter. That derivation needs the routing, so it runs in finalize(); this only records the binding.

Definition at line 1123 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_retrial()

template<class T>
void line::qn::Network< T >::set_retrial ( std::size_t node,
std::size_t cls,
const Distrib< T > & proc,
const T & rate,
int max_attempts = 0 )
inline

Queue.setRetrial(...): a station with an ORBIT instead of a waiting line.

An arrival finding every server busy joins the orbit and re-attempts at rate; a completion does NOT promote from the orbit, so the state is an (in-service, orbit) split rather than an ordered buffer.

Definition at line 563 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_retrieval_system()

template<class T>
void line::qn::Network< T >::set_retrieval_system ( std::size_t cache_node,
std::size_t read_class,
std::size_t miss_class,
const std::vector< std::size_t > & queue_nodes )
inline

Cache.setRetrievalSystem(readClass, missClass, queues): a delayed-hit cache whose misses are fetched by circulating a per-item retrieval class through queue_nodes and back to the cache.

Creates one retrieval class per item, each inheriting the read class's service at every retrieval queue (call set_service(queue, readClass, ...) first); the routing among the cache and the queues is inherited from the read class in link(). Records the retrieval capacity (nitems - total cache capacity), the queue node list, and the item -> retrieval-class map that cache_retrieval_inputs reads. Must be called after the read/miss classes and the cache exist.

Definition at line 952 of file network_builder.h.

◆ set_reward()

template<class T>
void line::qn::Network< T >::set_reward ( const std::string & nm,
const std::function< T(const std::vector< T > &)> & fn,
const std::string & kind = std::string(),
std::size_t node = 0,
std::size_t cls = 0 )
inline

model.setReward(name, fn): a named reward evaluated on the AGGREGATE state row, the per-(station, class) job counts in (ist-1)*K + k order.

Redeclaring a name REPLACES it rather than adding a second reward under the same name, so a caller refining a definition does not end up with two answers labelled identically.

Definition at line 2040 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_routing()

template<class T>
void line::qn::Network< T >::set_routing ( std::size_t node,
std::size_t cls,
RoutingStrategy rs )
inline

node.setRouting(class, strategy).

Definition at line 1475 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::read_jsim(), and line::Node::set_routing().

◆ set_routing_param()

template<class T>
void line::qn::Network< T >::set_routing_param ( std::size_t node,
std::size_t cls,
int d )
inline

The d of a power-of-d (SQ) dispatcher, per (node, class).

Definition at line 734 of file network_builder.h.

Referenced by line::io::build_network_from_json(), and line::io::read_jsim().

◆ set_routing_weights()

template<class T>
void line::qn::Network< T >::set_routing_weights ( std::size_t node,
std::size_t cls,
const std::map< std::size_t, double > & weights )
inline

The per-destination weights of a WRROBIN dispatcher, per (node, class).

Definition at line 722 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::read_jsim(), and line::Node::set_routing_weights().

◆ set_sched_param()

template<class T>
void line::qn::Network< T >::set_sched_param ( std::size_t node,
std::size_t cls,
const T & weight )
inline

The DPS / GPS weight of a class at a station.

Definition at line 1325 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::io::read_jsim(), and line::Station::set_sched_param().

◆ set_server_parallelism()

template<class T>
void line::qn::Network< T >::set_server_parallelism ( std::size_t node,
std::size_t cls,
std::size_t n )
inline

Queue.setServerParallelism(class, n): the servers a job seizes for the whole of its service.

The station then serves at most floor(c/n) such jobs at a time.

Definition at line 642 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_service()

template<class T>
void line::qn::Network< T >::set_service ( std::size_t node,
std::size_t cls,
const Distrib< T > & d )
inline

station.setService(class, dist).

A Prior gets its MIXTURE moments here, where a Markovian family gets the moments of its (D0,D1): both are the "what does the struct report before anything solves" question, and leaving a Prior at mean 0 would make a struct dump read as an Immediate.

Definition at line 1145 of file network_builder.h.

Referenced by line::opt::ServiceRate::apply(), line::io::build_network_from_json(), line::uq::SolverUq< T >::expand(), line::fes::fes_aggregate(), line::api::infer_mlps(), line::infer::infer_quick_model(), line::io::jmva2line(), line::io::read_jsim(), line::Station::set_service(), and line::api::sn_aggregate_chains().

◆ set_service_rate_function()

template<class T>
void line::qn::Network< T >::set_service_rate_function ( std::size_t node,
const std::function< T(const std::vector< std::size_t > &)> & muFun,
const Matrix< T > & swap_graph = Matrix<T>() )
inline

Queue.setServiceRateFunction(muFun): the TOTAL service rate of a PAS or OI station as a function of the ordered microstate, a 1-based list of class indices in queue order.

Only PAS and OI take one, and the reference errors on any other discipline. As Queue.setServiceRateFunction does, this ALSO installs a representative per-class service distribution Exp(mu([r])), so that the ordinary rate/procid machinery stays consistent; the authoritative description of the station remains mu(c). A class whose mu([r]) is not positive and finite is disabled there, again as the reference does.

swap_graph is sn.nodeparam{ind}.swapGraph, empty (all zero) for a genuinely order-independent station.

Definition at line 1241 of file network_builder.h.

◆ set_setup_delayoff()

template<class T>
void line::qn::Network< T >::set_setup_delayoff ( std::size_t node,
std::size_t cls,
const Distrib< T > & setup,
const Distrib< T > & delayoff )
inline

Queue.setDelayOff(class, setupTime, delayoffTime): the station powers down after sitting idle for the delay-off time, and the next arrival pays the setup time before service.

The pair is set together because a setup with no delay-off never fires and a delay-off with no setup is free.

Definition at line 750 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_signal()

template<class T>
void line::qn::Network< T >::set_signal ( std::size_t cls,
lang::SignalType type,
lang::RemovalPolicy policy = lang::RemovalPolicy::RANDOM,
std::size_t target = 0,
const std::vector< T > & remdist = std::vector<T>() )
inline

Declare a class to be a G-network SIGNAL rather than a job.

A signal never joins a station: it removes jobs already there and is annihilated. target is the 1-based class it may remove, or 0 for the classic untargeted Gelenbe customer. remdist is the batch-size pmf indexed by batch size 0,1,2,...; empty means "remove exactly one".

Definition at line 2069 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_state_dep_routing()

template<class T>
void line::qn::Network< T >::set_state_dep_routing ( std::size_t entry,
std::size_t departure,
const std::vector< std::vector< std::size_t > > & branches,
const std::vector< std::size_t > & level,
const std::vector< double > & C,
const Matrix< double > & d,
std::size_t cls = 0 )
inline

node.setStateDepRouting(class, departure, branches, level, C, d).

Declares entry the entry centre e of a subnetwork Q(V,V) served by the product-form state-dependent routing of A. E. Krzesinski, "Multiclass Queueing Networks with State-Dependent Routing", Performance Evaluation 7(2):125-143, 1987.

All node indices are 1-based, as elsewhere in the builder. departure may equal entry in a central server model. branches follows the paper's own indexing: branches[0] must be empty because branch index 1 denotes the complement M-V, and branches[b] lists the nodes of branch b with its entry centre first and its departure centre last. level[b] is the index t of the subnetwork with B_b in V_t - V_{t+1}, and level[0] is ignored. C holds the T coefficients C_t and d the T by B coefficients d_tb, read for 1 <= t <= level[b].

Negative C_t and positive d_tb make the routing prefer the least congested branches and impose the population bounds m_b <= d_tb/(-C_t) and v_t <= D_tt/(-C_t). The residual probability returns the customer to the departure centre, the busy form of waiting of Sec. 2.5, so the entry node needs a self-loop when entry and departure coincide.

Definition at line 1504 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_state_prior()

template<class T>
void line::qn::Network< T >::set_state_prior ( std::size_t node,
const Matrix< T > & space,
const std::vector< T > & prior )
inline

StatefulNode.setStatePrior(space, prior): a distribution over the rows of a DECLARED state space.

The two are set together because a prior indexes that space and means nothing without it.

Definition at line 699 of file network_builder.h.

Referenced by line::io::build_network_from_json().

◆ set_switchover() [1/2]

template<class T>
void line::qn::Network< T >::set_switchover ( std::size_t node,
std::size_t cls,
const Distrib< T > & so )
inline

Queue.setSwitchover(jobclass, distrib): the switchover time of a class.

Definition at line 1285 of file network_builder.h.

Referenced by line::io::build_network_from_json(), line::Station::set_switchover(), and line::Station::set_switchover().

◆ set_switchover() [2/2]

template<class T>
void line::qn::Network< T >::set_switchover ( std::size_t node,
std::size_t from_cls,
std::size_t to_cls,
const Distrib< T > & so )
inline

Queue.setSwitchover(fromClass, toClass, distrib): the walk between two CLASSES at an ordinary station, the reference's (K x K) form.

An UNDECLARED pair stays Disabled and is therefore not serialized, which is what the JAR and python write. MATLAB fills its cell with Immediate instead and writes all K^2 entries; the two mean the same thing, since no solver reads a pairwise switchover, and the sparse form is the one that round-trips a document unchanged.

Refused at a POLLING station, where a switchover is the walk out of one BUFFER and is declared per class by the overload above. The reference accepts the call there and then drops the extra rows when it serializes, which is a silently different model.

Definition at line 1308 of file network_builder.h.

◆ set_sync_reply()

template<class T>
void line::qn::Network< T >::set_sync_reply ( std::size_t node,
std::size_t call_cls,
std::size_t reply_cls )
inline

Declare a SYNCHRONOUS call: a job of call_cls leaving node keeps its server until a job of the REPLY class reply_cls arrives back here.

The block is one nvars column per (node, calling class), so it stays zero-width – and every other model's state width unchanged – unless a model actually declares a reply. node is checked here and marked, but refresh_replyblock re-derives the whole block from the routing on every refresh, exactly as the reference does; naming a node is therefore an assertion about this model, not the definition of the block.

Definition at line 1918 of file network_builder.h.

◆ station_index()

template<class T>
std::size_t line::qn::Network< T >::station_index ( std::size_t node) const
inline

Definition at line 2091 of file network_builder.h.

Referenced by line::Station::get_station_index().


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