Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17324


Ignore:
Timestamp:
10/08/19 18:32:26 (5 years ago)
Author:
dpiringe
Message:

#3026

  • added new project HeuristicLab.JsonInterface.App -> takes two arguments (template and config) to create an IOptimizer-Item, starts the run and writes the results to a file (currently hardcoded: C:\Workspace\test.txt)
  • made HeuristicLab.JsonInterface and HeuristicLab.JsonInterface.App to valid plugins
  • fixed a reference resolving bug with not-changeable parameters
Location:
branches/3026_IntegrationIntoSymSpace
Files:
6 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab 3.3.sln

    r17284 r17324  
    475475EndProject
    476476Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.JsonInterface", "HeuristicLab.JsonInterface\HeuristicLab.JsonInterface.csproj", "{0E3AAB5E-F152-44E0-A054-4D9A83ECEE08}"
     477EndProject
     478Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.JsonInterface.App", "HeuristicLab.JsonInterface.App\HeuristicLab.JsonInterface.App.csproj", "{039D995F-1AA5-4461-92B3-B466F612D998}"
    477479EndProject
    478480Global
     
    23182320    {0E3AAB5E-F152-44E0-A054-4D9A83ECEE08}.Release|x86.ActiveCfg = Release|Any CPU
    23192321    {0E3AAB5E-F152-44E0-A054-4D9A83ECEE08}.Release|x86.Build.0 = Release|Any CPU
     2322    {039D995F-1AA5-4461-92B3-B466F612D998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     2323    {039D995F-1AA5-4461-92B3-B466F612D998}.Debug|Any CPU.Build.0 = Debug|Any CPU
     2324    {039D995F-1AA5-4461-92B3-B466F612D998}.Debug|x64.ActiveCfg = Debug|Any CPU
     2325    {039D995F-1AA5-4461-92B3-B466F612D998}.Debug|x64.Build.0 = Debug|Any CPU
     2326    {039D995F-1AA5-4461-92B3-B466F612D998}.Debug|x86.ActiveCfg = Debug|Any CPU
     2327    {039D995F-1AA5-4461-92B3-B466F612D998}.Debug|x86.Build.0 = Debug|Any CPU
     2328    {039D995F-1AA5-4461-92B3-B466F612D998}.Release|Any CPU.ActiveCfg = Release|Any CPU
     2329    {039D995F-1AA5-4461-92B3-B466F612D998}.Release|Any CPU.Build.0 = Release|Any CPU
     2330    {039D995F-1AA5-4461-92B3-B466F612D998}.Release|x64.ActiveCfg = Release|Any CPU
     2331    {039D995F-1AA5-4461-92B3-B466F612D998}.Release|x64.Build.0 = Release|Any CPU
     2332    {039D995F-1AA5-4461-92B3-B466F612D998}.Release|x86.ActiveCfg = Release|Any CPU
     2333    {039D995F-1AA5-4461-92B3-B466F612D998}.Release|x86.Build.0 = Release|Any CPU
    23202334  EndGlobalSection
    23212335  GlobalSection(SolutionProperties) = preSolution
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj

    r17322 r17324  
    1111    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    1212    <FileAlignment>512</FileAlignment>
    13     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     13    <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
    1414    <Deterministic>true</Deterministic>
    1515    <TargetFrameworkProfile />
     
    8181    <Compile Include="Converters\ValueTypeMatrixConverter.cs" />
    8282    <Compile Include="Converters\ValueTypeValueConverter.cs" />
     83    <Compile Include="Plugin.cs" />
    8384    <Compile Include="Properties\AssemblyInfo.cs" />
    8485    <Compile Include="JsonItem.cs" />
     
    8990    <None Include="HeuristicLab.snk" />
    9091    <None Include="packages.config" />
     92    <None Include="Plugin.cs.frame" />
    9193  </ItemGroup>
    9294  <ItemGroup>
    93     <ProjectReference Include="..\HeuristicLab.Algorithms.ALPS\3.3\HeuristicLab.Algorithms.ALPS-3.3.csproj">
    94       <Project>{59f354cb-fe13-4253-aed2-ad86372bec27}</Project>
    95       <Name>HeuristicLab.Algorithms.ALPS-3.3</Name>
    96     </ProjectReference>
    97     <ProjectReference Include="..\HeuristicLab.Algorithms.Benchmarks\3.3\HeuristicLab.Algorithms.Benchmarks-3.3.csproj">
    98       <Project>{068c70a7-8caf-4ab6-8721-4564d62292bc}</Project>
    99       <Name>HeuristicLab.Algorithms.Benchmarks-3.3</Name>
    100     </ProjectReference>
    101     <ProjectReference Include="..\HeuristicLab.Algorithms.CMAEvolutionStrategy\3.4\HeuristicLab.Algorithms.CMAEvolutionStrategy-3.4.csproj">
    102       <Project>{291010e4-2f4e-4d29-a795-753cff293fdb}</Project>
    103       <Name>HeuristicLab.Algorithms.CMAEvolutionStrategy-3.4</Name>
    104     </ProjectReference>
    105     <ProjectReference Include="..\HeuristicLab.Algorithms.DataAnalysis.DecisionTrees\3.4\HeuristicLab.Algorithms.DataAnalysis.DecisionTrees-3.4.csproj">
    106       <Project>{541a53f3-e6a7-402f-91bb-d76041cdd9fd}</Project>
    107       <Name>HeuristicLab.Algorithms.DataAnalysis.DecisionTrees-3.4</Name>
    108     </ProjectReference>
    109     <ProjectReference Include="..\HeuristicLab.Algorithms.DataAnalysis.Glmnet\3.4\HeuristicLab.Algorithms.DataAnalysis.Glmnet-3.4.csproj">
    110       <Project>{4c7f6d8a-b279-4898-acd6-7be39111def9}</Project>
    111       <Name>HeuristicLab.Algorithms.DataAnalysis.Glmnet-3.4</Name>
    112     </ProjectReference>
    113     <ProjectReference Include="..\HeuristicLab.Algorithms.EvolutionStrategy\3.3\HeuristicLab.Algorithms.EvolutionStrategy-3.3.csproj">
    114       <Project>{e0b45023-cb84-48a1-a1b7-8295b64b7bad}</Project>
    115       <Name>HeuristicLab.Algorithms.EvolutionStrategy-3.3</Name>
    116     </ProjectReference>
    117     <ProjectReference Include="..\HeuristicLab.Algorithms.GeneticAlgorithm\3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.csproj">
    118       <Project>{a51da44f-cb35-4f6f-99f5-2a2e904ab93b}</Project>
    119       <Name>HeuristicLab.Algorithms.GeneticAlgorithm-3.3</Name>
    120     </ProjectReference>
    121     <ProjectReference Include="..\HeuristicLab.Algorithms.GradientDescent\3.3\HeuristicLab.Algorithms.GradientDescent-3.3.csproj">
    122       <Project>{1256b945-eea9-4be4-9880-76b5b113f089}</Project>
    123       <Name>HeuristicLab.Algorithms.GradientDescent-3.3</Name>
    124     </ProjectReference>
    125     <ProjectReference Include="..\HeuristicLab.Algorithms.LocalSearch\3.3\HeuristicLab.Algorithms.LocalSearch-3.3.csproj">
    126       <Project>{4ae3fc69-c575-42d2-bc46-0fad5850efc5}</Project>
    127       <Name>HeuristicLab.Algorithms.LocalSearch-3.3</Name>
    128     </ProjectReference>
    129     <ProjectReference Include="..\HeuristicLab.Algorithms.MOCMAEvolutionStrategy\3.3\HeuristicLab.Algorithms.MOCMAEvolutionStrategy-3.3.csproj">
    130       <Project>{0e2e224f-e9b2-41f3-b510-09183eeba2af}</Project>
    131       <Name>HeuristicLab.Algorithms.MOCMAEvolutionStrategy-3.3</Name>
    132     </ProjectReference>
    133     <ProjectReference Include="..\HeuristicLab.Algorithms.NSGA2\3.3\HeuristicLab.Algorithms.NSGA2-3.3.csproj">
    134       <Project>{15452b9f-a436-4139-8ee7-da72fb8d3664}</Project>
    135       <Name>HeuristicLab.Algorithms.NSGA2-3.3</Name>
    136     </ProjectReference>
    137     <ProjectReference Include="..\HeuristicLab.Algorithms.OffspringSelectionEvolutionStrategy\3.3\HeuristicLab.Algorithms.OffspringSelectionEvolutionStrategy-3.3.csproj">
    138       <Project>{1d41eae6-cc79-41d4-858c-589c4db5e50d}</Project>
    139       <Name>HeuristicLab.Algorithms.OffspringSelectionEvolutionStrategy-3.3</Name>
    140     </ProjectReference>
    141     <ProjectReference Include="..\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm\3.3\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.csproj">
    142       <Project>{f409dd9e-1e9c-4eb1-aa3a-9f6e987c6e58}</Project>
    143       <Name>HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3</Name>
    144     </ProjectReference>
    145     <ProjectReference Include="..\HeuristicLab.Algorithms.ParameterlessPopulationPyramid\3.3\HeuristicLab.Algorithms.ParameterlessPopulationPyramid-3.3.csproj">
    146       <Project>{9319c447-8183-4dbc-8145-0e3cf98084cc}</Project>
    147       <Name>HeuristicLab.Algorithms.ParameterlessPopulationPyramid-3.3</Name>
    148     </ProjectReference>
    149     <ProjectReference Include="..\HeuristicLab.Algorithms.ParticleSwarmOptimization\3.3\HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.csproj">
    150       <Project>{2c429157-9c34-4dd3-9d5f-b444b751e39a}</Project>
    151       <Name>HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3</Name>
    152     </ProjectReference>
    153     <ProjectReference Include="..\HeuristicLab.Algorithms.RandomSearch\3.3\HeuristicLab.Algorithms.RandomSearch-3.3.csproj">
    154       <Project>{4a15dc1a-51ee-4cb7-ac05-f5afddece1b1}</Project>
    155       <Name>HeuristicLab.Algorithms.RandomSearch-3.3</Name>
    156     </ProjectReference>
    157     <ProjectReference Include="..\HeuristicLab.Algorithms.RAPGA\3.3\HeuristicLab.Algorithms.RAPGA-3.3.csproj">
    158       <Project>{b03c4e41-1d01-4c60-b0f4-dbb257d98ca8}</Project>
    159       <Name>HeuristicLab.Algorithms.RAPGA-3.3</Name>
    160     </ProjectReference>
    161     <ProjectReference Include="..\HeuristicLab.Algorithms.ScatterSearch\3.3\HeuristicLab.Algorithms.ScatterSearch-3.3.csproj">
    162       <Project>{5fee5db4-7fd9-4cbd-bec2-3fee17b31a94}</Project>
    163       <Name>HeuristicLab.Algorithms.ScatterSearch-3.3</Name>
    164     </ProjectReference>
    165     <ProjectReference Include="..\HeuristicLab.Algorithms.SimulatedAnnealing\3.3\HeuristicLab.Algorithms.SimulatedAnnealing-3.3.csproj">
    166       <Project>{96e5ed5b-187d-4012-9cda-d85cdad38342}</Project>
    167       <Name>HeuristicLab.Algorithms.SimulatedAnnealing-3.3</Name>
    168     </ProjectReference>
    169     <ProjectReference Include="..\HeuristicLab.Algorithms.TabuSearch\3.3\HeuristicLab.Algorithms.TabuSearch-3.3.csproj">
    170       <Project>{d58a232d-04ba-4186-b73e-0ec86fd31abe}</Project>
    171       <Name>HeuristicLab.Algorithms.TabuSearch-3.3</Name>
    172     </ProjectReference>
    173     <ProjectReference Include="..\HeuristicLab.Algorithms.VariableNeighborhoodSearch\3.3\HeuristicLab.Algorithms.VariableNeighborhoodSearch-3.3.csproj">
    174       <Project>{e4cfb0c3-0589-4893-b38e-8bedf885c765}</Project>
    175       <Name>HeuristicLab.Algorithms.VariableNeighborhoodSearch-3.3</Name>
    176     </ProjectReference>
    177     <ProjectReference Include="..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
    178       <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
    179       <Name>HeuristicLab.Analysis-3.3</Name>
    180     </ProjectReference>
    18195    <ProjectReference Include="..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    182       <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
     96      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
    18397      <Name>HeuristicLab.Collections-3.3</Name>
    18498    </ProjectReference>
    18599    <ProjectReference Include="..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    186       <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
     100      <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project>
    187101      <Name>HeuristicLab.Common-3.3</Name>
    188102    </ProjectReference>
    189103    <ProjectReference Include="..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    190       <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
     104      <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project>
    191105      <Name>HeuristicLab.Core-3.3</Name>
    192106    </ProjectReference>
     
    195109      <Name>HeuristicLab.Data-3.3</Name>
    196110    </ProjectReference>
    197     <ProjectReference Include="..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj">
    198       <Project>{DBECB8B0-B166-4133-BAF1-ED67C3FD7FCA}</Project>
    199       <Name>HeuristicLab.Encodings.PermutationEncoding-3.3</Name>
    200     </ProjectReference>
    201     <ProjectReference Include="..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    202       <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
    203       <Name>HeuristicLab.Operators-3.3</Name>
    204     </ProjectReference>
    205111    <ProjectReference Include="..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    206       <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     112      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
    207113      <Name>HeuristicLab.Optimization-3.3</Name>
    208114    </ProjectReference>
     
    215121      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    216122    </ProjectReference>
    217     <ProjectReference Include="..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
    218       <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
    219       <Name>HeuristicLab.Problems.Instances-3.3</Name>
    220     </ProjectReference>
    221     <ProjectReference Include="..\HeuristicLab.Problems.Knapsack\3.3\HeuristicLab.Problems.Knapsack-3.3.csproj">
    222       <Project>{E10F395F-C8A6-48AD-B470-9AA7A1F43809}</Project>
    223       <Name>HeuristicLab.Problems.Knapsack-3.3</Name>
    224     </ProjectReference>
    225     <ProjectReference Include="..\HeuristicLab.Problems.TravelingSalesman\3.3\HeuristicLab.Problems.TravelingSalesman-3.3.csproj">
    226       <Project>{d767c38d-8014-46b0-9a32-03a3aecce34a}</Project>
    227       <Name>HeuristicLab.Problems.TravelingSalesman-3.3</Name>
    228     </ProjectReference>
    229     <ProjectReference Include="..\HeuristicLab.Problems.VehicleRouting\3.4\HeuristicLab.Problems.VehicleRouting-3.4.csproj">
    230       <Project>{B94FFB82-43D4-40AB-9980-B03470ADF221}</Project>
    231       <Name>HeuristicLab.Problems.VehicleRouting-3.4</Name>
    232     </ProjectReference>
    233123    <ProjectReference Include="..\HeuristicLab.SequentialEngine\3.3\HeuristicLab.SequentialEngine-3.3.csproj">
    234       <Project>{dc3d7072-7999-4719-b65d-3997744d5dc1}</Project>
     124      <Project>{DC3D7072-7999-4719-B65D-3997744D5DC1}</Project>
    235125      <Name>HeuristicLab.SequentialEngine-3.3</Name>
    236126    </ProjectReference>
     
    238128  <ItemGroup />
    239129  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     130  <PropertyGroup>
     131    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     132set ProjectDir=$(ProjectDir)
     133set SolutionDir=$(SolutionDir)
     134set Outdir=$(Outdir)
     135
     136call PreBuildEvent.cmd
     137
     138</PreBuildEvent>
     139  </PropertyGroup>
    240140</Project>
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs

    r17322 r17324  
    22using System.Collections.Generic;
    33using System.Linq;
    4 using HeuristicLab.Algorithms.GeneticAlgorithm;
    54using HeuristicLab.Core;
    65using HeuristicLab.Data;
    7 using HeuristicLab.Encodings.PermutationEncoding;
    86using HeuristicLab.Optimization;
    9 using HeuristicLab.Problems.TravelingSalesman;
    107using Newtonsoft.Json;
    118using Newtonsoft.Json.Linq;
    12 using Newtonsoft.Json.Serialization;
    139
    1410namespace HeuristicLab.JsonInterface {
     
    1612
    1713    private JObject template = JObject.Parse(Constants.Template);
     14    private Dictionary<string, string> TypeList = new Dictionary<string, string>();
     15    private JArray JsonItems { get; set; } = new JArray();
    1816
    19     private Dictionary<string, string> TypeList = new Dictionary<string, string>();
    20 
    21     JArray jsonItems = new JArray();
    2217    private void PopulateJsonItems(JsonItem item) {
    2318      if (item.Parameters != null) {
    2419        if(item.Range == null)
    25           jsonItems.Add(Serialize(item));
     20          JsonItems.Add(Serialize(item));
    2621        foreach (var p in item.Parameters)
    2722          if(p.Parameters != null)
     
    4742
    4843    public string GenerateTemplate(IAlgorithm algorithm, IProblem problem, params string[] freeParameters) {
     44      JsonItems.Clear();
     45      TypeList.Clear();
     46
    4947      algorithm.Problem = problem;
    5048      JsonItem algorithmData = JsonItemConverter.Extract(algorithm);
     
    5553      template[Constants.Metadata][Constants.Algorithm] = algorithm.Name;
    5654      template[Constants.Metadata][Constants.Problem] = problem.Name;
    57       template[Constants.Objects] = jsonItems;
     55      template[Constants.Objects] = JsonItems;
    5856      template[Constants.Types] = JObject.FromObject(TypeList);
    5957
     
    6361    #region Helper
    6462    private void RefactorFreeParameters(JToken token, string[] freeParameters) {
    65 
    66 
    6763      IList<JObject> objToRemove = new List<JObject>();
    6864      TransformNodes(x => {
     
    7773          objToRemove.Add(x);
    7874        } else {
    79           //x.Property(nameof(JsonItem.Path))?.Remove();
    8075          x.Property(nameof(JsonItem.Type))?.Remove();
    8176          x.Property(nameof(JsonItem.Parameters))?.Remove();
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCInstantiator.cs

    r17322 r17324  
    1010using HeuristicLab.Data;
    1111using HeuristicLab.Optimization;
     12using HeuristicLab.SequentialEngine;
    1213using Newtonsoft.Json.Linq;
    1314
     
    4950      //7. get problem data and object
    5051      JsonItem problemData = GetData(problemName);
     52     
    5153      IProblem problem = CreateObject<IProblem>(problemData);
    5254      algorithm.Problem = problem;
     
    5456      //8. inject configuration
    5557      JsonItemConverter.Inject(algorithm, algorithmData);
    56       JsonItemConverter.Inject(problem, problemData);
     58      //JsonItemConverter.Inject(problem, problemData);
     59
     60      if (algorithm is EngineAlgorithm) {
     61        algorithm.Cast<EngineAlgorithm>().Engine = new SequentialEngine.SequentialEngine();
     62        File.WriteAllText(@"C:\Workspace\test2.txt", "test");
     63      }
    5764
    5865      return algorithm;
     
    8693        foreach (var p in x.Parameters)
    8794          if (p.Default is string) {
    88             string key = $"{p.Path}.{p.Default.Cast<string>()}";
     95            string key = p.Path;
     96            if (p.Range != null)
     97              key = $"{p.Path}.{p.Default.Cast<string>()}";
     98
    8999            if (ParameterizedItems.TryGetValue(key, out JsonItem value))
    90100              p.Reference = value;
     
    171181    private IList<JsonItem> PopulateOperators(JObject obj) {
    172182      IList<JsonItem> list = new List<JsonItem>();
    173       JToken operators = obj[nameof(Operators)];
     183      JToken operators = obj[nameof(JsonItem.Operators)];
    174184      if (operators != null)
    175185        foreach (JObject sp in operators)
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItem.cs

    r17322 r17324  
    1515    public string Name { get; set; }
    1616    public string Type { get; set; }
    17     public string Path { get; set; } = "";
     17    public string Path { get; set; }
    1818    public IList<JsonItem> Parameters { get; set; }
    1919    public IList<JsonItem> Operators { get; set; }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.Tests/HeuristicLab.JsonInterface/GeneratorInstantiatorTest.cs

    r17323 r17324  
    2121      TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
    2222      JCGenerator gen = new JCGenerator();
     23      //File.WriteAllText(@"C:\Workspace\Template.json", gen.GenerateTemplate(alg, tsp));
    2324      File.WriteAllText(templateFilePath, gen.GenerateTemplate(alg, tsp));
    2425      File.WriteAllText(configFilePath, "["+
Note: See TracChangeset for help on using the changeset viewer.