Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/29/16 10:28:26 (7 years ago)
Author:
gkronber
Message:

#2653: added a separate lock object for the kdTree in NearestNeighbourModel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs

    r14236 r14314  
    3636  public sealed class NearestNeighbourModel : ClassificationModel, INearestNeighbourModel {
    3737
     38    private object kdTreeLockObject = new object();
    3839    private alglib.nearestneighbor.kdtree kdTree;
    3940    public alglib.nearestneighbor.kdtree KDTree {
     
    4748      }
    4849    }
     50
    4951
    5052    public override IEnumerable<string> VariablesUsedForPrediction {
     
    201203        }
    202204        int numNeighbours;
    203         lock (kdTree) { // gkronber: the following calls change the kdTree data structure
     205        lock (kdTreeLockObject) { // gkronber: the following calls change the kdTree data structure
    204206          numNeighbours = alglib.nearestneighbor.kdtreequeryknn(kdTree, x, k, false);
    205207          alglib.nearestneighbor.kdtreequeryresultsdistances(kdTree, ref dists);
     
    237239        }
    238240        int numNeighbours;
    239         lock (kdTree) {
     241        lock (kdTreeLockObject) {
    240242          // gkronber: the following calls change the kdTree data structure
    241243          numNeighbours = alglib.nearestneighbor.kdtreequeryknn(kdTree, x, k, false);
Note: See TracChangeset for help on using the changeset viewer.