private void ThreadMethod(int start, int end, int min)
        {
            for (int i = start; i < end; i++)
            {
                int           cCount        = i;
                ClusterResult clusterresult = null;
                switch (this.MethodMode)
                {
                case 0: clusterresult = SingleStart(cCount, ref this.WaitObj.Flags[i - min]); break;

                case 1: clusterresult = SingleStartWithWeight(cCount, ref this.WaitObj.Flags[i - min]); break;
                }
                ClusterAssessReport_BWP clusterassessreport = Assess.GetBWP(Data, clusterresult, Distences);
                lock (this.SyObject)
                {
                    this.FinalReport.HisResult.Add(clusterresult);
                    this.FinalReport.HisReport.Add(clusterassessreport);
                    if (clusterassessreport.AvgBWP > this.Score)
                    {
                        this.Score = clusterassessreport.AvgBWP;
                        FinalReport.FanialResult = clusterresult;
                        FinalReport.FanialReport = clusterassessreport;
                    }
                }
            }
            if (Barobj != null)
            {
                Barobj.RemoveParticipant();
            }
        }
 public KMeans(object threadpool, IDataTable <DataRow> data, string[] properties, int maxcount, int minclustercount, int maxclustercount, double[] mean, double[] v, Protocol.Structure.WaitObject wt, int initialmode, int methodmode, int maxthread)
 {
     this.Data            = data;
     this.Properties      = properties;
     this.MaxCount        = maxcount;
     this.DataCount       = data.RowCount;
     this.ParaCount       = properties.Length;
     this.Distences       = new double[this.DataCount, this.ParaCount];
     this.MaxClusterCount = maxclustercount;
     this.MinClusterCount = minclustercount;
     this.WaitObj         = wt;
     this.InitialMode     = initialmode;
     this.MethodMode      = methodmode;
     this.Mean            = mean;
     this.Stdev           = v;
     this.MaxThreadCount  = maxthread;
     this.Distences       = new double[DataCount, DataCount];
     this.ThreadPool      = threadpool as List <Thread>;
     Parallel.For(0, this.DataCount - 1, new Action <int>((i) =>
     {
         for (int j = i + 1; j < this.DataCount; j++)
         {
             var temp             = Assess.GetEdistence(this.Data, i, j, this.Properties, this.ParaCount);
             this.Distences[i, j] = temp;
             this.Distences[j, i] = temp;
         }
     }));
 }