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

The SolverENV entry surface: a port of the analyzer selection that @@SolverENV/SolverENV.m's init performs (lines 311-327) and of the compression switch setCompression arms (line 160, applied at line 412). More...

#include <algorithm>
#include <cstddef>
#include <string>
#include <vector>
#include "line/lang/qn/environment.h"
#include "line/num/number.h"
#include "line/solvers/env/solver_env.h"
#include "line/solvers/env/solver_env_limit.h"
#include "line/solvers/env/solver_env_meanfield.h"
#include "line/solvers/env/solver_env_statevec.h"
#include "line/util/matrix.h"
Include dependency graph for env_dispatch.h:

Go to the source code of this file.

Classes

struct  line::env::EnvAnalyzerSolution< T >
 What the ENV entry reports: the environment-blended metrics, and the whole result of whichever coupling produced them. More...

Namespaces

namespace  line
namespace  line::env

Functions

std::vector< std::string > line::env::env_list_valid_methods ()
 Port of SolverENV.listValidMethods.
void line::env::env_check_method (const std::string &method)
 Port of runAnalyzerChecks' method gate: an unlisted method is refused.
template<class T>
EnvAnalyzerSolution< T > line::env::solver_env (Environment< T > &e, const EnvOptions &o)
 SolverENV.init's analyzer selection: solve the environment with the coupling o.method names.
template<class T>
EnvAnalyzerSolution< T > line::env::solver_env (Environment< T > &e, const EnvOptions &o, const EnvCompressOptions &c)
 The same, on a COMPRESSED environment: aggregate the stages first, then run the coupling over the macro-states.

Detailed Description

The SolverENV entry surface: a port of the analyzer selection that @@SolverENV/SolverENV.m's init performs (lines 311-327) and of the compression switch setCompression arms (line 160, applied at line 412).

WHAT SELECTS WHAT. The reference holds ONE solver object and swaps the function handle it delegates pre/analyze/post/finish to: method in {statevec, blend} installs solver_env_statevec_analyzer, and every other method installs solver_env_meanfield_analyzer. This port has two solver CLASSES instead of one object with two handles, because the two couplings carry different objects across an environment switch – the mean-field one carries the marginal mean queue lengths, the state-vector one the whole joint distribution – and so they need different options, different stage solvers and different result types. This file is the switch that stands in front of them, and it is the only place that knows both exist.

WHY SolverEnv STILL REFUSES statevec BY NAME. It is the mean-field coupling and nothing else; asked for the state-vector one it cannot answer, and answering with the mean-field collapse would be the silent fallback the whole port avoids. The refusal is therefore kept where it is and this entry routes AROUND it rather than through it.

THE THIRD THING THIS SWITCH SELECTS is neither coupling: avg and dec, the closed-form fast/slow limits of solveEnvLimit, which bypass the fixed point entirely and are ported as SolverEnvLimit. The reference routes them the same way, at the TOP of runAnalyzer and before iterate, because there is no inter-stage coupling to choose when nothing crosses a switch.

WHICH COUPLINGS TAKE A LAYERED STAGE. Only the mean-field one, and that is the reference's split rather than this port's: a statevec/blend run needs one generator per stage to propagate a joint law across, which an LQN does not have (it decomposes into a network per layer), and the avg/dec limits read a stage's station rate table, which an LQN does not carry. Both refuse a LayeredNetwork stage by name, in their own init, through Environment::reject_lqn_stages; so does the compression, whose macro-state is a network at averaged rates. The one thing still refused everywhere is the cache aggregation of the two analyzers.

WHAT COMPRESSION IS, AND WHY IT IS A SEPARATE OVERLOAD. setCompression is an explicit opt-in flag in the reference, defaulting to false, and the knobs it reads live in options.config rather than beside method. Passing the EnvCompressOptions is that opt-in here: there is no way to ask for the compressed solve without saying which decomposition kernel and which partition search it should use. The reference applies compression inside init, i.e. BEFORE the analyzer runs and independently of which analyzer was installed, so both couplings can run on a compressed environment and both do here.

Definition in file env_dispatch.h.