![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Ports of the sn_has_* / sn_is_* predicate family of matlab/src/api/sn. More...
#include <cmath>#include <cstddef>#include <limits>#include <vector>#include "line/api/sn/sn_get_buffer_size.h"#include "line/lang/lang_types.h"#include "line/lang/qn/network_struct.h"#include "line/num/number.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::api |
Functions | |
| template<class T> | |
| bool | line::api::sn_has_dps (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_dps_prio (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_fcfs (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_gps (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_gps_prio (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_hol (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_inf (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_lcfs (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_lcfs_pi (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_lcfs_pr (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_lept (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_ljf (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_lps (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_polling (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_ps (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_ps_prio (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_sept (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_setf (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_siro (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_sjf (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_srpt (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_homogeneous_scheduling (const qn::NetworkStruct< T > &sn, qn::SchedStrategy) |
| Port of sn_has_homogeneous_scheduling. | |
| template<class T> | |
| bool | line::api::sn_has_open_classes (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_closed_classes (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_multiple_closed_classes (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_mixed_classes (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_multi_chain (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_single_chain (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_multi_class (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_single_class (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_class_switching (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_is_open_model (const qn::NetworkStruct< T > &sn) |
| all(isinf(sn.njobs)): EVERY class is open, which a mixed model fails. | |
| template<class T> | |
| bool | line::api::sn_is_closed_model (const qn::NetworkStruct< T > &sn) |
| all(isfinite(sn.njobs)): EVERY class is closed. | |
| template<class T> | |
| bool | line::api::sn_is_mixed_model (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_priorities (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_multi_server (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| bool | line::api::sn_has_fractional_populations (const qn::NetworkStruct< T > &sn) |
| any(sn.njobs ~= round(sn.njobs)); an infinite population rounds to itself. | |
| template<class T> | |
| bool | line::api::sn_has_load_dependence (const qn::NetworkStruct< T > &sn) |
| size(sn.lldscaling,2)>0: some station carries a limited-load scaling row. | |
| template<class T> | |
| bool | line::api::sn_has_fork_join (const qn::NetworkStruct< T > &sn) |
| any(sn.fj(:) > 0): the model has a Fork closed by a Join. | |
| template<class T> | |
| bool | line::api::sn_has_sd_routing (const qn::NetworkStruct< T > &sn) |
| sn_has_sd_routing: some node dispatches on the STATE of the network. | |
| template<class T> | |
| bool | line::api::sn_has_multi_class_fcfs (const qn::NetworkStruct< T > &sn) |
| sum(sn.rates(i,:)>0)>1 at some FCFS station: more than one class is served there. | |
| template<class T> | |
| bool | line::api::sn_has_multi_class_heter_fcfs (const qn::NetworkStruct< T > &sn) |
| sn_has_multi_class_heter_fcfs: an FCFS station whose per-class rates differ. | |
| template<class T> | |
| bool | line::api::sn_has_multi_class_heter_exp_fcfs (const qn::NetworkStruct< T > &sn) |
| An FCFS station with heterogeneous rates whose SCVs are all one (exponential). | |
| template<class T> | |
| bool | line::api::sn_sched_is_product_form (const qn::NetworkStruct< T > &sn) |
| The disciplines the reference admits in sn_has_product_form. | |
| template<class T> | |
| bool | line::api::sn_has_blocking (const qn::NetworkStruct< T > &sn) |
| Defined below, after sn_is_mm1k_loss, which it exempts. | |
| template<class T> | |
| bool | line::api::sn_has_product_form (const qn::NetworkStruct< T > &sn) |
| Port of sn_has_product_form. | |
| template<class T> | |
| bool | line::api::sn_has_product_form_not_het_fcfs (const qn::NetworkStruct< T > &sn, bool check_means=true) |
| Port of sn_has_product_form_not_het_fcfs: LCFS is out, and every enabled FCFS pair with a finite positive SCV must have that SCV equal to one, with the service means agreeing across the classes served there. | |
| template<class T> | |
| bool | line::api::sn_is_population_model (const qn::NetworkStruct< T > &sn) |
| sn_is_population_model: every station is population dependent only, which is what lets the fluid and mean-field limits close on the queue lengths. | |
| template<class T> | |
| bool | line::api::sn_is_bas_model (const qn::NetworkStruct< T > &sn) |
| sn_is_bas_model: a single-class closed model with blocking-after-service. | |
| template<class T> | |
| bool | line::api::sn_is_mm1k_loss (const qn::NetworkStruct< T > &sn) |
| sn_is_mm1k_loss: the three-node Source/Queue/Sink model of an M/M/1/K with loss, the shape MVA answers in closed form instead of iterating. | |
Ports of the sn_has_* / sn_is_* predicate family of matlab/src/api/sn.
The reference keeps each predicate in its own one-line .m file; collecting them in one header keeps the port readable and, more importantly, keeps the DEFINITIONS in one place. Several of these predicates gate solver dispatch, so a predicate that quietly differs from the reference does not raise an error – it routes the model to a different algorithm and returns a different number.
NetworkStruct carries member functions with some of these names. Where both exist the free function here is the reference-faithful one and the member is a convenience used inside the struct's own refresh; sn_has_product_form is the case where the two DISAGREE, see the note on that function. sn_has_blocking and sn_is_mm1k_loss are the other way round: the SOLVERS read them through NetworkStruct::has_product_form, so the body lives on the struct and these forward to it rather than carrying a second copy.
ARITHMETIC: field. Every test is a comparison; nothing here is transcendental, so the whole family instantiates under Rational.
Definition in file sn_predicates.h.