signals - Genetic Algorithm for Data modem for GSM voice channel -
i'm working on project of data modem gsm voice channel. i'm coding c++
the main idea of modem: generate speech-like symbols, code data in , send throught gsm codec. ga used generate these symbols.
the main idea of ga is:
- generate initial symbol set
- generate random data
- code data symbols
- send through gsm codec
- recieve data codec
- decode original data point 2
- calculate percentage of rubbish data
then there cycle until 1 of following conditions met: iterations has been passed or rubbish data percentage low enough.
i able implement algorithm, ga opeators - crossover , mutation - not work properly. turns so, initial set best 1 , others worse.
in algorithm use ranking selection probability distribution с*(1-с)^n n - number of element in rank c - ga parameter. in article put 0.075.
the crossover: g' = b*g1 + (1-b)*g2 b [-a, 1+a]. a=0.5 g' - complex spectra of offspring g1, g2 - complex spectras of parents. parents selected roulette wheel rotation according ranking selection.
mutation:
- randomnly select symbol
- choose random complex number [-1; 1]x[-1; 1]
- substitute 1 of 1..nf components in complex spectra. number of component chosen randomnly
the probability of mutation 0.1. probability of crossover 0.9.
i use elitism, means put best symbols previous generation next.
nonetheless, useless. crossover , mutation doestn't work properly.
maybe has been working in project or on similiar ones? give link full article: here article algorithm decribed @ section 4. upd: full source code source code
any appreciated.
void alphabet::blendcrossover(int offsprings) { int parentindexes[2] = {-1, -1}; int copyindex = 0; float parameter; float r = 0.0f; float c = 0; complexnumber ** childspectra = new complexnumber*[n_samples]; complexnumber ** firstparentspectra; complexnumber ** secondparentspectra; symbol * tmp; sortbyfitness(); distributeprobabilities(); for(int i=0; i<n_samples;i++) childspectra[i] = new complexnumber(0, 0); for(int i=0; i<n_symbols - offsprings; i++) *(nextgeneration[i]) = *(symbolpool[i]); for(int i=0; i<offsprings; i++) { { for(int j=0; j<2; j++) { r = generaterandomnum((float)0.0, (float)1.0); c = 0.0; for(int k=0; k<n_symbols; k++) { c += symbolpool[k]->getprobability(); if(r < c) { parentindexes[j] = k; break; } } } } while(parentindexes[0] == -1 || parentindexes[1] == -1 || parentindexes[0] == parentindexes[1]); firstparentspectra = symbolpool[parentindexes[0]]->getspectra(); secondparentspectra = symbolpool[parentindexes[1]]->getspectra(); parameter = generaterandomnum((float)-0.5, (float)1.5); for(int j=0; j<n_samples; j++) { childspectra[j]->setrealpart(secondparentspectra[j]->getrealpart() + parameter*(firstparentspectra[j]->getrealpart() - secondparentspectra[j]->getrealpart())); childspectra[j]->setimpart(secondparentspectra[j]->getimpart() + parameter*(firstparentspectra[j]->getimpart() - secondparentspectra[j]->getimpart())); } inversedft(childspectra, nextgeneration[n_symbols - 1 - i]); nextgeneration[n_symbols - 1 - i]->timescoded = 0; nextgeneration[n_symbols - 1 - i]->timesdecoded = 0; } for(int = 0; i<n_symbols; i++) *(symbolpool[i]) = *(nextgeneration[i]); } void alphabet::mutate(int offsprings) { int randomindex = (int)generaterandomnum(n_symbols - 1 - offsprings, n_symbols-1); int randomcomponent = (int)generaterandomnum(1, n_frequencies); complexnumber ** spectra = symbolpool[randomindex]->getspectra(); spectra[randomcomponent]->setrealpart((float)generaterandomnum((float)-1.0, (float)1.0)); spectra[randomcomponent]->setimpart((float)generaterandomnum((float)-1.0, (float)1.0)); inversedft(spectra, symbolpool[randomindex]); symbolpool[randomindex]->normalize(); symbolpool[randomindex]->timescoded = 0; symbolpool[randomindex]->timesdecoded = 0; return; }
Comments
Post a Comment