Changeset 18055 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultCollectionProcessors
- Timestamp:
- 09/16/21 15:27:07 (3 years ago)
- 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 12 12 13 13 namespace HeuristicLab.JsonInterface { 14 /* 14 15 [StorableType("4AF9EF94-2EF3-4F54-8B8D-942454CF8DDF")] 15 public class FilterResultCollectionProcessor : ParameterizedNamedItem, IR esultCollectionProcessor {16 public class FilterResultCollectionProcessor : ParameterizedNamedItem, IRunCollectionModifier { 16 17 17 18 #region Constants 18 19 private const string FilterStringParameterName = "Filters"; 20 private const string Filter2StringParameterName = "Filters2"; 19 21 #endregion 20 22 … … 22 24 public IFixedValueParameter<StringValue> FilterStringParameter => 23 25 (IFixedValueParameter<StringValue>)Parameters[FilterStringParameterName]; 26 public IFixedValueParameter<ItemList<StringValue>> Filter2StringParameter => 27 (IFixedValueParameter<ItemList<StringValue>>)Parameters[Filter2StringParameterName]; 24 28 #endregion 25 29 … … 29 33 public FilterResultCollectionProcessor() { 30 34 Parameters.Add(new FixedValueParameter<StringValue>(FilterStringParameterName, "", new StringValue())); 35 Parameters.Add(new FixedValueParameter<ItemList<StringValue>>(Filter2StringParameterName, "", new ItemList<StringValue>())); 31 36 } 32 37 public FilterResultCollectionProcessor(FilterResultCollectionProcessor original, Cloner cloner) : base(original, cloner) { } … … 39 44 var filters = FilterStringParameter.Value.Value.Split(';'); 40 45 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 } 47 50 } 48 } 51 }*/ 49 52 } -
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; 1 using HeuristicLab.Common; 2 using HeuristicLab.Problems.DataAnalysis.Symbolic; 3 using HEAL.Attic; 4 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 8 5 using 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;14 6 15 7 namespace HeuristicLab.JsonInterface { 8 [Item(Name = "RunCollection SymbolicRegressionSolution Python Formatter")] 16 9 [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(); 18 13 19 14 #region Constructors & Cloning 20 15 [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) { } 24 19 25 20 public override IDeepCloneable Clone(Cloner cloner) { 26 return new SymRegPythonProcessor(this, cloner);21 return new RunCollectionSRSolutionPythonFormatter(this, cloner); 27 22 } 28 23 #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 }39 24 } 40 25 }
Note: See TracChangeset
for help on using the changeset viewer.