Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/18/15 11:56:07 (9 years ago)
Author:
mkommend
Message:

#1967: Introduced separate lock object for synchronizing access to the random object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessCovarianceOptimizationProblem.cs

    r13234 r13242  
    192192    }
    193193
     194    private readonly object syncRoot = new object();
    194195    // Does not produce the same result for the same seed when using parallel engine (see below)!
    195196    public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) {
     
    223224        // Evaluate might be called concurrently therefore access to random has to be synchronized.
    224225        // However, results of multiple runs with the same seed will be different when using the parallel engine.
    225         lock (random) {
     226        lock (syncRoot) {
    226227          for (int i = 0; i < covarianceFunction.GetNumberOfParameters(nVars); i++) {
    227228            hyperParameters[1 + i] = random.NextDouble() * 2.0 - 1.0;
Note: See TracChangeset for help on using the changeset viewer.