5#ifndef LINE_SOLVERS_MAM_SOLVER_MAM_SYNC_H
6#define LINE_SOLVERS_MAM_SOLVER_MAM_SYNC_H
85 return "The sync methods require a single open class.";
86 std::size_t nsrc = 0, nq = 0, src = 0, q = 0;
87 for (std::size_t i = 0; i < L.
nstations; ++i) {
88 if (L.
stations[i].sched == SchedStrategy::EXT) {
96 if (L.
nstations != 2 || nsrc != 1 || nq != 1)
97 return "The sync methods require exactly one Source and one Queue station.";
98 if (L.
stations[q - 1].sched != SchedStrategy::FCFS)
99 return std::string(
"The sync methods require an FCFS queue; the station uses ") +
101 ". The synchronous approximation is a model of the M/G/c/K FIFO queue.";
103 return "The sync methods require Poisson (exponential) arrivals.";
105 const std::size_t qrow = (q - 1) * L.
nclasses;
106 if (L.
rt.rows() > qrow && L.
rt(qrow, qrow) > zero)
107 return "The sync methods do not support feedback: every completion must leave the network.";
109 for (
const T& v : L.
stations[q - 1].lldscaling)
110 if (v != one) ld =
true;
112 return "The sync methods do not support setup times or load dependence.";
113 const double c = L.
stations[q - 1].nservers;
114 const double K = L.
stations[q - 1].cap;
115 if (!std::isfinite(c) || c < 1.0)
return "The sync methods require a finite number of servers.";
116 if (!std::isfinite(K))
117 return "The sync methods require a finite capacity: the synchronous approximation is an "
118 "M/G/c/K model. Set Queue.setCapacity(K).";
120 return "The sync methods require a capacity no smaller than the number of servers.";
122 return std::string(
"The sync methods require the drop rule at the finite buffer; the "
130 if (pid == ProcessType::DET) {
132 }
else if (pid == ProcessType::EXP || pid == ProcessType::ERLANG ||
133 pid == ProcessType::HYPEREXP || pid == ProcessType::PH ||
134 pid == ProcessType::APH || pid == ProcessType::COXIAN ||
135 pid == ProcessType::COX2) {
137 return "The synchronous phase expansion (options.config.sync_phases >= 1) requires a "
138 "deterministic service time.";
142 return std::string(
"The sync methods take a deterministic or phase-type service time; "
143 "the station declares ") +
147 par->lambda = L.
rates(src - 1, 0);
148 par->c =
static_cast<std::size_t
>(c);
149 par->K =
static_cast<std::size_t
>(K);
155 return std::string();
164 const std::string prefix =
"sync.";
165 if (
opt.method.compare(0, prefix.size(), prefix) != 0)
167 "SolverMAM: solver_mam_sync answers 'sync.faster' and 'sync.slower' "
168 "only, not '" +
opt.method +
"'");
169 const std::string variant =
opt.method.substr(prefix.size());
182 const std::size_t si = par.
srcIdx - 1, qi = par.
qIdx - 1;
UnsupportedError(const std::string &what)
A network plus its refreshed NetworkStruct.
std::size_t phases_of(std::size_t ist, std::size_t r) const
sn.phases(i,r): the order of the process representation.
std::vector< std::vector< Distrib< T > > > service
service[i][r], 0-based station and class; a disabled entry marks a pair never visited.
std::map< std::size_t, SetupDelayOffParam< T > > setupparam
Setup / delay-off, keyed by 1-based STATION index.
Matrix< T > rt
sn.rt and sn.rtnodes: the class-expanded routing.
Matrix< double > procid() const
sn.procid (M x K): the ProcessType id of each (station, class) pair, as refreshProcessTypes....
std::vector< JobClass > classes
std::vector< Station< T > > stations
stations[k-1] is the k-th station
Matrix< T > rates
(nstations x nclasses) service rates and SCVs, with a PARALLEL disabled flag instead of MATLAB's NaN ...
std::vector< std::vector< DropStrategy > > droprule
What refreshProcessRepresentations and refreshLST compute FROM a distribution: the (D0,...
The exception types the port throws.
The option and result types SolverMAM shares with its analyzers.
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
mam::Map< T > dist_to_map(const Distrib< T > &d)
The (D0,D1) pair that reaches sn.proc.
SchedStrategy
Scheduling disciplines, with the values of MATLAB SchedStrategy.
DropStrategy
Blocking and loss rules, with the values of MATLAB DropStrategy.
ProcessType
Distribution kinds, with the values of MATLAB ProcessType.
const char * sched_to_text(SchedStrategy s)
const char * process_to_text(ProcessType p)
The MATLAB ProcessType name, as sn.procid prints it.
const char * drop_to_text(lang::DropStrategy d)
mva::MvaSolution< T > solver_mam_sync(const qn::NetworkStruct< T > &L, const MamOptions &opt)
Port of solver_mam_sync.m: fills Q, U, R, T, C, X from qsys_mgck_sync.
std::vector< T > map_pie(const Map< T > &m)
Phase distribution seen by an arriving job, pie = pi D1 / (pi D1 e).
std::string mam_sync_refusal(const qn::NetworkStruct< T > &L, std::size_t nph, MamSyncParams< T > *par=nullptr)
mam_sync_applicable.m: why the sync methods cannot answer this model, or "" when they can,...
MgckSyncResult< T > qsys_mgck_sync(const T &lambda, std::size_t c, std::size_t K, const ServiceLaw< T > &svc, const std::string &variant, std::size_t nphases, const T &tol, std::size_t nmaxCap)
Synchronous approximation of the M/G/c/K queue with dual bounds.
Conservation laws of a layered queueing network, enumerated from its structure.
A queueing network and its refreshed NetworkStruct.
Synchronous approximation of the M/G/c/K queue with dual bounds (German, EPEW 2025).
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
std::shared_ptr< Distrib< T > > declared
The law as DECLARED, when this one is a surrogate fitted over it.
The options SolverMAM reads.
What qsys_mgck_sync needs, read off the model by mam_sync_refusal.
std::size_t qIdx
1-based Queue station
qsys::ServiceLaw< T > svc
std::size_t srcIdx
1-based Source station
A MAP as the pair of matrices (D0, D1).
Class-level results, the [Q,U,R,T,C,X] of the MATLAB analyzers.
Return value of qsys_mgck_sync, mirroring the MATLAB result struct.
T meanSojournTime
meanQueueLength / throughput
T utilization
mean busy servers / c in the synchronized model
T meanQueueLength
mean number in system
T throughput
lambda (1 - pK)
Service-time descriptor, the C++ form of the MATLAB svc struct.
static ServiceLaw deterministic(const T &d)
Constant service time d.
static ServiceLaw phase_type(const std::vector< T > &alpha, const Matrix< T > &Tmat)
Phase type (alpha, Tmat).