public ServerSelector(ProblemInput input, ProblemOutput result) { _input = input; _result = result; _availableServersByCapacity = new Stack <Server>(GetServerListByPreference(input)); }
public RowAllocator(ProblemInput input, ProblemOutput result, Random random) { _random = random; _result = result; _input = input; _unusedServers = new Stack <Server>(); CreateRows(); }
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)); }