private static AlgorithmResult RunSchedulerAlgorithm(int?instanceNumber = null, bool copyToClipboard = true) { var dto = SchedulingBenchmarkInstanceReader.FromXml(instanceNumber ?? InstanceNumber); var schedulingBenchmarkModel = DtoToSchedulingBenchmarkModelMapper.MapToSchedulingBenchmarkModel(dto); var sw = new Stopwatch(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); sw.Start(); var result = SchedulerAlgorithmRunner.Run(schedulingBenchmarkModel); sw.Stop(); if (copyToClipboard) { Clipboard.Copy(result.ToRosterViewerFormat()); } var(feasible, messages) = FeasibilityEvaluator.Evaluate(result); messages.Sort(); return(new AlgorithmResult { Name = "Scheduler Algorithm Solution", Result = result, Penalty = OptimalityEvaluator.CalculatePenalty(result), Feasible = feasible, FeasibilityMessages = messages, Duration = sw.Elapsed }); }
public ExpectedTestResultsGenerator(int instanceNumber) { var dto = SchedulingBenchmarkInstanceReader.FromXml(instanceNumber); var schedulingBenchmarkModel = DtoToSchedulingBenchmarkModelMapper.MapToSchedulingBenchmarkModel(dto); _result = SchedulerAlgorithmRunner.Run(schedulingBenchmarkModel); _aggregates = EvaluationDataAggregator.GetAggregate(_result).ToDictionary(a => a.EmployeeId); _feasibilityEvaluator = new FeasibilityEvaluator(_result); }