/// <summary> /// Allocate the resources to try to satisfy demand as well as possible /// </summary> /// <param name="currentTime"></param> private void AllocateDemand(Time currentTime, Dictionary <string, IResource> resources, Map map) { foreach (var r in resources) { Allocation allocation; Resource resource = (Resource)r.Value; switch (resource.Distribution) { case "first": case "nearest": allocation = Allocation.AllocateAsHarpagon(currentTime, resource, map.Cells, Math.Max(map.SizeX, map.SizeY), resource.Distribution); break; default: allocation = Allocation.AllocateAsSolomon(currentTime, resource, map.Cells); break; } Allocations[resource.Id] = allocation; } }
public void AddAllocation(string resourceId, Allocation allocation) { Allocations[resourceId] = allocation; }