Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/06/19 14:39:00 (4 years ago)
Author:
dpiringe
Message:

#3026:

  • extended the BaseConverter class to set the type of the extracted value and removed the assignment of type in all other converters
  • fixed a bug in ConfigurableConverter -> now it correctly iterates through all items from an IEnumerable and calls the extract callback
  • MultiCheckedOperatorConverter:
    • deleted unnecessary code line
    • now adds operators to parameters (instead of operator list, because the operator list will get removed in a future commit)
    • does not set the path of its added items anymore
  • ParameterBaseConverter removed unnecessary code lines
  • deleted ParameterBaseConverter
  • reimplemented StorableConverter to test it again (still not really useable, because it bloats the template massively)
  • fixed a pathing bug in ValueParameterConverter (extended ValueRangeConverter, ValueTypeArrayConverter, ValueTypeMatrixConverter, ValueTypeValueConverter to archive this)
  • JCGenerator now only writes a single array with parameters (only FreeParameters) and saves a .hl File to test a new type of implementation of the whole JsonInterface
  • fixed a bug in JsonItem -> now it replaces the name in path of the item (not the whole path as it was before)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/Heuristiclab.ConfigStarter/Program.cs

    r17371 r17374  
    1212using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    1313using HeuristicLab.PluginInfrastructure.Manager;
     14using HeuristicLab.SequentialEngine;
     15using System.Threading;
    1416
    1517namespace Heuristiclab.ConfigStarter {
    1618  public class Program {
     19
     20    private static string Reduce(string str) =>
     21      str
     22      .Replace(" ", "")
     23      .Replace("-", "")
     24      .Replace("`", "")
     25      .Replace(".", "")
     26      .Replace("<", "")
     27      .Replace(">", "")
     28      .Replace("(", "_")
     29      .Replace(")", "_");
     30
     31    private static void Visualize(JsonItem item, StringBuilder sb) {
     32      sb.Append($"  {item.GetHashCode()} [label=\"{item.Name}\"];\n");
     33      foreach (var i in item.Parameters) {
     34        sb.Append($"  {item.GetHashCode()} -> {i.GetHashCode()};\n");
     35      }
     36      foreach(var i in item.Parameters) {
     37        Visualize(i, sb);
     38      }
     39    }
     40
    1741    public static void Main(string[] args) {
    1842
     
    3256
    3357      GeneticAlgorithm alg = new GeneticAlgorithm();
     58      alg.MaximumGenerations.Value = 10000;
    3459      TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
    3560      tsp.Coordinates[0, 0] = 123;
     61
    3662
    3763
     
    4066      alg.Problem = prop;
    4167
     68      alg.Engine = new SequentialEngine();
     69      Task t = alg.StartAsync();
     70      Thread.Sleep(1000);
     71      alg.Stop();
     72
     73      StorableConverter storableConverter = new StorableConverter();
     74      JsonItem item = storableConverter.Extract(alg);
     75
     76      StringBuilder sb = new StringBuilder();
     77
     78      //Visualize(item, sb);
     79
     80      //File.WriteAllText(@"C:\Workspace\item.gv", $"digraph G {{\n{sb.ToString()}}}");
     81
     82
     83      //Console.WriteLine(alg);
    4284      File.WriteAllText(@"C:\Workspace\Template.json", JCGenerator.GenerateTemplate(alg));
    4385
Note: See TracChangeset for help on using the changeset viewer.