LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::gen::NetworkGenerator< T > Class Template Reference

A random qn::Network<T> source, configured once and then drawn from. More...

#include <line/gen/network_generator.h>

Public Member Functions

 NetworkGenerator (long long seed=0, TopologyKind kind=TopologyKind::Rand)
 MATLAB's rng(seed) followed by NetworkGenerator('topologyFcn', ...): the stream is seeded FIRST and the constructor then validates the topology on a two-vertex call, as MATLAB's set.topologyFcn does, so a Random topology costs the five draws of randGraph(2) and a Cyclic one none.
void set_seed (long long seed)
 Reseed the single stream every draw comes from, as MATLAB rng(seed).
void set_model_name (const std::string &nm)
 The name given to the generated model.
const std::string & model_name () const
void set_sched_strat (const std::string &strat)
 fcfs, ps, inf, lcfs, lcfspr, siro, sjf, ljf, sept, lept, or randomize.
const std::string & sched_strat () const
void set_routing_strat (const std::string &strat)
 Probabilities, Random, or randomize.
const std::string & routing_strat () const
void set_distribution (const std::string &d)
 Exp, Erlang, HyperExp, or randomize.
const std::string & distribution () const
void set_cclass_job_load (const std::string &load)
 high, medium, low, or randomize: the population band of a closed class.
const std::string & cclass_job_load () const
void set_varying_service_rates (bool v)
 Service means spread over 2^-6 .
bool varying_service_rates () const
void set_multi_server_queues (bool v)
 Queues get 1..40 servers instead of exactly one.
bool multi_server_queues () const
void set_random_cs_nodes (bool v)
 Each link gets a ClassSwitch node inserted on a coin flip.
bool random_cs_nodes () const
void set_multi_chain_cs (bool v)
 Classes are partitioned into random chains and switching is confined to a chain, instead of the default "all open classes switch among themselves and all closed classes among themselves".
bool multi_chain_cs () const
void set_topology (TopologyKind kind)
 Pick one of the two shipped topology generators; validated like set_topology_fcn.
