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

Consistency checks on a NetworkStruct, a port of jar/src/main/java/jline/api/sn/SnValidate.java and ValidationLevel.java. More...

#include <cmath>
#include <cstddef>
#include <string>
#include <vector>
#include "line/lang/lang_types.h"
#include "line/lang/qn/network_struct.h"
#include "line/num/number.h"
Include dependency graph for sn_validate.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::api

Enumerations

enum class  line::api::ValidationLevel { line::api::Full , line::api::Minimal , line::api::None }
 How much of the struct to check; the reference's ValidationLevel. More...

Functions

template<class T>
std::vector< std::string > line::api::sn_validate_dimensions (const qn::NetworkStruct< T > &sn)
 The (nstations x nclasses) matrices agree with the declared dimensions.
template<class T>
std::vector< std::string > line::api::sn_validate_rates (const qn::NetworkStruct< T > &sn)
 Rates and SCVs are non-negative wherever the pair is enabled.
template<class T>
std::vector< std::string > line::api::sn_validate_population (const qn::NetworkStruct< T > &sn)
 Class populations are neither NaN nor negative; an open class may be Inf.
template<class T>
std::vector< std::string > line::api::sn_validate_routing (const qn::NetworkStruct< T > &sn)
 Every non-empty row of rt is a probability vector summing to one.
template<class T>
std::vector< std::string > line::api::sn_validate_servers (const qn::NetworkStruct< T > &sn)
 Server counts are positive, except at a Source or a Sink.
template<class T>
std::vector< std::string > line::api::sn_validate (const qn::NetworkStruct< T > &sn, ValidationLevel level=ValidationLevel::Full)
 Consistency checks on a NetworkStruct, a port of jar/src/main/java/jline/api/sn/SnValidate.java and ValidationLevel.java.
template<class T>
std::string line::api::sn_validate_station_index (const qn::NetworkStruct< T > &sn, std::size_t ist, const std::string &paramName="stationIdx")
template<class T>
std::string line::api::sn_validate_class_index (const qn::NetworkStruct< T > &sn, std::size_t r, const std::string &paramName="classIdx")
template<class T>
std::string line::api::sn_validate_node_index (const qn::NetworkStruct< T > &sn, std::size_t ind, const std::string &paramName="nodeIdx")
template<class T>
std::string line::api::sn_validate_node_type (const qn::NetworkStruct< T > &sn, std::size_t ind, qn::NodeType expected)

Detailed Description

Consistency checks on a NetworkStruct, a port of jar/src/main/java/jline/api/sn/SnValidate.java and ValidationLevel.java.

The reference returns a LIST OF MESSAGES rather than throwing, so a caller can report every defect of a struct at once instead of the first one; that contract is kept here. The setters in sn_setters.h are the intended callers: they mutate a struct in place and can leave it internally inconsistent, and this is what tells them so.

WHAT DIFFERS FROM THE JAR, and why. The reference tests the SHAPE of the matrices it stores (rates, scv, nservers, njobs, classprio, phases each being an independently-sized Matrix that could disagree with nstations/nclasses). This port holds nservers, the populations, the priorities and the phase counts as per-station and per-class members of Station and JobClass, so those shapes cannot disagree by construction and the corresponding checks would be vacuous. The checks that survive are the ones with real content: the two genuinely free-standing matrices (rates, scv), the parallel disabled mask that replaces MATLAB's NaN sentinel, and the value checks on rates, populations, routing and servers.

NaN IS NOT A DISABLED MARKER HERE. The reference skips a NaN rate because MATLAB writes NaN for a pair the class never visits; this port carries that out of band in disabled (Rational has no NaN), so the skip reads the flag.

ARITHMETIC: field plus comparisons, so it instantiates under Rational.

Definition in file sn_validate.h.