5#ifndef LINE_LANG_QN_NODES_H
6#define LINE_LANG_QN_NODES_H
74 operator std::size_t()
const {
return idx_; }
150 :
Station(m, m.add_queue(nm, sched), nm) {}
185 for (std::size_t k = 0; k < classes.size(); ++k)
207 :
Node(m, m.add_class_switch(nm), nm) {
220 :
Node(m, m.add_fork(nm, tasks_per_link), nm) {}
227 :
Node(m, m.add_join(nm, fork_node), nm) {}
238 :
Node(m, m.add_cache(nm, par), nm) {}
241 const std::vector<std::size_t>& hit_classes) {
258 :
Station(m, m.add_place(nm, sched), nm) {}
289 :
Node(m, m.add_transition(nm, par), nm) {}
315 std::size_t mode,
const std::function<
double(
const std::vector<double>&)>& g) {
341 operator std::size_t()
const {
return idx_; }
356 :
JobClass(m, m.add_closed_class(nm, njobs, refstat_node, prio), nm) {}
363 :
JobClass(m, m.add_open_class(nm, prio), nm) {}
370 std::size_t refstat_node,
int prio = 0)
371 :
JobClass(m, m.add_self_looping_class(nm, njobs, refstat_node, prio), nm) {}
379 const Place& place,
double tokens) {
384 const Place& place,
double tokens) {
389 const Node& dest,
double tokens) {
399 const std::vector<std::size_t>& nodes) {
400 for (std::size_t k = 0; k + 1 < nodes.size(); ++k) P.
set(r, s, nodes[k], nodes[k + 1], 1.0);
411 if (nodes.size() > 1) P.
set(r, r, nodes.back(), nodes.front(), 1.0);
Cache(NetworkModel &m, const std::string &nm, const qn::CacheParam< double > &par)
void set_item_read_classes(const std::vector< std::size_t > &read_classes, const std::vector< std::size_t > &hit_classes)
setItemReadClasses(read_classes, hit_classes), one entry per item.
void set_class_switching_matrix(const Matrix< double > &C)
setClassSwitchingMatrix(C).
ClassSwitch(NetworkModel &m, const std::string &nm, const Matrix< double > &C)
ClosedClass(NetworkModel &m, const std::string &nm, double njobs, std::size_t refstat_node, int prio=0)
Delay(NetworkModel &m, const std::string &nm)
Fork(NetworkModel &m, const std::string &nm, double tasks_per_link=1.0)
A job class: the index it was given, and the model that owns it.
JobClass(NetworkModel &m, std::size_t idx, const std::string &nm)
const std::string & get_name() const
getName().
std::size_t get_index() const
get_index(): the 1-based class index.
void set_strategy(lang::JoinStrategy strategy, double quorum=0.0)
setStrategy(strategy, quorum).
Join(NetworkModel &m, const std::string &nm, std::size_t fork_node)
A node of the model: the index it was given, and the model that owns it.
Node(NetworkModel &m, std::size_t idx, const std::string &nm)
void set_routing(std::size_t cls, lang::RoutingStrategy rs)
setRouting(class, strategy).
NetworkModel & model() const
The model this node belongs to.
std::size_t get_index() const
get_index(): the 1-based node index the builder assigned.
void set_routing_weights(std::size_t cls, const std::map< std::size_t, double > &weights)
setRoutingWeight(class, weights): the WRROBIN share per destination.
const std::string & get_name() const
getName().
OpenClass(NetworkModel &m, const std::string &nm, int prio=0)
Place(model, name): a Petri-net place.
void set_departure_discipline(std::size_t cls, lang::DepartureDiscipline rule)
setDepartureDiscipline(class, rule): how a served token leaves the depository.
void set_initial_marking(const std::vector< double > &tokens)
setInitialMarking(tokens).
Place(NetworkModel &m, const std::string &nm)
Place(NetworkModel &m, const std::string &nm, lang::SchedStrategy sched)
Place(model, name, schedStrategy): a place with an EMBEDDED QUEUE.
Queue(NetworkModel &m, const std::string &nm, lang::SchedStrategy sched=lang::SchedStrategy::FCFS)
Router(NetworkModel &m, const std::string &nm)
SelfLoopingClass(NetworkModel &m, const std::string &nm, double njobs, std::size_t refstat_node, int prio=0)
Sink(NetworkModel &m, const std::string &nm)
void set_arrival_batch(std::size_t cls, const Dist &d)
setArrivalBatch(class, batchSizeDist).
void set_arrival(std::size_t cls, const Dist &d)
setArrival(class, distribution).
void set_marked_arrival(const Dist &d, const std::vector< std::size_t > &classes)
setMarkedArrival(process, classes): bind a MARKED arrival process, one class per mark.
Source(NetworkModel &m, const std::string &nm)
void add_server_type(const qn::Station< double >::ServerType &stype)
addServerType(type): one pool of a heterogeneous station.
void set_breakdown(const Dist &failure, const Dist &repair)
setBreakdown(failure, repair).
void set_polling_type(lang::PollingType rule, int par=0)
setPollingType(type, k).
Station(NetworkModel &m, std::size_t idx, const std::string &nm)
void set_switchover(std::size_t from_cls, std::size_t to_cls, const Dist &so)
setSwitchover(fromClass, toClass, distribution).
void set_capacity(double k)
setCapacity(k), the K of Kendall's notation.
void set_service(std::size_t cls, const Dist &d)
setService(class, distribution).
void set_sched_param(std::size_t cls, double weight)
setSchedParam(class, weight): the DPS/GPS share.
void set_class_capacity(std::size_t cls, double k)
setClassCapacity(class, k).
std::size_t get_station_index() const
getStationIndex(): the 1-based station index, distinct from the node one.
void set_drop_rule(std::size_t cls, lang::DropStrategy rule)
setDropRule(class, rule).
void set_number_of_servers(double n)
setNumberOfServers(n).
void set_load_dependence(const std::vector< double > &alpha)
setLoadDependence(alpha).
void set_switchover(std::size_t cls, const Dist &so)
setSwitchover(class, distribution).
void set_firing_weights(std::size_t mode, double w)
setFiringWeights(mode, weight): the share among simultaneously enabled modes.
Transition(NetworkModel &m, const std::string &nm)
void set_number_of_servers(std::size_t mode, double n)
setNumberOfServers(mode, n); GlobalConstants::MaxInt is infinite.
void set_firing_rate_dependence(std::size_t mode, const std::function< double(const std::vector< double > &)> &g)
setFiringRateDependence(mode, g): g(marking) scales the firing rate.
void set_firing_outcome(std::size_t mode, const JobClass &cls, const Node &dest, double tokens)
setFiringOutcome(mode, class, node, tokens); the node may be a Sink.
void set_timing_strategy(std::size_t mode, lang::TimingStrategy ts)
setTimingStrategy(mode, strategy): TIMED or IMMEDIATE.
void set_inhibiting_conditions(std::size_t mode, const JobClass &cls, const Place &place, double tokens)
setInhibitingConditions(mode, class, place, tokens); absent means never.
void set_firing_priorities(std::size_t mode, double prio)
setFiringPriorities(mode, priority).
std::size_t add_mode(const std::string &nm)
addMode(name): the new mode's 1-based index.
void set_distribution(std::size_t mode, const Dist &d)
setDistribution(mode, dist): the mode's firing law.
void set_enabling_conditions(std::size_t mode, const JobClass &cls, const Place &place, double tokens)
setEnablingConditions(mode, class, place, tokens).
Transition(NetworkModel &m, const std::string &nm, const qn::TransitionParam< double > &par)
The all-at-once form, for a caller that already holds a finished block.
A queueing network under construction.
void set_drop_rule(std::size_t node, std::size_t cls, DropStrategy rule)
station.setDropRule(class, rule).
void set_departure_discipline(std::size_t node, std::size_t cls, lang::DepartureDiscipline rule)
Place.setDepartureDiscipline(class, rule).
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 f...
void set_class_capacity(std::size_t node, std::size_t cls, double k)
station.setChainCapacity(class, k).
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 ...
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_mode_timing(std::size_t node, std::size_t mode, lang::TimingStrategy ts)
Transition.setTimingStrategy(mode, strategy): TIMED or IMMEDIATE.
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_distribution(std::size_t node, std::size_t mode, const Distrib< T > &d)
Transition.setDistribution(mode, dist): the mode's firing law.
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_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 BLOCK...
void set_number_of_servers(std::size_t node, double n)
queue.setNumberOfServers(n).
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_class_switch_matrix(std::size_t node, const Matrix< T > &C)
Install the switching matrix of a ClassSwitch created without one.
void set_routing(std::size_t node, std::size_t cls, RoutingStrategy rs)
node.setRouting(class, strategy).
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.
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_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_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_firing_priority(std::size_t node, std::size_t mode, double prio)
Transition.setFiringPriorities(mode, priority).
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_capacity(std::size_t node, double k)
station.setCapacity(k), the K of Kendall's notation.
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 add_server_type(std::size_t node, const typename Station< T >::ServerType &stype)
Queue.addServerType(...): one heterogeneous server pool of the station.
void set_service(std::size_t node, std::size_t cls, const Distrib< T > &d)
station.setService(class, dist).
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...
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...
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_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.
std::size_t station_index(std::size_t node) const
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_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 cl...
The routing matrix a model script fills in, MATLAB's P cell array.
void set(std::size_t r, std::size_t s, std::size_t i, std::size_t j, const T &p)
Enumerations and the minimal distribution descriptor shared by the model layer of the C++ port.
SchedStrategy
Scheduling disciplines, with the values of MATLAB SchedStrategy.
DropStrategy
Blocking and loss rules, with the values of MATLAB DropStrategy.
TimingStrategy
SPN transition timing, with the values of MATLAB TimingStrategy.
JoinStrategy
Join rules, with the values of MATLAB JoinStrategy.
RoutingStrategy
Routing strategies, with the values of MATLAB RoutingStrategy.
DepartureDiscipline
When a Place releases a served token, MATLAB DepartureDiscipline.
PollingType
Polling service disciplines, with the values of MATLAB PollingType.
Conservation laws of a layered queueing network, enumerated from its structure.
lang::Distrib< double > Dist
qn::Network< double > NetworkModel
void cyclic_routing(Routing &P, std::size_t r, const std::vector< std::size_t > &nodes)
The same chain closed into a cycle, which is how a closed model circulates.
qn::RoutingMatrix< double > Routing
void serial_routing(Routing &P, std::size_t r, std::size_t s, const std::vector< std::size_t > &nodes)
Network.serialRouting(nodes) for one class pair: 1 -> 2 -> ... -> n.
The Network constructor API: Queue, Delay, Source, Sink, Router, ClassSwitch, Cache,...
A heterogeneous server pool: count servers that serve only compatible classes, each with its own serv...
The parameters of a Cache node, MATLAB's sn.nodeparam{ind} for a Cache.