Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/22/11 16:23:01 (12 years ago)
Author:
epitzer
Message:

#1696: Updated build configuration and simplified thread handling and removed hard coded paths

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/FitnessLandscapeAnalysis/VRPProblemAnalyzer/KMeansClustering.cs

    r7231 r7232  
    2323        double[,] centers = null;
    2424        int[] xyc = null;
    25         bool aborted = false;
    2625
    2726
     
    2928          alglib.kmeansgenerate(vertices, vertices.Length / 2, 2, k, restarts + 1, out info, out centers, out xyc);
    3029        });
    31 
    3230        t.Start();
    33         Stopwatch sw = new Stopwatch();
    34         sw.Start();
    35         while (t.ThreadState == System.Threading.ThreadState.Running && sw.ElapsedMilliseconds < 1000) {
    36           Thread.Sleep(10);
     31        if (!t.Join(1000)) {
     32          t.Abort();
     33          continue;
    3734        }
    38         sw.Stop();
    39 
    40         if (t.ThreadState == System.Threading.ThreadState.Running) {
    41           aborted = true;
    42           t.Abort();
    43         }
    4435
    4536        if (info == -3)
    4637          return new List<Cluster>();
    47         else if (info == 1 && !aborted) {
     38        else if (info == 1) {
    4839          List<Cluster> result = new List<Cluster>();
    4940          int count = centers.Length / 2;
Note: See TracChangeset for help on using the changeset viewer.