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

LqnModel -> .lqnx, a port of matlab/src/lang/layered/@LayeredNetwork/writeXML.m. More...

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <string>
#include <vector>
#include "line/lang/lqn/lqn_reader.h"
#include "line/util/error.h"
#include "line/util/xml.h"
Include dependency graph for lqn_writer.h:

Go to the source code of this file.

Classes

struct  line::lqn::LqnWriteReport
 What the schema could not carry, one human-readable line per loss. More...

Namespaces

namespace  line
namespace  line::lqn

Functions

template<class T>
LqnWriteReport line::lqn::write_lqnx (const LqnModel< T > &m, const std::string &path, const std::string &model_name=std::string("LQN"), bool use_abstract_names=false)
 Write a layered model as a .lqnx document.

Detailed Description

LqnModel -> .lqnx, a port of matlab/src/lang/layered/@LayeredNetwork/writeXML.m.

WHY IT WRITES THE INTERMEDIATE MODEL AND NOT THE STRUCT. getStruct flattens a precedence block into edges of graph, so an AND-fork and two independent sequences leave the same trace there, and a POST_LOOP loses its counts to the branch shares. lqns rejects a document whose activity graph does not name its blocks, so a writer working from the struct would have to guess them; the reference writes from the handle graph for the same reason, and LqnModel is this port's stand-in for it (lqn_reader.h).

WHAT THE SCHEMA CANNOT CARRY, and what this does about it:

  • A think time on a NON-reference task. lqns rejects think-time there outright ('Task "X" is not a reference task'), so the attribute is dropped and the caller is told through LqnWriteReport::dropped, never silently. See _kb, "lqnx cannot carry non-ref think time".
  • PRE_OR branch shares. An OR-JOIN takes whichever branch arrives, so the schema puts no prob on a pre-OR activity; writeXML.m omits them too. The reader accepts them when present, so a document that carries them round-trips through THIS port and not through the reference.
  • Cache tasks, item entries and admission constraints. They reach this port through the JSON interchange or the builder, and the LQN schema has no element for any of them. A model that declares one is REFUSED by name rather than written as a plain task, because lqns would answer the resulting document and the answer would describe a different model. A SETUP TASK IS NOT IN THAT LIST: <setup>/<delay-off> are a LINE extension that every codebase here writes and reads, so the model survives the round trip; lqns ignores the two elements and answers the model without the cold start, which is what it would do with them absent too.

REPLIES. lqns requires every synchronously-called entry of a non-reference task to name its reply activity. A model built in code, or read from a document that left them implicit, has none declared, so the implicit rule of getStruct.m:641-671 is reproduced here: a leaf activity of the task (no successor within the same task) replies to the entry reached by walking the graph backwards, and an entry that declares any reply keeps its own.

Definition in file lqn_writer.h.