Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3026

  • removed the option to set the value for JsonItems via exporter
    • reworked some base controls
    • added new controls for JsonItem specific properties (e.g. ArrayResizable)
    • deleted a lot of obsolet controls
  • removed the Enable checkbox in the detail view of JsonItems
  • exporter now clones the IOptimizer object
  • added a check + message for unsupported exports
  • list of JsonItems now includes unsupported JsonItems (disabled and marked with 'unsupported')
  • refactored the converter type check
    • now every converter has to specify its supported type(s)
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.