private double _CalculateAccessory(Claster claster, ClasterAccessory accessory) { double result = 0.0F; var neededAccessory = _accessories.First(i => i.Item == accessory.Item && i.Claster == claster); result = accessory.FitnessValue / neededAccessory.FitnessValue; result = Math.Pow(result, _m * 2); return(result); }
private void _CalculateCentre(Claster claster) { var tmpAcessories = _accessories.Where(i => i.Claster == claster); var denomSum = tmpAcessories.Sum(i => Math.Pow(i.Accessory, _m)); for (int i = 0; i < claster.Dimensions; i++) { var numSum = tmpAcessories.Sum(j => Math.Pow(j.Accessory, _m) * j.Item.GetValue(i)); claster.SetCentre(i, numSum / denomSum); } }
private double _CalculateAccessory(Claster claster, ClasterAccessory accessory) { double result = 0.0F; var neededAccessory = _accessories.First(i => i.Item == accessory.Item && i.Claster == claster); result = accessory.FitnessValue / neededAccessory.FitnessValue; result = Math.Pow(result, _m * 2); return result; }