Init version
This commit is contained in:
419
DerevyankoReport.cpp
Normal file
419
DerevyankoReport.cpp
Normal file
@@ -0,0 +1,419 @@
|
||||
#include "DerevyankoReport.h"
|
||||
#include "individual/Trait.h"
|
||||
#include "individual/Phenotype.h"
|
||||
//#include "population/BreedingStrategies/PopulationBreedingStrategy.h"
|
||||
#include "population/BreedingStrategies/NeutralEvolutionBreedStrat.h"
|
||||
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
|
||||
using std::string;
|
||||
|
||||
BisexualPopulation* DerevyankoReport::populationFactory(int size, std::string initMtGenome){
|
||||
BisexualPopulation* ans;
|
||||
|
||||
std::list<Individual*> males;
|
||||
std::list<Individual*> females;
|
||||
|
||||
Gene gene1(Gene::Sequence, "mtDna1", initMtGenome);
|
||||
Chromosome chrom1("Mitochondrial chromosome");
|
||||
chrom1.insertGeneToEnd(gene1);
|
||||
|
||||
std::vector<Chromosome> fGenome;
|
||||
std::vector<Chromosome> mGenome;
|
||||
fGenome.push_back(chrom1);
|
||||
mGenome.push_back(chrom1);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Trait trait1(Trait::Discrete, "Age", 20);
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
InnerSubstratesPool* subPool = 0;
|
||||
// (END) <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
for(int i = 0; i < size/2; i++){
|
||||
Genotype* genotype = new Genotype(fGenome, mGenome);
|
||||
Phenotype* phenotype = new Phenotype(trait1);
|
||||
males.push_back(new Individual(genotype, phenotype, subPool, Individual::male, 0));
|
||||
|
||||
genotype = new Genotype(fGenome, mGenome);
|
||||
phenotype = new Phenotype(trait1);
|
||||
females.push_back(new Individual(genotype, phenotype, subPool, Individual::female, 0));
|
||||
}
|
||||
|
||||
ans = new BisexualPopulation(males,females);
|
||||
return ans;
|
||||
}
|
||||
void DerevyankoReport::reportRFBR2013_01(){
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> f)
|
||||
string initMtDNA = "TTCTTTCATGGGGAAGCAGATTTGGGTACCACCCAAGTATTGACTCACCCATCAACAACC";
|
||||
initMtDNA += "GCTATGTATTTCGTACATTACTGCCAGCCACCATGAATATTGTACGGTACCATAAATACT";
|
||||
initMtDNA += "TGACCACCTGTAGTACATAAAAACCCAATCCACATCAAAACCCCCCCCTCATGCTTACAA";
|
||||
initMtDNA += "GCAAGTACAGCAATCAACCTTCAACTATCACACATCAACTGCAACTCCAAAGCCACCCCT";
|
||||
initMtDNA += "CACCCACTAGGATATCAACAAACCTACCCATCCTTAACAGTACATGGTACATAAAGCCAT";
|
||||
initMtDNA += "TTACCGTACATAGCACATTACAGTCAAATCCCTTCTCGTCCCCATGGATGACCCCCCTCA";
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> G)
|
||||
string initMtDNA_G = initMtDNA;
|
||||
initMtDNA_G.replace(60,1,"T");
|
||||
initMtDNA_G.replace(120,1,"A");
|
||||
initMtDNA_G.replace(180,1,"C");
|
||||
initMtDNA_G.replace(240,1,"G");
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//
|
||||
int basePopSize = 5000;
|
||||
float initBirthRate = 0.25f;
|
||||
float deltaBirthRate = 0.0002f;
|
||||
BisexualPopulation* pop_f = populationFactory(basePopSize, initMtDNA);
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_f =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_f->setBirthRate(initBirthRate);
|
||||
breedStrat_f->setDeathRate(initBirthRate-deltaBirthRate);
|
||||
pop_f->setBreedingStrategy(breedStrat_f);
|
||||
|
||||
BisexualPopulation* pop_G = populationFactory(basePopSize, initMtDNA_G);
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_G =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_G->setBirthRate(initBirthRate);
|
||||
breedStrat_G->setDeathRate(initBirthRate-deltaBirthRate);
|
||||
pop_G->setBreedingStrategy(breedStrat_G);
|
||||
|
||||
///////////////////////////////////////////
|
||||
//
|
||||
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
unsigned int generation;
|
||||
|
||||
// <20><><EFBFBD> 1.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1
|
||||
int genPerMigr_f_G = 100;
|
||||
float part_f_to_G = 0.01f;
|
||||
float part_G_to_f = 0.01f;
|
||||
std::cout<<"Variant 1"<<std::endl;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2
|
||||
//int genPerMigr_f_G = 1000;
|
||||
//float part_f_to_G = 0.1f;
|
||||
//float part_G_to_f = 0.1f;
|
||||
//std::cout<<"Variant 2"<<std::endl;
|
||||
|
||||
for(generation = 0; generation < 7000; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_f->breedAll();
|
||||
pop_f->mutationAll();
|
||||
|
||||
pop_G->breedAll();
|
||||
pop_G->mutationAll();
|
||||
|
||||
if(generation != 0 && ((generation % genPerMigr_f_G) == 0)){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_f, pop_G, part_f_to_G, part_G_to_f);
|
||||
std::cout<<"Migration f<->G\t"<<code<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// <20><><EFBFBD> 2.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> e <20> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> (10 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) f <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float fraction_e_founder = 0.5f;
|
||||
BisexualPopulation* pop_e = pop_f->createSubpopulation(fraction_e_founder);
|
||||
std::cout<<"pop_e has been created"<<std::endl;
|
||||
|
||||
for(; generation < 7010; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_e->breedAll();
|
||||
pop_e->mutationAll();
|
||||
|
||||
pop_G->breedAll();
|
||||
pop_G->mutationAll();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD> 3.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><> F <20> d
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 50 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> d, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 90% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float fraction_F_founder = 0.1f;
|
||||
BisexualPopulation* pop_F = pop_e->createSubpopulation(fraction_F_founder);
|
||||
std::cout<<"pop_F has been created"<<std::endl;
|
||||
|
||||
BisexualPopulation* pop_d = pop_e; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> d
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_d =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_d->setBirthRate(initBirthRate);
|
||||
breedStrat_d->setDeathRate(initBirthRate-deltaBirthRate*2);
|
||||
pop_d->setBreedingStrategy(breedStrat_d);
|
||||
std::cout<<"pop_e -> pop_d\tPop dynamics coeffs have been changed:\td =\t";
|
||||
std::cout<<(initBirthRate-deltaBirthRate*2)<<std::endl;
|
||||
|
||||
for(; generation < 7060; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_d->breedAll();
|
||||
pop_d->mutationAll();
|
||||
|
||||
pop_F->breedAll();
|
||||
pop_F->mutationAll();
|
||||
|
||||
pop_G->breedAll();
|
||||
pop_G->mutationAll();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD> 4.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> d <20><> E <20> c
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 100 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> c, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 90% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float fraction_E_founder = 0.1f;
|
||||
BisexualPopulation* pop_E = pop_d->createSubpopulation(fraction_E_founder);
|
||||
std::cout<<"pop_E has been created"<<std::endl;
|
||||
|
||||
BisexualPopulation* pop_c = pop_d; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> c
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_c =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_c->setBirthRate(initBirthRate);
|
||||
breedStrat_c->setDeathRate(initBirthRate-deltaBirthRate*2.5f);
|
||||
pop_c->setBreedingStrategy(breedStrat_c);
|
||||
std::cout<<"pop_d -> pop_c\tPop dynamics coeffs have been changed:\td =\t";
|
||||
std::cout<<(initBirthRate-deltaBirthRate*2.5f)<<std::endl;
|
||||
|
||||
for(; generation < 7160; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_c->breedAll();
|
||||
pop_c->mutationAll();
|
||||
|
||||
pop_E->breedAll();
|
||||
pop_E->mutationAll();
|
||||
|
||||
pop_F->breedAll();
|
||||
pop_F->mutationAll();
|
||||
|
||||
pop_G->breedAll();
|
||||
pop_G->mutationAll();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD> 5.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> c <20><> D <20> b
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 100 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 90% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float fraction_D_founder = 0.1f;
|
||||
BisexualPopulation* pop_D = pop_c->createSubpopulation(fraction_D_founder);
|
||||
std::cout<<"pop_D has been created"<<std::endl;
|
||||
|
||||
BisexualPopulation* pop_b = pop_c; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_b =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_b->setBirthRate(initBirthRate);
|
||||
breedStrat_b->setDeathRate(initBirthRate-deltaBirthRate*3.f);
|
||||
pop_b->setBreedingStrategy(breedStrat_b);
|
||||
std::cout<<"pop_c -> pop_b\tPop dynamics coeffs have been changed:\td =\t";
|
||||
std::cout<<(initBirthRate-deltaBirthRate*3.f)<<std::endl;
|
||||
|
||||
for(; generation < 7260; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_b->breedAll();
|
||||
pop_b->mutationAll();
|
||||
|
||||
pop_D->breedAll();
|
||||
pop_D->mutationAll();
|
||||
|
||||
pop_E->breedAll();
|
||||
pop_E->mutationAll();
|
||||
|
||||
pop_F->breedAll();
|
||||
pop_F->mutationAll();
|
||||
|
||||
pop_G->breedAll();
|
||||
pop_G->mutationAll();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD> 6.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b <20><> C <20> a
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 200 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> a, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 90% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float fraction_C_founder = 0.1f;
|
||||
BisexualPopulation* pop_C = pop_b->createSubpopulation(fraction_C_founder);
|
||||
std::cout<<"pop_C has been created"<<std::endl;
|
||||
|
||||
BisexualPopulation* pop_a = pop_b; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_a =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_a->setBirthRate(initBirthRate);
|
||||
breedStrat_a->setDeathRate(initBirthRate-deltaBirthRate*3.5f);
|
||||
pop_a->setBreedingStrategy(breedStrat_a);
|
||||
std::cout<<"pop_b -> pop_a\tPop dynamics coeffs have been changed:\td =\t";
|
||||
std::cout<<(initBirthRate-deltaBirthRate*3.5f)<<std::endl;
|
||||
|
||||
for(; generation < 7460; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_a->breedAll();
|
||||
pop_a->mutationAll();
|
||||
|
||||
pop_C->breedAll();
|
||||
pop_C->mutationAll();
|
||||
|
||||
pop_D->breedAll();
|
||||
pop_D->mutationAll();
|
||||
|
||||
pop_E->breedAll();
|
||||
pop_E->mutationAll();
|
||||
|
||||
pop_F->breedAll();
|
||||
pop_F->mutationAll();
|
||||
|
||||
pop_G->breedAll();
|
||||
pop_G->mutationAll();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD> 7.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> a <20><> A <20> B
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2540 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> A, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 50% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||
// <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> A <20> B, <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> A <20> C, D, E, F (G <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
float fraction_B_founder = 0.5f;
|
||||
BisexualPopulation* pop_B = pop_a->createSubpopulation(fraction_B_founder);
|
||||
std::cout<<"pop_B has been created"<<std::endl;
|
||||
|
||||
BisexualPopulation* pop_A = pop_a; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> A
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_A =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_A->setBirthRate(initBirthRate);
|
||||
breedStrat_A->setDeathRate(initBirthRate-deltaBirthRate*4.f);
|
||||
pop_A->setBreedingStrategy(breedStrat_A);
|
||||
std::cout<<"pop_a -> pop_A\tPop dynamics coeffs have been changed:\td =\t";
|
||||
std::cout<<(initBirthRate-deltaBirthRate*4.f)<<std::endl;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1
|
||||
int genPerMigr_A_B = 100;
|
||||
int genPerMigr_A_C = 150;
|
||||
int genPerMigr_A_D = 200;
|
||||
int genPerMigr_A_E = 250;
|
||||
int genPerMigr_A_F = 300;
|
||||
|
||||
float part_A_to_B = 0.01f;
|
||||
float part_B_to_A = 0.01f;
|
||||
float part_A_to_C = 0.005f;
|
||||
float part_A_to_D = 0.005f;
|
||||
float part_A_to_E = 0.005f;
|
||||
float part_A_to_F = 0.005f;
|
||||
|
||||
for(; generation < 10001; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_A->breedAll();
|
||||
pop_A->mutationAll();
|
||||
|
||||
pop_B->breedAll();
|
||||
pop_B->mutationAll();
|
||||
|
||||
pop_C->breedAll();
|
||||
pop_C->mutationAll();
|
||||
|
||||
pop_D->breedAll();
|
||||
pop_D->mutationAll();
|
||||
|
||||
pop_E->breedAll();
|
||||
pop_E->mutationAll();
|
||||
|
||||
pop_F->breedAll();
|
||||
pop_F->mutationAll();
|
||||
|
||||
if((generation % genPerMigr_A_B) == 0){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_A, pop_B, part_A_to_B, part_B_to_A);
|
||||
std::cout<<"Migration A<->B\t"<<code<<std::endl;
|
||||
}
|
||||
if((generation % genPerMigr_A_C) == 0){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_A, pop_C, part_A_to_C, 0.f);
|
||||
std::cout<<"Migration A->C\t"<<code<<std::endl;
|
||||
}
|
||||
if((generation % genPerMigr_A_D) == 0){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_A, pop_D, part_A_to_D, 0.f);
|
||||
std::cout<<"Migration A->D\t"<<code<<std::endl;
|
||||
}
|
||||
if((generation % genPerMigr_A_E) == 0){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_A, pop_E, part_A_to_E, 0.f);
|
||||
std::cout<<"Migration A->E\t"<<code<<std::endl;
|
||||
}
|
||||
if((generation % genPerMigr_A_F) == 0){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_A, pop_F, part_A_to_F, 0.f);
|
||||
std::cout<<"Migration A->F\t"<<code<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::ofstream file("GenStatistics.pop_A.fasta");
|
||||
pop_A->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_A.txt");
|
||||
pop_A->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
////////////////////////////////////////
|
||||
file.open("GenStatistics.pop_B.fasta");
|
||||
pop_B->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_B.txt");
|
||||
pop_B->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////
|
||||
file.open("GenStatistics.pop_C.fasta");
|
||||
pop_C->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_C.txt");
|
||||
pop_C->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////
|
||||
file.open("GenStatistics.pop_D.fasta");
|
||||
pop_D->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_D.txt");
|
||||
pop_D->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////
|
||||
file.open("GenStatistics.pop_E.fasta");
|
||||
pop_E->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_E.txt");
|
||||
pop_E->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////
|
||||
file.open("GenStatistics.pop_F.fasta");
|
||||
pop_F->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_F.txt");
|
||||
pop_F->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////
|
||||
file.open("GenStatistics.pop_G.fasta");
|
||||
pop_G->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_G.txt");
|
||||
pop_G->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////
|
||||
file.open("GenStatistics.pop_flittle.fasta");
|
||||
pop_f->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_flittle.txt");
|
||||
pop_f->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
////////////////////////////////////////
|
||||
}
|
||||
Reference in New Issue
Block a user