source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultFormatter/MatlabResultFormatter.cs @ 17834

Last change on this file since 17834 was 17834, checked in by dpiringe, 2 months ago

#3026

  • added ResultFormatter to add an extra layer of result transformation logic (converting a result value to a string with a defined logic, e.g. MatlabResultFormatter for ISymbolicRegressionSolution)
  • extended the IResultJsonItem with two properties for result formatting
  • added a new control to selected a result formatter for a result value
  • refactored the Runner for the new result formatting process
File size: 929 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
7using HeuristicLab.Problems.DataAnalysis.Symbolic;
8using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
9
10namespace HeuristicLab.JsonInterface {
11  public class MatlabResultFormatter : ResultFormatter {
12    public override int Priority => 5;
13
14    public override bool CanFormatType(Type t) {
15      var interfaces = t.GetInterfaces();
16      return t.GetInterfaces().Any(x => x == typeof(ISymbolicRegressionSolution));
17    }
18     
19    private ISymbolicExpressionTreeStringFormatter MatlabFormatter => new SymbolicDataAnalysisExpressionMATLABFormatter();
20
21    public override string Format(object o) => MatlabFormatter.Format((ISymbolicExpressionTree)((ISymbolicRegressionSolution)o).Model.SymbolicExpressionTree);
22  }
23}
Note: See TracBrowser for help on using the repository browser.