Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Dispatcher.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Dispatcher.cs	(revision 1071)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Dispatcher.cs	(revision 1072)
@@ -64,5 +64,9 @@
                .GroupBy(t => (int)((Literal)t.Property).Value);
             foreach (var targetVariable in targetVariableStatements) {
-              numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject].Add(targetVariable.Key, targetVariable.Count());
+              if (numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject].ContainsKey(targetVariable.Key)) {
+                numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject][targetVariable.Key] = targetVariable.Count();
+              } else {
+                numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject].Add(targetVariable.Key, targetVariable.Count());
+              }
             }
           }
@@ -87,7 +91,10 @@
     public Execution GetNextJob() {
       if (dispatchQueue.Count == 0) FillDispatchQueue();
-      Execution next = dispatchQueue[0];
-      dispatchQueue.RemoveAt(0);
-      return next;
+      if (dispatchQueue.Count > 0) {
+        Execution next = dispatchQueue[0];
+        dispatchQueue.RemoveAt(0);
+        return next;
+      } else
+        return null;
     }
 
@@ -113,6 +120,6 @@
       StandardGP sgp = new StandardGP();
       sgp.SetSeedRandomly = true;
-      sgp.MaxGenerations = 100;
-      sgp.PopulationSize = 10000;
+      sgp.MaxGenerations = 1;
+      sgp.PopulationSize = 1000;
       sgp.Elites = 1;
       sgp.ProblemInjector = probInjector;
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Executer.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Executer.cs	(revision 1071)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Executer.cs	(revision 1072)
@@ -69,8 +69,11 @@
             // get an execution from the dispatcher and execute in grid via job-manager
             Execution execution = dispatcher.GetNextJob();
-            AtomicOperation op = new AtomicOperation(execution.Engine.OperatorGraph.InitialOperator, execution.Engine.GlobalScope);
-            WaitHandle opWh = jobManager.BeginExecuteOperation(execution.Engine.GlobalScope, op);
-            wh.Add(opWh);
-            activeOperations.Add(opWh, op);
+            if (execution != null) {
+              AtomicOperation op = new AtomicOperation(execution.Engine.OperatorGraph.InitialOperator, execution.Engine.GlobalScope);
+              WaitHandle opWh = jobManager.BeginExecuteOperation(execution.Engine.GlobalScope, op);
+              wh.Add(opWh);
+              activeOperations.Add(opWh, op);
+              activeExecutions.Add(opWh, execution);
+            }
           }
           // wait until any job is finished
@@ -90,12 +93,5 @@
           }
           if (finishedEngine != null) {
-            Entity modelEntity = new Entity(Ontology.CedmaNameSpace+Guid.NewGuid());
-            store.Add(new Statement(modelEntity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree));
-            Entity targetVariableAttr = new Entity(Ontology.CedmaNameSpace+Guid.NewGuid());
-            store.Add(new Statement(modelEntity, Ontology.PredicateModelAttribute, targetVariableAttr));
-            store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeName, new Literal("TargetVariable")));
-            store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeValue, new Literal(finishedExecution.TargetVariable)));
-            store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeType, Ontology.TypeCategoricalAttribute));
-            store.Add(new Statement(finishedExecution.DataSetEntity, Ontology.PredicateHasModel, modelEntity));
+            StoreResults(finishedExecution, finishedEngine);
           }
         }
@@ -105,4 +101,23 @@
       }
     }
+
+    private void StoreResults(Execution finishedExecution, ProcessingEngine finishedEngine) {
+      Entity modelEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
+      store.Add(new Statement(modelEntity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree));
+      store.Add(new Statement(finishedExecution.DataSetEntity, Ontology.PredicateHasModel, modelEntity));
+      Entity targetVariableAttr = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
+      store.Add(new Statement(modelEntity, Ontology.PredicateModelAttribute, targetVariableAttr));
+      store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeName, new Literal("TargetVariable")));
+      store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeValue, new Literal(finishedExecution.TargetVariable)));
+      store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeType, Ontology.TypeCategoricalAttribute));
+
+      Scope bestModelScope = finishedEngine.GlobalScope.GetVariableValue<Scope>("BestValidationSolution", false);
+      double validationMape = bestModelScope.GetVariableValue<DoubleData>("ValidationMAPE", false).Data;
+      Entity validationMapeAttr = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
+      store.Add(new Statement(modelEntity, Ontology.PredicateModelAttribute, validationMapeAttr));
+      store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeName, new Literal("ValidationMeanAbsolutePercentageError")));
+      store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeValue, new Literal(validationMape)));
+      store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeType, Ontology.TypeOrdinalAttribute));
+    }
   }
 }
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.sln
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.sln	(revision 1071)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.sln	(revision 1072)
@@ -515,4 +515,5 @@
 		{E66D1EAA-525C-4F6D-BD25-DBCAE3750E25}.Visualization Debug|x86.Build.0 = Debug|x86
 		{545CE756-98D8-423B-AC2E-6E7D70926E5C}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86