void set_topology_fcn (const std::function< Matrix< double >(std::size_t, MatlabRng &)> &fcn)
 A custom topology: any function from a vertex count (and the generator's own stream, so a custom topology stays reproducible too) to a square 0/1 adjacency matrix.
qn::Network< T > generate (int num_queues, int num_delays, int num_oclass, int num_cclass)
 The full form.
qn::Network< T > generate (int num_queues, int num_delays, int num_oclass)
 generate(numQueues, numDelays, numOClass), closed-class count drawn 1..4.
qn::Network< T > generate (int num_queues, int num_delays)
 generate(numQueues, numDelays), no open classes.
qn::Network< T > generate (int num_queues)
 generate(numQueues), delays decided by the rule above.
qn::Network< T > generate ()
 Everything drawn: 1..8 queues, 1..4 closed classes, no open classes.

Static Public Member Functions

static std::size_t max_generate_attempts ()
 Resampling budget before an unsatisfiable configuration is reported.

Detailed Description

template<class T>
class line::gen::NetworkGenerator< T >

A random qn::Network<T> source, configured once and then drawn from.

Every setter validates its argument against the same vocabulary the reference accepts, so a typo is an error at configuration time rather than a silently different model.

Definition at line 255 of file network_generator.h.

Constructor & Destructor Documentation

◆ NetworkGenerator()

template<class T>
line::gen::NetworkGenerator< T >::NetworkGenerator ( long long seed = 0,
TopologyKind kind = TopologyKind::Rand )
inlineexplicit

MATLAB's rng(seed) followed by NetworkGenerator('topologyFcn', ...): the stream is seeded FIRST and the constructor then validates the topology on a two-vertex call, as MATLAB's set.topologyFcn does, so a Random topology costs the five draws of randGraph(2) and a Cyclic one none.

Definition at line 263 of file network_generator.h.

References line::gen::Rand, and set_topology().

Member Function Documentation

◆ cclass_job_load()

template<class T>
const std::string & line::gen::NetworkGenerator< T >::cclass_job_load ( ) const
inline

Definition at line 310 of file network_generator.h.

◆ distribution()

template<class T>
const std::string & line::gen::NetworkGenerator< T >::distribution ( ) const
inline

Definition at line 300 of file network_generator.h.

◆ generate() [1/5]

template<class T>
qn::Network< T > line::gen::NetworkGenerator< T >::generate ( )
inline

Everything drawn: 1..8 queues, 1..4 closed classes, no open classes.

Definition at line 409 of file network_generator.h.

References generate().

◆ generate() [2/5]

template<class T>
qn::Network< T > line::gen::NetworkGenerator< T >::generate ( int num_queues)
inline

generate(numQueues), delays decided by the rule above.

Definition at line 405 of file network_generator.h.

References generate().

◆ generate() [3/5]

template<class T>
qn::Network< T > line::gen::NetworkGenerator< T >::generate ( int num_queues,
int num_delays )
inline

generate(numQueues, numDelays), no open classes.

Definition at line 401 of file network_generator.h.

References generate().

◆ generate() [4/5]

template<class T>
qn::Network< T > line::gen::NetworkGenerator< T >::generate ( int num_queues,
int num_delays,
int num_oclass )
inline

generate(numQueues, numDelays, numOClass), closed-class count drawn 1..4.

Definition at line 397 of file network_generator.h.

References generate().

◆ generate() [5/5]

template<class T>
qn::Network< T > line::gen::NetworkGenerator< T >::generate ( int num_queues,
int num_delays,
int num_oclass,
int num_cclass )
inline

The full form.

num_delays < 0 means "decide for me", which is the reference's []: one delay when there is a single queue, otherwise a coin flip between none and one. num_cclass < 0 likewise draws 1..4, after the delays, which is MATLAB's order.

Definition at line 368 of file network_generator.h.

References line::qn::Network< T >::get_struct(), line::InputError::InputError(), and max_generate_attempts().

Referenced by generate(), generate(), generate(), generate(), and run_generate().

◆ max_generate_attempts()

template<class T>
std::size_t line::gen::NetworkGenerator< T >::max_generate_attempts ( )
inlinestatic

Resampling budget before an unsatisfiable configuration is reported.

Definition at line 356 of file network_generator.h.

Referenced by generate().

◆ model_name()

template<class T>
const std::string & line::gen::NetworkGenerator< T >::model_name ( ) const
inline

Definition at line 273 of file network_generator.h.

◆ multi_chain_cs()

template<class T>
bool line::gen::NetworkGenerator< T >::multi_chain_cs ( ) const
inline

Definition at line 330 of file network_generator.h.

◆ multi_server_queues()

template<class T>
bool line::gen::NetworkGenerator< T >::multi_server_queues ( ) const
inline

Definition at line 318 of file network_generator.h.

◆ random_cs_nodes()

template<class T>
bool line::gen::NetworkGenerator< T >::random_cs_nodes ( ) const
inline

Definition at line 322 of file network_generator.h.

◆ routing_strat()

template<class T>
const std::string & line::gen::NetworkGenerator< T >::routing_strat ( ) const
inline

Definition at line 291 of file network_generator.h.

◆ sched_strat()

template<class T>
const std::string & line::gen::NetworkGenerator< T >::sched_strat ( ) const
inline

Definition at line 282 of file network_generator.h.

◆ set_cclass_job_load()

template<class T>
void line::gen::NetworkGenerator< T >::set_cclass_job_load ( const std::string & load)
inline

high, medium, low, or randomize: the population band of a closed class.

Definition at line 303 of file network_generator.h.

References line::InputError::InputError().

Referenced by run_generate().

◆ set_distribution()

template<class T>
void line::gen::NetworkGenerator< T >::set_distribution ( const std::string & d)
inline

Exp, Erlang, HyperExp, or randomize.

Definition at line 294 of file network_generator.h.

References line::InputError::InputError().

Referenced by run_generate().

◆ set_model_name()

template<class T>
void line::gen::NetworkGenerator< T >::set_model_name ( const std::string & nm)
inline

The name given to the generated model.

nw is the reference's.

Definition at line 272 of file network_generator.h.

Referenced by run_generate().

◆ set_multi_chain_cs()

template<class T>
void line::gen::NetworkGenerator< T >::set_multi_chain_cs ( bool v)
inline

Classes are partitioned into random chains and switching is confined to a chain, instead of the default "all open classes switch among themselves and all closed classes among themselves".

Definition at line 329 of file network_generator.h.

Referenced by run_generate().

◆ set_multi_server_queues()

template<class T>
void line::gen::NetworkGenerator< T >::set_multi_server_queues ( bool v)
inline

Queues get 1..40 servers instead of exactly one.

Definition at line 317 of file network_generator.h.

Referenced by run_generate().

◆ set_random_cs_nodes()

template<class T>
void line::gen::NetworkGenerator< T >::set_random_cs_nodes ( bool v)
inline

Each link gets a ClassSwitch node inserted on a coin flip.

Definition at line 321 of file network_generator.h.

Referenced by run_generate().

◆ set_routing_strat()

template<class T>
void line::gen::NetworkGenerator< T >::set_routing_strat ( const std::string & strat)
inline

Probabilities, Random, or randomize.

Definition at line 285 of file network_generator.h.

References line::InputError::InputError().

Referenced by run_generate().

◆ set_sched_strat()

template<class T>
void line::gen::NetworkGenerator< T >::set_sched_strat ( const std::string & strat)
inline

fcfs, ps, inf, lcfs, lcfspr, siro, sjf, ljf, sept, lept, or randomize.

Definition at line 276 of file network_generator.h.

References line::InputError::InputError().

Referenced by run_generate().

◆ set_seed()

template<class T>
void line::gen::NetworkGenerator< T >::set_seed ( long long seed)
inline

Reseed the single stream every draw comes from, as MATLAB rng(seed).

Definition at line 269 of file network_generator.h.

Referenced by run_generate().

◆ set_topology()

template<class T>
void line::gen::NetworkGenerator< T >::set_topology ( TopologyKind kind)
inline

Pick one of the two shipped topology generators; validated like set_topology_fcn.

Definition at line 333 of file network_generator.h.

References line::gen::Cyclic, line::gen::cyclic_graph(), line::gen::rand_graph(), and set_topology_fcn().

Referenced by NetworkGenerator(), and run_generate().

◆ set_topology_fcn()

template<class T>
void line::gen::NetworkGenerator< T >::set_topology_fcn ( const std::function< Matrix< double >(std::size_t, MatlabRng &)> & fcn)
inline

A custom topology: any function from a vertex count (and the generator's own stream, so a custom topology stays reproducible too) to a square 0/1 adjacency matrix.

Validated on a two-vertex call, as the reference does, and that call draws from the generator's own stream exactly as MATLAB's does.

Definition at line 346 of file network_generator.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by set_topology().

◆ set_varying_service_rates()

template<class T>
void line::gen::NetworkGenerator< T >::set_varying_service_rates ( bool v)
inline

Service means spread over 2^-6 .

. 2^6 instead of all being 1.

Definition at line 313 of file network_generator.h.

Referenced by run_generate().

◆ varying_service_rates()

template<class T>
bool line::gen::NetworkGenerator< T >::varying_service_rates ( ) const
inline

Definition at line 314 of file network_generator.h.


The documentation for this class was generated from the following file: