- Timestamp:
- 01/11/13 17:28:12 (12 years ago)
- 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 133 133 inRange = true; 134 134 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) { 136 136 artmp[k] = sp.D[k] * nd.NextDouble(); 137 } 137 138 138 139 for (int k = 0; k < arx[0].Length; k++) { … … 140 141 for (int j = 0; j < arx[0].Length; j++) 141 142 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) 143 144 if (bounds[k % bounds.Rows, 0] > arx[i][k] || arx[i][k] > bounds[k % bounds.Rows, 1]) 144 145 inRange = false; -
branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAUpdater.cs
r9129 r9148 231 231 // end testAndCorrectNumerics 232 232 233 233 234 if (sp.InitialIterations.Value >= iterations) { 234 235 for (int i = 0; i < N; i++) 235 236 sp.D[i] = Math.Sqrt(sp.C[i, i]); 237 DegenerateStateParameter.ActualValue = new BoolValue(false); 236 238 } else { 237 239 var c = new double[sp.C.Rows, sp.C.Columns]; … … 239 241 for (int j = 0; j < sp.C.Columns; j++) 240 242 c[i, j] = sp.C[i, j]; 243 241 244 double[] eVal; 242 245 double[,] eVec; … … 245 248 sp.B = new DoubleMatrix(eVec); 246 249 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 } 249 256 250 257 if (sp.D.Min() == 0.0) sp.AxisRatio.Value = double.PositiveInfinity;
Note: See TracChangeset
for help on using the changeset viewer.