Ignore:
Timestamp:
01/07/20 17:19:05 (7 weeks ago)
Author:
dpiringe
Message:

#3026:

  • moved from usage of IAlgorithm to IOptimizer (in JCGenerator and JsonTemplateInstantiator)
  • added new converter: AlgorithmConverter
File:
1 edited

Legend:

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

    r17394 r17395  
    1111  internal static class Runner {
    1212    internal static void Run(string template, string config, string outputFile = @"C:\Workspace\test.txt") {
    13       IAlgorithm alg = JsonTemplateInstantiator.Instantiate(template, config);
     13      IOptimizer optimizer = JsonTemplateInstantiator.Instantiate(template, config);
    1414 
    15       Task task = alg.StartAsync();
     15      Task task = optimizer.StartAsync();
    1616      while(!task.IsCompleted) {
    17         WriteResultsToFile(outputFile, alg);
     17        WriteResultsToFile(outputFile, optimizer);
    1818        Thread.Sleep(100);
    1919      }
    20       WriteResultsToFile(outputFile, alg);
     20      WriteResultsToFile(outputFile, optimizer);
    2121    }
    2222
    23     private static void WriteResultsToFile(string file, IAlgorithm optimizer) =>
     23    private static void WriteResultsToFile(string file, IOptimizer optimizer) =>
    2424      File.WriteAllText(file, FetchResults(optimizer));
    2525
    26     private static string FetchResults(IAlgorithm optimizer) {
     26    private static string FetchResults(IOptimizer optimizer) {
    2727      StringBuilder sb = new StringBuilder();
    28       //foreach (var run in optimizer.Runs) {
    29         //sb.AppendLine($"--- {run.ToString()} ---");
    30         foreach (var res in optimizer.Results) {
    31           sb.AppendLine($"{res.Name}: {res.Value}");
     28      foreach (var run in optimizer.Runs) {
     29        sb.AppendLine($"--- {run.ToString()} ---");
     30        foreach (var res in run.Results) {
     31          sb.AppendLine($"{res.Key}: {res.Value}");
    3232        }
    33       //}
     33      }
    3434      return sb.ToString();
    3535    }
Note: See TracChangeset for help on using the changeset viewer.