Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3026:

  • deleted: ConvertableAttribute, DummyConverter, ObjectExtensions
  • renamed: CustomJsonWriter -> SingleLineArrayJsonWriter, JCInstantiator -> JsonTemplateInstantiator
  • added: JsonItemConverterFactory, UnsupportedJsonItem
  • IJsonItemConverter:
    • added two new properties: Priority and ConvertableType -> because converters are automatically collected by plugin infrastructure now
    • Extract, Inject references a root converter now -> typically an instance of JsonItemConverter -> to prevent cycles
  • JsonItemConverter:
    • now implements the interface IJsonItemConverter
    • is now a dynamic class
    • is only instantiable with an factory (JsonItemConverterFactory)
    • still has the old (but now public) static methods Extract and Inject (without ref param IJsonItemConverter root) -> creates instance with factory and calls methods of instance
    • removed register and unregister methods, because the factory collects all converters automatically now (on first call of Create)
    • has cycle detection for Extract and Inject
    • renamed method Get to GetConverter
File size: 1.9 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 = tsp;
46
47      File.WriteAllText(@"C:\Workspace\Template.json", JCGenerator.GenerateTemplate(alg));
48      JsonTemplateInstantiator.Instantiate(@"C:\Workspace\Template.json");
49      /*
50      List<ICommandLineArgument> arguments = new List<ICommandLineArgument>();
51      arguments.Add(new StartArgument("JsonInterface"));
52      arguments.Add(new OpenArgument(@"C:\Workspace\Template.json"));
53      arguments.Add(new OpenArgument(@"C:\Workspace\ConfigProto1.json"));
54
55      app.Run(arguments.ToArray());
56      */
57    }
58  }
59}
Note: See TracBrowser for help on using the repository browser.