Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultFormatters/SymbolicRegressionSolutionFormatterBase.cs @ 18026

Last change on this file since 18026 was 18026, checked in by dpiringe, 23 months ago

#3026

  • fixed a bug in Runner: the zip-method created wrong pairs (because the lists are unordered)
  • fixed a bug in SymbolicRegressionSolutionFormatterBase: the method now checks the target type as well
File size: 867 bytes
Line 
1using System;
2using System.Linq;
3using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
4using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
5
6namespace HeuristicLab.JsonInterface {
7  public abstract class SymbolicRegressionSolutionFormatterBase : ResultFormatter {
8    public override int Priority => 5;
9
10    public override bool CanFormatType(Type t) {
11      var interfaces = t.GetInterfaces();
12      var symRegSolutionType = typeof(ISymbolicRegressionSolution);
13      return t == symRegSolutionType || interfaces.Any(x => x == symRegSolutionType);
14    }
15
16    protected abstract ISymbolicExpressionTreeStringFormatter SymbolicExpressionTreeStringFormatter { get; }
17
18    public override string Format(object o) => SymbolicExpressionTreeStringFormatter.Format(((ISymbolicRegressionSolution)o).Model.SymbolicExpressionTree);
19  }
20}
Note: See TracBrowser for help on using the repository browser.