Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/IItemExtensions.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/IItemExtensions.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/IItemExtensions.cs	(revision 17266)
@@ -6,5 +6,5 @@
 using HeuristicLab.Core;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public static class IItemExtensions {
     public static void SetWithParameterData(this IItem item, ParameterData data) {
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/ObjectExtensions.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/ObjectExtensions.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/ObjectExtensions.cs	(revision 17266)
@@ -5,5 +5,5 @@
 using System.Threading.Tasks;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public static class ObjectExtensions {
     public static T Cast<T>(this object obj) => (T)obj;
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/TypeExtensions.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/TypeExtensions.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Extensions/TypeExtensions.cs	(revision 17266)
@@ -5,6 +5,19 @@
 using System.Threading.Tasks;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public static class TypeExtensions {
+    public static int GetInterfaceDistance(this Type type, Type interfaceType) {
+      if (!interfaceType.IsInterface) return -1;
+      int distance = 0;
+      Type baseType = type;
+      while (baseType != typeof(object)) {
+        var interfaces = baseType.GetInterfaces();
+        var minimalInterfaces = interfaces.Except(interfaces.SelectMany(i => i.GetInterfaces()));
+        if (baseType == interfaceType && minimalInterfaces.Any(i => i == interfaceType))
+          ++distance;
+        baseType = baseType.BaseType;
+      }
+      return distance;
+    }
     public static bool IsEqualTo(this Type type, Type other) {
       if (other == null) throw new ArgumentNullException("other");
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/HeuristicLab.Manufacture.csproj
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/HeuristicLab.Manufacture.csproj	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/HeuristicLab.Manufacture.csproj	(revision 17266)
@@ -7,6 +7,6 @@
     <ProjectGuid>{0E3AAB5E-F152-44E0-A054-4D9A83ECEE08}</ProjectGuid>
     <OutputType>Exe</OutputType>
-    <RootNamespace>ParameterTest</RootNamespace>
-    <AssemblyName>ParameterTest</AssemblyName>
+    <RootNamespace>HeuristicLab.Manufacture</RootNamespace>
+    <AssemblyName>HeuristicLab.Manufacture</AssemblyName>
     <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
@@ -60,4 +60,6 @@
     <Compile Include="ParameterTransformer\ValueParameterTransformer.cs" />
     <Compile Include="TypeTransformer\EnumTypeTransformer.cs" />
+    <Compile Include="TypeTransformer\DummyTransformer.cs" />
+    <Compile Include="ParameterTransformer\LookupParameterTransformer.cs" />
     <Compile Include="TypeTransformer\StringValueTransformer.cs" />
     <Compile Include="TypeTransformer\ValueTypeArrayTransformer.cs" />
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Interfaces/ITypeTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Interfaces/ITypeTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Interfaces/ITypeTransformer.cs	(revision 17266)
@@ -7,11 +7,10 @@
 using Newtonsoft.Json.Linq;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
+  //IDataProcessor?
   public interface ITypeTransformer {
-    ParameterData ToData(IItem value);
-    //IItem FromData(ParameterData obj, Type targetType);
-
-    void SetValue(IItem item, ParameterData obj);
-    //void SetParameter(ParameterData data, IParameter parameter, Type )
+    ParameterData Extract(IItem value);
+    void Inject(IItem item, ParameterData data);
   }
 }
+
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCGenerator.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCGenerator.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCGenerator.cs	(revision 17266)
@@ -11,6 +11,39 @@
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
+using Newtonsoft.Json.Serialization;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
+
+  public class CustomWriter : JsonTextWriter {
+    private Stack<Formatting> formattings = new Stack<Formatting>();
+    private int lvl = 0;
+    public override void WriteStartArray() {
+      base.WriteStartArray();
+      if(lvl > 1) {
+        formattings.Push(base.Formatting);
+        base.Formatting = Formatting.None;
+      }
+      lvl++;
+    }
+
+    public override void WriteEndArray() {
+      base.WriteEndArray();
+      lvl--;
+      if (lvl > 1)
+        base.Formatting = formattings.Pop();
+    }
+
+    public CustomWriter(TextWriter writer) : base(writer) { }
+
+    public static string Serialize(JToken token) {
+      JsonSerializer serializer = new JsonSerializer();
+      StringWriter sw = new StringWriter();
+      CustomWriter writer = new CustomWriter(sw);
+      writer.Formatting = Formatting.Indented;
+      serializer.Serialize(writer, token);
+      return sw.ToString();
+    }
+  }
+
   public class JCGenerator {
 
@@ -28,89 +61,77 @@
     private Dictionary<string, string> TypeList = new Dictionary<string, string>();
 
-    public string GenerateTemplate(IAlgorithm algorithm, IProblem problem) {
+    public string GenerateTemplate(IAlgorithm algorithm, IProblem problem, params string[] freeParameters) {
       algorithm.Problem = problem;
-      foreach(var x in BJCO(algorithm)) {
-        Console.WriteLine(x.ToString());
-      }
-      /*
-      JCObject algorithmData = BuildJCObject(algorithm);
-      JCObject problemData = BuildJCObject(problem);
+      IList<JCObject> items = BJCO(algorithm);
+      JArray jsonItems = new JArray();
+      
+      foreach(var item in items) {
+        JToken token = JObject.FromObject(item, Settings());
 
-      ProcessStaticParameters(algorithmData, problemData);
-      ProcessFreeParameters(algorithmData, problemData);
-      ProcessTypeList();
-
-      return template.ToString(Formatting.Indented);
-      */
-      return "";
+        RefactorFreeParameters(token, freeParameters);
+        RefactorStaticParameters(token);
+        if(token["StaticParameters"].HasValues || token["FreeParameters"].HasValues)
+          jsonItems.Add(token);
+      } 
+      return CustomWriter.Serialize(jsonItems);
     }
 
-    #region Helper
-    private JCObject BuildJCObject(IItem item) {
-      JCObject obj = new JCObject();
-      obj.Name = item.ItemName;
-      obj.Parameters = BuildJCParameter(item).Parameters;
-      return obj;
+    private void RefactorFreeParameters(JToken token, string[] freeParameters) {
+
+      token["FreeParameters"] = token["StaticParameters"];
+
+      IList<JObject> objToRemove = new List<JObject>();
+      TransformNodes(x => {
+        var p = x.ToObject<ParameterData>();
+
+        /*bool isSelected = false;
+        string name = x["Name"].ToObject<string>();
+        foreach (var selected in freeParameters)
+          isSelected = (name == selected || isSelected);
+        */
+        if (/*!isSelected ||*/ p.Default == null || (p.Default != null && p.Default.GetType() == typeof(string) && p.Range == null)) {
+          objToRemove.Add(x);
+        } else {
+          x.Property("Path")?.Remove();
+          x.Property("Type")?.Remove();
+        }
+      }, token["FreeParameters"]);
+      foreach (var x in objToRemove) x.Remove();
+     
     }
 
+    private void RefactorStaticParameters(JToken token) {
+      IList<JObject> objToRemove = new List<JObject>();
+      TransformNodes(x => {
+        var p = x.ToObject<ParameterData>();
+        x.Property("Range")?.Remove();
+        if (p.Default == null) objToRemove.Add(x);
+      }, token["StaticParameters"]);
+      foreach (var x in objToRemove) x.Remove();
+    }
+      
+    
+
+    #region Helper
     private IList<JCObject> BJCO(IParameterizedItem item) {
       List<JCObject> list = new List<JCObject>();
       JCObject obj = new JCObject();
       obj.Name = item.ItemName;
+      obj.Type = item.GetType().AssemblyQualifiedName;
       obj.StaticParameters = new List<ParameterData>();
-      obj.FreeParameters = new List<ParameterData>();
-
       list.Add(obj);
 
       foreach (var param in item.Parameters) {
         if(!param.Hidden) {
-          ParameterData newParam = new ParameterData();
-          newParam.Name = param.Name;
-          if (!Util.IsTypeOf(param, typeof(ILookupParameter<>))) {
-            if (param.ActualValue is IntValue) {
-              SetParameterValueStats(newParam, ((IntValue)param.ActualValue).Value, 0, int.MaxValue);
-            } else if (param.ActualValue is BoolValue) {
-              SetParameterValueStats(newParam, ((BoolValue)param.ActualValue).Value, false, true);
-            } else if (param.ActualValue is PercentValue) {
-              SetParameterValueStats(newParam, ((PercentValue)param.ActualValue).Value, 0d, 1d);
-            } else if (param.ActualValue is DoubleValue) {
-              SetParameterValueStats(newParam, ((DoubleValue)param.ActualValue).Value, 0d, double.MaxValue);
-            } else if (Util.IsTypeOf(param.ActualValue, typeof(EnumValue<>))) {
-              var enumType = ((dynamic)param.ActualValue).Value.GetType();
-              SetParameterValueStats(newParam,
-                Enum.GetName(enumType, ((dynamic)param.ActualValue).Value),
-                Enum.GetNames(enumType));
-            } else if (param.ActualValue is StringValue) {
-              SetParameterValueStats(newParam, ((StringValue)param.ActualValue).Value);
-            } else if (Util.IsTypeOf(param.ActualValue, typeof(ValueTypeMatrix<>))) {
-              SetParameterValueStats(newParam, ((dynamic)param.ActualValue).CloneAsMatrix());
-            } else if (Util.IsTypeOf(param.ActualValue, typeof(ValueTypeArray<>))) {
-              SetParameterValueStats(newParam, ((dynamic)param.ActualValue).CloneAsArray());
-            } else {
-              AddType(param.ActualValue);
-              //newParam.Path = newParam.Path.Substring(0, newParam.Path.Length - 6);
-              SetParameterValueStats(newParam, param.ActualValue?.GetType().Name, ExtractPossibleValues(item, param.DataType));
-            }
-          }
+          obj.StaticParameters.Add(Transformer.Extract(param));
 
-
-          obj.StaticParameters.Add(newParam);
-
-          if (param is IParameterizedItem) {
-            list.AddRange(BJCO((IParameterizedItem)param));
-          }
-          if (Util.IsTypeOf(param, typeof(IConstrainedValueParameter<>))) {
-            foreach (var validValue in ((dynamic)param).ValidValues) {
-              if (newParam.Range == null) newParam.Range = new List<object>();
-              object v = (object)validValue;
-              try {
-                if (!newParam.Range.Contains(v))
-                  newParam.Range.Add(v);
-              } catch { }
-              if (validValue is IParameterizedItem) {
+          if (param is IParameterizedItem)
+            list.AddRange(BJCO(param.Cast<IParameterizedItem>()));
+          
+          if (param.GetType().IsEqualTo(typeof(IConstrainedValueParameter<>)))
+            foreach (var validValue in param.Cast<dynamic>().ValidValues)
+              if (validValue is IParameterizedItem && 
+                ((IParameterizedItem)validValue).Parameters.Any(p => !p.Hidden))
                 list.AddRange(BJCO((IParameterizedItem)validValue));
-              }
-            }
-          }
         }
       }
@@ -119,23 +140,4 @@
 
 
-
-    private IEnumerable<IParameterizedItem> GetIParameterItems(IParameterizedItem item) {
-      List<IParameterizedItem> items = new List<IParameterizedItem>();
-      items.Add(item);
-      foreach(var param in item.Parameters) {
-        if(param is IParameterizedItem) {
-          items.AddRange(GetIParameterItems((IParameterizedItem)param));
-        }
-        if(Util.IsTypeOf(param, typeof(IConstrainedValueParameter<>))){
-          foreach(var validValue in ((dynamic)param).ValidValues) {
-            if(validValue is IParameterizedItem) {
-              items.AddRange(GetIParameterItems((IParameterizedItem)validValue));
-            }
-          }
-        }
-      }
-      return items;
-    }
-
     private JsonSerializer Settings() => new JsonSerializer() {
       TypeNameHandling = TypeNameHandling.None,
@@ -143,37 +145,4 @@
     };
 
-    private void ProcessFreeParameters(JCObject algorithmData, JCObject problemData) {
-      JObject freeParams = new JObject();
-      JToken alg = JToken.FromObject(algorithmData.Parameters, Settings());
-      JToken prob = JToken.FromObject(problemData.Parameters, Settings());
-      
-      IList<JObject> objToRemove = new List<JObject>();
-      TransformNodes(x => {
-        var p = x.ToObject<ParameterData>();
-        if (p.Default == null || (p.Default != null && p.Default.GetType() == typeof(string) && p.Range == null)) {
-          objToRemove.Add(x);
-        } else {
-          x.Property("Path")?.Remove();
-          x.Property("Type")?.Remove();
-        }
-      },alg, prob);
-      foreach (var x in objToRemove) x.Remove();
-
-      freeParams.Add(algorithmData.Name, alg);
-      freeParams.Add(problemData.Name, prob);
-      template["FreeParameters"] = freeParams;
-    }
-
-    private void ProcessStaticParameters(JCObject algorithmData, JCObject problemData) {
-      template["StaticParameters"]["Algorithm"] = JObject.FromObject(algorithmData, Settings());
-      template["StaticParameters"]["Problem"] = JObject.FromObject(problemData, Settings());
-      TransformNodes(x => x.Property("Range")?.Remove(),
-        template["StaticParameters"]["Algorithm"]["Parameters"],
-        template["StaticParameters"]["Problem"]["Parameters"]);
-    }
-
-    private void ProcessTypeList() {
-      template["StaticParameters"]["TypeList"] = JObject.FromObject(TypeList);
-    }
 
     private void TransformNodes(Action<JObject> action, params JToken[] tokens) {
@@ -184,137 +153,5 @@
     #endregion
 
-    
-    private ParameterData BuildJCParameter(IItem item, string startPath = "") {
-      ParameterData obj = new ParameterData();
-      obj.Name = item.ItemName;
-      obj.Path = startPath;
-
-      AddType(item, obj.Name);
-
-      try {
-        ExtractParameterInfo(item, obj);
-      } catch { }
-      ExtractOperatorInfo(item, obj);
-      return obj;
-    }
-
-    private bool ProcessValueTypeParameters(ParameterData jCParameter, IParameter parameter) {
-      if (parameter.ActualValue is IntValue)
-        SetParameterValueStats(jCParameter, 
-          ((IntValue)parameter.ActualValue).Value, 
-          0, int.MaxValue);
-      else if (parameter.ActualValue is BoolValue)
-        SetParameterValueStats(jCParameter, 
-          ((BoolValue)parameter.ActualValue).Value, 
-          false, true);
-      else if (parameter.ActualValue is PercentValue)
-        SetParameterValueStats(jCParameter, 
-          ((PercentValue)parameter.ActualValue).Value, 
-          0d, 1d);
-      else if (parameter.ActualValue is DoubleValue)
-        SetParameterValueStats(jCParameter, 
-          ((DoubleValue)parameter.ActualValue).Value, 
-          0d, double.MaxValue);
-      else return false;
-      return true;
-    }
-
-    private bool ProcessEnumTypeParameters(ParameterData jCParameter, IParameter parameter) {
-      if (Util.IsTypeOf(parameter.ActualValue, typeof(EnumValue<>))) {
-        var enumType = ((dynamic)parameter.ActualValue).Value.GetType();
-        SetParameterValueStats(jCParameter,
-          Enum.GetName(enumType, ((dynamic)parameter.ActualValue).Value),
-          Enum.GetNames(enumType));
-      } else return false;
-      return true;
-    }
-
-    private bool ProcessMatrixTypeParameters(ParameterData jCParameter, IParameter parameter) {
-      if (Util.IsTypeOf(parameter.ActualValue, typeof(ValueTypeMatrix<>))) {
-        SetParameterValueStats(jCParameter, ((dynamic)parameter.ActualValue).CloneAsMatrix());
-      } else return false;
-      return true;
-    }
-
-    private bool ProcessArrayTypeParameters(ParameterData jCParameter, IParameter parameter) {
-      if (Util.IsTypeOf(parameter.ActualValue, typeof(ValueTypeArray<>))) {
-        SetParameterValueStats(jCParameter, ((dynamic)parameter.ActualValue).CloneAsArray());
-      } else return false;
-      return true;
-    }
-
-    private void SetParameterValueStats(ParameterData parameter, object value, params object[] range) {
-      parameter.Default = value;
-      parameter.Range = range.Length == 0 ? null : range;
-    }
-
-    
-    private void ExtractParameterInfo(IItem item, ParameterData obj) {
-      if (item is IParameterizedItem) {
-        foreach (var param in ((IParameterizedItem)item).Parameters) {
-          if (!param.Hidden) {
-
-            ParameterData newParam = BuildJCParameter(param);
-            newParam.Name = param.Name;
-            var tmpType = param.GetType();
-            newParam.Path = (obj.Path != "" ? obj.Path + "." : "") + param.Name + ".Value.Value";
-
-            if (obj.Parameters == null)
-              obj.Parameters = new List<ParameterData>();
-            obj.Parameters.Add(newParam);
-
-
-            if (param.ActualValue is IntValue) {
-              SetParameterValueStats(newParam, ((IntValue)param.ActualValue).Value, 0, int.MaxValue);
-            } else if (param.ActualValue is BoolValue) {
-              SetParameterValueStats(newParam, ((BoolValue)param.ActualValue).Value, false, true);
-            } else if (param.ActualValue is PercentValue) {
-              SetParameterValueStats(newParam, ((PercentValue)param.ActualValue).Value, 0d, 1d);
-            } else if (param.ActualValue is DoubleValue) {
-              SetParameterValueStats(newParam, ((DoubleValue)param.ActualValue).Value, 0d, double.MaxValue);
-            } else if (Util.IsTypeOf(param.ActualValue, typeof(EnumValue<>))) {
-              var enumType = ((dynamic)param.ActualValue).Value.GetType();
-              SetParameterValueStats(newParam, 
-                Enum.GetName(enumType, ((dynamic)param.ActualValue).Value), 
-                Enum.GetNames(enumType));
-            } else if (param.ActualValue is StringValue) {
-              SetParameterValueStats(newParam, ((StringValue)param.ActualValue).Value);
-            } else if (Util.IsTypeOf(param.ActualValue, typeof(ValueTypeMatrix<>))) {
-              SetParameterValueStats(newParam, ((dynamic)param.ActualValue).CloneAsMatrix());
-            } else if (Util.IsTypeOf(param.ActualValue, typeof(ValueTypeArray<>))) {
-              SetParameterValueStats(newParam, ((dynamic)param.ActualValue).CloneAsArray());
-            } else {
-              AddType(param.ActualValue);
-              newParam.Path = newParam.Path.Substring(0, newParam.Path.Length - 6);
-              SetParameterValueStats(newParam, param.ActualValue?.GetType().Name, ExtractPossibleValues(item, param.DataType));
-            }
-          }
-        }
-      }
-    }
-
-    private object[] ExtractPossibleValues(IItem item, Type paramType) {
-      IList<object> list = new List<object>();
-      if (item is Algorithm) {
-        IEnumerable<IItem> items = ((Algorithm)item).Problem.Operators.Where(x => paramType.IsAssignableFrom(x.GetType()));
-        foreach (var op in items) {
-          string name = op.GetType().Name;
-          list.Add(name);
-          AddType(op, name);
-        }
-      }
-      return list.ToArray();
-    }
-
-    private void AddType(object obj, string key = null) {
-      if (obj != null) {
-        if (key == null) key = obj.GetType().Name;
-        try {
-          if (!TypeList.ContainsKey(key))
-            TypeList.Add(key, obj.GetType().AssemblyQualifiedName);
-        } catch { }
-      }
-    }
-
+    /*
     private void ExtractOperatorInfo(IItem item, ParameterData obj) {
       if (item is IMultiOperator) {
@@ -330,5 +167,5 @@
         }
       }
-    }
+    }*/
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCInstantiator.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCInstantiator.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCInstantiator.cs	(revision 17266)
@@ -12,5 +12,5 @@
 using Newtonsoft.Json.Linq;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
 
   
@@ -28,6 +28,28 @@
 
     public IAlgorithm Instantiate(string configFile) {
-      JObject config = JObject.Parse(File.ReadAllText(configFile));
+      JArray config = JArray.Parse(File.ReadAllText(configFile));
+      JCObject obj = config[0].ToObject<JCObject>();
+      IAlgorithm algorithm = CreateObject<IAlgorithm>(obj);
 
+      foreach(var sp in obj.StaticParameters) {
+        if(algorithm.Parameters.TryGetValue(sp.Name, out IParameter param)) {
+          Transformer.Inject(param, sp);
+        }
+      }
+
+      foreach (var sp in obj.FreeParameters) {
+        if (algorithm.Parameters.TryGetValue(sp.Name, out IParameter param)) {
+          if(IsInRangeList(sp.Range, sp.Default) || 
+            IsInNumericRange<long>(sp.Default, sp.Range[0], sp.Range[1]) || 
+            IsInNumericRange<double>(sp.Default, sp.Range[0], sp.Range[1]))
+          Transformer.Inject(param, sp);
+        }
+      }
+
+
+      return algorithm;
+
+
+      /*
       TypeList = config[SParametersID][TListID].ToObject<Dictionary<string, string>>();
 
@@ -46,4 +68,10 @@
       UseFreeParams(problemData.Name, freeProblemParameters, algorithm.Problem);
       return algorithm;
+      */
+    }
+
+    private T CreateObject<T>(JCObject obj) {
+      Type type = Type.GetType(obj.Type);
+      return (T)Activator.CreateInstance(type);
     }
 
@@ -56,5 +84,5 @@
 
     private void ProcessParameters(JCObject obj, IParameterizedItem instance) {
-      foreach (var param in obj.Parameters)
+      foreach (var param in obj.StaticParameters)
         if (param.Default != null)
           SetParameterValue(FindPropertyByKey(instance, param.Name), param.Default);
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ConstrainedValueParameterTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ConstrainedValueParameterTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ConstrainedValueParameterTransformer.cs	(revision 17266)
@@ -6,11 +6,28 @@
 using HeuristicLab.Core;
 
-namespace ParameterTest.ParameterTransformer {
+namespace HeuristicLab.Manufacture {
   public class ConstrainedValueParameterTransformer : ParameterBaseTransformer {
-    public override void SetValue(IParameter parameter, ParameterData data) {
+    public override void InjectData(IParameter parameter, ParameterData data) {
       foreach (var x in parameter.Cast<dynamic>().ValidValues)
         if (x.GetType().Name == CastValue<string>(data.Default))
           parameter.ActualValue = x;
     }
+
+    public override ParameterData ExtractData(IParameter value) {
+      return new ParameterData() {
+        Name = value.Name,
+        Default = value.ActualValue?.GetType().Name,
+        Range = GetValidValues(value)
+      };
+    }
+
+    #region Helper
+    private object[] GetValidValues(IParameter value) {
+      List<object> list = new List<object>();
+      var values = value.Cast<dynamic>().ValidValues;
+      foreach (var x in values) list.Add(x);
+      return list.Select(x => x.GetType().Name).ToArray();
+    }
+    #endregion
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/LookupParameterTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/LookupParameterTransformer.cs	(revision 17266)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/LookupParameterTransformer.cs	(revision 17266)
@@ -0,0 +1,18 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Manufacture {
+  public class LookupParameterTransformer : ParameterBaseTransformer {
+    public override ParameterData ExtractData(IParameter value) {
+      return new ParameterData() { Name = value.Name };
+    }
+
+    public override void InjectData(IParameter parameter, ParameterData data) {
+      
+    }
+  }
+}
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterBaseTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterBaseTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterBaseTransformer.cs	(revision 17266)
@@ -6,15 +6,12 @@
 using HeuristicLab.Core;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public abstract class ParameterBaseTransformer : BaseTransformer {
-    public override IItem FromData(ParameterData obj, Type targetType) {
-      throw new NotImplementedException();
-    }
+    public override ParameterData ExtractData(IItem value) => ExtractData(value.Cast<IParameter>());
+    public abstract ParameterData ExtractData(IParameter value);
 
+    public override void InjectData(IItem item, ParameterData data) => InjectData(item.Cast<IParameter>(), data);
 
-
-    public override void SetValue(IItem item, ParameterData data) => SetValue(item.Cast<IParameter>(), data);
-
-    public abstract void SetValue(IParameter parameter, ParameterData data);
+    public abstract void InjectData(IParameter parameter, ParameterData data);
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ValueParameterTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ValueParameterTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ValueParameterTransformer.cs	(revision 17266)
@@ -6,10 +6,15 @@
 using HeuristicLab.Core;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public class ValueParameterTransformer : ParameterBaseTransformer {
 
-    public override void SetValue(IParameter parameter, ParameterData data) => 
-      Transformer.SetValue(parameter.ActualValue, data);
+    public override void InjectData(IParameter parameter, ParameterData data) => 
+      Transformer.Inject(parameter.ActualValue, data);
 
+    public override ParameterData ExtractData(IParameter value) {
+      ParameterData data = Transformer.Extract(value.ActualValue);
+      data.Name = value.Name;
+      return data;
+    }
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Program.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Program.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Program.cs	(revision 17266)
@@ -27,5 +27,5 @@
 
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   
   public class Program {
@@ -36,12 +36,12 @@
 
       JCGenerator gen = new JCGenerator();
-      File.WriteAllText(@"C:\Workspace\TemplateProto9.json", gen.GenerateTemplate(alg, tsp));
+      File.WriteAllText(@"C:\Workspace\TemplateProto10.json", gen.GenerateTemplate(alg, tsp));
       
       JCInstantiator configurator = new JCInstantiator();
-      //configurator.Instantiate(@"C:\Workspace\TemplateProto9.json");
+      configurator.Instantiate(@"C:\Workspace\TemplateProto10.json");
       //Configure(@"C:\Workspace\TemplateProto9.json");
       //Console.WriteLine(Optimizer);
 
-      Console.ReadLine();
+      //Console.ReadLine();
     }
   }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Template.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Template.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Template.cs	(revision 17266)
@@ -7,8 +7,8 @@
 using Newtonsoft.Json;
 
-namespace ParameterTest {   
-  public class JCObject {
+namespace HeuristicLab.Manufacture {   
+  public class JCObject { //Blueprint, Component,  ?
     public string Name { get; set; }
-    public IList<ParameterData> Parameters { get; set; }
+    public string Type { get; set; }
     public IList<ParameterData> FreeParameters { get; set; }
     public IList<ParameterData> StaticParameters { get; set; }
@@ -18,5 +18,5 @@
       sb.Append($"{Name}: [");
       foreach(var x in StaticParameters) {
-        sb.Append(x.ToString());
+        sb.Append(x?.ToString());
       }
       sb.Append($"\n]");
@@ -36,4 +36,14 @@
     public IList<ParameterData> Operators { get; set; }
 
+    public ParameterData() { }
+    /*
+    public ParameterData(ParameterData original) {
+      this.Name = original.Name;
+      this.Type = original.Type;
+      this.Default = original.Default;
+      this.Path = original.Path;
+      this.Name = original.Name;
+      this.Name = original.Name;
+    }*/
     public override string ToString() {
       StringBuilder sb = new StringBuilder();
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Transformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Transformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Transformer.cs	(revision 17266)
@@ -7,5 +7,5 @@
 using HeuristicLab.Data;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public static class Transformer {
     private static IDictionary<Type, ITypeTransformer> transformers = new Dictionary<Type, ITypeTransformer>();
@@ -20,12 +20,31 @@
 
     public static ITypeTransformer Get(Type type) {
+      IList<KeyValuePair<Type, ITypeTransformer>> possibleTransformers = new List<KeyValuePair<Type, ITypeTransformer>>();
       foreach (var x in transformers) {
-        if (type.IsEqualTo(x.Key)) return x.Value;
+        if (type.IsEqualTo(x.Key))
+          possibleTransformers.Add(x);
       }
-      return null;
+
+      if(possibleTransformers.Count > 0) {
+        ITypeTransformer nearest = possibleTransformers.First().Value;
+        int nearestDistance = -1;
+        foreach (var x in possibleTransformers) {
+          int d = type.GetInterfaceDistance(x.Key);
+          if (d != -1 && (nearestDistance == -1 || d < nearestDistance)) {
+            nearestDistance = d;
+            nearest = x.Value;
+          }
+        }
+        return nearest;
+      }
+      return new DummyTransformer();
     }
 
-    internal static void SetValue(IItem item, ParameterData data) {
-      Get(item.GetType()).SetValue(item, data);
+    internal static void Inject(IItem item, ParameterData data) {
+      Get(item.GetType()).Inject(item, data);
+    }
+
+    internal static ParameterData Extract(IItem item) {
+      return Get(item.GetType()).Extract(item);
     }
 
@@ -48,4 +67,8 @@
       Register<PercentMatrix>(new ValueTypeMatrixTransformer<PercentMatrix, double>());
       Register<BoolMatrix>(new ValueTypeMatrixTransformer<BoolMatrix, bool>());
+
+      Register(typeof(IConstrainedValueParameter<>), new ConstrainedValueParameterTransformer());
+      Register(typeof(ILookupParameter), new LookupParameterTransformer());
+      Register(typeof(IValueParameter), new ValueParameterTransformer());
     }
 
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/BaseTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/BaseTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/BaseTransformer.cs	(revision 17266)
@@ -7,17 +7,25 @@
 using Newtonsoft.Json.Linq;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public abstract class BaseTransformer : ITypeTransformer
   {
-    public abstract void SetValue(IItem item, ParameterData data);
-    public abstract IItem FromData(ParameterData obj, Type targetType);
-    public virtual ParameterData ToData(IItem value) => 
-      new ParameterData() { Name = value.ItemName };
+    public ParameterData Extract(IItem value) {
+      ParameterData data = ExtractData(value);
+      data.Name = String.IsNullOrEmpty(data.Name) ? value.ItemName : data.Name;
+      return data;
+    }
 
+    public void Inject(IItem item, ParameterData data) => InjectData(item, data);
+
+    public abstract void InjectData(IItem item, ParameterData data);
+    public abstract ParameterData ExtractData(IItem value);
+
+    #region Helper
     protected ValueType CastValue<ValueType>(object obj) {
       if (obj is JToken)
-        return ((JToken)obj).ToObject<ValueType>();
-      else
-        return (ValueType)obj;
+        return (obj.Cast<JToken>()).ToObject<ValueType>();
+      else if (obj is IConvertible)
+        return Convert.ChangeType(obj, typeof(ValueType)).Cast<ValueType>();
+      else return (ValueType)obj;
     }
 
@@ -26,4 +34,5 @@
 
     protected IItem Instantiate<T>(params object[] args) => Instantiate(typeof(T), args);
+    #endregion
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/DummyTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/DummyTransformer.cs	(revision 17266)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/DummyTransformer.cs	(revision 17266)
@@ -0,0 +1,17 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Manufacture {
+  public class DummyTransformer : BaseTransformer {
+    public override void InjectData(IItem item, ParameterData data) {
+      // do nothing because the instance already exists and 
+      // there are no values to inject
+    }
+
+    public override ParameterData ExtractData(IItem value) => new ParameterData();
+  }
+}
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/EnumTypeTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/EnumTypeTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/EnumTypeTransformer.cs	(revision 17266)
@@ -7,20 +7,14 @@
 using HeuristicLab.Data;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public class EnumTypeTransformer : BaseTransformer {
-    public override IItem FromData(ParameterData obj, Type targetType) {
-      Type enumType = targetType.GenericTypeArguments.First();
-      var data = Enum.Parse(enumType, CastValue<string>(obj.Default));
-      //item.Cast<dynamic>().Value = data;
-      return Instantiate(targetType, data);
-    }
 
-    public override void SetValue(IItem item, ParameterData data) {
-      Type enumType = item.GetType().GenericTypeArguments.First();
-      item.Cast<dynamic>().Value = Enum.Parse(enumType, CastValue<string>(data.Default));
-    }
+    public override void InjectData(IItem item, ParameterData data) =>
+      item.Cast<dynamic>().Value = Enum.Parse(
+        item.GetType().GenericTypeArguments.First(), 
+        CastValue<string>(data.Default));
 
-    public override ParameterData ToData(IItem value) {
-      ParameterData data = base.ToData(value);
+    public override ParameterData ExtractData(IItem value) {
+      ParameterData data = new ParameterData();
       object val = ((dynamic)value).Value;
       Type enumType = val.GetType();
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/StringValueTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/StringValueTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/StringValueTransformer.cs	(revision 17266)
@@ -7,19 +7,13 @@
 using HeuristicLab.Data;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public class StringValueTransformer : BaseTransformer {
-    public override IItem FromData(ParameterData obj, Type targetType) =>
-      //item.Cast<StringValue>().Value = CastValue<string>(obj.Default);
-      new StringValue() { Value = CastValue<string>(obj.Default) };
-
-    public override void SetValue(IItem item, ParameterData data) =>
+    public override void InjectData(IItem item, ParameterData data) =>
       item.Cast<StringValue>().Value = CastValue<string>(data.Default);
 
-    public override ParameterData ToData(IItem value) {
-      ParameterData data = base.ToData(value);
-      data.Default = value.Cast<StringValue>().Value;
-      return data;
-    }
-
+    public override ParameterData ExtractData(IItem value) => 
+      new ParameterData() {
+        Default = value.Cast<StringValue>().Value
+      };
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeArrayTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeArrayTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeArrayTransformer.cs	(revision 17266)
@@ -8,26 +8,24 @@
 using Newtonsoft.Json.Linq;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public class ValueTypeArrayTransformer<ArrayType, T> : BaseTransformer
     where ArrayType : ValueTypeArray<T>
     where T : struct 
   {
-    public override IItem FromData(ParameterData obj, Type targetType) =>
-      Instantiate<ArrayType>(CastValue<T[]>(obj.Default));
+    public override void InjectData(IItem item, ParameterData data) => 
+      CopyArrayData(item.Cast<ArrayType>(), CastValue<T[]>(data.Default));
 
-    public override void SetValue(IItem item, ParameterData data) {
-      T[] arr = CastValue<T[]>(data.Default);
-      ArrayType valueArray = item.Cast<ArrayType>();
-      for (int i = 0; i < arr.Length; ++i) {
-        valueArray[i] = arr[i];
+    public override ParameterData ExtractData(IItem value) => 
+      new ParameterData() {
+        Default = value.Cast<ArrayType>().CloneAsArray()
+      };
+
+    #region Helper
+    private void CopyArrayData(ArrayType array, T[] data) {
+      for (int i = 0; i < data.Length; ++i) {
+        array[i] = data[i];
       }
     }
-      //item.Cast<StringValue>().Value = CastValue<string>(data.Default);
-
-    public override ParameterData ToData(IItem value) {
-      ParameterData data = base.ToData(value);
-      data.Default = value.Cast<ArrayType>().CloneAsArray();
-      return data;
-    }
+    #endregion
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeMatrixTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeMatrixTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeMatrixTransformer.cs	(revision 17266)
@@ -8,35 +8,26 @@
 using HeuristicLab.Core;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public class ValueTypeMatrixTransformer<MatrixType, T> : BaseTransformer
     where MatrixType : ValueTypeMatrix<T> 
     where T : struct 
   {
-    public override IItem FromData(ParameterData obj, Type targetType) {
-      /*T[,] arr = CastValue<T[,]>(obj.Default);
-      MatrixType matrix = item.Cast<MatrixType>();
-      for (int x = 0; x < arr.GetLength(0); ++x){
-        for (int y = 0; y < arr.GetLength(1); ++y) {
-          matrix[x, y] = arr[x, y];
-        }
-      }*/
-      return Instantiate<MatrixType>(CastValue<T[,]>(obj.Default));
-    }
+    public override void InjectData(IItem item, ParameterData data) => 
+      CopyMatrixData(item.Cast<MatrixType>(), CastValue<T[,]>(data.Default));
 
-    public override void SetValue(IItem item, ParameterData data) {
-      T[,] arr = CastValue<T[,]>(data.Default);
-      MatrixType matrix = item.Cast<MatrixType>();
-      for (int x = 0; x < arr.GetLength(0); ++x) {
-        for (int y = 0; y < arr.GetLength(1); ++y) {
-          matrix[x, y] = arr[x, y];
+    public override ParameterData ExtractData(IItem value) =>
+      new ParameterData() {
+        Default = value.Cast<MatrixType>().CloneAsMatrix()
+      };
+
+    #region Helper
+    private void CopyMatrixData(MatrixType matrix, T[,] data) {
+      for (int x = 0; x < data.GetLength(0); ++x) {
+        for (int y = 0; y < data.GetLength(1); ++y) {
+          matrix[x, y] = data[x, y];
         }
       }
     }
-
-    public override ParameterData ToData(IItem value) {
-      ParameterData data = base.ToData(value);
-      data.Default = value.Cast<MatrixType>().CloneAsMatrix();
-      return data;
-    }
+    #endregion
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeValueTransformer.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeValueTransformer.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeValueTransformer.cs	(revision 17266)
@@ -7,23 +7,25 @@
 using HeuristicLab.Data;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public class ValueTypeValueTransformer<ValueType, T> : BaseTransformer
     where ValueType : ValueTypeValue<T>
     where T : struct {
-    public override IItem FromData(ParameterData obj, Type targetType) =>
-      //item.Cast<ValueType>().Value = CastValue<T>(obj.Default);
-      Instantiate<ValueType>(CastValue<T>(obj.Default));
-    public override void SetValue(IItem item, ParameterData data) =>
+
+    public override void InjectData(IItem item, ParameterData data) =>
       item.Cast<ValueType>().Value = CastValue<T>(data.Default);
 
-    public override ParameterData ToData(IItem value) {
-      ParameterData data = base.ToData(value);
-      data.Default = value.Cast<ValueType>().Value;
-      data.Range = new object[] { default(T), GetMaxValue() };
-      return data;
-    }
+    public override ParameterData ExtractData(IItem value) => 
+      new ParameterData() {
+        Default = value.Cast<ValueType>().Value,
+        Range = new object[] { default(T), GetMaxValue() }
+      };
 
+    #region Helper
     private object GetMaxValue() {
       TypeCode typeCode = Type.GetTypeCode(typeof(T));
+
+      if (typeof(ValueType).IsEqualTo(typeof(PercentValue)))
+        return 1.0d;
+
       switch (typeCode) {
         case TypeCode.Int16: return Int16.MaxValue;
@@ -41,4 +43,5 @@
       }
     }
+    #endregion
   }
 }
Index: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Util.cs
===================================================================
--- branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Util.cs	(revision 17263)
+++ branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Util.cs	(revision 17266)
@@ -6,5 +6,5 @@
 using HeuristicLab.Core;
 
-namespace ParameterTest {
+namespace HeuristicLab.Manufacture {
   public class Util {
     public static bool IsTypeOf(object obj, Type t) {
