Changeset 18026
- Timestamp:
- 07/20/21 17:39:48 (3 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App/Runner.cs
r17834 r18026 5 5 using System.Threading; 6 6 using System.Threading.Tasks; 7 using HeuristicLab.Core; 7 8 using HeuristicLab.Optimization; 8 9 using Newtonsoft.Json.Linq; … … 53 54 54 55 // zip and filter the results with the ResultJsonItems 55 var filteredResults = configuredResultItems.Zip( 56 run.Results.Where(x => configuredResultItems.Any(y => y.Name == x.Key)), 57 (x, y) => new { Item = x, Value = y.Value }); 56 var filteredResults = new List<Tuple<IResultJsonItem, IItem>>(); 57 foreach(var resultItem in configuredResultItems) { 58 foreach(var result in run.Results) { 59 if(resultItem.Name == result.Key) { 60 filteredResults.Add(Tuple.Create(resultItem, result.Value)); 61 } 62 } 63 } 58 64 59 65 // add results to the JObject 60 66 foreach(var result in filteredResults) { 61 var formatter = GetResultFormatter(result.Item .ResultFormatterType);62 obj.Add(result.Item .Name, formatter.Format(result.Value));67 var formatter = GetResultFormatter(result.Item1.ResultFormatterType); 68 obj.Add(result.Item1.Name, formatter.Format(result.Item2)); 63 69 } 64 70 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs
r17834 r18026 108 108 foreach (JObject obj in Config) { 109 109 // build item from config object 110 string path = obj.Property("Path").Value.ToString(); 110 string path = obj.Property("Path").Value.ToString(); // TODO: catch exception if path is not available 111 111 // override default value 112 112 if (Objects.TryGetValue(path, out IJsonItem param)) { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultFormatters/SymbolicRegressionSolutionFormatterBase.cs
r17843 r18026 10 10 public override bool CanFormatType(Type t) { 11 11 var interfaces = t.GetInterfaces(); 12 return t.GetInterfaces().Any(x => x == typeof(ISymbolicRegressionSolution)); 12 var symRegSolutionType = typeof(ISymbolicRegressionSolution); 13 return t == symRegSolutionType || interfaces.Any(x => x == symRegSolutionType); 13 14 } 14 15 15 16 protected abstract ISymbolicExpressionTreeStringFormatter SymbolicExpressionTreeStringFormatter { get; } 16 17 17 public override string Format(object o) => SymbolicExpressionTreeStringFormatter.Format(( ISymbolicExpressionTree)((ISymbolicRegressionSolution)o).Model.SymbolicExpressionTree);18 public override string Format(object o) => SymbolicExpressionTreeStringFormatter.Format(((ISymbolicRegressionSolution)o).Model.SymbolicExpressionTree); 18 19 } 19 20 }
Note: See TracChangeset
for help on using the changeset viewer.