Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/11/13 17:28:12 (12 years ago)
Author:
abeham
Message:

#1961:

  • Added Logarithmic flag also to AxisRatio
  • Fixed some bugs regarding initial iterations
  • Removed the PredefinedRealVectorCreator and instead added a NormalDistributedRealVectorCreator
    • When sigma is 0 this is the same as the PredefinedRealVectorCreator
Location:
branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAMutator.cs

    r9129 r9148  
    133133            inRange = true;
    134134            var artmp = new double[arx[0].Length];
    135             for (int k = 0; k < arx[0].Length; ++k)
     135            for (int k = 0; k < arx[0].Length; ++k) {
    136136              artmp[k] = sp.D[k] * nd.NextDouble();
     137            }
    137138
    138139            for (int k = 0; k < arx[0].Length; k++) {
     
    140141              for (int j = 0; j < arx[0].Length; j++)
    141142                sum += B[k, j] * artmp[j];
    142               arx[i][k] = xmean[k] + sp.Sigma.Value * sum; // m + sig * Normal(0,C) 
     143              arx[i][k] = xmean[k] + sp.Sigma.Value * sum; // m + sig * Normal(0,C)
    143144              if (bounds[k % bounds.Rows, 0] > arx[i][k] || arx[i][k] > bounds[k % bounds.Rows, 1])
    144145                inRange = false;
  • branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAUpdater.cs

    r9129 r9148  
    231231      // end testAndCorrectNumerics
    232232
     233
    233234      if (sp.InitialIterations.Value >= iterations) {
    234235        for (int i = 0; i < N; i++)
    235236          sp.D[i] = Math.Sqrt(sp.C[i, i]);
     237        DegenerateStateParameter.ActualValue = new BoolValue(false);
    236238      } else {
    237239        var c = new double[sp.C.Rows, sp.C.Columns];
     
    239241          for (int j = 0; j < sp.C.Columns; j++)
    240242            c[i, j] = sp.C[i, j];
     243
    241244        double[] eVal;
    242245        double[,] eVec;
     
    245248        sp.B = new DoubleMatrix(eVec);
    246249
    247         for (int i = 0; i < sp.D.Length; i++)
    248           sp.D[i] = Math.Sqrt(eVal[i]);
     250        for (int i = 0; i < sp.D.Length; i++) {
     251          if (eVal[i] < 0) {
     252            DegenerateStateParameter.ActualValue.Value = true;
     253            sp.D[i] = 0;
     254          } else sp.D[i] = Math.Sqrt(eVal[i]);
     255        }
    249256
    250257        if (sp.D.Min() == 0.0) sp.AxisRatio.Value = double.PositiveInfinity;
Note: See TracChangeset for help on using the changeset viewer.