public override Bid GetWinnerBid()
        {
            if (Bids.Count == 0)
            {
                return(null);
            }
            else
            {
                //Steps
                //1 : I only send push requests that are valid
                //2 : Find all containers migration costs average

                var avgCost =
                    Bids.Select(x => x.ContainerId).Select(x => Containers[x].MigrationCost).Average();
                var        NewBids  = Bids.Where(x => Containers[x.ContainerId].MigrationCost >= avgCost).ToList();
                ForsmanBid winner   = NewBids.First();
                var        lds      = ToBeHostLoadInfos(NewBids[0].BiddingHost, NewBids[0].NewLoadInfo);
                var        bentropy = AccountingHelpers.CalculateEntropy(lds);
                //3: Find the new entropy after migration
                for (int i = 1; i < NewBids.Count; i++)
                {
                    lds = ToBeHostLoadInfos(NewBids[i].BiddingHost, NewBids[i].NewLoadInfo);
                    var entropy = AccountingHelpers.CalculateEntropy(lds);
                    if (entropy > bentropy)
                    {
                        bentropy = entropy;
                        winner   = NewBids[i];
                    }
                }
                return(winner);
            }
        }
        public void ReadCurrentState()
        {
            lock (_lock)
            {
                List <HostLoadInfo> loads          = GetLoadList(false);
                List <HostLoadInfo> predictedLoads = GetLoadList(true);

                double neededtAvg = CalculateVolumeAverage(loads);
                double min        = CalculateNeededVolumeMin(loads);
                double max        = CalculateNeededVolumeMax(loads);

                double predictedAvg = CalculateVolumeAverage(predictedLoads);

                CalculateOutOfBoundHosts(out int underUtilized, out int overUtilizedHosts, out int normal, out int evacuating);

                int    slaViolationsCount  = CalculateSlaViolationsCount();
                double slaViolationPercent = CalculateSlaViolationsPercent();
                double imagePulls          = _currentRequests[MessageTypes.ImagePullRequest];
                var    mvalues             = new MeasuresValues(
                    _currentRequests[MessageTypes.PushRequest],
                    _currentRequests[MessageTypes.PullRequest],
                    CalculateIdealHostsCount(loads),
                    loads.Count,
                    _currentRequests[MessageTypes.MigrateContainerRequest],
                    _currentRequests.Values.Sum(),
                    AccountingHelpers.CalculateEntropy(loads),
                    AccountingHelpers.CalculateEntropy(predictedLoads),
                    _currentRequests[MessageTypes.PushLoadAvailabilityRequest],
                    _currentRequests[MessageTypes.PullLoadAvailabilityRequest], neededtAvg, predictedAvg,
                    min,
                    max,
                    underUtilized,
                    overUtilizedHosts,
                    normal,
                    evacuating,
                    slaViolationsCount,
                    slaViolationPercent,
                    loads.PowerConsumption(),
                    loads.StandardDeviation(),
                    imagePulls,
                    communicatedSize
                    );

                MeasureHolder.HostMeasureValuesList.Add(new HostMeasureValues(loads));
                MeasureHolder.MeasuredValuesList.Add(mvalues);
                //Debug.WriteLine($"Communicated Size = {communicatedSize}");
                //Debug.WriteLine($"Total Data  = {MeasureHolder.HostMeasureValueList.Last().AverageDataTotal}");


                ClearInformation();
            }
        }