LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::gen Namespace Reference

Classes

class  LayeredNetworkGenerator
 A random lqn::LqnBuilder<T> source, configured once and then drawn from. More...
class  MatlabRng
 One MATLAB global random stream, as left by rng(seed). More...
class  NetworkGenerator
 A random qn::Network<T> source, configured once and then drawn from. More...
struct  Range
 A closed interval the generator samples from. More...

Enumerations

enum class  TopologyKind { Rand , Cyclic }
 The two topology generators the reference ships, randGraph and cyclicGraph. More...

Functions

Matrix< double > rand_spanning_tree (std::size_t num_vertices, MatlabRng &r)
 randSpanningTree(n): vertex i (i >= 1) is attached to a uniformly chosen earlier vertex, randi(i) in MATLAB's 1-based terms, and always a tree rooted at 0.
Matrix< double > rand_graph (std::size_t num_vertices, MatlabRng &r)
 randGraph(n): a random strongly connected digraph on n vertices, as a random spanning tree closed up by strongConnect and then relabelled by a random permutation (without which vertex 0 would always be the DFS root).
Matrix< double > cyclic_graph (std::size_t num_vertices)
 cyclicGraph(n): the single cycle 0 -> 1 -> ... -> n-1 -> 0.
std::vector< double > randfixedsumone (std::size_t num_elems, MatlabRng &r)
 randfixedsumone(n): n probabilities summing to exactly 1.
std::vector< int > randintfixedsum (int s, int n, MatlabRng &r)
 randintfixedsum(s, n): n STRICTLY POSITIVE integers summing to s.

Enumeration Type Documentation

◆ TopologyKind

enum class line::gen::TopologyKind
strong

The two topology generators the reference ships, randGraph and cyclicGraph.

Enumerator
Rand 
Cyclic 

Definition at line 92 of file network_generator.h.

Function Documentation

◆ cyclic_graph()

Matrix< double > line::gen::cyclic_graph ( std::size_t num_vertices)
inline

cyclicGraph(n): the single cycle 0 -> 1 -> ... -> n-1 -> 0.

Definition at line 187 of file network_generator.h.

References cyclic_graph(), and line::InputError::InputError().

Referenced by cyclic_graph(), and line::gen::NetworkGenerator< T >::set_topology().

◆ rand_graph()

Matrix< double > line::gen::rand_graph ( std::size_t num_vertices,
MatlabRng & r )
inline

randGraph(n): a random strongly connected digraph on n vertices, as a random spanning tree closed up by strongConnect and then relabelled by a random permutation (without which vertex 0 would always be the DFS root).

Definition at line 163 of file network_generator.h.

References line::InputError::InputError(), rand_graph(), rand_spanning_tree(), and line::gen::MatlabRng::randperm().

Referenced by rand_graph(), and line::gen::NetworkGenerator< T >::set_topology().

◆ rand_spanning_tree()

Matrix< double > line::gen::rand_spanning_tree ( std::size_t num_vertices,
MatlabRng & r )
inline

randSpanningTree(n): vertex i (i >= 1) is attached to a uniformly chosen earlier vertex, randi(i) in MATLAB's 1-based terms, and always a tree rooted at 0.

Definition at line 102 of file network_generator.h.

References rand_spanning_tree(), and line::gen::MatlabRng::randi().

Referenced by rand_graph(), and rand_spanning_tree().

◆ randfixedsumone()

std::vector< double > line::gen::randfixedsumone ( std::size_t num_elems,
MatlabRng & r )
inline

randfixedsumone(n): n probabilities summing to exactly 1.

The reference's own recipe, quirks kept: a uniform point of the simplex from Stafford's randfixedsum (which draws even at n = 1), each entry rounded UP to a multiple of 1e-3 (so the rounded vector oversums), and the FIRST LARGEST entry absorbing the whole residual. Rounding to three digits is what keeps the emitted model.json readable; the absorption keeps the row stochastic after it.

Definition at line 208 of file network_generator.h.

References line::gen::MatlabRng::randfixedsum(), and randfixedsumone().

Referenced by randfixedsumone().

◆ randintfixedsum()

std::vector< int > line::gen::randintfixedsum ( int s,
int n,
MatlabRng & r )
inline

randintfixedsum(s, n): n STRICTLY POSITIVE integers summing to s.

The reference's recursion: draw the first part uniformly from 1..s-n (which leaves at least one unit for each remaining part) and recurse on the rest. There is no shuffle here: genCSMask permutes the result with randperm.

Definition at line 231 of file network_generator.h.

References line::InputError::InputError(), line::gen::MatlabRng::randi(), and randintfixedsum().

Referenced by randintfixedsum().