Changeset 17540


Ignore:
Timestamp:
05/12/20 17:06:04 (7 months ago)
Author:
dpiringe
Message:

#3026:

  • added new converter: BatchRunConverter, ExperimentConverter
  • fixed a bug with the path of the .hl file in JCGenerator
  • fixed a bug with a redundant search for a suitable converter in JsonItemConverter
  • added a restriction for TargetVariable and AllowedInputVariables in RegressionProblemDataConverter
  • removed unnecessary code in Runner
Location:
branches/3026_IntegrationIntoSymSpace
Files:
2 added
5 edited

Legend:

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

    r17519 r17540  
    5151          if (configuredResults.Contains(res.Key)) {
    5252            if (res.Value is ISymbolicRegressionSolution solution) {
    53               /* TEST */
    54               var csFormatter = new CSharpSymbolicExpressionTreeStringFormatter();
    55               File.WriteAllText(@"C:\Workspace\output\csFormatted.cs", csFormatter.Format(solution.Model.SymbolicExpressionTree));
    56               /* END TEST */
    5753              var formatter = new SymbolicDataAnalysisExpressionMATLABFormatter();
    5854              var x = formatter.Format(solution.Model.SymbolicExpressionTree);
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs

    r17519 r17540  
    254254      };
    255255    }
    256      
    257 
    258     private IJsonItem GetTargetVariable(IItem item) =>
    259       new StringJsonItem() {
     256
     257
     258    private IJsonItem GetTargetVariable(IItem item) {
     259      var vars = (IEnumerable<StringValue>)((dynamic)item).InputVariables;
     260      return new StringJsonItem() {
    260261        Name = TargetVariable,
    261262        Value = (string)((dynamic)item).TargetVariable,
    262         //ConcreteRestrictedItems = variables.Select(x => x.Value)
    263       };
    264 
    265     private IJsonItem GetAllowedInputVariables(IItem item) =>
    266       new StringArrayJsonItem() {
     263        ConcreteRestrictedItems = vars.Select(x => x.Value)
     264      };
     265    }
     266
     267    private IJsonItem GetAllowedInputVariables(IItem item) {
     268      var vars = (IEnumerable<StringValue>)((dynamic)item).InputVariables;
     269      return new StringArrayJsonItem() {
    267270        Name = AllowedInputVariables,
    268271        Value = ((IEnumerable<string>)((dynamic)item).AllowedInputVariables).ToArray(),
    269         //ConcreteRestrictedItems = variables.Select(x => x.Value)
    270       };
     272        ConcreteRestrictedItems = vars.Select(x => x.Value)
     273      };
     274    }
    271275    #endregion
    272276  }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj

    r17483 r17540  
    6363    <Compile Include="Constants.cs" />
    6464    <Compile Include="Converters\AlgorithmConverter.cs" />
     65    <Compile Include="Converters\BatchRunConverter.cs" />
     66    <Compile Include="Converters\ExperimentConverter.cs" />
    6567    <Compile Include="Converters\RegressionProblemDataConverter.cs" />
    6668    <Compile Include="Converters\ResultParameterConverter.cs" />
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs

    r17519 r17540  
    3131      #region Serialize HL File
    3232      ProtoBufSerializer serializer = new ProtoBufSerializer();
    33       string hlFilePath = fullPath + templateName + ".hl";
     33      string hlFilePath = Path.Combine(fullPath, templateName + ".hl");
    3434      serializer.Serialize(optimizer, hlFilePath);
    3535      #endregion
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverter.cs

    r17519 r17540  
    6262        IJsonItemConverter converter = GetConverter(item.GetType());
    6363        if (converter == null) return new UnsupportedJsonItem();
    64         IJsonItem tmp = GetConverter(item.GetType()).Extract(item, root);
     64        IJsonItem tmp = converter.Extract(item, root);
    6565        ExtractCache.Add(hash, tmp);
    6666        return tmp;
Note: See TracChangeset for help on using the changeset viewer.