Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/BoolConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/BoolConverter.cs	(revision 3881)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/BoolConverter.cs	(revision 3881)
@@ -0,0 +1,67 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.ExternalEvaluation {
+  [Item("BoolConverter", "Converts a ValueTypeValue<bool>, ValueTypeArray<bool>, or ValueTypeMatrix<bool> and adds it to the SolutionMessage's BoolVars or BoolArrayVars. A matrix is encoded as array by concatenating all rows and setting length as the length of a row.")]
+  [StorableClass]
+  public class BoolConverter : Item, IItemToSolutionMessageConverter {
+    private static readonly Type[] itemTypes = new Type[] { typeof(ValueTypeValue<bool>), typeof(ValueTypeArray<bool>), typeof(ValueTypeMatrix<bool>) };
+
+    #region IItemToSolutionMessageConverter Members
+    
+    public Type[] ItemTypes {
+      get { return itemTypes; }
+    }
+
+    public void AddItemToBuilder(IItem item, string name, SolutionMessage.Builder builder) {
+      ValueTypeValue<bool> value = (item as ValueTypeValue<bool>);
+      if (value != null) {
+        SolutionMessage.Types.BoolVariable.Builder var = SolutionMessage.Types.BoolVariable.CreateBuilder();
+        var.SetName(name).SetData(value.Value);
+        builder.AddBoolVars(var.Build());
+      } else {
+        ValueTypeArray<bool> array = (item as ValueTypeArray<bool>);
+        if (array != null) {
+          SolutionMessage.Types.BoolArrayVariable.Builder var = SolutionMessage.Types.BoolArrayVariable.CreateBuilder();
+          var.SetName(name).AddRangeData(array).SetLength(array.Length);
+          builder.AddBoolArrayVars(var.Build());
+        } else {
+          ValueTypeMatrix<bool> matrix = (item as ValueTypeMatrix<bool>);
+          if (matrix != null) {
+            SolutionMessage.Types.BoolArrayVariable.Builder var = SolutionMessage.Types.BoolArrayVariable.CreateBuilder();
+            var.SetName(name).AddRangeData(matrix.AsEnumerable()).SetLength(matrix.Columns);
+            builder.AddBoolArrayVars(var.Build());
+          } else {
+            throw new ArgumentException(ItemName + ": Item is not of a supported type.", "item");
+          }
+        }
+      }
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DateTimeValueConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DateTimeValueConverter.cs	(revision 3881)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DateTimeValueConverter.cs	(revision 3881)
@@ -0,0 +1,56 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Problems.ExternalEvaluation {
+  [Item("DateTimeValueConverter", "Converts a DateTimeValue and adds it to the SolutionMessage's StringVars. The format is yyyy-MM-dd HH:mm:sszzz, e.g. 2010-05-31 19:15:33+01:00.")]
+  [StorableClass]
+  public class DateTimeValueConverter : Item, IItemToSolutionMessageConverter {
+    private static readonly Type[] itemTypes = new Type[] { typeof(DateTimeValue) };
+
+    #region IItemToSolutionMessageConverter Members
+
+    public Type[] ItemTypes {
+      get { return itemTypes; }
+    }
+
+    public void AddItemToBuilder(IItem item, string name, SolutionMessage.Builder builder) {
+      DateTimeValue date = (item as DateTimeValue);
+      if (date != null) {
+        SolutionMessage.Types.StringVariable.Builder var = SolutionMessage.Types.StringVariable.CreateBuilder();
+        var.SetName(name).SetData(date.Value.ToString("yyyy-MM-dd HH:mm:sszzz"));
+        builder.AddStringVars(var.Build());
+      } else {
+        throw new ArgumentException(ItemName + ": Item is not of a supported type.", "item");
+      }
+    }
+    
+    #endregion
+
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DoubleConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DoubleConverter.cs	(revision 3881)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DoubleConverter.cs	(revision 3881)
@@ -0,0 +1,67 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.ExternalEvaluation {
+  [Item("DoubleConverter", "Converts a ValueTypeValue<double>, ValueTypeArray<double>, or ValueTypeMatrix<double> and adds it to the SolutionMessage's DoubleVars or DoubleArrayVars. A matrix is encoded as array by concatenating all rows and setting length as the length of a row.")]
+  [StorableClass]
+  public class DoubleConverter : Item, IItemToSolutionMessageConverter {
+    private static readonly Type[] itemTypes = new Type[] { typeof(ValueTypeValue<double>), typeof(ValueTypeArray<double>), typeof(ValueTypeMatrix<double>) };
+
+    #region IItemToSolutionMessageConverter Members
+    
+    public Type[] ItemTypes {
+      get { return itemTypes; }
+    }
+
+    public void AddItemToBuilder(IItem item, string name, SolutionMessage.Builder builder) {
+      ValueTypeValue<double> value = (item as ValueTypeValue<double>);
+      if (value != null) {
+        SolutionMessage.Types.DoubleVariable.Builder var = SolutionMessage.Types.DoubleVariable.CreateBuilder();
+        var.SetName(name).SetData(value.Value);
+        builder.AddDoubleVars(var.Build());
+      } else {
+        ValueTypeArray<double> array = (item as ValueTypeArray<double>);
+        if (array != null) {
+          SolutionMessage.Types.DoubleArrayVariable.Builder var = SolutionMessage.Types.DoubleArrayVariable.CreateBuilder();
+          var.SetName(name).AddRangeData(array).SetLength(array.Length);
+          builder.AddDoubleArrayVars(var.Build());
+        } else {
+          ValueTypeMatrix<double> matrix = (item as ValueTypeMatrix<double>);
+          if (matrix != null) {
+            SolutionMessage.Types.DoubleArrayVariable.Builder var = SolutionMessage.Types.DoubleArrayVariable.CreateBuilder();
+            var.SetName(name).AddRangeData(matrix.AsEnumerable()).SetLength(matrix.Columns);
+            builder.AddDoubleArrayVars(var.Build());
+          } else {
+            throw new ArgumentException(ItemName + ": Item is not of a supported type.", "item");
+          }
+        }
+      }
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/IntegerConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/IntegerConverter.cs	(revision 3881)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/IntegerConverter.cs	(revision 3881)
@@ -0,0 +1,67 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.ExternalEvaluation {
+  [Item("IntegerConverter", "Converts a ValueTypeValue<int>, ValueTypeArray<int>, or ValueTypeMatrix<int> and adds it to the SolutionMessage's IntegerVars or IntegerArrayVars. A matrix is encoded as array by concatenating all rows and setting length as the length of a row.")]
+  [StorableClass]
+  public class IntegerConverter : Item, IItemToSolutionMessageConverter {
+    private static readonly Type[] itemTypes = new Type[] { typeof(ValueTypeValue<int>), typeof(ValueTypeArray<int>), typeof(ValueTypeMatrix<int>) };
+
+    #region IItemToSolutionMessageConverter Members
+    
+    public Type[] ItemTypes {
+      get { return itemTypes; }
+    }
+
+    public void AddItemToBuilder(IItem item, string name, SolutionMessage.Builder builder) {
+      ValueTypeValue<int> value = (item as ValueTypeValue<int>);
+      if (value != null) {
+        SolutionMessage.Types.IntegerVariable.Builder var = SolutionMessage.Types.IntegerVariable.CreateBuilder();
+        var.SetName(name).SetData(value.Value);
+        builder.AddIntegerVars(var.Build());
+      } else {
+        ValueTypeArray<int> array = (item as ValueTypeArray<int>);
+        if (array != null) {
+          SolutionMessage.Types.IntegerArrayVariable.Builder var = SolutionMessage.Types.IntegerArrayVariable.CreateBuilder();
+          var.SetName(name).AddRangeData(array).SetLength(array.Length);
+          builder.AddIntegerArrayVars(var.Build());
+        } else {
+          ValueTypeMatrix<int> matrix = (item as ValueTypeMatrix<int>);
+          if (matrix != null) {
+            SolutionMessage.Types.IntegerArrayVariable.Builder var = SolutionMessage.Types.IntegerArrayVariable.CreateBuilder();
+            var.SetName(name).AddRangeData(matrix.AsEnumerable()).SetLength(matrix.Columns);
+            builder.AddIntegerArrayVars(var.Build());
+          } else {
+            throw new ArgumentException(ItemName + ": Item is not of a supported type.", "item");
+          }
+        }
+      }
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/StringConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/StringConverter.cs	(revision 3881)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/StringConverter.cs	(revision 3881)
@@ -0,0 +1,74 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Problems.ExternalEvaluation {
+  [Item("StringConverter", "Converts a StringValue, StringArray, StringMatrix, IStringConvertibleValue, IStringConvertibleArray, or IStringConvertibleMatrix and adds it to the SolutionMessage's StringVars or StringArrayVars. A matrix is encoded as array by concatenating all rows and setting length as the length of a row.")]
+  [StorableClass]
+  public class StringConverter : Item, IItemToSolutionMessageConverter {
+    private static readonly Type[] itemTypes = new Type[] { typeof(StringValue), typeof(StringArray), typeof(StringMatrix), typeof(IStringConvertibleValue), typeof(IStringConvertibleArray), typeof(IStringConvertibleMatrix) };
+
+    #region IItemToSolutionMessageConverter Members
+    
+    public Type[] ItemTypes {
+      get { return itemTypes; }
+    }
+
+    public void AddItemToBuilder(IItem item, string name, SolutionMessage.Builder builder) {
+      IStringConvertibleValue value = (item as IStringConvertibleValue);
+      if (value != null) {
+        SolutionMessage.Types.StringVariable.Builder var = SolutionMessage.Types.StringVariable.CreateBuilder();
+        var.SetName(name).SetData(value.GetValue());
+        builder.AddStringVars(var.Build());
+      } else {
+        IStringConvertibleArray array = (item as IStringConvertibleArray);
+        if (array != null) {
+          SolutionMessage.Types.StringArrayVariable.Builder var = SolutionMessage.Types.StringArrayVariable.CreateBuilder();
+          var.SetName(name).SetLength(array.Length);
+          for (int i = 0; i < array.Length; i++)
+            var.AddData(array.GetValue(i));
+          builder.AddStringArrayVars(var.Build());
+        } else {
+          IStringConvertibleMatrix matrix = (item as IStringConvertibleMatrix);
+          if (matrix != null) {
+            SolutionMessage.Types.StringArrayVariable.Builder var = SolutionMessage.Types.StringArrayVariable.CreateBuilder();
+            var.SetName(name).SetLength(matrix.Columns);
+            for (int i = 0; i < matrix.Rows; i++)
+              for (int j = 0; j < matrix.Columns; j++)
+                var.AddData(matrix.GetValue(i, j));
+            builder.AddStringArrayVars(var.Build());
+          } else {
+            throw new ArgumentException(ItemName + ": Item is not of a supported type.", "item");
+          }
+        }
+      }
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/TimeSpanValueConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/TimeSpanValueConverter.cs	(revision 3881)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/TimeSpanValueConverter.cs	(revision 3881)
@@ -0,0 +1,56 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Problems.ExternalEvaluation {
+  [Item("TimeSpanValueConverter", "Converts a TimeSpanValue and adds it to the SolutionMessage's StringVars. The format is d.hh:mm:ss, e.g. 1113.10:55:00 (1113 days 10 hours, 55 minutes, 0 seconds).")]
+  [StorableClass]
+  public class TimeSpanValueConverter : Item, IItemToSolutionMessageConverter {
+    private static readonly Type[] itemTypes = new Type[] { typeof(TimeSpanValue) };
+
+    #region IItemToSolutionMessageConverter Members
+
+    public Type[] ItemTypes {
+      get { return itemTypes; }
+    }
+
+    public void AddItemToBuilder(IItem item, string name, SolutionMessage.Builder builder) {
+      DateTimeValue date = (item as DateTimeValue);
+      if (date != null) {
+        SolutionMessage.Types.StringVariable.Builder var = SolutionMessage.Types.StringVariable.CreateBuilder();
+        var.SetName(name).SetData(date.Value.ToString(@"d\.hh\:mm\:ss"));
+        builder.AddStringVars(var.Build());
+      } else {
+        throw new ArgumentException(ItemName + ": Item is not of a supported type.", "item");
+      }
+    }
+    
+    #endregion
+
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs	(revision 3872)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs	(revision 3881)
@@ -38,14 +38,23 @@
     }
 
+    public IValueParameter<SolutionMessageBuilder> MessageBuilderParameter {
+      get { return (IValueParameter<SolutionMessageBuilder>)Parameters["MessageBuilder"]; }
+    }
+
+    private SolutionMessageBuilder MessageBuilder {
+      get { return MessageBuilderParameter.Value; }
+    }
+
     public ExternalEvaluator()
       : base() {
       Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the current solution."));
       Parameters.Add(new ValueLookupParameter<IEvaluationServiceClient>("Client", "The client that communicates with the external process."));
+      Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder()));
     }
 
     public override IOperation Apply() {
       IEvaluationServiceClient client = ClientParameter.ActualValue;
-      SolutionMessage.Builder messageBuilder = SolutionMessage.CreateBuilder();
-      messageBuilder.SolutionId = 0;
+      SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder();
+      protobufBuilder.SolutionId = 0;
       foreach (IParameter param in CollectedValues) {
         IItem value = param.ActualValue;
@@ -54,5 +63,5 @@
           string name = lookupParam != null ? lookupParam.TranslatedName : param.Name;
           try {
-            value.AddToSolutionMessage(name, messageBuilder);
+            MessageBuilder.AddToMessage(value, name, protobufBuilder);
           } catch (ArgumentException ex) {
             throw new InvalidOperationException("ERROR in " + Name + ": Parameter " + name + " cannot be added to the message.", ex);
@@ -60,5 +69,5 @@
         }
       }
-      QualityMessage answer = client.Evaluate(messageBuilder.Build());
+      QualityMessage answer = client.Evaluate(protobufBuilder.Build());
       if (QualityParameter.ActualValue == null)
         QualityParameter.ActualValue = new DoubleValue(answer.Quality);
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj	(revision 3872)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj	(revision 3881)
@@ -83,4 +83,10 @@
   <ItemGroup>
     <None Include="HeuristicLabProblemsExternalEvaluationPlugin.cs.frame" />
+    <Compile Include="Converters\BoolConverter.cs" />
+    <Compile Include="Converters\TimeSpanValueConverter.cs" />
+    <Compile Include="Converters\DateTimeValueConverter.cs" />
+    <Compile Include="Converters\DoubleConverter.cs" />
+    <Compile Include="Converters\IntegerConverter.cs" />
+    <Compile Include="Converters\StringConverter.cs" />
     <Compile Include="Drivers\EvaluationServiceClient.cs" />
     <Compile Include="Drivers\EvaluationChannel.cs" />
@@ -93,8 +99,9 @@
     <Compile Include="Interfaces\IEvaluationChannel.cs" />
     <Compile Include="Interfaces\IExternalEvaluationProblemEvaluator.cs" />
+    <Compile Include="Interfaces\IItemToSolutionMessageConverter.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <None Include="Properties\AssemblyInfo.frame" />
     <Compile Include="Protos\ExternalEvaluationMessages.cs" />
-    <Compile Include="SolutionMessageBuilding.cs" />
+    <Compile Include="SolutionMessageBuilder.cs" />
     <None Include="Protos\ProcessProtos.cmd" />
   </ItemGroup>
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Interfaces/IItemToSolutionMessageConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Interfaces/IItemToSolutionMessageConverter.cs	(revision 3881)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Interfaces/IItemToSolutionMessageConverter.cs	(revision 3881)
@@ -0,0 +1,30 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Problems.ExternalEvaluation {
+  public interface IItemToSolutionMessageConverter : IItem {
+    Type[] ItemTypes { get; }
+    void AddItemToBuilder(IItem item, string name, SolutionMessage.Builder builder);
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto	(revision 3872)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto	(revision 3881)
@@ -14,4 +14,5 @@
     required string name = 1;
     repeated int32 data = 2;
+    optional int32 length = 3;
   }
   repeated IntegerArrayVariable integerArrayVars = 3;
@@ -26,4 +27,5 @@
     required string name = 1;
     repeated double data = 2;
+    optional int32 length = 3;
   }
   repeated DoubleArrayVariable doubleArrayVars = 5;
@@ -38,4 +40,5 @@
     required string name = 1;
     repeated bool data = 2;
+    optional int32 length = 3;
   }
   repeated BoolArrayVariable boolArrayVars = 7;
@@ -50,4 +53,5 @@
     required string name = 1;
     repeated string data = 2;
+    optional int32 length = 3;
   }
   repeated StringArrayVariable stringArrayVars = 9;
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/SolutionMessageBuilder.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/SolutionMessageBuilder.cs	(revision 3881)
+++ trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/SolutionMessageBuilder.cs	(revision 3881)
@@ -0,0 +1,127 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Collections;
+
+namespace HeuristicLab.Problems.ExternalEvaluation {
+  [Item("SolutionMessageBuilder", "Holds and uses a number of converters to translate HeuristicLab objects into appropriate fields of a solution message.")]
+  [StorableClass]
+  public class SolutionMessageBuilder : NamedItem {
+    public override bool CanChangeName { get { return false; } }
+    public override bool CanChangeDescription { get { return false; } }
+    private Dictionary<Type, Action<IItem, string, SolutionMessage.Builder>> dispatcher;
+
+    [Storable]
+    private CheckedItemCollection<IItemToSolutionMessageConverter> converters;
+    public CheckedItemCollection<IItemToSolutionMessageConverter> Converters {
+      get { return converters; }
+    }
+
+    [StorableConstructor]
+    protected SolutionMessageBuilder(bool deserializing) : base(deserializing) { }
+    public SolutionMessageBuilder()
+      : base() {
+      name = ItemName;
+      description = ItemDescription;
+      converters = new CheckedItemCollection<IItemToSolutionMessageConverter>();
+      AttachEventHandlers();
+
+      converters.Add(new BoolConverter());
+      converters.Add(new DateTimeValueConverter());
+      converters.Add(new DoubleConverter());
+      converters.Add(new IntegerConverter());
+      converters.Add(new StringConverter());
+      converters.Add(new TimeSpanValueConverter());
+    }
+
+    public void AddToMessage(IItem item, string name, SolutionMessage.Builder builder) {
+      if (dispatcher == null) FillDispatcher();
+      Type itemType = item.GetType();
+      while (!dispatcher.ContainsKey(itemType)) {
+        if (itemType.BaseType != null) itemType = itemType.BaseType;
+        else break;
+      }
+      if (itemType.BaseType == null && !dispatcher.ContainsKey(itemType)) {
+        IEnumerable<Type> interfaces = item.GetType().GetInterfaces().Where(x => dispatcher.ContainsKey(x));
+        if (interfaces.Count() != 1) throw new ArgumentException(Name + ": No converter for type + " + itemType.FullName + " defined.", "item");
+        else itemType = interfaces.Single();
+      }
+      dispatcher[itemType](item, name, builder);
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AttachEventHandlers() {
+      converters.ItemsAdded += new CollectionItemsChangedEventHandler<IItemToSolutionMessageConverter>(converters_ItemsAdded);
+      converters.ItemsRemoved += new CollectionItemsChangedEventHandler<IItemToSolutionMessageConverter>(converters_ItemsRemoved);
+      converters.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IItemToSolutionMessageConverter>(converters_CheckedItemsChanged);
+    }
+
+    private void converters_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IItemToSolutionMessageConverter> e) {
+      AddToDispatcher(e.Items);
+    }
+
+    private void converters_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IItemToSolutionMessageConverter> e) {
+      RemoveFromDispatcher(e.Items);
+    }
+
+    private void converters_CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IItemToSolutionMessageConverter> e) {
+      FillDispatcher();
+    }
+
+    private void FillDispatcher() {
+      dispatcher = new Dictionary<Type, Action<IItem, string, SolutionMessage.Builder>>();
+      foreach (IItemToSolutionMessageConverter c in converters.CheckedItems) {
+        Type[] types = c.ItemTypes;
+        foreach (Type t in types) {
+          if (dispatcher.ContainsKey(t)) dispatcher.Remove(t);
+          dispatcher.Add(t, new Action<IItem, string, SolutionMessage.Builder>(c.AddItemToBuilder));
+        }
+      }
+    }
+
+    private void AddToDispatcher(IEnumerable<IItemToSolutionMessageConverter> items) {
+      if (dispatcher == null) FillDispatcher();
+      foreach (IItemToSolutionMessageConverter c in items) {
+        Type[] types = c.ItemTypes;
+        foreach (Type t in types) {
+          if (dispatcher.ContainsKey(t)) dispatcher.Remove(t);
+          dispatcher.Add(t, new Action<IItem, string, SolutionMessage.Builder>(c.AddItemToBuilder));
+        }
+      }
+    }
+
+    private void RemoveFromDispatcher(IEnumerable<IItemToSolutionMessageConverter> items) {
+      if (dispatcher == null) FillDispatcher();
+      foreach (IItemToSolutionMessageConverter c in items) {
+        Type[] types = c.ItemTypes;
+        foreach (Type t in types) {
+          if (dispatcher.ContainsKey(t)) dispatcher.Remove(t);
+        }
+      }
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/SolutionMessageBuilding.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/SolutionMessageBuilding.cs	(revision 3872)
+++ 	(revision )
@@ -1,107 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-
-namespace HeuristicLab.Problems.ExternalEvaluation {
-  public static class SolutionMessageBuildRegistry {
-    private static readonly Dictionary<Type, Action<string, IItem, SolutionMessage.Builder>> dispatcher = new Dictionary<Type, Action<string, IItem, SolutionMessage.Builder>>();
-
-    static SolutionMessageBuildRegistry() {
-      dispatcher.Add(typeof(ValueTypeValue<int>), (name, item, builder) => DefaultSolutionMessageBuilder.AddAsIntegerVar(name, (ValueTypeValue<int>)item, builder));
-      dispatcher.Add(typeof(ValueTypeArray<int>), (name, item, builder) => DefaultSolutionMessageBuilder.AddAsIntegerArrayVar(name, (ValueTypeArray<int>)item, builder));
-      dispatcher.Add(typeof(ValueTypeValue<double>), (name, item, builder) => DefaultSolutionMessageBuilder.AddAsDoubleVar(name, (ValueTypeValue<double>)item, builder));
-      dispatcher.Add(typeof(ValueTypeArray<double>), (name, item, builder) => DefaultSolutionMessageBuilder.AddAsDoubleArrayVar(name, (ValueTypeArray<double>)item, builder));
-      dispatcher.Add(typeof(ValueTypeValue<bool>), (name, item, builder) => DefaultSolutionMessageBuilder.AddAsBoolVar(name, (ValueTypeValue<bool>)item, builder));
-      dispatcher.Add(typeof(ValueTypeArray<bool>), (name, item, builder) => DefaultSolutionMessageBuilder.AddAsBoolArrayVar(name, (ValueTypeArray<bool>)item, builder));
-      dispatcher.Add(typeof(IStringConvertibleValue), (name, item, builder) => DefaultSolutionMessageBuilder.AddAsStringVar(name, (IStringConvertibleValue)item, builder));
-    }
-
-    internal static void AddToSolutionMessage(this IItem item, string name, SolutionMessage.Builder builder) {
-      Type type = item.GetType();
-      while (!dispatcher.ContainsKey(type)) {
-        if (type.BaseType != null) type = type.BaseType;
-        else break;
-      }
-      if (type.BaseType == null && !dispatcher.ContainsKey(type)) {
-        IEnumerable<Type> interfaces = item.GetType().GetInterfaces().Where(x => dispatcher.ContainsKey(x));
-        if (interfaces.Count() != 1) throw new ArgumentException("It is unknown how to handle values of type " + item.GetType().FullName);
-        else type = interfaces.Single();
-      }
-      
-      dispatcher[type](name, item, builder);
-    }
-
-    public static bool IsRegistered(Type type) {
-      return dispatcher.ContainsKey(type);
-    }
-
-    public static void Register(Type type, Action<string, IItem, SolutionMessage.Builder> registrar) {
-      if (dispatcher.ContainsKey(type)) throw new ArgumentException("Type " + type.FullName + " is already registered.", "type");
-      dispatcher.Add(type, registrar);
-    }
-
-    public static void Deregister(Type type) {
-      if (!dispatcher.ContainsKey(type)) throw new ArgumentException("Type " + type.FullName + " is not registered.", "type");
-      dispatcher.Remove(type);
-    }
-  }
-
-  public static class DefaultSolutionMessageBuilder {
-    public static void AddAsIntegerVar(string name, ValueTypeValue<int> value, SolutionMessage.Builder builder) {
-      builder.AddIntegerVars(SolutionMessage.Types.IntegerVariable.CreateBuilder().SetName(name).SetData(value.Value).Build());
-    }
-    public static void AddAsDoubleVar(string name, ValueTypeValue<double> value, SolutionMessage.Builder builder) {
-      builder.AddDoubleVars(SolutionMessage.Types.DoubleVariable.CreateBuilder().SetName(name).SetData(value.Value).Build());
-    }
-    public static void AddAsBoolVar(string name, ValueTypeValue<bool> value, SolutionMessage.Builder builder) {
-      builder.AddBoolVars(SolutionMessage.Types.BoolVariable.CreateBuilder().SetName(name).SetData(value.Value).Build());
-    }
-    public static void AddAsStringVar(string name, IStringConvertibleValue value, SolutionMessage.Builder builder) {
-      builder.AddStringVars(SolutionMessage.Types.StringVariable.CreateBuilder().SetName(name).SetData(value.GetValue()).Build());
-    }
-    public static void AddAsIntegerArrayVar(string name, ValueTypeArray<int> valueTypeArray, SolutionMessage.Builder builder) {
-      SolutionMessage.Types.IntegerArrayVariable.Builder tmp = SolutionMessage.Types.IntegerArrayVariable.CreateBuilder();
-      tmp.SetName(name);
-      for (int i = 0; i < valueTypeArray.Length; i++)
-        tmp.AddData(valueTypeArray[i]);
-      builder.AddIntegerArrayVars(tmp.Build());
-    }
-    public static void AddAsDoubleArrayVar(string name, ValueTypeArray<double> valueTypeArray, SolutionMessage.Builder builder) {
-      SolutionMessage.Types.DoubleArrayVariable.Builder tmp = SolutionMessage.Types.DoubleArrayVariable.CreateBuilder();
-      tmp.SetName(name);
-      for (int i = 0; i < valueTypeArray.Length; i++)
-        tmp.AddData(valueTypeArray[i]);
-      builder.AddDoubleArrayVars(tmp.Build());
-    }
-    public static void AddAsBoolArrayVar(string name, ValueTypeArray<bool> valueTypeArray, SolutionMessage.Builder builder) {
-      SolutionMessage.Types.BoolArrayVariable.Builder tmp = SolutionMessage.Types.BoolArrayVariable.CreateBuilder();
-      tmp.SetName(name);
-      for (int i = 0; i < valueTypeArray.Length; i++)
-        tmp.AddData(valueTypeArray[i]);
-      builder.AddBoolArrayVars(tmp.Build());
-    }
-  }
-}
