GSM语音信道数据调制解调器的遗传算法

时间:2015-10-22 14:00:38

标签: signals signal-processing genetic-algorithm gsm genetic-programming

我正在开发一个用于GSM语音通道的数据调制解调器项目。我用C ++编码

调制解调器的主要思想:生成类似语音的符号,其中包含代码数据并通过GSM编解码器发送。 GA用于生成这些符号。

GA的主要思想是:

  1. 生成初始符号集
  2. 生成随机数据
  3. 将数据编码为符号
  4. 通过gsm编解码器发送
  5. 从编解码器接收数据
  6. 将其解码为第2点的原始数据
  7. 计算垃圾数据的百分比
  8. 然后有周期,直到满足下列条件之一: 所有迭代都已通过或垃圾数据百分比足够低。

    我能够实现该算法,但GA操作符 - 交叉和变异 - 无法正常工作。它变成了这样,初始集合是最好的集合而其他集合更糟糕。

    在我的算法中,我使用具有概率分布с*(1-с)^ n的排名选择 n - 排名中的元素数量 c - GA参数。在文章中他们把它写成0.075。

    交叉: G'= b * G1 +(1-b)* G2 b来自[-a,1 + a]。 α= 0.5 G' - 后代的复杂光谱 G1,G2 - 父母的复杂景象。 根据排名选择,选择轮盘赌轮旋转的父母。

    突变:

    1. 随机选择符号
    2. 从[-1;中选择一个随机复数1]×[-1; 1]
    3. 在复杂光谱中替换他的1..Nf成分之一。组件的数量也是随机选择的
    4. 突变的概率是0.1。 交叉概率为0.9。

      我也使用精英主义,这意味着我把上一代的最佳符号放到下一代。

      尽管如此,它毫无用处。交叉和变异不能正常工作。

      也许某人已经在这个项目中工作过或类似的工作? 我还提供了一篇完整文章的链接: Here is the article 该算法在第4节中描述。 UPD :完整的源代码 source code

      任何帮助都将不胜感激。

      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++)
      {
          do
          {
              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 i = 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;
      }
      

0 个答案:

没有答案