Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HLMapper.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HLMapper.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HLMapper.cs	(revision 8817)
@@ -0,0 +1,68 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Data;
+using HeuristicLab.Services.Optimization.ControllerService.Model;
+using HeuristicLab.Optimization;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Services.Optimization.ControllerService {
+  public interface IScenarioMapper {
+    void MapScenario(OptimizationScenario scenario, IAlgorithm algorithm);
+  }
+
+  public static class HLMapper {
+    public static DoubleValue ConvertToDoubleValue(Parameter parameter) {
+      var dv = parameter.Value as DecimalValue;
+      return new DoubleValue(dv.Value);      
+    }
+
+    public static Permutation ConvertToPermutation(Parameter parameter) {
+      double[] input = (parameter.Value as DecimalVector).Value;
+      int[] arr = new int[input.Length];
+      for (int i = 0; i < input.Length; i++) {
+        arr[i] = Convert.ToInt32(input[i]);
+      }
+      var valueObj = new HeuristicLab.Encodings.PermutationEncoding.Permutation(Encodings.PermutationEncoding.PermutationTypes.RelativeUndirected, arr);
+      return valueObj;
+    }
+
+    public static DoubleMatrix ConvertToDoubleMatrix(Parameter parameter) {
+      var matrix = parameter.Value as DecimalMatrix;
+      // TODO: Check for empty matrices
+      double[,] data = new double[matrix.Value.Length, matrix.Value[0].Length];
+      for (int i=0; i < matrix.Value.Length; i++) {
+        for (int j=0; j < matrix.Value[i].Length; j++) {
+          data[i,j] = matrix.Value[i][j];
+        }
+      }
+      return new DoubleMatrix(data);
+    }
+
+    public static HeuristicLab.Data.BoolValue ConvertToBoolValue(Parameter parameter) {
+      return new HeuristicLab.Data.BoolValue((parameter.Value as HeuristicLab.Services.Optimization.ControllerService.Model.BoolValue).Value);
+    }
+
+    public static IntValue ConvertToIntValue(Parameter parameter) {
+      return new IntValue((int)(parameter.Value as DecimalValue).Value);
+    }
+
+    public static PercentValue ConvertToPercentValue(Parameter parameter) {
+      return new PercentValue((parameter.Value as DecimalValue).Value / 100);
+    }
+
+    public static string GetStringValue(Parameter parameter) {
+      return (parameter.Value as HeuristicLab.Services.Optimization.ControllerService.Model.TypeValue).Value;
+    }
+
+    public static T FindInItemSet<T>(Core.IItemSet<T> items, Parameter what) where T : class,Core.INamedItem {
+      return items.FirstOrDefault((entry) => { return entry.Name == (what.Value as HeuristicLab.Services.Optimization.ControllerService.Model.TypeValue).Value; });
+    }
+
+    public static T FindOperator<T>(IProblem problem, Parameter what) where T : IOperator {
+      return problem.Operators.OfType<T>().FirstOrDefault((item) => { return item.ItemName == (what.Value as HeuristicLab.Services.Optimization.ControllerService.Model.TypeValue).Value; });
+    }
+  }
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj	(revision 8817)
@@ -131,4 +131,5 @@
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
     <Reference Include="System.Runtime.Serialization" />
@@ -141,5 +142,8 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="HiveScenarioManagerOld.cs" />
+    <Compile Include="HiveMapper.cs" />
     <Compile Include="HiveScenarioManager.cs" />
+    <Compile Include="HLMapper.cs" />
     <Compile Include="Interfaces\IControllerService.cs" />
     <Compile Include="Interfaces\IScenarioManager.cs" />
@@ -147,4 +151,5 @@
     <Compile Include="PlaceholderControllerService.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ScenarioParser.cs" />
     <Compile Include="Utility.cs" />
   </ItemGroup>
@@ -153,4 +158,8 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+  </PropertyGroup>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveMapper.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveMapper.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveMapper.cs	(revision 8817)
@@ -0,0 +1,20 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Services.Optimization.ControllerService.Model {
+  public static class HiveMapper {    
+    public static double FindDoubleValue(this InputParameters ip, string what) {     
+      foreach (var param in ip.Items) {
+        if (param.Value.Name == what) {
+          var dv = param.Value as DecimalValue;
+          //DoubleValue result = new DoubleValue(dv.Value);
+          return dv.Value;
+        }
+      }
+      return 0.0;
+    }
+  }
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManager.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManager.cs	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManager.cs	(revision 8817)
@@ -15,98 +15,13 @@
 using System.Threading;
 using HeuristicLab.Data;
+using System.IO;
 
 namespace HeuristicLab.Services.Optimization.ControllerService {
   public class HiveScenarioManager : IScenarioManager {
-    public object MapControllerDataType(object model, Parameter param) {
-      switch (param.Type) {
-        case ParameterType.Boolean:
-          return (param.Value as Model.BoolValue).Value;
-        case ParameterType.Integer:
-          return Convert.ToInt32((param.Value as Model.DecimalValue).Value);          
-        case ParameterType.Percent:        
-        case ParameterType.Decimal:
-          return (param.Value as Model.DecimalValue).Value;
-        case ParameterType.DecimalMatrix:
-          return Utility.ToMultiD(((param.Value as Model.DecimalMatrix).Value));
-        case ParameterType.DecimalVector:
-          return (param.Value as Model.DecimalVector).Value;
-        case ParameterType.Type:
-          //TODO handle type correctly!
-          var typeValue = param.Value as Model.TypeValue;
-          
-          IProblem problem = model as IProblem;
-          IAlgorithm algoModel = model as IAlgorithm;
-          if (problem == null && algoModel != null) {
-            problem = algoModel.Problem;
-          }
-
-          if (problem != null) {
-            var toselect = problem.Operators.OfType<IOperator>().FirstOrDefault(x => x.Name == typeValue.Value);
-            if (toselect != null) {
-              return toselect;
-            }
-          }
-          
-          string parameterPropertyName = typeValue.Name.EndsWith("Parameter") ? typeValue.Name : typeValue.Name + "Parameter";
-          var parameterProperty = model.GetType().GetProperty(parameterPropertyName);
-          if (parameterProperty != null) {
-            var parameterPropertyValue = parameterProperty.GetGetMethod().Invoke(model, null);
-            var vvProp = parameterPropertyValue.GetType().GetProperty("ValidValues");
-            if (vvProp != null) {
-              //http://stackoverflow.com/questions/245607/how-is-generic-covariance-contra-variance-implemented-in-c-sharp-4-0 because of covariance declared in IEnumerable
-              var options = vvProp.GetGetMethod().Invoke(parameterPropertyValue, null) as IEnumerable<IItem>;
-              if (options != null) {
-                var result = options.FirstOrDefault(x => x.ItemName == typeValue.Value);
-                if (result != null)
-                  return result;
-              }
-            }
-          }
-
-          Type type = null;
-          foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) {
-            type = asm.GetType(typeValue.Value);
-            if (type != null)
-              break;
-          }
-          
-          return Activator.CreateInstance(type);
-      }
-      return null;
-    }
-
-    public object CreateHLObjectForType(object obj, Type type, Parameter prop) {
-      var value = MapControllerDataType(obj, prop);
-      if (prop.Type == ParameterType.Type)
-        return value;
-
-      if (type == typeof(HeuristicLab.Encodings.PermutationEncoding.Permutation)) {
-        double[] input = value as double[];
-        int[] arr = new int[input.Length];
-        for (int i = 0; i < input.Length; i++) {
-          arr[i] = Convert.ToInt32(input[i]);
-        }
-        var valueObj = new HeuristicLab.Encodings.PermutationEncoding.Permutation(Encodings.PermutationEncoding.PermutationTypes.RelativeUndirected, arr);
-        return valueObj;
-      }
-      var propertyGetter = obj.GetType().GetProperty(prop.Value.Name).GetGetMethod();        
-      return Activator.CreateInstance(propertyGetter.ReturnType, value);
-    }
-
-    private void MapProperty(object model, Parameter prop) {
-      var propertyGetter = model.GetType().GetProperty(prop.Value.Name).GetGetMethod();
-      var propertySetter = model.GetType().GetProperty(prop.Value.Name).GetSetMethod();
-      var value = propertyGetter.Invoke(model, null);
-      var valueProperty = value != null ? value.GetType().GetProperty("Value") : null;
-      if (propertySetter != null) {
-        var instance = CreateHLObjectForType(model, propertyGetter.ReturnType, prop);
-        propertySetter.Invoke(model, new object[] { instance });
-      }
-      else if (valueProperty != null) {        
-        valueProperty.GetSetMethod().Invoke(value, new object[] { MapControllerDataType(model, prop) });
-      }
-      else {
-        Console.WriteLine("Failed to handle property!");
-      }
+    private static IScenarioMapper tspMapper;
+    private static object lockable;
+
+    static HiveScenarioManager() {
+      lockable = new object();
     }
 
@@ -114,16 +29,105 @@
       Experiment experiment = new Experiment();
       var problem = new TravelingSalesmanProblem();
-      foreach (var prop in scenario.InputParameters.Items) {
-        MapProperty(problem, prop);
-      }
-
       var algo = new GeneticAlgorithm();
       algo.Problem = problem;      
-      foreach (var prop in scenario.AlgorithmParameters.Items) {
-        MapProperty(algo, prop);
-      }
+      
+      MapExperiment(scenario, algo);
 
       experiment.Optimizers.Add(algo);
       SendExperimentToHive(user, experiment);
+    }
+
+    static public string AssemblyDirectory {
+      get {
+        string codeBase = Assembly.GetExecutingAssembly().CodeBase;
+        UriBuilder uri = new UriBuilder(codeBase);
+        string path = Uri.UnescapeDataString(uri.Path);
+        return Path.GetDirectoryName(path);
+      }
+    }
+
+    private IScenarioMapper GetMapper(Model.OptimizationScenario scenario) {
+      if (tspMapper == null) {
+        lock (lockable) {
+          if (tspMapper != null)
+            return tspMapper;
+          
+          // http://stackoverflow.com/questions/3188882/compile-and-run-dynamic-code-without-generating-exe
+          using (var csCodeProvider = new Microsoft.CSharp.CSharpCodeProvider()) {
+            var cp = new System.CodeDom.Compiler.CompilerParameters() {
+              GenerateInMemory = true
+            };
+
+            var referencedPaths = Directory.GetFiles(AssemblyDirectory, "*.dll");
+            foreach (var loadedAssembly in referencedPaths) {
+              cp.ReferencedAssemblies.Add(loadedAssembly);
+            }
+            cp.ReferencedAssemblies.Add("System.dll");
+            cp.ReferencedAssemblies.Add("System.Core.dll");
+            cp.ReferencedAssemblies.Add("System.Data.dll");
+            cp.ReferencedAssemblies.Add("System.Xml.dll");
+            cp.ReferencedAssemblies.Add("System.Xml.Linq.dll");
+
+            var res = csCodeProvider.CompileAssemblyFromSource(
+              cp,
+            @"using System;
+              using System.Collections.Generic;
+              using System.Linq;
+              using System.Text;
+              using HeuristicLab.Data;
+              using HeuristicLab.Services.Optimization.ControllerService.Model; 
+              using HeuristicLab.Optimization;
+              using HeuristicLab.Services.Optimization.ControllerService;
+              using HeuristicLab.Algorithms.GeneticAlgorithm;
+              using HeuristicLab.Problems.TravelingSalesman;
+              public class TSPScenarioMapper : IScenarioMapper {
+                public void MapScenario(OptimizationScenario scenario, IAlgorithm algorithm) {
+                  Console.WriteLine(""Mapping scenario!"");
+                  var ga = algorithm as GeneticAlgorithm;
+                  var problem = algorithm.Problem as TravelingSalesmanProblem;
+                  
+                  problem.BestKnownQuality = HLMapper.ConvertToDoubleValue(scenario.InputParameters.FindByName(""BestKnownQuality""));
+                  problem.BestKnownSolution = HLMapper.ConvertToPermutation(scenario.InputParameters.FindByName(""BestKnownSolution""));
+                  problem.Coordinates = HLMapper.ConvertToDoubleMatrix(scenario.InputParameters.FindByName(""Coordinates""));
+                  var evalParam = HLMapper.GetStringValue(scenario.InputParameters.FindByName(""EvaluatorParameter""));
+                  if (evalParam == ""HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator"") {
+                    problem.EvaluatorParameter.Value = new TSPRoundedEuclideanPathEvaluator();
+                  }
+                  else if (evalParam == ""HeuristicLab.Problems.TravelingSalesman.TSPGeoPathEvaluator"") {
+                    problem.EvaluatorParameter.Value = new TSPGeoPathEvaluator();
+                  }
+                  else {
+                    problem.EvaluatorParameter.Value = new TSPEuclideanPathEvaluator();
+                  }
+                  problem.UseDistanceMatrix = HLMapper.ConvertToBoolValue(scenario.InputParameters.FindByName(""UseDistanceMatrix""));
+                  Console.WriteLine(""Mapping algorithm..."");
+                  ga.Mutator = HLMapper.FindInItemSet<HeuristicLab.Optimization.IManipulator>(ga.MutatorParameter.ValidValues, scenario.AlgorithmParameters.FindByName(""Mutator""));
+                  ga.CrossoverParameter.Value = HLMapper.FindOperator<HeuristicLab.Optimization.ICrossover>(problem, scenario.AlgorithmParameters.FindByName(""CrossoverParameter""));
+                  ga.Elites = HLMapper.ConvertToIntValue(scenario.AlgorithmParameters.FindByName(""Elites""));
+                  ga.MaximumGenerations = HLMapper.ConvertToIntValue(scenario.AlgorithmParameters.FindByName(""MaximumGenerations""));
+                  ga.MutationProbability = HLMapper.ConvertToPercentValue(scenario.AlgorithmParameters.FindByName(""MutationProbability""));                
+                  ga.PopulationSize = HLMapper.ConvertToIntValue(scenario.AlgorithmParameters.FindByName(""PopulationSize""));
+                  ga.Seed = HLMapper.ConvertToIntValue(scenario.AlgorithmParameters.FindByName(""Seed""));
+                  ga.Selector = HLMapper.FindInItemSet<HeuristicLab.Optimization.ISelector>(ga.SelectorParameter.ValidValues, scenario.AlgorithmParameters.FindByName(""Selector""));
+                  ga.SetSeedRandomly = HLMapper.ConvertToBoolValue(scenario.AlgorithmParameters.FindByName(""SetSeedRandomly""));
+                }
+              }"
+            );
+
+            foreach (var error in res.Errors) {
+              Console.WriteLine(error);
+            }
+
+            var type = res.CompiledAssembly.GetType("TSPScenarioMapper");
+            tspMapper = Activator.CreateInstance(type) as IScenarioMapper;
+          } // using
+        } // lock        
+       } // if
+       return tspMapper;
+     }  
+
+    private void MapExperiment(Model.OptimizationScenario scenario, IAlgorithm algorithm) {      
+      IScenarioMapper mapper = GetMapper(scenario);
+      mapper.MapScenario(scenario, algorithm);     
     }
 
@@ -246,4 +250,6 @@
       return runs;
     }
+
+    //TODO: We might need images / +++
     private Parameter MapHiveDataType(string name, IItem item) {
       Parameter result = new Parameter();
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManagerOld.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManagerOld.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManagerOld.cs	(revision 8817)
@@ -0,0 +1,302 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Services.Optimization.ControllerService.Interfaces;
+using HeuristicLab.Optimization;
+using HeuristicLab.Algorithms.GeneticAlgorithm;
+using HeuristicLab.Problems.TravelingSalesman;
+using HeuristicLab;
+using System.Reflection;
+using HeuristicLab.Services.Optimization.ControllerService.Model;
+using HeuristicLab.Core;
+using System.Collections;
+using HeuristicLab.Clients.Hive;
+using System.Threading;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Services.Optimization.ControllerService {
+  public class HiveScenarioManagerOld : IScenarioManager {
+    public object MapControllerDataType(object model, Parameter param) {
+      switch (param.Type) {
+        case ParameterType.Boolean:
+          return (param.Value as Model.BoolValue).Value;
+        case ParameterType.Integer:
+          return Convert.ToInt32((param.Value as Model.DecimalValue).Value);          
+        case ParameterType.Percent:        
+        case ParameterType.Decimal:
+          return (param.Value as Model.DecimalValue).Value;
+        case ParameterType.DecimalMatrix:
+          return Utility.ToMultiD(((param.Value as Model.DecimalMatrix).Value));
+        case ParameterType.DecimalVector:
+          return (param.Value as Model.DecimalVector).Value;
+        case ParameterType.Type:
+          //TODO handle type correctly!
+          var typeValue = param.Value as Model.TypeValue;
+          
+          IProblem problem = model as IProblem;
+          IAlgorithm algoModel = model as IAlgorithm;
+          if (problem == null && algoModel != null) {
+            problem = algoModel.Problem;
+          }
+
+          if (problem != null) {
+            var toselect = problem.Operators.OfType<IOperator>().FirstOrDefault(x => x.Name == typeValue.Value);            
+            if (toselect != null) {
+              return toselect;
+            }
+          }
+          
+          string parameterPropertyName = typeValue.Name.EndsWith("Parameter") ? typeValue.Name : typeValue.Name + "Parameter";
+          var parameterProperty = model.GetType().GetProperty(parameterPropertyName);
+          if (parameterProperty != null) {
+            var parameterPropertyValue = parameterProperty.GetGetMethod().Invoke(model, null);
+            var vvProp = parameterPropertyValue.GetType().GetProperty("ValidValues");
+            if (vvProp != null) {
+              //http://stackoverflow.com/questions/245607/how-is-generic-covariance-contra-variance-implemented-in-c-sharp-4-0 because of covariance declared in IEnumerable
+              var options = vvProp.GetGetMethod().Invoke(parameterPropertyValue, null) as IEnumerable<IItem>;
+              if (options != null) {
+                var result = options.FirstOrDefault(x => x.ItemName == typeValue.Value);
+                if (result != null)
+                  return result;
+              }
+            }
+          }
+
+          Type type = null;
+          foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) {
+            type = asm.GetType(typeValue.Value);
+            if (type != null)
+              break;
+          }
+          
+          return Activator.CreateInstance(type);
+      }
+      return null;
+    }
+
+    public object CreateHLObjectForType(object obj, Type type, Parameter prop) {
+      var value = MapControllerDataType(obj, prop);
+      if (prop.Type == ParameterType.Type)
+        return value;
+
+      if (type == typeof(HeuristicLab.Encodings.PermutationEncoding.Permutation)) {
+        double[] input = value as double[];
+        int[] arr = new int[input.Length];
+        for (int i = 0; i < input.Length; i++) {
+          arr[i] = Convert.ToInt32(input[i]);
+        }
+        var valueObj = new HeuristicLab.Encodings.PermutationEncoding.Permutation(Encodings.PermutationEncoding.PermutationTypes.RelativeUndirected, arr);
+        return valueObj;
+      }
+      var propertyGetter = obj.GetType().GetProperty(prop.Value.Name).GetGetMethod();        
+      return Activator.CreateInstance(propertyGetter.ReturnType, value);
+    }
+
+    private void MapProperty(object model, Parameter prop) {
+      var propertyGetter = model.GetType().GetProperty(prop.Value.Name).GetGetMethod();
+      var propertySetter = model.GetType().GetProperty(prop.Value.Name).GetSetMethod();
+      var value = propertyGetter.Invoke(model, null);
+      var valueProperty = value != null ? value.GetType().GetProperty("Value") : null;
+      if (propertySetter != null) {
+        var instance = CreateHLObjectForType(model, propertyGetter.ReturnType, prop);
+        propertySetter.Invoke(model, new object[] { instance });
+      }
+      else if (valueProperty != null) {        
+        valueProperty.GetSetMethod().Invoke(value, new object[] { MapControllerDataType(model, prop) });
+      }
+      else {
+        Console.WriteLine("Failed to handle property!");
+      }
+    }
+
+    public void DispatchScenario(Model.User user, Model.OptimizationScenario scenario) {
+      Experiment experiment = new Experiment();
+      var problem = new TravelingSalesmanProblem();
+      foreach (var prop in scenario.InputParameters.Items) {
+        MapProperty(problem, prop);
+      }
+
+      var algo = new GeneticAlgorithm();
+      algo.Problem = problem;      
+      foreach (var prop in scenario.AlgorithmParameters.Items) {
+        MapProperty(algo, prop);
+      }
+
+      experiment.Optimizers.Add(algo);
+      SendExperimentToHive(user, experiment);
+    }
+
+    private void SendExperimentToHive(Model.User user, Experiment exp) {
+      var job = new RefreshableJob();
+      job.IsAllowedPrivileged = true;      
+      job.Job.Name = "Web Scheduled Traveling Salesman Job";
+      job.Job.ResourceNames = "TESTGROUP";
+      job.RefreshAutomatically = false;
+      job.HiveTasks.Add(new OptimizerHiveTask(exp));
+      HiveServiceLocator.Instance.Username = user.Username;
+      HiveServiceLocator.Instance.Password = user.Password;
+      HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
+      
+      HiveClient.StartJob((ex) => { 
+        Console.WriteLine(ex.StackTrace); 
+      }, job, new CancellationToken());
+
+      job.StopResultPolling();
+    }
+
+
+    public IList<Model.Job> GetJobs(User user) {
+      HiveServiceLocator.Instance.Username = user.Username;
+      HiveServiceLocator.Instance.Password = user.Password;
+      HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
+      var jobsLoaded = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.Job>>(s => s.GetJobs());
+      IList<Model.Job> jobs = new List<Model.Job>();
+      
+      foreach (var job in jobsLoaded) {
+        jobs.Add(ConvertJob(user, job));
+      }
+      return jobs;
+    }
+
+    private Model.Job ConvertJob(User user, HeuristicLab.Clients.Hive.Job job) 
+    {
+      var waitingJobs = job.JobCount - job.CalculatingCount - job.FinishedCount;
+      Model.JobState? state = null;
+      var jobTasks = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.LightweightTask>>(s => s.GetLightweightJobTasks(job.Id));
+      
+      foreach (var task in jobTasks) {        
+        switch (task.State) {
+          case TaskState.Aborted:
+            state = JobState.Aborted;
+            break;
+          case TaskState.Failed:
+            state = JobState.Failed;
+            break;
+        }
+      }
+      if (!state.HasValue) {
+        if (job.CalculatingCount > 0)
+          state = JobState.Calculating;
+        else if (waitingJobs > 0)
+          state = JobState.Waiting;
+        else
+          state = JobState.Finished;
+      }
+      return new Model.Job() { Id = job.Id.ToString(), Name = job.Name, Resource = job.ResourceNames, State = state.Value };
+    }
+
+
+    public Model.Job GetJob(User user, string id) {
+      HiveServiceLocator.Instance.Username = user.Username;
+      HiveServiceLocator.Instance.Password = user.Password;
+      HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
+      var guid = Guid.Parse(id);
+      return ConvertJob(user, HiveServiceLocator.Instance.CallHiveService<HeuristicLab.Clients.Hive.Job>(s => s.GetJob(guid)));
+    }
+
+
+    public void DeleteJob(User user, string id) {
+      HiveServiceLocator.Instance.Username = user.Username;
+      HiveServiceLocator.Instance.Password = user.Password;
+      HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
+      var guid = Guid.Parse(id);
+      HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(guid));      
+    }
+
+    public IList<Model.Run> GetJobResults(User user, string id) {
+      HiveServiceLocator.Instance.Username = user.Username;
+      HiveServiceLocator.Instance.Password = user.Password;
+      HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
+      var guid = Guid.Parse(id);
+      var jobTasks = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.LightweightTask>>(s => s.GetLightweightJobTasks(guid));
+
+      IList<Guid> taskIds = new List<Guid>();
+      foreach (var task in jobTasks) {
+        taskIds.Add(task.Id);
+      }
+      TaskDownloader downloader = new TaskDownloader(taskIds);
+      downloader.StartAsync();
+      while (!downloader.IsFinished) {        
+        Thread.Sleep(500);
+
+        if (downloader.IsFaulted) {
+          throw downloader.Exception;
+        }
+      }
+      IDictionary<Guid, HiveTask> hiveTasks = downloader.Results;
+      IList<Model.Run> runs = new List<Model.Run>();
+      foreach (var keyTask in hiveTasks.Keys) {
+        var oht = hiveTasks[keyTask] as OptimizerHiveTask;
+        if (oht != null) {
+          foreach (var run in oht.ItemTask.Item.Runs) {
+            Model.Run taskRun = new Model.Run();
+            taskRun.Id = taskRun.Name = run.Name;
+            IList<Parameter> resultValues = new List<Model.Parameter>();
+            foreach (var key in run.Results.Keys) {
+              var value = run.Results[key];              
+              Parameter result = MapHiveDataType(key, value);
+              resultValues.Add(result);
+            }
+            taskRun.Results = resultValues;
+            runs.Add(taskRun);
+          }
+        }
+      }
+      return runs;
+    }
+    private Parameter MapHiveDataType(string name, IItem item) {
+      Parameter result = new Parameter();
+      result.Type = ParameterType.String;
+      if (item is IStringConvertibleValue) {
+        var value = (item as IStringConvertibleValue).GetValue();
+        result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = value };
+      }
+      else if (item is IStringConvertibleValueTuple) {
+        var value1 = (item as IStringConvertibleValueTuple).Item1.GetValue();
+        var value2 = (item as IStringConvertibleValueTuple).Item2.GetValue();
+        result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = "{" + value1 + ", " + value2 + "}" };
+      }
+      else if (item is IStringConvertibleArray) {
+        StringBuilder sb = new StringBuilder();
+        var array = item as IStringConvertibleArray;
+        if (array.Length == 0) {
+          sb.Append("[ ]");
+        } else {
+          sb.Append("[");
+          for (int i=0; i < array.Length - 1; i++) {
+            sb.Append(array.GetValue(i)).Append(", ");          
+          }
+          sb.Append(array.GetValue(array.Length - 1));
+          sb.Append(" ]");
+        }
+        var value = sb.ToString();
+        result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = value };
+      }
+      else if (item is IStringConvertibleMatrix) {
+        StringBuilder sb = new StringBuilder();
+        var matrix = item as IStringConvertibleMatrix;
+        if (matrix.Rows == 0 || matrix.Columns == 0) {
+          sb.Append("[ ]");
+        }
+        else {
+          sb.Append("[ ");
+          for (int r = 0; r < matrix.Rows; r++) {
+            sb.Append("( ");
+            for (int c = 0; c < matrix.Columns - 1; c++) {
+              sb.Append(matrix.GetValue(r, c)).Append(", ");
+            }
+            sb.Append(matrix.GetValue(r, matrix.Columns - 1)).Append(r < matrix.Rows - 1 ? " ), " : " )");
+          }
+          sb.Append(" ]");
+        }
+        var value = sb.ToString();
+        result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = value };
+      }
+      else {
+        result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = "Cannot be displayed as string" };
+      }
+      return result;
+    }
+  }
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Model/ControllerModel.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Model/ControllerModel.cs	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Model/ControllerModel.cs	(revision 8817)
@@ -80,6 +80,6 @@
 
     public override bool TrySetFromString(string input) {
-      var splitted = input.Split(':');
-      int index;
+      var splitted = input.Split(':');      
+      int index;      
       if (splitted.Length != 2)
         return false;
@@ -191,4 +191,13 @@
       set { items = value; }
     }
