![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Port of SolverJMT, the Java Modelling Tools client. More...
#include "line/util/line_console.h"#include <algorithm>#include <cctype>#include <cmath>#include <cstdio>#include <cstdlib>#include <fstream>#include <limits>#include <map>#include <sstream>#include <string>#include <vector>#include <sys/stat.h>#include <unistd.h>#include "line/io/docker_image.h"#include "line/io/jmva_writer.h"#include "line/io/jmt_writer.h"#include "line/lang/qn/network_struct.h"#include "line/lang/qn/solver_feature_sets.h"#include "line/solvers/mva/sn_chain.h"#include "line/solvers/mva/solver_mva_runner.h"#include "line/util/error.h"#include "line/util/http.h"#include "line/util/sha256.h"#include "line/util/subprocess.h"#include "line/util/tempdir.h"#include "line/util/xml.h"Go to the source code of this file.
Classes | |
| struct | line::jmt::JmtOptions |
| The options of one JMT solve, SolverOptions('JMT') restricted to what is read. More... | |
| struct | line::jmt::JmtMeasure |
| One <measure> of a JMT result document, by its attributes. More... | |
| struct | line::jmt::JmtResult< T > |
| The result of a JMT solve: the shared AvgResult plus what only JMT reports. More... | |
Namespaces | |
| namespace | line |
| Conservation laws of a layered queueing network, enumerated from its structure. | |
| namespace | line::jmt |
Functions | |
| util::ProcResult | line::jmt::jmt_run_docker (const std::string &image, const std::string &mode, const std::string &model_path, long seed, const JmtOptions &opt) |
| Run the analysis inside the JMT container and copy the result back beside the model, so the caller sees the layout a local JVM would have produced. | |
| const char * | line::jmt::jmt_result_ext (const std::string &mode) |
| The suffix jmt.commandline.Jmt appends to the model path, per mode. | |
| bool | line::jmt::jmt_available () |
| True when a local JVM and common/JMT.jar are both present. | |
| util::ProcResult | line::jmt::jmt_solve_rest (const std::string &rest_url, const std::string &mode, const std::string &model_path, long seed, const JmtOptions &opt) |
| Port of jmtSolveRest: POST the model document, write the result document back beside the model so the local parsers are unaffected. | |
| util::ProcResult | line::jmt::jmt_run (const std::string &mode, const std::string &model_path, long seed, const JmtOptions &opt) |
| Port of jmtRun: one batch analysis, leaving the result where the JMT CLI itself would leave it. | |
| std::vector< JmtMeasure > | line::jmt::jmt_parse_measures (const std::string &result_path, const std::string &command_output) |
| Port of getResultsJSIM: every <measure> of the result document. | |
| template<class T> | |
| JmtResult< T > | line::jmt::jmt_map_measures (const qn::NetworkStruct< T > &sn, const std::vector< JmtMeasure > &measures, bool confint) |
| Port of getResults.m: the measures mapped onto the metric matrices. | |
| template<class T> | |
| void | line::jmt::jmt_region_losses (const qn::NetworkStruct< T > &sn, JmtResult< T > &res) |
| The region loss table, port of the sn.nregions > 0 tail of getResults.m. | |
| template<class T> | |
| JmtResult< T > | line::jmt::jmt_parse_jmva (const qn::NetworkStruct< T > &sn, const std::string &result_path, const std::string &command_output) |
| Port of getResultsJMVA.m: the per-CHAIN answer spread back over the classes. | |
| std::vector< std::string > | line::jmt::jmt_list_valid_methods () |
| Port of SolverJMT.listValidMethods. | |
| std::string | line::jmt::jmt_removed_method_refusal (const std::string &method) |
| The migration sentence for a method name SolverJMT no longer has; empty for any other name. | |
| template<class T> | |
| std::string | line::jmt::jmt_method_refusal (const qn::NetworkStruct< T > &sn, const std::string &method, const JmtOptions &opt) |
| The structural half of SolverJMT's method gate; empty when admissible. | |
| template<class T> | |
| JmtResult< T > | line::jmt::solver_jmt_run_analyzer (const qn::NetworkStruct< T > &sn, const JmtOptions &opt_in) |
| Port of @@SolverJMT/runAnalyzer.m, the jsim and jmva arms. | |
Variables | |
| static const char * | line::jmt::JMT_DOCKER_IMAGE = "imperialqore/jmt-rest:latest" |
| The default JMT REST/Docker image, MATLAB's jmtDockerImage candidate. | |
| static const char * | line::jmt::JMT_JAR_URL = "https://line-solver.sourceforge.net/latest/JMT.jar" |
| Where a missing jar is fetched from; LINE_JMT_URL names a mirror instead. | |
| static const char * | line::jmt::JMT_JAR_SHA256 |
| The digest a fetched jar must have, and the reason the fetch can be trusted. | |
Port of SolverJMT, the Java Modelling Tools client.
WHAT A JMT SOLVE IS. The model is written out as a JMT document – a .jsimg for the discrete-event engine, a .jmva for the analytical one – jmt.commandline.Jmt is run on it, and the result document JMT leaves beside the model is parsed back into the same AvgResult every other solver in this port returns. The translation is io/jmt_writer.h and the SHARED io/jmva_writer.h, which SolverLQNS writes through as well; this file is the dispatch, the parse and the metric mapping.
THREE WAYS TO REACH JMT, in the order jmtRun.m tries them:
CONSENT IS NOT ASSUMED, FOR EITHER FETCH. The Docker arm is reached only when LINE_JMT_DOCKER opts in, and the jar is downloaded only when LINE_JMT_DOWNLOAD does: this port has no terminal to ask at – the reference prompts, and refuses in a -batch session – so an absent variable is a refusal, exactly as an empty answer is there. Fetching 31 MiB because a solver was called is not a decision a library may take on its own.
WHAT THE FETCH ADDS OVER THE REFERENCE, once consented to: the transfer is https and stays https across redirects, the bytes are checked against a pinned SHA-256 (JMT_JAR_SHA256) before anything is installed, and the file is renamed into place only after it verifies. MATLAB, the JAR and python all trust the transport and stop there, so the C++ edition is the only one that authenticates the jar itself; LINE_JMT_SHA256 takes a different digest deliberately and LINE_JMT_URL a mirror.
WHAT IS NOT PORTED, and why it is refused rather than approximated: getProbAggr / getProbSysAggr Both weigh the simulated trajectory against sn.state{isf}, the model's CURRENT state, which qn::NetworkStruct does not carry – the same gap that stops SolverLDES's getProb in this port. the transient ensemble default over a finite timespan averages sampleSysAggr over config.replications seeds, and sampleSysAggr reads the JMT arrival/departure LOG files, which requires a Logger on every station of the model; it is composed from jmt_sample_sys_aggr in jmt_logs.h (jmt_transient_replications).
Definition in file solver_jmt.h.