1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.PluginInfrastructure;
|
---|
7 | using HeuristicLab.JsonInterface.App;
|
---|
8 | using HeuristicLab.Algorithms.GeneticAlgorithm;
|
---|
9 | using HeuristicLab.Problems.TravelingSalesman;
|
---|
10 | using HeuristicLab.JsonInterface;
|
---|
11 | using System.IO;
|
---|
12 | using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
|
---|
13 | using HeuristicLab.PluginInfrastructure.Manager;
|
---|
14 | using HeuristicLab.SequentialEngine;
|
---|
15 | using System.Threading;
|
---|
16 |
|
---|
17 | namespace 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 | }
|
---|