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

Port of SolverJMT, the Java Modelling Tools client. More...

#include "line/util/line_console.h"
#include <algorithm>
#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/subprocess.h"
#include "line/util/tempdir.h"
#include "line/util/xml.h"
Include dependency graph for solver_jmt.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
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< JmtMeasureline::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.
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.

Detailed Description

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 SolverQNS 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:

  1. options.rest_url, a JMT REST server (the imperialqore/jmt-rest image). Nothing runs locally.
  2. a local JVM plus common/JMT.jar, the default.
  3. no JVM, but a usable Docker daemon: the same image, run as a container. Every one of them leaves the result at <model>-result.jsim or <model>-result.jmva, so the parsers do not know which one ran. That contract is what makes the three interchangeable, and it is why the Docker arm copies the container's output back beside the model.

CONSENT IS NOT ASSUMED FOR THE PULL. The Docker arm is reached only when LINE_JMT_DOCKER opts in: 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. Downloading 50 MB because a solver was called is not a decision a library may take.

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 replication method It averages sampleSysAggr over iter_max seeds, and sampleSysAggr reads the JMT arrival/departure LOG files, which requires a Logger on every station of the model; the transient arm is available through jmt_sample_sys_aggr and is composed there.

Definition in file solver_jmt.h.