public List <AllocOutput> GetAllocationsGA(AllocInput allocInput) { List <AllocOutput> allocations = new List <AllocOutput>(); GA GAlgo = new GA(allocInput.Tasks, allocInput.Processors, allocInput.Coefficients, allocInput.RefFrequency, allocInput.MaxDuration); GAlgo.Train(); Population pop = GAlgo.GetLastGeneration(); var uniqueCorrectAllocs = GAlgo.GetCorrectAllocs().GroupBy(elem => elem.GetUniqueId()).Select(group => group.First()); foreach (var alloc in uniqueCorrectAllocs) { Dictionary <string, List <string> > processors = new Dictionary <string, List <string> >(); foreach (var proc in alloc.Processors) { processors.Add(proc.Value.Id, proc.Value.Tasks); } AllocOutput allocOutput = new AllocOutput((allocations.Count + 1).ToString(), alloc.ProgramRuntime, alloc.EnergyConsumed, processors); allocations.Add(allocOutput); } return(allocations); }
public List <AllocOutput> GetAllocationsHeuristic(AllocInput allocInput) { return(Heuristic.GetAllocations(allocInput)); }
public List <AllocOutput> GetAllocationsSortMid(AllocInput allocInput) { return(SortMid.GetAllocations(allocInput)); }