|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Base class for random network generators. More...
#include <random_network_generator.H>
Public Member Functions | |
| RandomNetworkGenerator (const NetworkGeneratorConfig &cfg) | |
| virtual | ~RandomNetworkGenerator ()=default |
| void | reseed () |
| Reset the random number generator to the original seed. | |
| void | reseed (unsigned new_seed) |
| Reset with a specific seed (also updates config.seed) | |
| virtual void | generate (Net &out)=0 |
Protected Types | |
| using | Node = typename Net::Node |
| using | Arc = typename Net::Arc |
Protected Member Functions | |
| double | random_capacity () |
| double | random_cost () |
| double | random_prob () |
| bool | is_connected (const Net &net, Node *source, Node *sink) |
| void | ensure_path (Net &net, Node *source, Node *sink, const std::vector< Node * > &nodes) |
| void | insert_arc (Net &net, Node *src, Node *tgt) |
Protected Attributes | |
| NetworkGeneratorConfig | config |
| std::mt19937 | rng |
| std::uniform_real_distribution< double > | capacity_dist |
| std::uniform_real_distribution< double > | cost_dist |
| std::uniform_real_distribution< double > | prob_dist {0.0, 1.0} |
Base class for random network generators.
Definition at line 84 of file random_network_generator.H.
Definition at line 91 of file random_network_generator.H.
Definition at line 90 of file random_network_generator.H.
|
inline |
Definition at line 99 of file random_network_generator.H.
|
virtualdefault |
|
inlineprotected |
Definition at line 178 of file random_network_generator.H.
References Aleph::Testing::RandomNetworkGenerator< Net >::insert_arc(), Aleph::Testing::RandomNetworkGenerator< Net >::is_connected(), and nodes.
|
pure virtual |
|
inlineprotected |
Definition at line 195 of file random_network_generator.H.
References Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Testing::RandomNetworkGenerator< Net >::random_capacity(), and Aleph::Testing::RandomNetworkGenerator< Net >::random_cost().
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::ensure_path().
|
inlineprotected |
Definition at line 145 of file random_network_generator.H.
References GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Digraph_Iterator< GT, Filter >::has_curr(), Aleph::DynList< T >::insert(), and Aleph::maps().
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::ensure_path().
|
inlineprotected |
Definition at line 127 of file random_network_generator.H.
References Aleph::Testing::RandomNetworkGenerator< Net >::capacity_dist, and Aleph::Testing::RandomNetworkGenerator< Net >::rng.
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::insert_arc().
|
inlineprotected |
Definition at line 133 of file random_network_generator.H.
References Aleph::Testing::RandomNetworkGenerator< Net >::cost_dist, and Aleph::Testing::RandomNetworkGenerator< Net >::rng.
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::insert_arc().
|
inlineprotected |
Definition at line 139 of file random_network_generator.H.
References Aleph::Testing::RandomNetworkGenerator< Net >::prob_dist, and Aleph::Testing::RandomNetworkGenerator< Net >::rng.
|
inline |
Reset the random number generator to the original seed.
Call this before generate() to get reproducible networks.
Definition at line 110 of file random_network_generator.H.
References Aleph::Testing::RandomNetworkGenerator< Net >::config, Aleph::Testing::RandomNetworkGenerator< Net >::rng, and Aleph::Testing::NetworkGeneratorConfig::seed.
|
inline |
Reset with a specific seed (also updates config.seed)
Definition at line 116 of file random_network_generator.H.
References Aleph::Testing::RandomNetworkGenerator< Net >::config, Aleph::maps(), Aleph::Testing::RandomNetworkGenerator< Net >::rng, and Aleph::Testing::NetworkGeneratorConfig::seed.
|
protected |
Definition at line 94 of file random_network_generator.H.
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::random_capacity().
|
protected |
Definition at line 87 of file random_network_generator.H.
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::reseed(), and Aleph::Testing::RandomNetworkGenerator< Net >::reseed().
|
protected |
Definition at line 95 of file random_network_generator.H.
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::random_cost().
|
protected |
Definition at line 96 of file random_network_generator.H.
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::random_prob().
|
protected |
Definition at line 88 of file random_network_generator.H.
Referenced by Aleph::Testing::RandomNetworkGenerator< Net >::random_capacity(), Aleph::Testing::RandomNetworkGenerator< Net >::random_cost(), Aleph::Testing::RandomNetworkGenerator< Net >::random_prob(), Aleph::Testing::RandomNetworkGenerator< Net >::reseed(), and Aleph::Testing::RandomNetworkGenerator< Net >::reseed().