LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
sn_setters.h File Reference

Ports of the sn_set_* family and of sn_refresh_process_fields (matlab/src/api/sn). More...

#include <cmath>
#include <cstddef>
#include <vector>
#include "line/api/mam/map_moment.h"
#include "line/api/mam/map_transform.h"
#include "line/lang/qn/network_struct.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for sn_setters.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::api

Functions

template<class T>
void line::api::sn_refresh_process_fields (qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r)
 Port of sn_refresh_process_fields: rebuild sn.service[ist][r] from the (rate, SCV) pair currently in sn.rates and sn.scv.
template<class T>
void line::api::sn_set_service (qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r, const T &rate, const T &scv, bool auto_refresh=false)
 Port of sn_set_service: write a (rate, SCV) pair at one (station, class).
template<class T>
void line::api::sn_set_arrival (qn::NetworkStruct< T > &sn, std::size_t r, const T &rate, const T &scv, bool auto_refresh=false)
 Port of sn_set_arrival: the same, at whichever station is the Source.
template<class T>
void line::api::sn_set_service_batch (qn::NetworkStruct< T > &sn, const Matrix< T > &rates, const Matrix< T > &scvs, const std::vector< std::vector< bool > > &set_rate, const std::vector< std::vector< bool > > &set_scv, bool auto_refresh=false)
 Port of sn_set_service_batch: write a whole (rate, SCV) table, skipping the entries the caller left undefined.
template<class T>
void line::api::sn_set_population (qn::NetworkStruct< T > &sn, std::size_t r, double njobs, bool auto_refresh=false)
 Port of sn_set_population: change a class population and the closed total.
template<class T>
void line::api::sn_set_servers (qn::NetworkStruct< T > &sn, std::size_t ist, double nservers)
 Port of sn_set_servers.
template<class T>
void line::api::sn_set_priority (qn::NetworkStruct< T > &sn, std::size_t r, int priority)
 Port of sn_set_priority.
template<class T>
void line::api::sn_set_fork_fanout (qn::NetworkStruct< T > &sn, std::size_t fork_node, double fanout)
 Port of sn_set_fork_fanout.
template<class T>
void line::api::sn_set_routing (qn::NetworkStruct< T > &sn, const Matrix< T > &rt, bool auto_refresh=false)
 Port of sn_set_routing: replace the class-expanded stateful routing wholesale.
template<class T>
void line::api::sn_set_routing_prob (qn::NetworkStruct< T > &sn, std::size_t from_stateful, std::size_t from_class, std::size_t to_stateful, std::size_t to_class, const T &prob, bool auto_refresh=false)
 Port of sn_set_routing_prob: one entry of the class-expanded stateful routing.

Detailed Description

Ports of the sn_set_* family and of sn_refresh_process_fields (matlab/src/api/sn).

These edit an ALREADY REFRESHED struct in place. The model layer is the normal way to change a network, but a sensitivity sweep, a design-of- experiments driver or an optimiser wants to move one number and re-solve without rebuilding and re-refreshing the whole struct – rebuilding would also renumber chains and visits, which is exactly what such a sweep must hold fixed.

WHAT refresh MEANS HERE. Only the caller knows whether the edit invalidated the derived fields, so each setter takes the flag rather than deciding: a rate or SCV change invalidates the process representation, a population change invalidates the visits, and everything else invalidates nothing.

sn_refresh_process_fields rebuilds the (D0, D1) representation from the first two moments alone, by the reference's rule: SCV one is exponential, SCV below one is Erlang-ceil(1/SCV), SCV above one is a two-phase hyperexponential, and a hyperexponential that comes out infeasible falls back to exponential. A non-positive, infinite or undefined rate is left alone – there is no representation to build.

ARITHMETIC: field for everything but map_hyperexp, which needs a square root and therefore refuses under exact arithmetic; an SCV above one is the only path that reaches it.

Definition in file sn_setters.h.