|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
#include <random_net.H>
Public Member Functions | |
| Random_Network_Flow (const unsigned int seed=time(nullptr)) | |
| ~Random_Network_Flow () | |
| Net * | operator() (const size_t num_ranks, const size_t num_nodes_by_rank, const double &rank_sigma=0.2, const double &cap_mean=100, const double &cap_sigma=0.9, const double &forward_density=0.3, const double &backward_density=0.01) |
| The number of nodes per rank is determined by a distribution normal with half num_nodes_by_rank and sigma deviation. | |
Private Types | |
| typedef Net::Node | Node |
| typedef Net::Arc | Arc |
Private Member Functions | |
| void | connect_ranks (size_t src_idx_rank, size_t tgt_idx_rank, const double &cap_mean, const double &cap_sigma, const double &density) |
| void | create_forward_arcs_in_rank (size_t curr_rank_idx, const double &cap_mean, const double &cap_sigma, const double &forward_density) |
| void | create_backward_arcs_in_rank (const size_t curr_rank_idx, const double &cap_mean, const double &cap_sigma, const double &backward_density) |
| void | create_ranks (const size_t num_ranks, const size_t num_nodes_by_rank, const double &rank_sigma) |
| void | create_arcs (const double &cap_mean, const double &cap_sigma, const double &forward_density, const double &backward_density) |
| After created ranks and their nodes, this routine creates the arcs. | |
Private Attributes | |
| DynArray< DynArray< Node * > > | rank |
| gsl_rng * | r |
| std::unique_ptr< Net > | net |
Definition at line 61 of file random_net.H.
Definition at line 64 of file random_net.H.
Definition at line 63 of file random_net.H.
|
inline |
Definition at line 71 of file random_net.H.
References Aleph::maps(), and Random_Network_Flow< Net >::r.
|
inline |
Definition at line 77 of file random_net.H.
References Aleph::maps(), and Random_Network_Flow< Net >::r.
|
inlineprivate |
Definition at line 83 of file random_net.H.
References arcs, Aleph::maps(), Random_Network_Flow< Net >::r, Random_Network_Flow< Net >::rank, and Aleph::HTList::size().
Referenced by Random_Network_Flow< Net >::create_backward_arcs_in_rank(), and Random_Network_Flow< Net >::create_forward_arcs_in_rank().
|
inlineprivate |
After created ranks and their nodes, this routine creates the arcs.
Forward arcs between a rank and another are randomly generated according an exponential with parameter forward_density*total_nodes. The arc capacity is generated according to a normal with mean cap_mean and deviation cap_sigma
Definition at line 160 of file random_net.H.
References ah_domain_error_if, Random_Network_Flow< Net >::create_backward_arcs_in_rank(), Random_Network_Flow< Net >::create_forward_arcs_in_rank(), Aleph::maps(), N, and Random_Network_Flow< Net >::rank.
Referenced by Random_Network_Flow< Net >::operator()().
|
inlineprivate |
Definition at line 124 of file random_net.H.
References Random_Network_Flow< Net >::connect_ranks(), and Aleph::maps().
Referenced by Random_Network_Flow< Net >::create_arcs().
|
inlineprivate |
Definition at line 114 of file random_net.H.
References Random_Network_Flow< Net >::connect_ranks(), Aleph::maps(), Random_Network_Flow< Net >::rank, and Aleph::HTList::size().
Referenced by Random_Network_Flow< Net >::create_arcs().
|
inlineprivate |
Definition at line 136 of file random_net.H.
References ah_domain_error_if, Aleph::maps(), num_nodes, Random_Network_Flow< Net >::r, and Random_Network_Flow< Net >::rank.
Referenced by Random_Network_Flow< Net >::operator()().
|
inline |
The number of nodes per rank is determined by a distribution normal with half num_nodes_by_rank and sigma deviation.
The sigma deviation should be a value between 0 and 1. The value of sigma that joins for normal distribution will be rank_sigma*num_nodes_by_rank.
The capacities of the arches are selected according to a Normal distribution with mean cap_mean and deviation cap_sigma.
The arcs of advancement between one rank and another correspond to a Exponential distribution with parameter forward_density*num_nodes_by_rank.
| [in] | num_ranks | Number of ranks in the network |
| [in] | num_nodes_by_rank | Average number of nodes per rank |
| [in] | rank_sigma | Standard deviation of the number of nodes per rank (0-1) |
| [in] | cap_mean | media de la capacidad por arco |
| [in] | cap_sigma | desviación estándar de la capacidad de arcos |
| [in] | forward_density | densidad de arcos hacia adelante (0-1) |
| [in] | backward_density | densidad de arcos hacia atrás (0-1) |
Definition at line 213 of file random_net.H.
References Random_Network_Flow< Net >::create_arcs(), Random_Network_Flow< Net >::create_ranks(), Aleph::maps(), Random_Network_Flow< Net >::rank, and Aleph::Net_Graph< NodeT, ArcT >::reset().
|
private |
Definition at line 68 of file random_net.H.
|
private |
Definition at line 67 of file random_net.H.
Referenced by Random_Network_Flow< Net >::Random_Network_Flow(), Random_Network_Flow< Net >::~Random_Network_Flow(), Random_Network_Flow< Net >::connect_ranks(), and Random_Network_Flow< Net >::create_ranks().