Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double tau=1/sqrt(2.0);
- ///////////////////TWORZENIE POPULACJI/////////////////
- vector <osobnik2> populacja(ile);
- for(int i=0; i<ile; i++){
- double a=(((rand () % 1025) - 512.0) / 100.0);
- double b=(((rand () % 1025) - 512.0) / 100.0);
- populacja[i] = osobnik2 (a, b);
- populacja[i].wypisz_LOG();
- }
- //////////////////TWORZENIE WEKTORA SIGM///////////////
- vector <double> sigma(ile);
- for(int i=0; i<ile; i++){
- sigma[i]=(double)((rand()%100)/100.0)+0.01; //wartości sigm pocz. od 0.01 do 1.0
- cout<<sigma[i]<<endl;
- }
- ///////////////////MUTOWANIE///////////////////////////
- mt19937 eng(static_cast<unsigned long>(time(nullptr)));
- for(int j=0; j<100; j++){
- for(int i=0; i<ile; i++){
- normal_distribution<double> dist(0, 1.0);
- sigma[i]*=exp(tau*dist(eng));
- normal_distribution<double> dist2(0, sigma[i]);
- populacja[i].x1+=dist2(eng);
- populacja[i].x2+=dist2(eng);
- }
- for(int i=0; i<ile; i++){
- cout<<sigma[i]<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment