- Timestamp:
- 12/22/11 16:23:01 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/FitnessLandscapeAnalysis/VRPProblemAnalyzer/KMeansClustering.cs
r7231 r7232 23 23 double[,] centers = null; 24 24 int[] xyc = null; 25 bool aborted = false;26 25 27 26 … … 29 28 alglib.kmeansgenerate(vertices, vertices.Length / 2, 2, k, restarts + 1, out info, out centers, out xyc); 30 29 }); 31 32 30 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; 37 34 } 38 sw.Stop();39 40 if (t.ThreadState == System.Threading.ThreadState.Running) {41 aborted = true;42 t.Abort();43 }44 35 45 36 if (info == -3) 46 37 return new List<Cluster>(); 47 else if (info == 1 && !aborted) {38 else if (info == 1) { 48 39 List<Cluster> result = new List<Cluster>(); 49 40 int count = centers.Length / 2;
Note: See TracChangeset
for help on using the changeset viewer.