Пример #1
0
        public void NextPosition(double w, double c1 = 2, double c2 = 2)
        {
            var rand  = Rand.NextDouble();
            var gbest = PlantGBest.GetGBest(Code);

            V      = Math.Round(w * V + c1 * rand * (PBest - Count) + c2 * rand * (gbest - Count));
            Count += Convert.ToInt32(V);
            if (Count > MaxCount)
            {
                Count = MaxCount;
            }
            if (Count < 0)
            {
                Count = 0;
            }
        }
Пример #2
0
 public void UpdateGBest()
 {
     PlantGBest.SetGBest(Code, Count);
 }