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

The solver API a user writes, spelled as its Python twin. More...

#include <cstddef>
#include <string>
#include <vector>
#include "line/lang/qn/network_builder.h"
#include "line/solvers/avg_table.h"
#include "line/solvers/solver_options.h"
#include "line/util/matrix.h"
Include dependency graph for solver.h:

Go to the source code of this file.

Classes

class  line::NetworkSolver
 The shared surface of every solver, Python's NetworkSolver. More...
class  line::SolverCTMC
 SolverCTMC: the average table plus the chain it was computed from. More...
class  line::SolverFLD
 SolverFLD: the fluid solver, which also answers a transient. More...
class  line::SolverBA
 SolverBA: the bounding solver, whose result is a bounds table. More...

Namespaces

namespace  line

Macros

#define LINE_DECLARE_SOLVER(Cls, tag)
 Every solver takes the model and either a method name or a full option set, mirroring Python's SolverX(model, method_or_options=None, **kwargs).

Typedefs

typedef qn::Network< double > line::Network
 Network as a user names it: the double model, Python's Network.
typedef qn::RoutingMatrix< double > line::RoutingMatrix
 model.init_routing_matrix()'s type, Python's RoutingMatrix.
typedef SolverMVA line::MVA
typedef SolverNC line::NC
typedef SolverCTMC line::CTMC
typedef SolverSSA line::SSA
typedef SolverFLD line::FLD
typedef SolverFLD line::SolverFluid
typedef SolverMAM line::MAM
typedef SolverJMT line::JMT
typedef SolverLDES line::LDES
typedef SolverAUTO line::AUTO
typedef SolverBA line::BA

Functions

 line::LINE_DECLARE_SOLVER (SolverMVA, "MVA")
 line::LINE_DECLARE_SOLVER (SolverNC, "NC")
 line::LINE_DECLARE_SOLVER (SolverMAM, "MAM")
 line::LINE_DECLARE_SOLVER (SolverSSA, "SSA")
 line::LINE_DECLARE_SOLVER (SolverJMT, "JMT")
 line::LINE_DECLARE_SOLVER (SolverLDES, "LDES")
 line::LINE_DECLARE_SOLVER (SolverAUTO, "AUTO")

Detailed Description

The solver API a user writes, spelled as its Python twin.

SolverMVA  s(model, "lin");
AvgTable   t = s.avg_table();

against Python's

s = MVA(model, method='lin')
t = s.avg_table()

NAMING. A multi-word getter drops the get_ prefix (avg_table, tran_avg, cdf_respt), because line_solver/_aliasing.py resolves exactly that spelling onto Python's own getAvgTable/getTranAvg/getCdfRespT; a SINGLE-word getter keeps it (get_name), because that same module deliberately refuses to expand a bare lowercase word and Python has no name(). So every name here is a name that also resolves in Python.

IT IS A FACADE, NOT A SOLVER. Every method forwards to the runner the CLI calls, so a program written against this header and line-cli on the same model answer with the same numbers.

THESE CLASSES ARE double-ONLY AND NOT TEMPLATES, deliberately. The solver templates are a heavy instantiation and the multiprecision arithmetic has no Python counterpart, so the bodies are compiled ONCE into line_mp_api and a translation unit including this header pays for none of it. Reach for line::mva::solver_mva_run_analyzer and its siblings directly when you want another arithmetic.

Definition in file solver.h.

Macro Definition Documentation

◆ LINE_DECLARE_SOLVER

#define LINE_DECLARE_SOLVER ( Cls,
tag )
Value:
class Cls : public NetworkSolver { \
public: \
explicit Cls(Network& m, const SolverOptions& o = SolverOptions()) \
: NetworkSolver(m, tag, o) {} \
Cls(Network& m, const std::string& method) \
: NetworkSolver(m, tag, SolverOptions().set_method(method)) {} \
}

Every solver takes the model and either a method name or a full option set, mirroring Python's SolverX(model, method_or_options=None, **kwargs).

Definition at line 104 of file solver.h.