Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/17/20 17:29:52 (5 years ago)
Author:
dpiringe
Message:

#3026:

  • added new CLI argument StringArgument
  • removed unnecessary check in StartArgument
  • changed output format from simple .txt to .json in HeuristicLab.JsonInterface.App.Runner
  • user has to enter output path now when executing JsonInterface on console
Location:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface
Files:
2 edited

Legend:

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

    r17439 r17442  
    2525    }
    2626
     27    public static IOptimizer Instantiate(string templateFile) =>
     28      Instantiate(templateFile, null, out IEnumerable<string> allowedResultNames);
     29
     30
     31    public static IOptimizer Instantiate(string templateFile, out IEnumerable<string> allowedResultNames) =>
     32      Instantiate(templateFile, null, out allowedResultNames);
     33
     34   
     35
    2736    /// <summary>
    2837    /// Instantiate an IAlgorithm object with a template and config.
     
    3140    /// <param name="configFile">Config file (json) for the template.</param>
    3241    /// <returns>confugrated IOptimizer object</returns>
    33     public static IOptimizer Instantiate(string templateFile, string configFile = "") {
     42    public static IOptimizer Instantiate(string templateFile, string configFile, out IEnumerable<string> allowedResultNames) {
    3443      InstData instData = new InstData() {
    3544        Objects = new Dictionary<string, IJsonItem>()
     
    6372      JsonItemConverter.Inject(optimizer, optimizerData);
    6473
     74      allowedResultNames = CollectResults(instData);
     75
    6576      return optimizer;
    6677    }
     
    7081    private static object GetValueFromJObject(JObject obj) =>
    7182      obj[nameof(IJsonItem.Value)]?.ToObject<object>();
     83
     84    private static IEnumerable<string> CollectResults(InstData instData) {
     85      IList<string> res = new List<string>();
     86      foreach(JObject obj in instData.Template[Constants.Results]) {
     87        res.Add(obj.Property("Name").Value.ToString());
     88      }
     89      return res;
     90    }
    7291
    7392    private static void CollectParameterizedItems(InstData instData) {
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/SingleLineArrayJsonWriter.cs

    r17406 r17442  
    88  /// It collapses arrays into a single line.
    99  /// </summary>
    10   internal class SingleLineArrayJsonWriter : JsonTextWriter {
     10  public class SingleLineArrayJsonWriter : JsonTextWriter {
    1111    private bool isRangeArray = false;
    1212    public override void WriteStartArray() {
Note: See TracChangeset for help on using the changeset viewer.