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

The matrix fluid method: a port of solver_fluid_matrix.m, the formulation of Ruuskanen, Berg, Lehtinen et al., PEVA 151 (2021). More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <limits>
#include <vector>
#include "line/api/mam/map_moment.h"
#include "line/api/mc/dtmc_stochcomp.h"
#include "line/lang/qn/network_struct.h"
#include "line/solvers/fluid/fluid_odes.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for fluid_matrix.h:

Go to the source code of this file.

Classes

struct  line::fluid::FluidMatrixSystem
 The assembled matrix-form drift and the maps that read metrics off it. More...

Namespaces

namespace  line
namespace  line::fluid

Functions

template<class T>
FluidMatrixSystem line::fluid::fluid_matrix_system (const qn::NetworkStruct< T > &sn, const std::vector< double > &init_sol, double pstar)
 Assemble the matrix-form drift of sn.
std::function< void(double, const double *, double *)> line::fluid::fluid_matrix_drift (const FluidMatrixSystem &s)
 The drift dx/dt = W' theta(x) + A_lambda.
bool line::fluid::fluid_matrix_degenerate (const FluidMatrixSystem &s, const std::function< void(double, const double *, double *)> &drift, const std::vector< double > &x, std::size_t K)
 Is the returned point one of a CONTINUUM of fixed points?

Detailed Description

The matrix fluid method: a port of solver_fluid_matrix.m, the formulation of Ruuskanen, Berg, Lehtinen et al., PEVA 151 (2021).

WHY THIS METHOD EXISTS ALONGSIDE closing. Both integrate the same fluid limit; they differ in how the drift is written. closing enumerates events and sums their jumps. This one writes the whole drift as one matrix,

dx/dt = W' theta(x) + A_lambda,   W = Psi + B P A'

where Psi is the block diagonal of the phase generators D0, B the column of completion rates (the row sums of D1), P the station-to-station routing and A the block diagonal of entry-phase vectors. theta(x) is the only nonlinear part: it is the mass actually IN SERVICE,

theta = x / (sum of x at the station) * min(servers, sum of x)

so it equals x while the station is under-loaded and saturates at the server count above it. Writing the drift this way is what lets the p-norm smoothing be applied in one place, and it is why MATLAB and native Python make this the DEFAULT method.

IT INTEGRATES ONCE, NOT ITERATIVELY. closing restarts from its own end state repeatedly; this method picks a single horizon, 10 * iter_max / min|W|, and integrates straight to it. Same fixed point, different route.

THE SOURCE IS NOT IN THE DYNAMICS. An EXT station's states are held at zero with theta = 0, and its arrivals are injected directly into the phases of the queues they route to, through A_lambda. The reference also strips the routing back INTO a Source first, so an open class cannot cycle through it. That is why the fluid state of an open model carries no Source mass here, unlike the closing drift, which keeps a unit pool.

DISABLED PAIRS. A (station, class) with no service still contributes one placeholder column so the block structure lines up; the reference marks it with NaN in A and then drops every NaN column from W. Reproduced, because the surviving index order is what every result map is aligned to.

Definition in file fluid_matrix.h.