[17371] | 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;
|
---|
[17374] | 14 | using HeuristicLab.SequentialEngine;
|
---|
| 15 | using System.Threading;
|
---|
[17371] | 16 |
|
---|
| 17 | namespace Heuristiclab.ConfigStarter {
|
---|
| 18 | public class Program {
|
---|
[17374] | 19 |
|
---|
[17371] | 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 |
|
---|
[17519] | 32 |
|
---|
[17371] | 33 | HeuristicLabJsonInterfaceAppApplication app = new HeuristicLabJsonInterfaceAppApplication();
|
---|
| 34 |
|
---|
| 35 | GeneticAlgorithm alg = new GeneticAlgorithm();
|
---|
[17374] | 36 | alg.MaximumGenerations.Value = 10000;
|
---|
[17371] | 37 | TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
|
---|
| 38 | tsp.Coordinates[0, 0] = 123;
|
---|
| 39 |
|
---|
| 40 |
|
---|
[17374] | 41 |
|
---|
[17371] | 42 | SymbolicRegressionSingleObjectiveProblem prop = new SymbolicRegressionSingleObjectiveProblem();
|
---|
| 43 |
|
---|
[17451] | 44 | alg.Problem = prop;
|
---|
[17371] | 45 |
|
---|
[17451] | 46 | IJsonItem root = JsonItemConverter.Extract(alg);
|
---|
[17473] | 47 | ActivateJsonItems(root);
|
---|
[17451] | 48 |
|
---|
[17439] | 49 |
|
---|
[17519] | 50 | JCGenerator.GenerateTemplate(@"C:\Workspace\ConfigStarter\", "Template", alg, root);
|
---|
| 51 |
|
---|
| 52 |
|
---|
[17371] | 53 | List<ICommandLineArgument> arguments = new List<ICommandLineArgument>();
|
---|
| 54 | arguments.Add(new StartArgument("JsonInterface"));
|
---|
[17519] | 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"));
|
---|
[17371] | 58 |
|
---|
| 59 | app.Run(arguments.ToArray());
|
---|
[17439] | 60 |
|
---|
[17371] | 61 | }
|
---|
[17473] | 62 |
|
---|
| 63 | private static void ActivateJsonItems(IJsonItem item) {
|
---|
[17477] | 64 | foreach (var x in item) {
|
---|
| 65 | x.Active = true;
|
---|
| 66 | if (x is ValueLookupJsonItem i) {
|
---|
| 67 | i.Active = true;
|
---|
| 68 | }
|
---|
[17519] | 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 | }*/
|
---|
[17473] | 77 | }
|
---|
| 78 | }
|
---|
[17371] | 79 | }
|
---|
| 80 | }
|
---|