using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Data; using HeuristicLab.Services.Optimization.ControllerService.Model; using HeuristicLab.Optimization; using HeuristicLab.Services.Optimization.ControllerService; using HeuristicLab.Algorithms.Benchmarks; using HeuristicLab.Parameters; using HeuristicLab.PluginInfrastructure; namespace HeuristicLab.Mappers { public class BenchmarkScenarioMapper : IScenarioMapper { public void MapScenario(OptimizationScenario scenario, out IAlgorithm algorithm) { var alg = scenario.FirstAlgorithm; var bm = new BenchmarkAlgorithm(); var bmFullName = HLMapper.GetStringValue(alg.Parameters.FindByName("Benchmark")); bm.BenchmarkParameter.Value = bm.Benchmark = bm.BenchmarkParameter.ValidValues.First(b => b.GetType().FullName == bmFullName); ((ValueParameter)bm.Parameters["ChunkSize"]).Value = HLMapper.ConvertToIntValue(alg.Parameters.FindByName("ChunkSize")); ((ValueParameter)bm.Parameters["TimeLimit"]).Value = HLMapper.ConvertToDoubleValue(alg.Parameters.FindByName("TimeLimit")); algorithm = bm; } } }