+
+    public Parameter FindByName(string name) {
+      foreach (var param in items) {
+        if (param.Value.Name == name) {          
+          return param;
+        }
+      }
+      return null;
+    }
   }
 
@@ -202,4 +211,13 @@
       set { items = value; }
     }
+
+    public Parameter FindByName(string name) {
+      foreach (var param in items) {
+        if (param.Value.Name == name) {
+          return param;
+        }
+      }
+      return null;
+    }
   }
 
@@ -208,4 +226,13 @@
     [DataMember]
     public string Name { get; set; }
+
+    [DataMember]
+    public string ProblemType { get; set; }
+
+    [DataMember]
+    public string AlgorithmType { get; set; }
+
+    [DataMember]
+    public string MapperType { get; set; }
 
     private InputParameters inputParams = new InputParameters();
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs	(revision 8817)
@@ -5,4 +5,5 @@
 using System.ServiceModel;
 using HeuristicLab.Services.Optimization.ControllerService.Interfaces;
+using HeuristicLab.Services.Optimization.ControllerService.Model;
 
 namespace HeuristicLab.Services.Optimization.ControllerService {
@@ -12,8 +13,10 @@
     private IList<Model.OptimizationScenario> scenarios;
 
+    private ScenarioParser parser = new ScenarioParser();
+
     private IScenarioManager hiveManager;
 
     public PlaceholderControllerService() {
-      var tsp = new Model.OptimizationScenario() { Name = "Traveling Salesman Problem" };
+      /*var tsp = new Model.OptimizationScenario() { Name = "Traveling Salesman Problem" };
       hiveManager = new HiveScenarioManager();
       tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Decimal, Value = new Model.DecimalValue() { Name = "BestKnownQuality", Value = 6110.0d } });
@@ -46,6 +49,9 @@
       tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "Selector", Value = "ProportionalSelector", Options = new string[] { "ProportionalSelector", "BestSelector" } } });
       tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Boolean, Value = new Model.BoolValue() { Name = "SetSeedRandomly", Value = true } });//, Value = true });
-      this.scenarios = new List<Model.OptimizationScenario>() { tsp };
+      this.scenarios = new List<Model.OptimizationScenario>() { tsp };*/      
       //hiveManager.DispatchScenario(tsp);
+      hiveManager = new HiveScenarioManager();
+      scenarios = parser.Scenarios;
+      //hiveManager.DispatchScenario(new User() { Username = "fschoeppl", Password = "fschoeppl" }, scenarios[0]);
     }
 
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Properties/AssemblyInfo.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Properties/AssemblyInfo.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Properties/AssemblyInfo.cs	(revision 8817)
@@ -0,0 +1,36 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Services.Optimization.Controller")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("FH-Hagenberg")]
+[assembly: AssemblyProduct("HeuristicLab.Services.Optimization.Controller")]
+[assembly: AssemblyCopyright("Copyright © FH-Hagenberg 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("bc333c49-808f-458e-81b3-a72c26769b04")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/ScenarioParser.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/ScenarioParser.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/ScenarioParser.cs	(revision 8817)
@@ -0,0 +1,229 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using System.Xml;
+using System.Globalization;
+using System.Xml.Linq;
+
+namespace HeuristicLab.Services.Optimization.ControllerService {
+  public class ScenarioParser {
+    private static IList<Model.OptimizationScenario> scenarios;
+    private static object lockable = new object();
+
+    public IList<Model.OptimizationScenario> Scenarios {
+      get {
+        if (scenarios == null) {
+          lock (lockable) {
+            if (scenarios == null) {
+              ParseScenarios();
+            }
+          }
+        }
+        return scenarios;
+      }
+    }
+    
+    public Model.OptimizationScenario GetByName(string name) {
+      foreach (var scen in Scenarios) {
+        if (scen.Name == name) {
+          return scen;
+        }
+      }
+      return null;
+    }
+
+    // http://www.sascha-dittmann.de/post/Webseitenpfade-einer-Windows-Azure-Web-Rolle-bestimmen.aspx
+    private static IEnumerable<string> WebSiteDirectories {
+      get {
+        var roleRootDir = Environment.GetEnvironmentVariable("RdRoleRoot");
+        if (roleRootDir == null)
+          return Enumerable.Empty<string>();
+        XNamespace roleModelNs =
+          "http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition";
+        var roleModelDoc = XDocument.Load(Path.Combine(roleRootDir, "RoleModel.xml"));
+        if (roleModelDoc.Root == null)
+          return Enumerable.Empty<string>();
+
+        var sites = roleModelDoc.Root.Element(roleModelNs + "Sites");
+        if (sites == null)
+          return Enumerable.Empty<string>();
+
+        var siteElements = sites.Elements(roleModelNs + "Site");
+
+        return
+          from siteElement in siteElements
+          where siteElement.Attribute("name") != null
+                && siteElement.Attribute("name").Value == "Web"
+                && siteElement.Attribute("physicalDirectory") != null
+          select Path.Combine(roleRootDir,
+                 siteElement.Attribute("physicalDirectory").Value);
+      }
+    }
+
+    private void ParseScenarios() {
+      var scens = new List<Model.OptimizationScenario>();
+      string path;
+      if (WebSiteDirectories.Count() != 0) {
+        path = WebSiteDirectories.FirstOrDefault() + @"\Mappings";
+      } else {
+        path = AppDomain.CurrentDomain.BaseDirectory + @"\Mappings";
+      }
+        
+      foreach (var file in Directory.EnumerateFiles(path, "*.xml")) {
+        var scenario = ParseScenario(file);
+        if (scenario != null)
+          scens.Add(scenario);
+      }
+
+      scenarios = scens;
+    }
+
+    private Model.OptimizationScenario ParseScenario(string filename) {
+      // Set the validation settings.
+      XmlReaderSettings settings = new XmlReaderSettings();
+      settings.ValidationType = ValidationType.Schema;
+      settings.Schemas.Add("urn:scenario-schema", AppDomain.CurrentDomain.BaseDirectory + @"\Mappings\scenario.xsd");
+      bool isErrorPresent = false;
+      settings.ValidationEventHandler += (sender, args) => {
+        Console.WriteLine(args.Message);
+        isErrorPresent = true;
+      };
+      Model.OptimizationScenario scenario = null;
+      using (var reader = XmlReader.Create(filename, settings)) {
+        while (!isErrorPresent && reader.Read()) {
+          if (reader.Name == "scenario" && reader.NodeType == XmlNodeType.Element) {
+            scenario = new Model.OptimizationScenario();
+            scenario.ProblemType = reader.GetAttribute("mapper");
+            scenario.ProblemType = reader.GetAttribute("algorithmType");
+            scenario.ProblemType = reader.GetAttribute("problemType");
+          }
+          else if (reader.Name == "name") {
+            scenario.Name = reader.ReadElementContentAsString();            
+          }
+          else if (reader.Name == "problemParameters") {
+            IList<Model.Parameter> problemParameters = ParseParameters(reader);
+            foreach (var param in problemParameters)
+              scenario.InputParameters.Items.Add(param);
+          }
+          else if (reader.Name == "algorithmParameters") {
+            IList<Model.Parameter> algoParameters = ParseParameters(reader);
+            foreach (var param in algoParameters)
+              scenario.AlgorithmParameters.Items.Add(param);
+          }
+        }
+      }
+      if (isErrorPresent)
+        return null;
+      return scenario;
+    }
+
+    struct ValueEntry {
+      public double v1;
+      public double v2;
+    };
+
+    private void ParseDecimalMatrix(Model.DecimalMatrix matrix, XmlReader reader) {      
+      IList<ValueEntry> ventries = new List<ValueEntry>();
+      while (reader.Read()) {        
+        if (reader.Name == "param")
+          break;
+        if (reader.Name == "value") {
+          var val1 = Convert.ToDouble(reader.GetAttribute("v1"), CultureInfo.InvariantCulture.NumberFormat);
+          var val2 = Convert.ToDouble(reader.GetAttribute("v2"), CultureInfo.InvariantCulture.NumberFormat);
+          ventries.Add(new ValueEntry() { v1 = val1, v2 = val2 });          
+        }
+      }
+      double[][] mat = new double[ventries.Count][];
+      int i=0;
+      foreach (var entry in ventries) {
+        mat[i] = new double[2];
+        mat[i][0] = entry.v1;
+        mat[i][1] = entry.v2;
+        i++;
+      }
+      matrix.Value = mat;
+    }
+
+    private IList<Model.Parameter> ParseParameters(XmlReader reader) {
+      IList<Model.Parameter> parameters = new List<Model.Parameter>();
+      while (reader.Read()) {
+        if (reader.Name.EndsWith("Parameters"))
+          break;
+        // parse parameter
+        if (reader.Depth == 2 && reader.Name == "param" && reader.NodeType == XmlNodeType.Element) {
+          var param = new Model.Parameter();
+          var typeAtt = reader.GetAttribute("type");
+          param.Type = (Model.ParameterType)Enum.Parse(typeof(Model.ParameterType), typeAtt);
+          switch (param.Type) {
+            case Model.ParameterType.Boolean:
+              param.Value = new Model.BoolValue() { Name = reader.GetAttribute("name"), Value = Convert.ToBoolean(reader.GetAttribute("value")) };
+              break;
+            case Model.ParameterType.Integer:
+            case Model.ParameterType.Percent:
+            case Model.ParameterType.Decimal:
+              //TODO: Check which comma char is being used; enhance to use any
+              param.Value = new Model.DecimalValue() { Name = reader.GetAttribute("name"), Value = Convert.ToDouble(reader.GetAttribute("value"), CultureInfo.InvariantCulture.NumberFormat) };
+              break;            
+            case Model.ParameterType.DecimalMatrix:
+              var decMatrix = new Model.DecimalMatrix() { Name = reader.GetAttribute("name") };
+              ParseDecimalMatrix(decMatrix, reader);
+              param.Value = decMatrix;
+              break;
+            case Model.ParameterType.DecimalVector:
+              var decVec = new Model.DecimalVector() { Name = reader.GetAttribute("name") };
+              ParseDecimalVector(decVec, reader);
+              param.Value = decVec;
+              break;
+            case Model.ParameterType.Type:
+              var type = new Model.TypeValue() { Name = reader.GetAttribute("name") };
+              ParseType(type, reader);
+              param.Value = type;
+              break;
+            case Model.ParameterType.String:
+              param.Value = new Model.StringValue() { Name = reader.GetAttribute("name"), Value = reader.GetAttribute("value") };
+              break;
+            default:
+              Console.WriteLine("Unhandled model type: " + param.Type);
+              break;
+          }
+          parameters.Add(param);
+        }
+      }
+      return parameters;
+    }
+
+    private void ParseType(Model.TypeValue type, XmlReader reader) {
+      var choices = new List<string>();
+      string selected = null;
+      while (reader.Read()) {
+        if (reader.Name == "param")
+          break;
+        if (reader.Name == "choice") {
+          var choice = reader.GetAttribute("name");
+          if (reader.HasAttributes && Convert.ToBoolean(reader.GetAttribute("selected"))) {            
+            selected = choice;
+          }
+          choices.Add(choice);
+        }
+      }
+      type.Options = choices.ToArray();
+      type.Value = selected;
+    }
+
+    private void ParseDecimalVector(Model.DecimalVector decVec, XmlReader reader) {
+      var entries = new List<double>();
+      //IList<ValueEntry> ventries = new List<ValueEntry>();
+      while (reader.Read()) {
+        if (reader.Name == "param")
+          break;
+        if (reader.Name == "value") {
+          var val1 = Convert.ToDouble(reader.GetAttribute("v1"), CultureInfo.InvariantCulture.NumberFormat);
+          entries.Add(val1);
+        }
+      }
+      decVec.Value = entries.ToArray();      
+    }
+  }
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Utility.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Utility.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Utility.cs	(revision 8817)
@@ -0,0 +1,37 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.Services.Optimization.ControllerService {
+  public static class Utility {
+    public static T[,] ToMultiD<T>(T[][] jArray) {
+      int i = jArray.Count();
+      int j = jArray.Select(x => x.Count()).Aggregate(0, (current, c) => (current > c) ? current : c);
+
+
+      var mArray = new T[i, j];
+
+      for (int ii = 0; ii < i; ii++) {
+        for (int jj = 0; jj < j; jj++) {
+          mArray[ii, jj] = jArray[ii][jj];
+        }
+      }
+
+      return mArray;
+    }
+
+    public static T[][] ToJagged<T>(T[,] mArray) {
+      var cols = mArray.GetLength(0);
+      var rows = mArray.GetLength(1);
+      var jArray = new T[cols][];
+      for (int i = 0; i < cols; i++) {
+        jArray[i] = new T[rows];
+        for (int j = 0; j < rows; j++) {
+          jArray[i][j] = mArray[i, j];
+        }
+      }
+      return jArray;
+    }
+  }
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/HeuristicLab.Services.Optimization.ControllerService.Tests.csproj
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/HeuristicLab.Services.Optimization.ControllerService.Tests.csproj	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/HeuristicLab.Services.Optimization.ControllerService.Tests.csproj	(revision 8817)
@@ -36,6 +36,129 @@
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="ALGLIB-3.5.0, Version=3.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\ALGLIB-3.5.0.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.PermutationEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.ParallelEngine-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.ParallelEngine-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.TravelingSalesman-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Problems.TravelingSalesman-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.VehicleRouting-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Problems.VehicleRouting-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.VehicleRouting-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Problems.VehicleRouting-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Tracing-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Tracing-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="IronPython">
+      <HintPath>..\ip\IronPython.dll</HintPath>
+    </Reference>
+    <Reference Include="IronPython.Modules">
+      <HintPath>..\ip\IronPython.Modules.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Dynamic">
+      <HintPath>..\ip\Microsoft.Dynamic.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Scripting">
+      <HintPath>..\ip\Microsoft.Scripting.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Scripting.AspNet">
+      <HintPath>..\ip\Microsoft.Scripting.AspNet.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Scripting.Metadata">
+      <HintPath>..\ip\Microsoft.Scripting.Metadata.dll</HintPath>
+    </Reference>
+    <Reference Include="Otis">
+      <HintPath>..\otis\build\bin\Debug\Otis.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
@@ -55,7 +178,21 @@
   </ItemGroup>
   <ItemGroup>
-    <None Include="app.config" />
+    <None Include="app.config">
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="mappings\mapping.py" />
+    <None Include="mappings\scenario.xsd">
+      <SubType>Designer</SubType>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="mappings\mapping.tsp.xml" />
+    <Content Include="mappings\tsp.xml" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PostBuildEvent>mkdir $(TargetDir)\mappings
+copy $(ProjectDir)\mappings\* $(TargetDir)\mappings</PostBuildEvent>
+  </PropertyGroup>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
Index: /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/Program.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/Program.cs	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/Program.cs	(revision 8817)
@@ -4,8 +4,25 @@
 using System.Text;
 using HeuristicLab.Services.Optimization.ControllerService.Interfaces;
+using HeuristicLab.Problems.TravelingSalesman;
+using System.Reflection;
+using System.IO;
+using Microsoft.Scripting.Hosting;
+using IronPython.Hosting;
+using HeuristicLab.Algorithms.GeneticAlgorithm;
+using HeuristicLab.Persistence.Core;
+using HeuristicLab.Core;
 
 namespace HeuristicLab.Services.Optimization.ControllerService.Tests {
   class Program {
     static void Main(string[] args) {
+      Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);    
+      //TestScenarioParser();
+      TestCodeDOM();
+      //TestPython();
+      //TestOtis();
+      //TestJobResults();
+    }
+
+    static void TestJobResults() {
       IScenarioManager manager = new HiveScenarioManager();
       Console.WriteLine("Press key to continue");
@@ -16,4 +33,192 @@
       }
     }
+
+    static void TestStorable() {
+      TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
+      GeneticAlgorithm algo = new GeneticAlgorithm();
+      algo.Problem = tsp;
+
+      
+    }
+
+    static void TestCodeDOM() {
+      ScenarioParser parser = new ScenarioParser();
+      var scen = parser.GetByName("Traveling Salesman Problem");
+      TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
+      GeneticAlgorithm algo = new GeneticAlgorithm();
+      algo.Problem = tsp;
+
+      // http://stackoverflow.com/questions/3188882/compile-and-run-dynamic-code-without-generating-exe
+      using (var csCodeProvider = new Microsoft.CSharp.CSharpCodeProvider()) {                
+
+        var cp = new System.CodeDom.Compiler.CompilerParameters() {
+            GenerateInMemory = true
+          };
+
+        var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
+        var loadedPaths = loadedAssemblies.Select(a => a.Location).ToArray();
+
+        var referencedPaths = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll");
+        foreach (var loadedAssembly in referencedPaths) {
+          cp.ReferencedAssemblies.Add(loadedAssembly);          
+        }
+        cp.ReferencedAssemblies.Add("System.dll");
+
+        tsp.BestKnownQuality = HLMapper.ConvertToDoubleValue(scen.InputParameters.FindByName("BestKnownQuality"));
+        
+        var res = csCodeProvider.CompileAssemblyFromSource(
+         cp
+         ,
+          @"using System;
+            using System.Collections.Generic;
+            using System.Linq;
+            using System.Text;
+            using HeuristicLab.Data;
+            using HeuristicLab.Services.Optimization.ControllerService.Model; 
+            using HeuristicLab.Optimization;
+            using HeuristicLab.Services.Optimization.ControllerService;
+            using HeuristicLab.Algorithms.GeneticAlgorithm;
+            using HeuristicLab.Problems.TravelingSalesman;
+            public class TSPScenarioMapper : IScenarioMapper {
+              public void MapScenario(OptimizationScenario scenario, IAlgorithm algorithm) {
+                Console.WriteLine(""Mapping scenario!"");
+                var ga = algorithm as GeneticAlgorithm;
+                var problem = algorithm.Problem as TravelingSalesmanProblem;
+                
+                problem.BestKnownQuality = HLMapper.ConvertToDoubleValue(scenario.InputParameters.FindByName(""BestKnownQuality""));
+                problem.BestKnownSolution = HLMapper.ConvertToPermutation(scenario.InputParameters.FindByName(""BestKnownSolution""));
+                problem.Coordinates = HLMapper.ConvertToDoubleMatrix(scenario.InputParameters.FindByName(""Coordinates""));
+                var evalParam = HLMapper.GetStringValue(scenario.InputParameters.FindByName(""EvaluatorParameter""));
+                if (evalParam == ""HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator"") {
+                  problem.EvaluatorParameter.Value = new TSPRoundedEuclideanPathEvaluator();
+                }
+                else if (evalParam == ""HeuristicLab.Problems.TravelingSalesman.TSPGeoPathEvaluator"") {
+                  problem.EvaluatorParameter.Value = new TSPGeoPathEvaluator();
+                }
+                else {
+                  problem.EvaluatorParameter.Value = new TSPEuclideanPathEvaluator();
+                }
+                problem.UseDistanceMatrix = HLMapper.ConvertToBoolValue(scenario.InputParameters.FindByName(""UseDistanceMatrix""));
+                Console.WriteLine(""Mapping algorithm..."");
+                ga.Mutator = HLMapper.FindInItemSet<HeuristicLab.Optimization.IManipulator>(ga.MutatorParameter.ValidValues, scenario.AlgorithmParameters.FindByName(""Mutator""));
+                ga.CrossoverParameter.Value = HLMapper.FindOperator<HeuristicLab.Optimization.ICrossover>(problem, scenario.AlgorithmParameters.FindByName(""CrossoverParameter""));
+                ga.Elites = HLMapper.ConvertToIntValue(scenario.AlgorithmParameters.FindByName(""Elites""));
+                ga.MaximumGenerations = HLMapper.ConvertToIntValue(scenario.AlgorithmParameters.FindByName(""MaximumGenerations""));
+                ga.MutationProbability = HLMapper.ConvertToPercentValue(scenario.AlgorithmParameters.FindByName(""MutationProbability""));                
+                ga.PopulationSize = HLMapper.ConvertToIntValue(scenario.AlgorithmParameters.FindByName(""PopulationSize""));
+                ga.Seed = HLMapper.ConvertToIntValue(scenario.AlgorithmParameters.FindByName(""Seed""));
+                ga.Selector = HLMapper.FindInItemSet<HeuristicLab.Optimization.ISelector>(ga.SelectorParameter.ValidValues, scenario.AlgorithmParameters.FindByName(""Selector""));
+                ga.SetSeedRandomly = HLMapper.ConvertToBoolValue(scenario.AlgorithmParameters.FindByName(""SetSeedRandomly""));
+              }
+            }"
+        );        
+
+        foreach (var error in res.Errors) {
+          Console.WriteLine(error);
+        }        
+        
+        var type = res.CompiledAssembly.GetType("TSPScenarioMapper");
+        var mapper = Activator.CreateInstance(type) as IScenarioMapper;
+        mapper.MapScenario(scen, algo);
+      }      
+    }
+
+    static void TestPython() {
+      ScenarioParser parser = new ScenarioParser();
+      var scen = parser.GetByName("Traveling Salesman Problem");
+      //TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
+      //GeneticAlgorithm algo = new GeneticAlgorithm();
+      //algo.Problem = tsp;
+      var rt = Python.CreateRuntime();
+      // workaround to load all referenced assemblies into the current AppDomain
+      var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
+      var loadedPaths = loadedAssemblies.Select(a => a.Location).ToArray();
+
+      var referencedPaths = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll");
+      var toLoad = referencedPaths.Where(r => !loadedPaths.Contains(r, StringComparer.InvariantCultureIgnoreCase)).ToList();
+      toLoad.ForEach(path => loadedAssemblies.Add(AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(path))));
+
+      foreach (var assm in AppDomain.CurrentDomain.GetAssemblies()) {                
+        rt.LoadAssembly(assm);  
+      }
+      
+      /*var scope = rt.CreateScope();
+      scope.SetVariable("source", scen);
+      scope.SetVariable("target", tsp);*/
+      var engine = rt.GetEngine("py");
+      char op = ' ';
+      while (op != 'q') {
+        try {
+          TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
+          GeneticAlgorithm algo = new GeneticAlgorithm();
+          algo.Problem = tsp;
+          Console.WriteLine("\n\n===============================================================");
+          var script = engine.CreateScriptSourceFromFile(System.Configuration.ConfigurationManager.AppSettings["scenarioPath"] + @"\mapping.py");          
+          var scope = engine.CreateScope();
+          scope.SetVariable("source", scen);
+          scope.SetVariable("problem", tsp);
+          scope.SetVariable("algorithm", algo);          
+          script.Execute(scope);                    
+        }
+        catch (Exception e) {
+          Console.WriteLine(e);
+        }
+        Console.WriteLine("Hit 'q' to quit...");
+        op = Console.ReadKey().KeyChar;
+      }
+
+      /*dynamic script = rt.UseFile("C:/temp/scenarios/mapping.py");
+      script.SetVariable("source", scen);
+      script.SetVariable("target", tsp);
+      
+
+      script.mapObjects(scen, tsp);*/
+      
+    }
+
+    static void TestOtis() {
+      Console.WriteLine();
+      Otis.Configuration cfg = new Otis.Configuration();
+      Model.DecimalValue dv = new Model.DecimalValue();
+      dv.Value = 100;
+      Console.WriteLine(dv);
+      Console.WriteLine(typeof(HeuristicLab.Data.DoubleValue).AssemblyQualifiedName);
+      Console.WriteLine(typeof(System.Double).AssemblyQualifiedName);
+
+      // workaround to load all referenced assemblies into the current AppDomain
+      var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
+      var loadedPaths = loadedAssemblies.Select(a => a.Location).ToArray();
+
+      var referencedPaths = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll");
+      var toLoad = referencedPaths.Where(r => !loadedPaths.Contains(r, StringComparer.InvariantCultureIgnoreCase)).ToList();
+      toLoad.ForEach(path => loadedAssemblies.Add(AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(path))));
+      
+      foreach (var assm in AppDomain.CurrentDomain.GetAssemblies()) {
+        //cfg.AddAssembly(assm);
+        cfg.AddAssemblyReference(assm);        
+      }
+      //cfg.AddAssemblyReference("HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec");
+      //cfg.AddAssemblyReference("HeuristicLab.Data-3.3.dll");
+      cfg.AddXmlFile(System.Configuration.ConfigurationManager.AppSettings["scenarioPath"] + @"\mapping.tsp.xml");
+
+      Otis.IAssembler<TravelingSalesmanProblem,Model.OptimizationScenario> asm = cfg.GetAssembler<TravelingSalesmanProblem,Model.OptimizationScenario>();
+      ScenarioParser parser = new ScenarioParser();
+      var scen = parser.GetByName("Traveling Salesman Problem");
+      TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
+      //tsp.BestKnownQuality = new Data.DoubleValue();
+      asm.Assemble(ref tsp, ref scen);
+      Console.WriteLine(tsp.BestKnownQuality);      
+    }
+
+    static void TestMapping() {
+    }
+
+    // template for mapping Model.OptimizationScenario & e.g. TSP
+    static void TestScenarioParser() {
+      ScenarioParser parser = new ScenarioParser();
+      var scen = parser.GetByName("Traveling Salesman Problem");
+      TravelingSalesmanProblem tsp = new TravelingSalesmanProblem();
+      // proceed with mapping between scen and tsp
+    }
   }
 }
Index: /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/Properties/AssemblyInfo.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/Properties/AssemblyInfo.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/Properties/AssemblyInfo.cs	(revision 8817)
@@ -0,0 +1,36 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Services.Optimization.ControllerService.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("FH-Hagenberg")]
+[assembly: AssemblyProduct("HeuristicLab.Services.Optimization.ControllerService.Tests")]
+[assembly: AssemblyCopyright("Copyright © FH-Hagenberg 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("0e306445-a9b1-472f-91fb-e9772cd36173")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/app.config
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/app.config	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/app.config	(revision 8817)
@@ -1,5 +1,7 @@
 <?xml version="1.0"?>
 <configuration>
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
+  </startup>
   <system.serviceModel>
     <diagnostics>
@@ -51,5 +53,5 @@
         </behavior>
       </endpointBehaviors>
-    </behaviors>    
+    </behaviors>
     <client>
       <endpoint address="http://127.0.0.1:8080/ControllerService.svc" behaviorConfiguration="LocalCertValidation" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IControllerService" contract="HeuristicLab.Services.Optimization.ControllerService.IControllerService" name="WSHttpBinding_IControllerService">
@@ -73,3 +75,25 @@
     </client>
   </system.serviceModel>
+  <appSettings>
+    <!--
+    <add key="scenarioPath" value="C:\temp\scenarios" />
+    <add key="scenarioSchemaPath" value="C:\temp\scenarios\scenario.xsd" />
+    -->
+    <!-- Adjust paths to your mappings folder -->
+    <add key="scenarioPath" value="C:\dev\Heuristiclab\branches\OaaS\HeuristicLab.Services.Optimization.ControllerService.Tests\mappings" />
+    <add key="scenarioSchemaPath" value="C:\dev\Heuristiclab\branches\OaaS\HeuristicLab.Services.Optimization.ControllerService.Tests\mappings\scenario.xsd" />
+    <add key="ClientSettingsProvider.ServiceUri" value="" />
+  </appSettings>
+  <system.web>
+    <membership defaultProvider="ClientAuthenticationMembershipProvider">
+      <providers>
+        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
+      </providers>
+    </membership>
+    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
+      <providers>
+        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
+      </providers>
+    </roleManager>
+  </system.web>
 </configuration>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/mapping.py
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/mapping.py	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/mapping.py	(revision 8817)
@@ -0,0 +1,88 @@
+from HeuristicLab.Data import DoubleValue, DoubleMatrix, BoolValue, IntValue, PercentValue
+from HeuristicLab.Encodings.PermutationEncoding import Permutation, PermutationTypes
+from HeuristicLab.Problems.TravelingSalesman import TSPRoundedEuclideanPathEvaluator, TSPGeoPathEvaluator, TSPEuclideanPathEvaluator
+from System import Array
+
+class HeuristicLabMapper:
+  def __init__(self):
+    self.__params = source.InputParameters
+
+  def UseParameters(self, params):
+    self.__params = params
+
+  def MapDoubleValue(self, name):
+    return DoubleValue(self.__params.FindByName(name).Value.Value)
+
+  def MapPermutation(self, name):
+    entries = Array.CreateInstance(int, self.__params.FindByName(name).Value.Value.Length)
+    i = 0
+    for value in self.__params.FindByName(name).Value.Value:
+      entries[i] = int(value)
+      i = i + 1
+    return Permutation(PermutationTypes.RelativeDirected, entries)  
+
+  def MapDoubleMatrix(self, name):
+    matrixEntries = self.__params.FindByName(name).Value.Value; 
+    result = Array.CreateInstance(float, matrixEntries.Length, matrixEntries[0].Length)
+    for i in range(matrixEntries.Length):    
+      for j in range(matrixEntries[i].Length):    
+        result[i, j] = matrixEntries[i][j]
+    return DoubleMatrix(result)  
+
+  def MapBoolValue(self, name):
+    return BoolValue(self.__params.FindByName(name).Value.Value)
+
+  def MapIntValue(self, name):
+    return IntValue(int(source.AlgorithmParameters.FindByName(name).Value.Value))
+
+  def MapPercentValue(self, name):
+    return PercentValue(self.__params.FindByName(name).Value.Value / 100)
+
+  def GetStringValue(self, name):
+    return self.__params.FindByName(name).Value.Value
+
+  def FindIn(self, name, lst):
+    param = self.__params.FindByName(name).Value.Value    
+    for operator in lst:  
+      if operator.Name == param:
+        return operator         
+    print "ERROR: Couldn't find " + name + " " + param
+    print "List: "
+    print lst   
+    return None
+
+  def FindOperator(self, name):
+    param = self.__params.FindByName(name).Value.Value    
+    for operator in problem.Operators:  
+      if operator.Name == param:
+        return operator      
+    return None
+
+
+mapper = HeuristicLabMapper()
+mapper.UseParameters(source.InputParameters)
+###### PROBLEM PARAMETERS ######
+problem.BestKnownQuality = mapper.MapDoubleValue("BestKnownQuality")
+problem.BestKnownSolution = mapper.MapPermutation("BestKnownSolution")
+problem.Coordinates = mapper.MapDoubleMatrix("Coordinates")
+evaluatorParameter = mapper.GetStringValue("EvaluatorParameter")
+if (evaluatorParameter == "HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator"):
+  problem.EvaluatorParameter.Value = TSPRoundedEuclideanPathEvaluator()
+elif (evaluatorParameter == "HeuristicLab.Problems.TravelingSalesman.TSPGeoPathEvaluator"):
+  problem.EvaluatorParameter.Value = TSPGeoPathEvaluator()
+else:
+  problem.EvaluatorParameter.Value = TSPEuclideanPathEvaluator()
+problem.UseDistanceMatrix = mapper.MapBoolValue("UseDistanceMatrix")
+
+###### ALGORITHM PARAMETERS ######
+mapper.UseParameters(source.AlgorithmParameters)
+# CrossoverParameter - string
+algorithm.CrossoverParameter.Value = mapper.FindOperator("CrossoverParameter")
+algorithm.Elites = mapper.MapIntValue("Elites")
+algorithm.MaximumGenerations = mapper.MapIntValue("MaximumGenerations")
+algorithm.MutationProbability = mapper.MapPercentValue("MutationProbability")
+algorithm.Mutator = mapper.FindIn("Mutator", algorithm.MutatorParameter.ValidValues)
+algorithm.PopulationSize = mapper.MapIntValue("PopulationSize")
+algorithm.Seed = mapper.MapIntValue("Seed")
+algorithm.Selector = mapper.FindIn("Selector", algorithm.SelectorParameter.ValidValues)
+algorithm.SetSeedRandomly = mapper.MapBoolValue("SetSeedRandomly")
Index: /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/mapping.tsp.xml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/mapping.tsp.xml	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/mapping.tsp.xml	(revision 8817)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- for testing resource reading-->
+<otis-mapping xmlns="urn:otis-mapping-1.0">
+	<!--corlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089-->
+	<!--DoubleValue, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec-->
+    <class name="HeuristicLab.Data.DoubleValue, HeuristicLab.Data-3.3" source="System.Double, mscorlib">
+		<member name="Value" expression="source"/>
+	</class>
+    <!--, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec-->
+	<!--, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null-->
+	<class name="HeuristicLab.Problems.TravelingSalesman.TravelingSalesmanProblem, HeuristicLab.Problems.TravelingSalesman-3.3" source="HeuristicLab.Services.Optimization.ControllerService.Model.OptimizationScenario, HeuristicLab.Services.Optimization.ControllerService" >
+		<!--member name="BestKnownQuality" expression="[$InputParameters.FindDoubleValue('BestKnownQuality')]"/-->
+		<member name="BestKnownQuality" expression="[HeuristicLab.Services.Optimization.ControllerService.Model.HiveMapper.FindDoubleValue($InputParameters, 'BestKnownQuality')]"/>
+	</class>
+	
+</otis-mapping>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/scenario.xsd
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/scenario.xsd	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/scenario.xsd	(revision 8817)
@@ -0,0 +1,45 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns="urn:scenario-schema"
+    elementFormDefault="qualified"
+    targetNamespace="urn:scenario-schema">
+
+ <xsd:element name="scenario" type="scenarioType"/>
+
+ <xsd:complexType name="scenarioType">
+  <xsd:sequence maxOccurs="1">   
+   <xsd:element name="name" type="xsd:string"/>
+   <xsd:element name="problemParameters" type="paramsType"/>
+   <xsd:element name="algorithmParameters" type="paramsType"/>
+  </xsd:sequence>
+  <xsd:attribute name="problemType" use="required"/>
+  <xsd:attribute name="algorithmType" use="required"/>
+  <xsd:attribute name="mapper" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="paramsType">
+  <xsd:sequence>
+   <xsd:element name="param" type="parameterType" minOccurs="1" maxOccurs="unbounded"/>      
+  </xsd:sequence>  
+ </xsd:complexType>
+
+ <xsd:complexType name="parameterType">
+  <xsd:choice>
+   <xsd:element name="value" type="valueType" minOccurs="0" maxOccurs="unbounded"/> 
+   <xsd:element name="choice" type="choiceType" minOccurs="0" maxOccurs="unbounded"/>      
+  </xsd:choice>
+  <xsd:attribute name="type" type="xsd:string" use="required"/>
+  <xsd:attribute name="name" type="xsd:string" use="required"/>
+  <xsd:attribute name="value" type="xsd:string"/>
+ </xsd:complexType>
+ 
+ <xsd:complexType name="choiceType">    
+  <xsd:attribute name="name" type="xsd:string" use="required"/>
+  <xsd:attribute name="selected" type="xsd:string"/>
+ </xsd:complexType>
+ 
+ <xsd:complexType name="valueType">
+  <xsd:attribute name="v1" type="xsd:string"/>
+  <xsd:attribute name="v2" type="xsd:string"/>
+ </xsd:complexType>
+
+</xsd:schema>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/tsp.xml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/tsp.xml	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.ControllerService.Tests/mappings/tsp.xml	(revision 8817)
@@ -0,0 +1,45 @@
+<?xml version='1.0'?>
+<scenario problemType="HeuristicLab.Problems.TravelingSalesman.TravelingSalesman"
+          algorithmType="HeuristicLab.Algorithms.GeneticAlgorithm"
+		  xmlns="urn:scenario-schema"
+          mapper="HeuristicLab.Controllers.HLMapper">
+  <name>Traveling Salesman Problem</name>
+  <problemParameters>
+    <param type="Decimal" name="BestKnownQuality" value="6110.0"/>
+    <param type="DecimalVector" name="BestKnownSolution">
+      <value v1="0"/>
+      <value v1="40"/>
+      <value v1="38"/>
+    </param>
+    <param type="DecimalMatrix" name="Coordinates">
+      <value v1="334.5909" v2="161.7809"/>
+      <value v1="503.5909" v2="172.7809"/>
+    </param>
+    <param type="Type" name="EvaluatorParameter">
+      <choice name="HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator" />
+      <choice name="HeuristicLab.Problems.TravelingSalesman.TSPGeoPathEvaluator" selected="true"/>
+      <choice name="HeuristicLab.Problems.TravelingSalesman.TSPEuclideanPathEvaluator"/>
+    </param>    
+    <param type="Boolean" name="UseDistanceMatrix" value="true"/> 
+  </problemParameters>
+  <algorithmParameters>
+    <param type="Type" name="CrossoverParameter">
+      <choice name="OrderCrossover2"/>
+      <choice name="CosaCrossover" selected="true"/>
+    </param>    
+    <param type="Integer" name="Elites" value="1"/>
+    <param type="Integer" name="MaximumGenerations" value="1000"/>
+    <param type="Percent" name="MutationProbability" value="5"/>
+    <param type="Type" name="Mutator">
+      <choice name="InversionManipulator" selected="true"/>
+      <choice name="ScrambleManipulator"/>
+    </param>
+    <param type="Integer" name="PopulationSize" value="100"/>
+    <param type="Integer" name="Seed" value="100"/>
+    <param type="Type" name="Selector">
+      <choice name="ProportionalSelector" selected="true"/>
+      <choice name="BestSelector"/>
+    </param>
+    <param type="Boolean" name="SetSeedRandomly" value="true"/>
+  </algorithmParameters>
+</scenario>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.HiveController/HeuristicLab.Services.Optimization.HiveController.csproj
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.HiveController/HeuristicLab.Services.Optimization.HiveController.csproj	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.HiveController/HeuristicLab.Services.Optimization.HiveController.csproj	(revision 8817)
@@ -0,0 +1,54 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{DDD9CC62-ED7D-48E0-834B-9876F130BB0F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Services.Optimization.HiveController</RootNamespace>
+    <AssemblyName>HeuristicLab.Services.Optimization.HiveController</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Class1.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.HiveController/Properties/AssemblyInfo.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.HiveController/Properties/AssemblyInfo.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.HiveController/Properties/AssemblyInfo.cs	(revision 8817)
@@ -0,0 +1,36 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Services.Optimization.HiveController")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("FH-Hagenberg")]
+[assembly: AssemblyProduct("HeuristicLab.Services.Optimization.HiveController")]
+[assembly: AssemblyCopyright("Copyright © FH-Hagenberg 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("6e1480c7-e1bf-4e1d-9409-54fee5ced46e")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj	(revision 8817)
@@ -25,4 +25,5 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <FilesToIncludeForPublish>AllFilesInProjectFolder</FilesToIncludeForPublish>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -136,4 +137,5 @@
     <Content Include="Global.asax" />
     <Content Include="ControllerService.svc" />
+    <Content Include="Mappings\tsp.xml" />
     <Content Include="Scripts\jquery-1.5.1-vsdoc.js" />
     <Content Include="Scripts\jquery-1.5.1.js" />
@@ -146,5 +148,7 @@
     <Content Include="Scripts\modernizr-1.7.js" />
     <Content Include="Scripts\modernizr-1.7.min.js" />
-    <Content Include="Web.config" />
+    <Content Include="Web.config">
+      <SubType>Designer</SubType>
+    </Content>
     <Content Include="Web.Debug.config">
       <DependentUpon>Web.config</DependentUpon>
@@ -247,4 +251,10 @@
   <ItemGroup>
     <Content Include="Views\Optimization\JobDetails.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Mappings\mapping.py" />
+    <None Include="Mappings\scenario.xsd">
+      <SubType>Designer</SubType>
+    </None>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/mapping.py
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/mapping.py	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/mapping.py	(revision 8817)
@@ -0,0 +1,88 @@
+from HeuristicLab.Data import DoubleValue, DoubleMatrix, BoolValue, IntValue, PercentValue
+from HeuristicLab.Encodings.PermutationEncoding import Permutation, PermutationTypes
+from HeuristicLab.Problems.TravelingSalesman import TSPRoundedEuclideanPathEvaluator, TSPGeoPathEvaluator, TSPEuclideanPathEvaluator
+from System import Array
+
+class HeuristicLabMapper:
+  def __init__(self):
+    self.__params = source.InputParameters
+
+  def UseParameters(self, params):
+    self.__params = params
+
+  def MapDoubleValue(self, name):
+    return DoubleValue(self.__params.FindByName(name).Value.Value)
+
+  def MapPermutation(self, name):
+    entries = Array.CreateInstance(int, self.__params.FindByName(name).Value.Value.Length)
+    i = 0
+    for value in self.__params.FindByName(name).Value.Value:
+      entries[i] = int(value)
+      i = i + 1
+    return Permutation(PermutationTypes.RelativeDirected, entries)  
+
+  def MapDoubleMatrix(self, name):
+    matrixEntries = self.__params.FindByName(name).Value.Value; 
+    result = Array.CreateInstance(float, matrixEntries.Length, matrixEntries[0].Length)
+    for i in range(matrixEntries.Length):    
+      for j in range(matrixEntries[i].Length):    
+        result[i, j] = matrixEntries[i][j]
+    return DoubleMatrix(result)  
+
+  def MapBoolValue(self, name):
+    return BoolValue(self.__params.FindByName(name).Value.Value)
+
+  def MapIntValue(self, name):
+    return IntValue(int(source.AlgorithmParameters.FindByName(name).Value.Value))
+
+  def MapPercentValue(self, name):
+    return PercentValue(self.__params.FindByName(name).Value.Value / 100)
+
+  def GetStringValue(self, name):
+    return self.__params.FindByName(name).Value.Value
+
+  def FindIn(self, name, lst):
+    param = self.__params.FindByName(name).Value.Value    
+    for operator in lst:  
+      if operator.Name == param:
+        return operator         
+    print "ERROR: Couldn't find " + name + " " + param
+    print "List: "
+    print lst   
+    return None
+
+  def FindOperator(self, name):
+    param = self.__params.FindByName(name).Value.Value    
+    for operator in problem.Operators:  
+      if operator.Name == param:
+        return operator      
+    return None
+
+
+mapper = HeuristicLabMapper()
+mapper.UseParameters(source.InputParameters)
+###### PROBLEM PARAMETERS ######
+problem.BestKnownQuality = mapper.MapDoubleValue("BestKnownQuality")
+problem.BestKnownSolution = mapper.MapPermutation("BestKnownSolution")
+problem.Coordinates = mapper.MapDoubleMatrix("Coordinates")
+evaluatorParameter = mapper.GetStringValue("EvaluatorParameter")
+if (evaluatorParameter == "HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator"):
+  problem.EvaluatorParameter.Value = TSPRoundedEuclideanPathEvaluator()
+elif (evaluatorParameter == "HeuristicLab.Problems.TravelingSalesman.TSPGeoPathEvaluator"):
+  problem.EvaluatorParameter.Value = TSPGeoPathEvaluator()
+else:
+  problem.EvaluatorParameter.Value = TSPEuclideanPathEvaluator()
+problem.UseDistanceMatrix = mapper.MapBoolValue("UseDistanceMatrix")
+
+###### ALGORITHM PARAMETERS ######
+mapper.UseParameters(source.AlgorithmParameters)
+# CrossoverParameter - string
+algorithm.CrossoverParameter.Value = mapper.FindOperator("CrossoverParameter")
+algorithm.Elites = mapper.MapIntValue("Elites")
+algorithm.MaximumGenerations = mapper.MapIntValue("MaximumGenerations")
+algorithm.MutationProbability = mapper.MapPercentValue("MutationProbability")
+algorithm.Mutator = mapper.FindIn("Mutator", algorithm.MutatorParameter.ValidValues)
+algorithm.PopulationSize = mapper.MapIntValue("PopulationSize")
+algorithm.Seed = mapper.MapIntValue("Seed")
+algorithm.Selector = mapper.FindIn("Selector", algorithm.SelectorParameter.ValidValues)
+algorithm.SetSeedRandomly = mapper.MapBoolValue("SetSeedRandomly")
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/scenario.xsd
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/scenario.xsd	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/scenario.xsd	(revision 8817)
@@ -0,0 +1,45 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns="urn:scenario-schema"
+    elementFormDefault="qualified"
+    targetNamespace="urn:scenario-schema">
+
+ <xsd:element name="scenario" type="scenarioType"/>
+
+ <xsd:complexType name="scenarioType">
+  <xsd:sequence maxOccurs="1">   
+   <xsd:element name="name" type="xsd:string"/>
+   <xsd:element name="problemParameters" type="paramsType"/>
+   <xsd:element name="algorithmParameters" type="paramsType"/>
+  </xsd:sequence>
+  <xsd:attribute name="problemType" use="required"/>
+  <xsd:attribute name="algorithmType" use="required"/>
+  <xsd:attribute name="mapper" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="paramsType">
+  <xsd:sequence>
+   <xsd:element name="param" type="parameterType" minOccurs="1" maxOccurs="unbounded"/>      
+  </xsd:sequence>  
+ </xsd:complexType>
+
+ <xsd:complexType name="parameterType">
+  <xsd:choice>
+   <xsd:element name="value" type="valueType" minOccurs="0" maxOccurs="unbounded"/> 
+   <xsd:element name="choice" type="choiceType" minOccurs="0" maxOccurs="unbounded"/>      
+  </xsd:choice>
+  <xsd:attribute name="type" type="xsd:string" use="required"/>
+  <xsd:attribute name="name" type="xsd:string" use="required"/>
+  <xsd:attribute name="value" type="xsd:string"/>
+ </xsd:complexType>
+ 
+ <xsd:complexType name="choiceType">    
+  <xsd:attribute name="name" type="xsd:string" use="required"/>
+  <xsd:attribute name="selected" type="xsd:string"/>
+ </xsd:complexType>
+ 
+ <xsd:complexType name="valueType">
+  <xsd:attribute name="v1" type="xsd:string"/>
+  <xsd:attribute name="v2" type="xsd:string"/>
+ </xsd:complexType>
+
+</xsd:schema>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/tsp.xml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/tsp.xml	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/tsp.xml	(revision 8817)
@@ -0,0 +1,45 @@
+<?xml version='1.0'?>
+<scenario problemType="HeuristicLab.Problems.TravelingSalesman.TravelingSalesman"
+          algorithmType="HeuristicLab.Algorithms.GeneticAlgorithm"
+		  xmlns="urn:scenario-schema"
+          mapper="HeuristicLab.Controllers.HLMapper">
+  <name>Traveling Salesman Problem</name>
+  <problemParameters>
+    <param type="Decimal" name="BestKnownQuality" value="6110.0"/>
+    <param type="DecimalVector" name="BestKnownSolution">
+      <value v1="0"/>
+      <value v1="40"/>
+      <value v1="38"/>
+    </param>
+    <param type="DecimalMatrix" name="Coordinates">
+      <value v1="334.5909" v2="161.7809"/>
+      <value v1="503.5909" v2="172.7809"/>
+    </param>
+    <param type="Type" name="EvaluatorParameter">
+      <choice name="HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator" />
+      <choice name="HeuristicLab.Problems.TravelingSalesman.TSPGeoPathEvaluator" selected="true"/>
+      <choice name="HeuristicLab.Problems.TravelingSalesman.TSPEuclideanPathEvaluator"/>
+    </param>    
+    <param type="Boolean" name="UseDistanceMatrix" value="true"/> 
+  </problemParameters>
+  <algorithmParameters>
+    <param type="Type" name="CrossoverParameter">
+      <choice name="OrderCrossover2"/>
+      <choice name="CosaCrossover" selected="true"/>
+    </param>    
+    <param type="Integer" name="Elites" value="1"/>
+    <param type="Integer" name="MaximumGenerations" value="1000"/>
+    <param type="Percent" name="MutationProbability" value="5"/>
+    <param type="Type" name="Mutator">
+      <choice name="InversionManipulator" selected="true"/>
+      <choice name="ScrambleManipulator"/>
+    </param>
+    <param type="Integer" name="PopulationSize" value="100"/>
+    <param type="Integer" name="Seed" value="100"/>
+    <param type="Type" name="Selector">
+      <choice name="ProportionalSelector" selected="true"/>
+      <choice name="BestSelector"/>
+    </param>
+    <param type="Boolean" name="SetSeedRandomly" value="true"/>
+  </algorithmParameters>
+</scenario>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Properties/AssemblyInfo.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Properties/AssemblyInfo.cs	(revision 8817)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Properties/AssemblyInfo.cs	(revision 8817)
@@ -0,0 +1,35 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Services.Optimization.Web")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("FH-Hagenberg")]
+[assembly: AssemblyProduct("HeuristicLab.Services.Optimization.Web")]
+[assembly: AssemblyCopyright("Copyright © FH-Hagenberg 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a8a5906f-6cef-40f5-8572-c2b49a1f985b")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalMatrix.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalMatrix.cshtml	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalMatrix.cshtml	(revision 8817)
@@ -7,5 +7,5 @@
   @for (int i = 0; i < Model.Value.Length; i++) {
   <tr>
-    @for (int j = 0; j < Model.Value[j].Length; j++) {                      
+    @for (int j = 0; j < Model.Value[i].Length; j++) {                      
     <td>
       @Model.Value[i][j]
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalMatrix.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalMatrix.cshtml	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalMatrix.cshtml	(revision 8817)
@@ -7,5 +7,5 @@
   @for (int i = 0; i < Model.Value.Length; i++) {
   <tr>
-    @for (int j = 0; j < Model.Value[j].Length; j++) {                      
+    @for (int j = 0; j < Model.Value[i].Length; j++) {                      
     <td>
       @Html.Raw(Html.TextBoxFor(model => Model.Value[i][j]).ToString().Replace("itm.Value.Value[" + i + "][" + j + "]", Model.Name + "_" + i + "_" + j))
Index: /branches/OaaS/HeuristicLab.Services.Optimization/HeuristicLab.Services.Optimization.ccproj
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization/HeuristicLab.Services.Optimization.ccproj	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization/HeuristicLab.Services.Optimization.ccproj	(revision 8817)
@@ -55,4 +55,7 @@
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <Folder Include="HeuristicLab.Services.Hive.WebRoleContent\" />
+  </ItemGroup>
   <!-- Import the target files for this project template -->
   <PropertyGroup>
Index: /branches/OaaS/HeuristicLab.Services.Optimization/ServiceConfiguration.Cloud.cscfg
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization/ServiceConfiguration.Cloud.cscfg	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization/ServiceConfiguration.Cloud.cscfg	(revision 8817)
@@ -27,4 +27,5 @@
     <Certificates>
       <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="5D180FD78AB82CA765690BBADC60014C6D4A88CA" thumbprintAlgorithm="sha1" />
+      <Certificate name="localhost" thumbprint="0F3B035DAC806C637B8E7A5BC957D8D30CFD6057" thumbprintAlgorithm="sha1" />
     </Certificates>
   </Role>
Index: /branches/OaaS/HeuristicLab.Services.Optimization/ServiceConfiguration.Local.cscfg
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization/ServiceConfiguration.Local.cscfg	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization/ServiceConfiguration.Local.cscfg	(revision 8817)
@@ -27,4 +27,5 @@
     <Certificates>
       <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="5D180FD78AB82CA765690BBADC60014C6D4A88CA" thumbprintAlgorithm="sha1" />
+      <Certificate name="localhost" thumbprint="0F3B035DAC806C637B8E7A5BC957D8D30CFD6057" thumbprintAlgorithm="sha1" />
     </Certificates>
   </Role>
Index: /branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.build.csdef
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.build.csdef	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.build.csdef	(revision 8817)
@@ -32,4 +32,9 @@
       <Certificate name="localhost" storeLocation="LocalMachine" storeName="My" />
     </Certificates>
+    <Contents>
+      <Content destination=".\">
+        <SourceDirectory path="rcf/Debug/HeuristicLab.Services.Hive.WebRoleContent\" />
+      </Content>
+    </Contents>
   </WebRole>
   <WebRole name="HeuristicLab.Services.Optimization.Web" vmsize="Small">
@@ -48,4 +53,7 @@
       <Import moduleName="RemoteAccess" />
     </Imports>
+    <Certificates>
+      <Certificate name="localhost" storeLocation="LocalMachine" storeName="My" />
+    </Certificates>
   </WebRole>
 </ServiceDefinition>
Index: /branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.csdef
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.csdef	(revision 8816)
+++ /branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.csdef	(revision 8817)
@@ -39,4 +39,7 @@
       <Import moduleName="RemoteAccess" />
     </Imports>
+    <Certificates>
+      <Certificate name="localhost" storeLocation="LocalMachine" storeName="My" />
+    </Certificates>
   </WebRole>
 </ServiceDefinition>
