本文整理汇总了C++中Network::clear_edges方法的典型用法代码示例。如果您正苦于以下问题:C++ Network::clear_edges方法的具体用法?C++ Network::clear_edges怎么用?C++ Network::clear_edges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network::clear_edges方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char *argv[]) {
if(argc != 5) {
printf("Wrong Number of Arguments\n");
exit(0);
}
//double alpha1 = argv[1]-0.0;
double alpha1, alpha2, beta1, beta2, gamma1, gamma2, phi1, phi2, eta1, eta2;
alpha1 = alpha2 = atof( argv[1] );
beta1 = 0.12;
beta2 = atof( argv[2] );
eta1 = 1.0/3.0;
eta2 = 1.0/3.0;
gamma1 = gamma2 = 1.0/5.0;
phi1 = phi2 = atof( argv[4]);
int intro_time;
intro_time = atoi( argv[3] );
int num_reps = 5000;
Network net = Network("gillespie toy", Network::Undirected);
net.populate(10000);
for(int i =1; i <= num_reps; i++){
net.clear_edges();
net.erdos_renyi(5);
Gillespie_SEIR_TwoStrain_Network sim(&net, alpha1, alpha2, eta1, eta2, gamma1, gamma2, beta1, beta2, phi1, phi2, intro_time);
cout << "Simulation number: " << i << endl;
sim.reset();
sim.rand_infect(5, 1);
sim.run_simulation(10000.0);
}
return 0;
}
示例2: main
int main(int argc,char *argv[]) {
if(argc != 10) {
printf("Wrong Number of Arguments\n");
exit(0);
}
//double alpha1 = argv[1]-0.0;
double beta_vax, beta_dis, gamma_vax, gamma_dis;
int init_inf, init_vax;
beta_vax = atof( argv[1] ); // vaccine transmissibility
beta_dis = atof( argv[2] ); // disease transmissibility
gamma_vax = atof( argv[3] ); // vaccine recovery rate
gamma_dis = atof( argv[4] ); // disease recovery rate
init_vax = atoi( argv[5] ); // number initially vaccinated
init_inf = atoi( argv[6] ); // number initially infected
string network_type = argv[7] ;
string vax_type = argv[8];
int num_reps = atoi( argv[9]);
Network net = Network("gillespie toy", Network::Undirected);
net.populate(10000);
for(int i =1; i <= num_reps; i++){
net.clear_edges();
if(network_type == "er"){
net.erdos_renyi(10);
} else if(network_type == "exp"){
net.rand_connect_exponential(0.1);
} else if(network_type == "unif"){
vector<int> degrees(10000, 10);
net.rand_connect_explicit(degrees);
} else{
cerr << "Unrecognized network type" << endl;
}
Gillespie_trans_vaccine sim(&net, gamma_vax, gamma_dis, beta_vax, beta_dis, vax_type);
cout << "Simulation number: " << i << endl;
sim.reset();
sim.run_simulation(10000.0, init_vax, init_inf);
}
return 0;
}
示例3: main
// runs a seasonally forced gillespie simulation on a exponential network
int main(int argc,char *argv[]) {
if(argc != 9) {
printf("Wrong Number of Arguments\n");
exit(0);
}
double alpha1, alpha2, beta1_max, beta2_max, gamma1, gamma2, phi1, phi2, eta1, eta2;
alpha1 = alpha2 = atof( argv[1] );
beta1_max = atof( argv[2] );
beta2_max = atof( argv[3] );
eta1 = eta2 = 1.0/2.62;
gamma1 = gamma2 = 1.0/3.38;
phi1 = phi2 = atof( argv[4]);
int intro_time, start_ind, shift;
intro_time = atoi( argv[5] );
start_ind = atoi( argv[6] );
shift = atoi( argv[7] );
string network_type = argv[8];
int num_reps = 4000;
Network net = Network("gillespie toy", Network::Undirected);
net.populate(10000);
for(int i =1; i <= num_reps; i++){
net.clear_edges();
if(network_type == "exp"){
net.rand_connect_exponential(0.06453487);
} else if(network_type == "unif"){
vector<int> degrees(10000, 16);
net.rand_connect_explicit(degrees);
} else{
cerr << "Unrecognized network type" << endl;
}
// cout << net.mean_deg() << endl;
Gillespie_SEIR_TwoStrain_Network sim(&net, alpha1, alpha2, eta1, eta2, gamma1, gamma2, beta1_max, beta2_max, phi1, phi2, intro_time, start_ind, shift);
cout << "Simulation number: " << i << endl;
sim.reset();
sim.rand_infect(5, 1);
sim.run_simulation(10000.0);
}
return 0;
}