![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Reader for the LINE model.json interchange of an ENVIRONMENT model into an env::Environment<T>. More...
#include <fstream>#include <string>#include <vector>#include "json.hpp"#include "line/io/network_reader.h"#include "line/lang/qn/environment.h"#include "line/num/number.h"#include "line/util/error.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::io |
Functions | |
| template<class T> | |
| env::Environment< T > | line::io::build_environment_from_json (const detail::json &root) |
| Build an env::Environment<T> from a parsed model.json envelope. | |
| template<class T> | |
| env::Environment< T > | line::io::read_environment_json (const std::string &path) |
| Parse a model.json file into an env::Environment<T>. | |
Reader for the LINE model.json interchange of an ENVIRONMENT model into an env::Environment<T>.
The wire format is the one environment2json in linemodel_save.m and _environment_to_json in python/line_solver/io/linemodel_io.py emit: {type: "Environment", name, numStages, stages: [{name, type, model}], transitions: [{from, to, distribution}]}, with from/to ZERO-BASED on the wire in both writers (MATLAB converts from its 1-based stage index when writing and back when reading, so a C++ reader that treated them as 1-based would silently rotate the environment process).
Each stage's model is an ordinary Network envelope, so it is handed to build_network_from_json unchanged: a stage network that MVA or the fluid solver can read on its own is exactly the stage network ENV runs, and no second, weaker parser exists for it.
nodeFailures HAS TWO ROLES, and which one applies is decided exactly as both readers decide it: by whether a DOWN_<node> stage is already declared.
MACRO FORM (no DOWN stage declared): the block IS the environment. The one declared stage holds the base model, and each entry expands into a DOWN_<node> stage carrying the degraded service plus the breakdown and repair arcs. transitions must be absent, because the block implies them.
EXPANDED FORM (the writers' own output): the stages and arcs came off the wire and the block adds only what the wire cannot express, the QUEUE-LENGTH RESET POLICIES breakdownResetPolicy and repairResetPolicy. They decide what the next stage starts from at a switch, so dropping them would run the identity reset and report a confident answer for a different model – which is why this reader refused the whole block before the policies were ported.
A custom policy is refused by env_reset_policy, and correctly: both writers warn and OMIT the key when the policy is a function handle, so the only way custom reaches here is a hand-written file claiming a policy that no file can carry.
Definition in file environment_reader.h.