Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/10/17 15:31:35 (7 years ago)
Author:
bwerth
Message:

#2592 formatting & removed unreferenced enum

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/MOCMAEvolutionStrategy/HeuristicLab.Algorithms.MOCMAEvolutionStrategy/3.3/Individual.cs

    r15089 r15176  
    3232  public class Individual : IDeepCloneable {
    3333
    34     public enum OffspringSuccess {
    35       Success, NoSuccess
    36     }
    37 
    3834    #region Properties
    3935    [Storable]
     
    5450    private double[,] lowerCholesky;
    5551
    56 
    5752    //Phenotype
    5853    [Storable]
     
    7065    protected Individual(bool deserializing) { }
    7166
    72     /// <summary>
    73     ///
    74     /// </summary>
    75     /// <param name="mean">has to be 0-vector with correct lenght</param>
    76     /// <param name="pSucc">has to be ptargetsucc</param>
    77     /// <param name="sigma">initialSigma</param>
    78     /// <param name="pc">has to be 0-vector with correct lenght</param>
    79     /// <param name="c">has to be a symmetric positive definit Covariance matrix</param>
    8067    public Individual(RealVector mean, double pSucc, double sigma, RealVector pc, double[,] c, MOCMAEvolutionStrategy strategy) {
    8168      Mean = mean;
     
    147134        if (stepNormSqr > 1 && 1 < strategy.CovarianceMatrixUnlearningRate * (2 * stepNormSqr - 1)) rate = 1 / (2 * stepNormSqr - 1);
    148135        CholeskyUpdate(lastStep, 1 + rate, -rate);
    149 
    150136      } else RoundUpdate();
    151 
    152137    }
    153138
     
    159144        UpdateEvolutionPath(1 - strategy.EvolutionPathLearningRate, evolutionpathUpdateWeight);
    160145        CholeskyUpdate(evolutionPath, 1 - strategy.CovarianceMatrixLearningRate, strategy.CovarianceMatrixLearningRate);
    161       } else {
    162         RoundUpdate();
    163       }
     146      } else RoundUpdate();
    164147    }
    165148
     
    172155    }
    173156
    174     #region helpers
     157    #region Helpers
    175158    private void CholeskyDecomposition(double[,] c) {
    176159      if (!alglib.spdmatrixcholesky(ref c, c.GetLength(0), false))
     
    192175        var gamma = dj * betaPrime + swj2;
    193176        var x1 = dj + swj2 / betaPrime;
    194         if (x1 < 0.0) return;//throw new ArgumentException("Update makes Covariancematrix indefinite");//TODO check wether ignoring this update is valid
     177        if (x1 < 0.0) return;
    195178        var nLjj = Math.Sqrt(x1);
    196179        lowerCholesky[j, j] = nLjj;
     
    202185        for (var i = j + 1; i < n; i++) lowerCholesky[i, j] *= nLjj / ljj;
    203186        for (var i = j + 1; i < n; i++) lowerCholesky[i, j] += nLjj * beta * wj / gamma * temp[i];
    204 
    205187      }
    206 
    207188    }
    208189
     
    213194    }
    214195    #endregion
    215 
    216196  }
    217 
    218197}
Note: See TracChangeset for help on using the changeset viewer.