Ejemplo n.º 1
0
        public ServerSelector(ProblemInput input, ProblemOutput result)
        {
            _input  = input;
            _result = result;

            _availableServersByCapacity = new Stack <Server>(GetServerListByPreference(input));
        }
Ejemplo n.º 2
0
 public RowAllocator(ProblemInput input, ProblemOutput result, Random random)
 {
     _random        = random;
     _result        = result;
     _input         = input;
     _unusedServers = new Stack <Server>();
     CreateRows();
 }
Ejemplo n.º 3
0
        public int GurranteedCapacity(ProblemOutput output)
        {
            Dictionary <int, int> rowsCpacity = new Dictionary <int, int>();
            var allocated = output._allocations.Values.Where(allocation => Equals(allocation.Pool, this));

            foreach (var server in allocated)
            {
                if (rowsCpacity.ContainsKey(server.Row))
                {
                    rowsCpacity[server.Row] += server.Server.Capacity;
                }
                else
                {
                    rowsCpacity.Add(server.Row, server.Server.Capacity);
                }
            }

            var maxRow = rowsCpacity.Max(_ => _.Value);

            rowsCpacity.Remove(maxRow);
            return(rowsCpacity.Sum(_ => _.Value));
        }