Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 17601 was 17601, checked in by dpiringe, 4 years ago

#3026:

  • JCGenerator changed name to JsonTemplateGenerator
File size: 2.6 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      } catch(Exception e) {
27        Console.WriteLine(e);
28      }
29
30      HEAL.Attic.Mapper.StaticCache.UpdateRegisteredTypes();
31
32     
33      HeuristicLabJsonInterfaceAppApplication app = new HeuristicLabJsonInterfaceAppApplication();
34
35      GeneticAlgorithm alg = new GeneticAlgorithm();
36      alg.MaximumGenerations.Value = 10000;
37      TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
38      tsp.Coordinates[0, 0] = 123;
39
40
41
42      SymbolicRegressionSingleObjectiveProblem prop = new SymbolicRegressionSingleObjectiveProblem();
43     
44      alg.Problem = prop;
45
46      IJsonItem root = JsonItemConverter.Extract(alg);
47      ActivateJsonItems(root);
48
49     
50      JsonTemplateGenerator.GenerateTemplate(@"C:\Workspace\ConfigStarter\", "Template", alg, root);
51     
52
53      List<ICommandLineArgument> arguments = new List<ICommandLineArgument>();
54      arguments.Add(new StartArgument("JsonInterface"));
55      arguments.Add(new OpenArgument(@"C:\Workspace\ConfigStarter\Template.json"));
56      arguments.Add(new OpenArgument(@"C:\Workspace\ConfigStarter\Config.json"));
57      arguments.Add(new StringArgument(@"C:\Workspace\ConfigStarter\Output.json"));
58
59      app.Run(arguments.ToArray());
60     
61    }
62
63    private static void ActivateJsonItems(IJsonItem item) {
64      foreach (var x in item) {
65        x.Active = true;
66        if (x is ValueLookupJsonItem i) {
67          i.Active = true;
68        }
69        /*
70        if(x.Name == "Dataset" && x is DoubleMatrixJsonItem mat) {
71          mat.Value = new double[5][];
72          mat.RowNames = new string[] { "R1", "R2", "R3" };
73          for(int j = 0; j < 5; ++j) {
74            mat.Value[j] = new double[10];
75          }
76        }*/
77      }
78    }
79  }
80}
Note: See TracBrowser for help on using the repository browser.