public void ProcessGlobalProfit(List <Federation> federationsList) { Utils.Logger tempLog = new Utils.Logger(); tempLog.PrintConsoleMessage("Recalculate Gloabl MarketShare", ""); if (!this.GlobalProfitHistory.ContainsKey(this.CurrentStateModel.CurrentTurn)) { this.GlobalProfitHistory.Add(this.CurrentStateModel.CurrentTurn, 1); } double sumCollabTraining = federationsList.Sum(f => f.CollabTrainingQuality); foreach (Federation f in federationsList) { f.MarketShare = this.GetSharePct(f.CollabTrainingQuality, sumCollabTraining); Console.WriteLine("DEBUG :: New Market Share :" + f.MarketShare); } }
public void CalculateCollabTQ(double dataQualityWeight, double dataQuantityWeight) { //sc.totalTrainingQuality = 0; Utils.Logger tempLog = new Utils.Logger(); List <double> trainingQualityList = new List <double>(); foreach (Player p in this.ParticipantList) { /* * tempLog.PrintConsoleMessage("PROCESS_TRAINING", "Player " + p.Pid + " submitted"); * tempLog.PrintConsoleMessage("Data ", "Quality ->" + p.DataOwned.DataQuality + " Quantity ->" + p.DataOwned.DataQuantity); * tempLog.PrintConsoleMessage("Resource", "Quantity ->" + p.ResourceOwned.AssignedQty); */ double valueOfData = (p.DataOwned.DataQuality * dataQualityWeight) + (p.DataOwned.DataQuantity * dataQuantityWeight); trainingQualityList.Add(valueOfData); // sc.totalTrainingQuality += valueOfData; } //Rounding double maxValue = trainingQualityList.Max(); double collabTQ = maxValue - this.calStandardDeviation(trainingQualityList); this.CollabTrainingQuality = Math.Round(collabTQ, 3); tempLog.PrintConsoleMessage("Collab Training Quality ", this.CollabTrainingQuality.ToString()); }