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

Ports of matlab/src/api/sn/sn_get_state_aggr.m and sn_is_state_valid.m. More...

#include <cmath>
#include <cstddef>
#include <map>
#include <utility>
#include <vector>
#include "line/lang/qn/network_struct.h"
#include "line/lang/qn/state.h"
#include "line/lang/qn/state_events.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for sn_state.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::api

Functions

template<class T>
std::vector< std::pair< T, std::vector< T > > > line::api::sn_get_state_aggr (const qn::NetworkStruct< T > &sn, const std::vector< std::vector< T > > &state)
 Port of sn_get_state_aggr: the per-class job counts of each stateful node's state row, with the phase and buffer encoding aggregated away.
template<class T>
Matrix< T > line::api::sn_declared_marginal (const qn::NetworkStruct< T > &sn)
 The (nstations x nclasses) per-class job counts of the model's OWN state.
template<class T>
bool line::api::sn_state_counts_valid (const qn::NetworkStruct< T > &sn, const Matrix< T > &n, const Matrix< T > &s)
 Port of State.isValid, which is the whole body of sn_is_state_valid once the marginals are formed.
template<class T>
bool line::api::sn_is_state_valid (const qn::NetworkStruct< T > &sn, const std::vector< std::vector< T > > &state)
 Port of sn_is_state_valid: form the station marginals of state and test them.

Detailed Description

Ports of matlab/src/api/sn/sn_get_state_aggr.m and sn_is_state_valid.m.

THE STATE ARGUMENT. The reference reads sn.state, a cell of one row per STATEFUL node that the model layer writes at initDefault time. This struct carries only the pieces of a declared state that cannot be derived (a Place's initial marking, a warm cache's contents, a declared prior over a declared space), and the solvers build the rest. Both functions therefore take the state explicitly, which is also what makes them usable on a candidate state rather than only on the one the struct happens to hold.

WHAT VALIDITY MEANS. Four things, in the reference's order: no class is present at a station that does not serve it; no station holds more jobs of a class than its capacity allows; the number of jobs IN SERVICE does not exceed the server count at a discipline that cannot overlap service, and never exceeds the number present; and every closed chain holds exactly its population. The last is the one that catches a hand-written initial state, and it is a relative test at CoarseTol because a fractional population is legal.

ARITHMETIC: field. Counting and comparison.

Definition in file sn_state.h.