+		{545CE756-98D8-423B-AC2E-6E7D70926E5C}.CEDMA Debug|Any CPU.Build.0 = Debug|x86
 		{545CE756-98D8-423B-AC2E-6E7D70926E5C}.CEDMA Debug|x86.ActiveCfg = Debug|x86
 		{545CE756-98D8-423B-AC2E-6E7D70926E5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -736,5 +737,6 @@
 		{23117533-8A91-474E-BBF6-C39485D0810A}.Visualization Debug|x86.ActiveCfg = Debug|x86
 		{23117533-8A91-474E-BBF6-C39485D0810A}.Visualization Debug|x86.Build.0 = Debug|x86
-		{1F5FA590-1D2D-406C-BDBD-03BAECEA3C80}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86
+		{1F5FA590-1D2D-406C-BDBD-03BAECEA3C80}.CEDMA Debug|Any CPU.ActiveCfg = Release|x86
+		{1F5FA590-1D2D-406C-BDBD-03BAECEA3C80}.CEDMA Debug|Any CPU.Build.0 = Release|x86
 		{1F5FA590-1D2D-406C-BDBD-03BAECEA3C80}.CEDMA Debug|x86.ActiveCfg = Debug|x86
 		{1F5FA590-1D2D-406C-BDBD-03BAECEA3C80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -749,5 +751,6 @@
 		{1F5FA590-1D2D-406C-BDBD-03BAECEA3C80}.Visualization Debug|x86.ActiveCfg = Debug|x86
 		{1F5FA590-1D2D-406C-BDBD-03BAECEA3C80}.Visualization Debug|x86.Build.0 = Debug|x86
-		{1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86
+		{1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|Any CPU.ActiveCfg = Release|x86
+		{1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|Any CPU.Build.0 = Release|x86
 		{1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|x86.ActiveCfg = Debug|x86
 		{1F1CF3ED-374C-4288-995B-93F6B872F571}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -762,6 +765,6 @@
 		{1F1CF3ED-374C-4288-995B-93F6B872F571}.Visualization Debug|x86.ActiveCfg = Debug|x86
 		{1F1CF3ED-374C-4288-995B-93F6B872F571}.Visualization Debug|x86.Build.0 = Debug|x86
-		{74223A32-C726-4978-BE78-37113A18373C}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86
-		{74223A32-C726-4978-BE78-37113A18373C}.CEDMA Debug|Any CPU.Build.0 = Debug|x86
+		{74223A32-C726-4978-BE78-37113A18373C}.CEDMA Debug|Any CPU.ActiveCfg = Release|x86
+		{74223A32-C726-4978-BE78-37113A18373C}.CEDMA Debug|Any CPU.Build.0 = Release|x86
 		{74223A32-C726-4978-BE78-37113A18373C}.CEDMA Debug|x86.ActiveCfg = Debug|x86
 		{74223A32-C726-4978-BE78-37113A18373C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -776,5 +779,6 @@
 		{74223A32-C726-4978-BE78-37113A18373C}.Visualization Debug|x86.ActiveCfg = Debug|x86
 		{74223A32-C726-4978-BE78-37113A18373C}.Visualization Debug|x86.Build.0 = Debug|x86
-		{7C20D100-8BEB-433A-9499-F075E2CB9297}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86
+		{7C20D100-8BEB-433A-9499-F075E2CB9297}.CEDMA Debug|Any CPU.ActiveCfg = Release|x86
+		{7C20D100-8BEB-433A-9499-F075E2CB9297}.CEDMA Debug|Any CPU.Build.0 = Release|x86
 		{7C20D100-8BEB-433A-9499-F075E2CB9297}.CEDMA Debug|x86.ActiveCfg = Debug|x86
 		{7C20D100-8BEB-433A-9499-F075E2CB9297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -789,5 +793,6 @@
 		{7C20D100-8BEB-433A-9499-F075E2CB9297}.Visualization Debug|x86.ActiveCfg = Debug|x86
 		{7C20D100-8BEB-433A-9499-F075E2CB9297}.Visualization Debug|x86.Build.0 = Debug|x86
-		{6084CFB5-733F-449D-9F92-2E40D13F0514}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86
+		{6084CFB5-733F-449D-9F92-2E40D13F0514}.CEDMA Debug|Any CPU.ActiveCfg = Release|x86
+		{6084CFB5-733F-449D-9F92-2E40D13F0514}.CEDMA Debug|Any CPU.Build.0 = Release|x86
 		{6084CFB5-733F-449D-9F92-2E40D13F0514}.CEDMA Debug|x86.ActiveCfg = Debug|x86
 		{6084CFB5-733F-449D-9F92-2E40D13F0514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -899,5 +904,6 @@
 		{8B14A35E-DBDF-43EB-B019-23E9FBC5A35E}.Visualization Debug|x86.ActiveCfg = Debug|x86
 		{8B14A35E-DBDF-43EB-B019-23E9FBC5A35E}.Visualization Debug|x86.Build.0 = Debug|x86
-		{A0821479-801F-43DF-B788-AE92FB410DA9}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86
+		{A0821479-801F-43DF-B788-AE92FB410DA9}.CEDMA Debug|Any CPU.ActiveCfg = Release|x86
+		{A0821479-801F-43DF-B788-AE92FB410DA9}.CEDMA Debug|Any CPU.Build.0 = Release|x86
 		{A0821479-801F-43DF-B788-AE92FB410DA9}.CEDMA Debug|x86.ActiveCfg = Debug|x86
 		{A0821479-801F-43DF-B788-AE92FB410DA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
