Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/Heuristiclab.ConfigStarter/Program.cs @ 17473

Last change on this file since 17473 was 17473, checked in by dpiringe, 5 years ago

#3026:

  • refactored inheritance structure of json items, now the default JsonItem is an abstract class without properties Value and Range -> splitted up into new interfaces
  • updated view models for new json item structure
  • updated SingleLineArrayJsonWriter
File size: 2.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.PluginInfrastructure;
7using HeuristicLab.JsonInterface.App;
8using HeuristicLab.Algorithms.GeneticAlgorithm;
9using HeuristicLab.Problems.TravelingSalesman;
10using HeuristicLab.JsonInterface;
11using System.IO;
12using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
13using HeuristicLab.PluginInfrastructure.Manager;
14using HeuristicLab.SequentialEngine;
15using System.Threading;
16
17namespace Heuristiclab.ConfigStarter {
18  public class Program {
19
20    public static void Main(string[] args) {
21
22      try {
23        string pluginPath = Path.GetFullPath(Directory.GetCurrentDirectory());
24        var pluginManager = new PluginManager(pluginPath);
25        pluginManager.DiscoverAndCheckPlugins();
26       
27      } catch(Exception e) {
28        Console.WriteLine(e);
29      }
30
31      HEAL.Attic.Mapper.StaticCache.UpdateRegisteredTypes();
32
33
34      HeuristicLabJsonInterfaceAppApplication app = new HeuristicLabJsonInterfaceAppApplication();
35
36      GeneticAlgorithm alg = new GeneticAlgorithm();
37      alg.MaximumGenerations.Value = 10000;
38      TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
39      tsp.Coordinates[0, 0] = 123;
40
41
42
43      SymbolicRegressionSingleObjectiveProblem prop = new SymbolicRegressionSingleObjectiveProblem();
44     
45      alg.Problem = prop;
46
47      IJsonItem root = JsonItemConverter.Extract(alg);
48      ActivateJsonItems(root);
49      //var x = root.Children[0];
50      //root.Children.Remove(x);
51      //x.Parent = null;
52
53
54      JCGenerator generator = new JCGenerator();
55      generator.GenerateTemplate(@"C:\Workspace", "Template", alg, root);
56      //JsonTemplateInstantiator.Instantiate(@"C:\Workspace\Template.json");
57     
58      List<ICommandLineArgument> arguments = new List<ICommandLineArgument>();
59      arguments.Add(new StartArgument("JsonInterface"));
60      arguments.Add(new OpenArgument(@"C:\Workspace\Template.json"));
61      arguments.Add(new OpenArgument(@"C:\Workspace\ConfigProto1.json"));
62      arguments.Add(new StringArgument(@"C:\Workspace\Output.json"));
63
64      app.Run(arguments.ToArray());
65     
66    }
67
68    private static void ActivateJsonItems(IJsonItem item) {
69      item.Active = true;
70      if(item.Children != null) {
71        foreach (var x in item.Children)
72          ActivateJsonItems(x);
73      }
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.