Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/16/21 15:27:07 (3 years ago)
Author:
dpiringe
Message:

#3026

  • added StorableTypeAttribute and StorableConstructorAttribute to all JsonItems
  • added a new JsonItem ListJsonItem + Interfaces IListJsonItem
  • renamed SymRegPythonProcessor to RunCollectionSRSolutionPythonFormatter
  • removed Interface IResultCollectionProcessor -> using the interface IRunCollectionModifier now (has aleady implementations)
  • renamed all related variables/fields/properties with a connection to ResultCollectionProcessor
  • added new implementations for IRunCollectionModifier
Location:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultCollectionProcessors
Files:
4 added
1 edited
1 moved

Legend:

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

    r18050 r18055  
    1212
    1313namespace HeuristicLab.JsonInterface {
     14  /*
    1415  [StorableType("4AF9EF94-2EF3-4F54-8B8D-942454CF8DDF")]
    15   public class FilterResultCollectionProcessor : ParameterizedNamedItem, IResultCollectionProcessor {
     16  public class FilterResultCollectionProcessor : ParameterizedNamedItem, IRunCollectionModifier {
    1617
    1718    #region Constants
    1819    private const string FilterStringParameterName = "Filters";
     20    private const string Filter2StringParameterName = "Filters2";
    1921    #endregion
    2022
     
    2224    public IFixedValueParameter<StringValue> FilterStringParameter =>
    2325      (IFixedValueParameter<StringValue>)Parameters[FilterStringParameterName];
     26    public IFixedValueParameter<ItemList<StringValue>> Filter2StringParameter =>
     27      (IFixedValueParameter<ItemList<StringValue>>)Parameters[Filter2StringParameterName];
    2428    #endregion
    2529
     
    2933    public FilterResultCollectionProcessor() {
    3034      Parameters.Add(new FixedValueParameter<StringValue>(FilterStringParameterName, "", new StringValue()));
     35      Parameters.Add(new FixedValueParameter<ItemList<StringValue>>(Filter2StringParameterName, "", new ItemList<StringValue>()));
    3136    }
    3237    public FilterResultCollectionProcessor(FilterResultCollectionProcessor original, Cloner cloner) : base(original, cloner) { }
     
    3944      var filters = FilterStringParameter.Value.Value.Split(';');
    4045     
    41      
    42       /*
    43       foreach (var filter in FilterStringParameter.Value) {
    44         if (results.ContainsKey(filter.Value))
    45           results.Remove(filter.Value);
    46       }*/
     46      foreach (var filter in filters) {
     47        if (results.ContainsKey(filter))
     48          results.Remove(filter);
     49      }
    4750    }
    48   }
     51  }*/
    4952}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultCollectionProcessors/RunCollectionSRSolutionPythonFormatter.cs

    r18054 r18055  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    6 using HeuristicLab.Collections;
    7 using HeuristicLab.Common;
     1using HeuristicLab.Common;
     2using HeuristicLab.Problems.DataAnalysis.Symbolic;
     3using HEAL.Attic;
     4using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    85using HeuristicLab.Core;
    9 using HeuristicLab.Optimization;
    10 using HeuristicLab.Problems.DataAnalysis.Symbolic;
    11 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    12 using HEAL.Attic;
    13 using HeuristicLab.Data;
    146
    157namespace HeuristicLab.JsonInterface {
     8  [Item(Name = "RunCollection SymbolicRegressionSolution Python Formatter")]
    169  [StorableType("844F2887-B7A0-4BD4-89B8-F9155C65D214")]
    17   public class SymRegPythonProcessor : ParameterizedNamedItem, IResultCollectionProcessor {
     10  public class RunCollectionSRSolutionPythonFormatter : RunCollectionSRSolutionFormatter {
     11    protected override ISymbolicExpressionTreeStringFormatter Formatter =>
     12      new SymbolicDataAnalysisExpressionPythonFormatter();
    1813
    1914    #region Constructors & Cloning
    2015    [StorableConstructor]
    21     protected SymRegPythonProcessor(StorableConstructorFlag _) : base(_) { }
    22     public SymRegPythonProcessor() { }
    23     public SymRegPythonProcessor(SymRegPythonProcessor original, Cloner cloner) : base(original, cloner) { }
     16    protected RunCollectionSRSolutionPythonFormatter(StorableConstructorFlag _) : base(_) { }
     17    public RunCollectionSRSolutionPythonFormatter() { Suffix = "Python"; }
     18    public RunCollectionSRSolutionPythonFormatter(RunCollectionSRSolutionPythonFormatter original, Cloner cloner) : base(original, cloner) { }
    2419
    2520    public override IDeepCloneable Clone(Cloner cloner) {
    26       return new SymRegPythonProcessor(this, cloner);
     21      return new RunCollectionSRSolutionPythonFormatter(this, cloner);
    2722    }
    2823    #endregion
    29 
    30     public void Apply(IObservableDictionary<string, IItem> results) {
    31       var formatter = new SymbolicDataAnalysisExpressionPythonFormatter();
    32       var resultCopy = new ObservableDictionary<string, IItem>(results);
    33       foreach (var kvp in resultCopy) {
    34         if (kvp.Value is ISymbolicRegressionSolution sol) {
    35           results.Add($"{kvp.Key} - Python" , new StringValue(formatter.Format(sol.Model.SymbolicExpressionTree)));
    36         }
    37       }
    38     }
    3924  }
    4025}
Note: See TracChangeset for help on using the changeset viewer.