Changeset 17353


Ignore:
Timestamp:
11/19/19 16:33:01 (2 weeks ago)
Author:
dpiringe
Message:

#3026:

  • relocated GetMaxValue and GetMinValue from ValueTypeValueConverter into BaseConverter
  • fixed a bug in ConstrainedValueParameterConverter (from GetType().Name to ToString())
  • printing now PrettyNames for types
  • added comments
  • added StorableConverter.cs (not finished, maybe not a good converter)
  • added ValueRangeConverter.cs for DoubleRange and IntRange
  • added ParameterConverter.cs for default parameter conversion
Location:
branches/3026_IntegrationIntoSymSpace
Files:
3 added
16 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Constants.cs

    r17330 r17353  
    66
    77namespace HeuristicLab.JsonInterface {
     8  /// <summary>
     9  /// Constants for reading/writing templates.
     10  /// </summary>
    811  internal class Constants {
    912
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/BaseConverter.cs

    r17284 r17353  
    55using System.Threading.Tasks;
    66using HeuristicLab.Core;
     7using HeuristicLab.Data;
    78using Newtonsoft.Json.Linq;
    89
     
    1011  public abstract class BaseConverter : IJsonItemConverter
    1112  {
     13    public void Inject(IItem item, JsonItem data) {
     14      if (data.Reference != null) {
     15        JsonItem.Merge(data, data.Reference);
     16      }
     17      InjectData(item, data);
     18    }
     19
    1220    public JsonItem Extract(IItem value) {
    1321      JsonItem data = ExtractData(value);
     
    1523      return data;
    1624    }
    17 
    18     public void Inject(IItem item, JsonItem data) {
    19       if(data.Reference != null) {
    20         JsonItem.Merge(data, data.Reference);
    21       }
    22       InjectData(item, data);
    23     }
    24 
     25   
    2526    public abstract void InjectData(IItem item, JsonItem data);
    2627    public abstract JsonItem ExtractData(IItem value);
     
    3839      (IItem)Activator.CreateInstance(type,args);
    3940
    40     protected IItem Instantiate<T>(params object[] args) => Instantiate(typeof(T), args);
     41    protected T Instantiate<T>(params object[] args) => (T)Instantiate(typeof(T), args);
     42
     43    protected object GetMaxValue(Type t) {
     44      TypeCode typeCode = Type.GetTypeCode(t);
     45
     46      if (typeof(ValueType).IsEqualTo(typeof(PercentValue)))
     47        return 1.0d;
     48
     49      switch (typeCode) {
     50        case TypeCode.Int16: return Int16.MaxValue;
     51        case TypeCode.Int32: return Int32.MaxValue;
     52        case TypeCode.Int64: return Int64.MaxValue;
     53        case TypeCode.UInt16: return UInt16.MaxValue;
     54        case TypeCode.UInt32: return UInt32.MaxValue;
     55        case TypeCode.UInt64: return UInt64.MaxValue;
     56        case TypeCode.Single: return Single.MaxValue;
     57        case TypeCode.Double: return Double.MaxValue;
     58        case TypeCode.Decimal: return Decimal.MaxValue;
     59        case TypeCode.Byte: return Byte.MaxValue;
     60        case TypeCode.Boolean: return true;
     61        default: return GetDefaultValue(t);
     62      }
     63    }
     64
     65    protected object GetMinValue(Type t) {
     66      TypeCode typeCode = Type.GetTypeCode(t);
     67
     68      if (typeof(ValueType).IsEqualTo(typeof(PercentValue)))
     69        return 0.0d;
     70
     71      switch (typeCode) {
     72        case TypeCode.Int16: return Int16.MinValue;
     73        case TypeCode.Int32: return Int32.MinValue;
     74        case TypeCode.Int64: return Int64.MinValue;
     75        case TypeCode.UInt16: return UInt16.MinValue;
     76        case TypeCode.UInt32: return UInt32.MinValue;
     77        case TypeCode.UInt64: return UInt64.MinValue;
     78        case TypeCode.Single: return Single.MinValue;
     79        case TypeCode.Double: return Double.MinValue;
     80        case TypeCode.Decimal: return Decimal.MinValue;
     81        case TypeCode.Byte: return Byte.MinValue;
     82        case TypeCode.Boolean: return false;
     83        default: return GetDefaultValue(t);
     84      }
     85    }
     86
     87    protected object GetDefaultValue(Type t) => t.IsValueType ? Activator.CreateInstance(t) : null;
    4188    #endregion
    4289  }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ConstrainedValueParameterConverter.cs

    r17342 r17353  
    44using System.Text;
    55using System.Threading.Tasks;
     6using HeuristicLab.Common;
    67using HeuristicLab.Core;
    78
     
    910  public class ConstrainedValueParameterConverter : ParameterBaseConverter {
    1011    public override void InjectData(IParameter parameter, JsonItem data) {
    11       foreach (var x in parameter.Cast<dynamic>().ValidValues)
    12         if (x.GetType().Name == CastValue<string>(data.Value))
     12      foreach(var x in GetValidValues(parameter))
     13        if(x.ToString() == CastValue<string>(data.Value))
    1314          parameter.ActualValue = x;
    1415
     
    2021      new JsonItem() {
    2122        Name = value.Name,
    22         Value = value.ActualValue?.GetType().Name,
    23         Range = GetValidValues(value),
     23        Value = value.ActualValue?.ToString(),
     24        Range = GetValidValues(value).Select(x => x.ToString()),
    2425        Parameters = GetParameterizedChilds(value)
    2526      };
    2627
    2728    #region Helper
    28     private object[] GetValidValues(IParameter value) {
    29       List<object> list = new List<object>();
     29    private IItem[] GetValidValues(IParameter value) {
     30      List<IItem> list = new List<IItem>();
    3031      var values = value.Cast<dynamic>().ValidValues;
    31       foreach (var x in values) list.Add(x.GetType().Name);
     32      foreach (var x in values) list.Add((IItem)x);
    3233      return list.ToArray();
    3334    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/DummyConverter.cs

    r17342 r17353  
    44using System.Text;
    55using System.Threading.Tasks;
     6using HeuristicLab.Common;
    67using HeuristicLab.Core;
    78
     
    1415
    1516    public override JsonItem ExtractData(IItem value) =>
    16       new JsonItem() { Value = value.GetType().Name };
     17      new JsonItem() { Value = value.GetType().GetPrettyName(false) };
    1718  }
    1819}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/MultiCheckedOperatorConverter.cs

    r17342 r17353  
    44using System.Text;
    55using System.Threading.Tasks;
     6using HeuristicLab.Common;
    67using HeuristicLab.Core;
    78
     
    1112      JsonItem data = base.ExtractData(value);
    1213
    13       data.Value = value.GetType().Name;
     14      data.Value = value.GetType().GetPrettyName(false);
    1415      data.Operators = new List<JsonItem>();
    1516      dynamic val = value.Cast<dynamic>();
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueLookupParameterConverter.cs

    r17342 r17353  
    1111      IValueLookupParameter param = value.Cast<IValueLookupParameter>();
    1212      object actualValue = null;
    13       IList<object> actualRange = null;
     13      IEnumerable<object> actualRange = null;
    1414      if(param.Value != null) {
    1515        JsonItem tmp = JsonItemConverter.Extract(param.Value);
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeValueConverter.cs

    r17342 r17353  
    1818      new JsonItem() {
    1919        Value = value.Cast<ValueType>().Value,
    20         Range = new object[] { GetMinValue(), GetMaxValue() }
     20        Range = new object[] { GetMinValue(typeof(T)), GetMaxValue(typeof(T)) }
    2121      };
    22 
    23     #region Helper
    24     private object GetMaxValue() {
    25       TypeCode typeCode = Type.GetTypeCode(typeof(T));
    26 
    27       if (typeof(ValueType).IsEqualTo(typeof(PercentValue)))
    28         return 1.0d;
    29 
    30       switch (typeCode) {
    31         case TypeCode.Int16: return Int16.MaxValue;
    32         case TypeCode.Int32: return Int32.MaxValue;
    33         case TypeCode.Int64: return Int64.MaxValue;
    34         case TypeCode.UInt16: return UInt16.MaxValue;
    35         case TypeCode.UInt32: return UInt32.MaxValue;
    36         case TypeCode.UInt64: return UInt64.MaxValue;
    37         case TypeCode.Single: return Single.MaxValue;
    38         case TypeCode.Double: return Double.MaxValue;
    39         case TypeCode.Decimal: return Decimal.MaxValue;
    40         case TypeCode.Byte: return Byte.MaxValue;
    41         case TypeCode.Boolean: return true;
    42         default: return default(T);
    43       }
    44     }
    45 
    46     private object GetMinValue() {
    47       TypeCode typeCode = Type.GetTypeCode(typeof(T));
    48 
    49       if (typeof(ValueType).IsEqualTo(typeof(PercentValue)))
    50         return 0.0d;
    51 
    52       switch (typeCode) {
    53         case TypeCode.Int16: return Int16.MinValue;
    54         case TypeCode.Int32: return Int32.MinValue;
    55         case TypeCode.Int64: return Int64.MinValue;
    56         case TypeCode.UInt16: return UInt16.MinValue;
    57         case TypeCode.UInt32: return UInt32.MinValue;
    58         case TypeCode.UInt64: return UInt64.MinValue;
    59         case TypeCode.Single: return Single.MinValue;
    60         case TypeCode.Double: return Double.MinValue;
    61         case TypeCode.Decimal: return Decimal.MinValue;
    62         case TypeCode.Byte: return Byte.MinValue;
    63         case TypeCode.Boolean: return false;
    64         default: return default(T);
    65       }
    66     }
    67     #endregion
    6822  }
    6923}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/CustomJsonWriter.cs

    r17342 r17353  
    44
    55namespace HeuristicLab.JsonInterface {
     6  /// <summary>
     7  /// Custom json writer for own formatting for templates.
     8  /// It collapses arrays into a single line.
     9  /// </summary>
    610  internal class CustomJsonWriter : JsonTextWriter {
    711    private bool isRangeArray = false;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj

    r17349 r17353  
    6363    <Compile Include="Attributes\ConvertableAttribute.cs" />
    6464    <Compile Include="Constants.cs" />
     65    <Compile Include="Converters\ParameterConverter.cs" />
     66    <Compile Include="Converters\StorableConverter.cs" />
    6567    <Compile Include="Converters\ValueLookupParameterConverter.cs" />
     68    <Compile Include="Converters\ValueRangeConverter.cs" />
    6669    <Compile Include="CustomJsonWriter.cs" />
    6770    <Compile Include="Extensions\ObjectExtensions.cs" />
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Interfaces/IJsonItemConverter.cs

    r17284 r17353  
    1010  public interface IJsonItemConverter {
    1111    /// <summary>
     12    /// Injects the saved infos from the JsonItem into the IItem.
     13    /// (Sets the necessary values.)
     14    /// </summary>
     15    /// <param name="item">The IItem which get the data injected.</param>
     16    /// <param name="data">The JsonItem with the saved values.</param>
     17    void Inject(IItem item, JsonItem data);
     18
     19    /// <summary>
    1220    /// Extracts all infos out of an IItem to create a JsonItem.
    1321    /// (For template generation.)
     
    1624    /// <returns>JsonItem with infos to reinitialise the IItem.</returns>
    1725    JsonItem Extract(IItem value);
    18 
    19     /// <summary>
    20     /// Injects the saved infos from the JsonItem into the IItem.
    21     /// (Sets the necessary values.)
    22     /// </summary>
    23     /// <param name="item">The IItem which get the data injected.</param>
    24     /// <param name="data">The JsonItem with the saved values.</param>
    25     void Inject(IItem item, JsonItem data);
    2626  }
    2727}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs

    r17349 r17353  
    22using System.Collections.Generic;
    33using System.Linq;
     4using HeuristicLab.Common;
    45using HeuristicLab.Core;
    56using HeuristicLab.Data;
     
    910
    1011namespace HeuristicLab.JsonInterface {
     12  /// <summary>
     13  /// Static class to generate json interface templates.
     14  /// </summary>
    1115  public static class JCGenerator {
    12 
    1316    private struct GenData {
    1417      public JObject Template { get; set; }
     
    1619      public JArray JsonItems { get; set; }
    1720    }
    18 
    19 
     21   
    2022    public static string GenerateTemplate(IAlgorithm algorithm) {
    2123      // data container
     
    3032      // which have parameters aswell
    3133      AddInstantiableIItem(Constants.Algorithm, algorithm, genData);
    32       IsConvertable(algorithm, true);
    33       if (algorithm.Problem != null && IsConvertable(algorithm.Problem, true)) // 1.2. only when an problem exists
     34      //IsConvertable(algorithm, true);
     35      if (algorithm.Problem != null) // 1.2. only when an problem exists
    3436        AddInstantiableIItem(Constants.Problem, algorithm.Problem, genData);
    3537
     
    4345   
    4446    #region Helper
    45     private static bool IsConvertable(object obj, bool throwException) {
     47    private static bool IsConvertable(object obj, bool throwException = false) {
    4648      bool tmp = ConvertableAttribute.IsConvertable(obj);
    4749      if (throwException && tmp)
    48         throw new NotSupportedException($"Type {obj.GetType().Name} is not convertable!");
     50        throw new NotSupportedException($"Type {obj.GetType().GetPrettyName(false)} is not convertable!");
    4951      return tmp;
    5052    }
     53
    5154    private static void AddInstantiableIItem(string metaDataTagName, IItem item, GenData genData) {
    5255      JsonItem jsonItem = JsonItemConverter.Extract(item);
     
    7881      obj.Property(nameof(JsonItem.Type))?.Remove();
    7982
    80       genData.TypeList.Add(item.Path, item.Type);
     83      if(!genData.TypeList.ContainsKey(item.Path))
     84        genData.TypeList.Add(item.Path, item.Type);
    8185      return obj;
    8286    }
     
    8791      TransformNodes(x => {
    8892        var p = x.ToObject<JsonItem>();
     93        x.Property(nameof(JsonItem.Type))?.Remove();
     94        x.Property(nameof(JsonItem.Parameters))?.Remove();
     95        /*
    8996        if ((p.Value == null || (p.Value != null && p.Value.GetType() == typeof(string) && p.Range == null) && p.ActualName == null)) {
    9097          objToRemove.Add(x);
     
    9299          x.Property(nameof(JsonItem.Type))?.Remove();
    93100          x.Property(nameof(JsonItem.Parameters))?.Remove();
    94         }
     101        }*/
    95102      }, token[Constants.FreeParameters]);
    96       foreach (var x in objToRemove) x.Remove();
     103      //foreach (var x in objToRemove) x.Remove();
    97104    }
    98105
     
    109116        if (p.Value == null) objToRemove.Add(x);
    110117      }, token[Constants.StaticParameters]);
    111       foreach (var x in objToRemove) x.Remove();
     118      //foreach (var x in objToRemove) x.Remove();
    112119    }
    113120
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCInstantiator.cs

    r17349 r17353  
    1414
    1515namespace HeuristicLab.JsonInterface {
     16  /// <summary>
     17  /// Static class to instantiate an IAlgorithm object with a json interface template and config.
     18  /// </summary>
    1619  public static class JCInstantiator {
    1720    private struct InstData {
     
    2326    }
    2427
     28    /// <summary>
     29    /// Instantiate an IAlgorithm object with a template and config.
     30    /// </summary>
     31    /// <param name="templateFile">Template file (json), generated with JCGenerator.</param>
     32    /// <param name="configFile">Config file (json) for the template.</param>
     33    /// <returns>confugrated IAlgorithm object</returns>
    2534    public static IAlgorithm Instantiate(string templateFile, string configFile = "") {
    2635      InstData instData = new InstData() {
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItem.cs

    r17349 r17353  
    99
    1010namespace HeuristicLab.JsonInterface {
     11  /// <summary>
     12  /// Main data class for json interface.
     13  /// </summary>
    1114  public class JsonItem {
    1215
     
    1417    private string name;
    1518    private object value;
    16     private IList<object> range;
     19    private IEnumerable<object> range;
    1720    #endregion
    1821   
     
    2730    public string Type { get; set; }
    2831    public string Path { get; set; }
    29     public IList<JsonItem> Parameters { get; set; }
     32    public IList<JsonItem> Parameters { get; set; } // -> für flachen aufbau -> childs?
    3033    public IList<JsonItem> Operators { get; set; }
    3134    public object Value {
    3235      get => value;
    3336      set {
    34         this.value = value;
     37        if (value is JContainer)
     38          this.value = ((JContainer)value).ToObject<object[]>();
     39        else
     40          this.value = value;
    3541        CheckConstraints();
    3642      }
    3743    }
    38     public IList<object> Range {
     44    public IEnumerable<object> Range {
    3945      get => range;
    4046      set {
     
    96102    private void CheckConstraints() {
    97103      if (Range != null && Value != null && !IsInRange())
    98         throw new ArgumentOutOfRangeException("Default", "Default is not in range.");
     104        throw new ArgumentOutOfRangeException(nameof(Value), $"{nameof(Value)} is not in range.");
    99105    }
    100106
    101 
    102     private bool IsInRange() => IsInRangeList() || IsInNumericRange();
     107    private bool IsInRange() => IsInRangeList() ||
     108      (Value.GetType().IsArray && ((object[])Value).All(x => IsInNumericRange(x))) ||
     109      (!Value.GetType().IsArray && IsInNumericRange(Value));
    103110
    104111    private bool IsInRangeList() {
     
    108115    }
    109116
    110     private bool IsInNumericRange() =>
    111       IsInNumericRange<long>()
    112       || IsInNumericRange<int>()
    113       || IsInNumericRange<short>()
    114       || IsInNumericRange<byte>()
    115       || IsInNumericRange<float>()
    116       || IsInNumericRange<double>();
     117    private bool IsInNumericRange(object value) =>
     118      IsInNumericRange<long>(value)
     119      || IsInNumericRange<int>(value)
     120      || IsInNumericRange<short>(value)
     121      || IsInNumericRange<byte>(value)
     122      || IsInNumericRange<float>(value)
     123      || IsInNumericRange<double>(value);
    117124
    118     private bool IsInNumericRange<T>() where T : IComparable {
    119       object value = Value, min = Range[0], max = Range[1];
     125    private bool IsInNumericRange<T>(object value) where T : IComparable {
     126      object min = Range.First(), max = Range.Last();
    120127      return value != null && min != null && max != null && value is T && min is T && max is T &&
    121128            (((T)min).CompareTo(value) == -1 || ((T)min).CompareTo(value) == 0) &&
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverter.cs

    r17287 r17353  
    88
    99namespace HeuristicLab.JsonInterface {
     10  /// <summary>
     11  /// Static class for handling json converters.
     12  /// </summary>
    1013  public static class JsonItemConverter {
    1114
     
    1518    }
    1619
    17     private static IDictionary<Type, ConverterPriorityContainer> transformers = new Dictionary<Type, ConverterPriorityContainer>();
     20    private static IDictionary<Type, ConverterPriorityContainer> Converters { get; set; }
     21      = new Dictionary<Type, ConverterPriorityContainer>();
    1822   
     23    /// <summary>
     24    /// Register a converter for a given type and priority.
     25    /// </summary>
     26    /// <param name="type">The type for which the converter will be selected.</param>
     27    /// <param name="converter">The implemented converter.</param>
     28    /// <param name="priority">The priority for the converter selection (when multiple converter match for a given type). Higher is better.</param>
    1929    public static void Register(Type type, IJsonItemConverter converter, int priority) {
    20       if (!transformers.ContainsKey(type))
    21         transformers.Add(type, new ConverterPriorityContainer() { Converter = converter, Priority = priority });
     30      if (!Converters.ContainsKey(type))
     31        Converters.Add(type, new ConverterPriorityContainer() { Converter = converter, Priority = priority });
    2232    }
    2333
    24     public static void Register<T>(IJsonItemConverter converter, int priority) => Register(typeof(T), converter, priority);
     34    public static void Register<T>(IJsonItemConverter converter, int priority) =>
     35      Register(typeof(T), converter, priority);
    2536
     37    /// <summary>
     38    /// Deregister a converter (same object has to be already registered).
     39    /// </summary>
     40    /// <param name="converter">Converter to deregister.</param>
     41    public static void Deregister(IJsonItemConverter converter) {
     42      var types =
     43        Converters
     44        .Where(x => x.Value.Converter.GetHashCode() == converter.GetHashCode())
     45        .Select(x => x.Key);
     46      foreach (var x in types)
     47        Converters.Remove(x);
     48    }
     49
     50    /// <summary>
     51    /// Get a converter for a specific type.
     52    /// </summary>
     53    /// <param name="type">The type for which the converter will be selected.</param>
     54    /// <returns>An IJsonItemConverter object.</returns>
    2655    public static IJsonItemConverter Get(Type type) {
    2756      IList<ConverterPriorityContainer> possibleConverters = new List<ConverterPriorityContainer>();
    28 
    29       foreach (var x in transformers)
     57     
     58      foreach (var x in Converters)
    3059        if (type.IsEqualTo(x.Key))
    3160          possibleConverters.Add(x.Value);
     
    4978
    5079
     80    /// <summary>
     81    /// Static constructor for default converter configuration.
     82    /// </summary>
    5183    static JsonItemConverter() {
    5284      Register<IntValue>(new ValueTypeValueConverter<IntValue, int>(), 1);
     
    6799      Register<BoolMatrix>(new ValueTypeMatrixConverter<BoolMatrix, bool>(), 1);
    68100
     101      Register<DoubleRange>(new DoubleRangeConverter(), 1);
     102      Register<IntRange>(new IntRangeConverter(), 1);
     103
    69104      Register(typeof(EnumValue<>), new EnumTypeConverter(), 1);
    70105
    71       Register<IValueParameter>(new ValueParameterConverter(), 1);
    72       Register<IParameterizedItem>(new ParameterizedItemConverter(), 1);
    73       Register<ILookupParameter>(new LookupParameterConverter(), 2);
    74       Register<IValueLookupParameter>(new ValueLookupParameterConverter(), 3);
     106      Register<IParameter>(new ParameterConverter(), 1);
    75107
    76       Register(typeof(IConstrainedValueParameter<>), new ConstrainedValueParameterConverter(), 2);
    77       Register(typeof(ICheckedMultiOperator<>), new MultiCheckedOperatorConverter(), 2);
     108      Register<IValueParameter>(new ValueParameterConverter(), 2);
     109      Register<IParameterizedItem>(new ParameterizedItemConverter(), 2);
     110      Register<ILookupParameter>(new LookupParameterConverter(), 3);
     111      Register<IValueLookupParameter>(new ValueLookupParameterConverter(), 4);
     112
     113      Register(typeof(IConstrainedValueParameter<>), new ConstrainedValueParameterConverter(), 3);
     114      Register(typeof(ICheckedMultiOperator<>), new MultiCheckedOperatorConverter(), 3);
    78115    }
    79116  }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.Tests/HeuristicLab.JsonInterface/GeneratorInstantiatorTest.cs

    r17330 r17353  
    2020      GeneticAlgorithm alg = new GeneticAlgorithm();
    2121      alg.Problem = new TravelingSalesmanProblem();
    22       JCGenerator gen = new JCGenerator();
    2322      //File.WriteAllText(@"C:\Workspace\Template.json", gen.GenerateTemplate(alg, tsp));
    24       File.WriteAllText(templateFilePath, gen.GenerateTemplate(alg));
     23      File.WriteAllText(templateFilePath, JCGenerator.GenerateTemplate(alg));
    2524      File.WriteAllText(configFilePath, "["+
    2625        "{\"Name\": \"Seed\",\"Default\": 55555,\"Path\": \"Genetic Algorithm (GA).Seed\"},"+
     
    3837    [TestMethod]
    3938    public void TestInstantiator() {
    40       JCInstantiator configurator = new JCInstantiator();
    41       GeneticAlgorithm alg = (GeneticAlgorithm)configurator.Instantiate(templateFilePath, configFilePath);
     39      GeneticAlgorithm alg = (GeneticAlgorithm)JCInstantiator.Instantiate(templateFilePath, configFilePath);
    4240
    4341      Assert.AreEqual(55555, alg.Seed.Value);
     
    5048    public void TestRangeChangeWithConfig() {
    5149      File.WriteAllText(configFilePath, "[{\"Name\": \"MutationProbability\", \"Path\": \"Genetic Algorithm (GA).MutationProbability\", \"Default\": 2.0,\"Range\":[0.0,2.0]}]");
    52       JCInstantiator configurator = new JCInstantiator();
    53       GeneticAlgorithm alg = (GeneticAlgorithm)configurator.Instantiate(templateFilePath, configFilePath);
     50      GeneticAlgorithm alg = (GeneticAlgorithm)JCInstantiator.Instantiate(templateFilePath, configFilePath);
    5451    }
    5552  }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r17323 r17353  
    591591    <Compile Include="HeuristicLab.IGraph\IGraphWrappersVectorTest.cs" />
    592592    <Compile Include="HeuristicLab.JsonInterface\GeneratorInstantiatorTest.cs" />
     593    <Compile Include="HeuristicLab.JsonInterface\ConvertableChecks.cs" />
    593594    <Compile Include="HeuristicLab.Persistence-3.3\StorableAttributeTests.cs" />
    594595    <Compile Include="HeuristicLab.Persistence-3.3\UseCases.cs" />
Note: See TracChangeset for help on using the changeset viewer.