Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/02/21 16:42:16 (3 years ago)
Author:
dpiringe
Message:

#3026

  • added a first version of a new feature called ResultCollectionPostProcessors, which should transform/process the results of an optimizer run
    • created a new interface IResultCollectionPostProcessor
    • created a new class SymRegPythonPostProcessor, which formats all ISymbolicRegressionSolution with the usage of the SymbolicDataAnalysisExpressionPythonFormatter
    • changed the generation and instantiation of templates to handle this new feature
    • the template files contains a new area PostProcessors
    • added functionality in Runner to use these new type of result processing
    • added a new tab in ExportJsonDialog to configure PostProcessors
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateGenerator.cs

    r18040 r18046  
    55using System.IO;
    66using HeuristicLab.Core;
     7using System.Linq;
    78
    89namespace HeuristicLab.JsonInterface {
     
    1819    /// <param name="optimizer">the optimizer object to serialize</param>
    1920    /// <param name="rootItem">Root JsonItem for serialization, considers only active JsonItems for serialization</param>
    20     public static void GenerateTemplate(string templatePath, IOptimizer optimizer, IJsonItem rootItem) {
     21    public static void GenerateTemplate(string templatePath, IOptimizer optimizer, IJsonItem rootItem, IEnumerable<IResultCollectionPostProcessor> postProcessors) {
    2122      // clear all runs
    2223      optimizer.Runs.Clear();
     
    3132      JArray parameterItems = new JArray();
    3233      JArray resultItems = new JArray();
     34      JArray postProcessorItems = new JArray();
     35      // postProcessors.Select(x => new JObject().Add("Name", JToken.Parse(x.GetType().Name))
     36      foreach (var proc in postProcessors) {
     37        var tmp = new JObject();
     38        tmp.Add("Name", proc.GetType().Name);
     39        postProcessorItems.Add(tmp);
     40      }
     41
    3342      IList<IJsonItem> jsonItems = new List<IJsonItem>();
    3443     
     
    6776      template[Constants.Parameters] = parameterItems;
    6877      template[Constants.Results] = resultItems;
     78      template["PostProcessors"] = postProcessorItems;
    6979      #endregion
    7080
     
    7686    #region Helper   
    7787    private static void PopulateJsonItems(IJsonItem item, IList<IJsonItem> jsonItems) {
    78       foreach(var x in item) {
     88      foreach(var x in item) { // TODO: dieses konstrukt notwendig?
    7989        if (x.Active && !(x is EmptyJsonItem) && !(x is UnsupportedJsonItem)) {
    8090          jsonItems.Add(x);
Note: See TracChangeset for help on using the changeset viewer.