Index: /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/Program.cs
===================================================================
--- /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/Program.cs	(revision 7543)
+++ /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/Program.cs	(revision 7544)
@@ -27,4 +27,10 @@
 using HeuristicLab.Persistence.Default.Xml;
 using System.Threading;
+using Microsoft.Hpc.Scheduler;
+using System.Net;
+using System.ServiceModel;
+using HeuristicLab.Operators.MPISupport;
+using HeuristicLab.Core;
+using System.Diagnostics;
 
 namespace HeuristicLab.MPIAlgorithmRunner {
@@ -33,17 +39,143 @@
 
     static void Main(string[] args) {
-      if (args.Length != 2) {
-        Console.WriteLine("Args:" + args.Length);
-
-        throw new ArgumentException("You must provide two arguments - the algorithm file and the result file");
+      if (args.Length == 2) {
+        string fileName = args[0];
+        string resultName = args[1];
+
+        using (new MPI.Environment(ref args)) {
+          if (MPI.Communicator.world.Rank != 0) {
+            Program p = new Program();
+            p.StartAlgorithm(fileName, resultName + MPI.Communicator.world.Rank + ".hl");
+          }
+        }
+      } else {
+        using (new MPI.Environment(ref args)) {
+          int clients = MPI.Communicator.world.Group.Size - 1;
+          Console.WriteLine("Clients: " + clients);
+
+          MPI.Communicator communicator = MPI.Communicator.world.Clone() as MPI.Communicator;
+
+          if (communicator.Rank == 0) {
+            ServiceHost service = AlgorithmBroker.StartService(communicator);
+            AlgorithmBroker broker = (service.SingletonInstance as AlgorithmBroker);
+
+            string address = GetAddress(service);
+            SetJobStatus(address);
+
+            bool[] finished = new bool[clients];
+            int finishedCount = 0;
+
+            while (finishedCount != clients) {
+              ItemList<ResultCollection> results = new ItemList<ResultCollection>();
+
+              for (int i = 0; i < clients; i++) {
+                if (!finished[i]) {
+                  int client = i + 1;
+                  ResultCollection result = communicator.Receive<MPITransportWrapper<ResultCollection>>(client, 1).InnerItem;
+
+                  Console.WriteLine("Received result " + result);
+
+                  if (results.Count != clients) {
+                    results.Add(result);
+                  } else {
+                    results[i] = result;
+                  }
+
+                  Console.WriteLine("Probing...");
+                  if (communicator.ImmediateProbe(client, 2) != null) {
+                    finished[i] = true;
+                    finishedCount++;
+                  }
+                }
+              }
+
+              Console.WriteLine("Update results");
+              lock (broker.resultLocker)
+                broker.Results = results;
+            }
+
+            lock (broker.ExitWaitHandle) {
+              broker.Terminated = true;
+            }
+
+            broker.ExitWaitHandle.WaitOne();
+            Console.WriteLine("Finished.");
+            Thread.Sleep(1000);
+            service.Close();
+          } else {
+              Program p = new Program();
+              p.StartAlgorithm(communicator);
+          }
+        }
+      }       
+    }
+
+    private static void SetJobStatus(string address) {
+      Console.WriteLine("Started service... at " + address);
+
+      // Discover the job's context from the environment
+      String headNodeName = System.Environment.GetEnvironmentVariable("CCP_SCHEDULER");
+      int jobId = System.Convert.ToInt32(System.Environment.GetEnvironmentVariable("CCP_JOBID"));
+
+      Console.WriteLine(jobId + "@" + headNodeName);
+
+      // Connect to the head node and get the job
+      IScheduler scheduler = new Scheduler();
+      scheduler.Connect(headNodeName);
+      ISchedulerJob job = scheduler.OpenJob(jobId);
+
+      job.SetCustomProperty("address", address);
+
+      job.Commit();
+    }
+
+    private static string GetAddress(ServiceHost service) {
+      IPHostEntry IPHost = Dns.GetHostByName(Dns.GetHostName());
+      string address = "net.tcp://" + IPHost.AddressList[0].ToString() + ":" + service.ChannelDispatchers[0].Listener.Uri.Port + "/AlgorithmBroker";
+
+      return address;
+    }
+
+    public void StartAlgorithm(MPI.Communicator communicator) {
+      IAlgorithm alg = communicator.Receive<MPITransportWrapper<IAlgorithm>>(0, 0).InnerItem;
+      int updateInterval = communicator.Receive<int>(0, 1);
+
+      Console.WriteLine("Starting algorithm...");
+
+      alg.Prepare(true);
+      waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
+      alg.Started += new EventHandler(alg_Started);
+      alg.Start();
+
+      waitHandle.WaitOne();
+
+      alg.Started -= new EventHandler(alg_Started);
+
+      while (alg.ExecutionState != ExecutionState.Stopped) {
+        Console.WriteLine("Pausing alg...");
+        alg.Pause();
+
+        while (alg.ExecutionState == ExecutionState.Started) {
+          Thread.Sleep(100);
+        }
+
+        communicator.Send<MPITransportWrapper<ResultCollection>>(
+          new MPITransportWrapper<ResultCollection>(alg.Results), 0, 1);
+
+        Console.WriteLine("Sending update...");
+
+        Console.WriteLine("Resuming alg...");
+        if (alg.ExecutionState == ExecutionState.Paused)
+          alg.Start();
+        Thread.Sleep(updateInterval);
       }
 
-      string fileName = args[0];
-      string resultName = args[1];
-
-      using (new MPI.Environment(ref args)) {
-        Program p = new Program();
-        p.StartAlgorithm(fileName, resultName + MPI.Communicator.world.Rank + ".hl");
-      }
+      communicator.Send<int>(communicator.Rank, 0, 2);
+      communicator.Send<MPITransportWrapper<ResultCollection>>(
+          new MPITransportWrapper<ResultCollection>(alg.Results), 0, 1);
+    }
+
+    void alg_Started(object sender, EventArgs e) {
+      waitHandle.Set();
     }
 
@@ -56,6 +188,9 @@
       alg.Prepare(true);
       alg.Start();
-
-      Thread.Sleep(10000);      
+      Console.WriteLine("ALG STARTED");
+      Stopwatch sw = new Stopwatch();
+      sw.Start();
+
+     /* Thread.Sleep(10000);      
       Thread t = new Thread(delegate() {
         while (true) {
@@ -82,13 +217,22 @@
       });
       t.IsBackground = true;
-      t.Start();
+      t.Start();*/
 
       waitHandle.WaitOne();
 
+      Console.WriteLine("ALG STOPPED");
+      sw.Stop();
+      Console.WriteLine("TIME: " + sw.ElapsedMilliseconds + "ms");
+
+      if (alg.Results.ContainsKey("Best valid Solution Distance") && alg.Results.ContainsKey("Best valid Solution Vehicles")) {
+        Console.WriteLine("BestDistance: " + alg.Results["Best valid Solution Distance"].Value.ToString() + ", " + 
+                          "BestVehicles: " + alg.Results["Best valid Solution Vehicles"].Value.ToString());
+      }
+
       XmlGenerator.Serialize(alg, resultName);
     }
 
     void algorithm_Stopped(object sender, EventArgs e) {
-      waitHandle.Set();
+      waitHandle.Set(); 
     }
   }
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Core/ScopeTransfer.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Core/ScopeTransfer.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Core/ScopeTransfer.cs	(revision 7544)
@@ -0,0 +1,54 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
+  [Serializable]
+  class ScopeTransfer {
+    public string Name { get; set; }
+    public string Description { get; set; }
+    public List<VariableTransfer> Variables { get; set; }
+    public List<ScopeTransfer> SubScopes { get; set; }
+
+    public ScopeTransfer() {
+      Variables = new List<VariableTransfer>();
+      SubScopes = new List<ScopeTransfer>();
+    }
+
+    public static ScopeTransfer Convert(IScope item) {
+      ScopeTransfer result = new ScopeTransfer();
+
+      result.Name = item.Name;
+      result.Description = item.Description;
+
+      foreach (IVariable variable in item.Variables) {
+        result.Variables.Add(VariableTransfer.Convert(variable));
+      }
+
+      foreach (IScope subscope in item.SubScopes) {
+        result.SubScopes.Add(Convert(subscope));
+      }
+
+      return result;
+    }
+
+    public static IScope Convert(ScopeTransfer item, IExecutionContext globalScope) {
+      IScope result = new Scope();
+
+      result.Name = item.Name;
+      result.Description = item.Description;
+
+      foreach (VariableTransfer variable in item.Variables) {
+        result.Variables.Add(VariableTransfer.Convert(variable, globalScope));
+      }
+
+      foreach (ScopeTransfer subscope in item.SubScopes) {
+        result.SubScopes.Add(Convert(subscope, globalScope));
+      }
+
+      return result;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Core/VariableTransfer.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Core/VariableTransfer.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Core/VariableTransfer.cs	(revision 7544)
@@ -0,0 +1,34 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
+  [Serializable]
+  class VariableTransfer {
+    public string Name { get; set; }
+    public string Description { get; set; }
+    public object Value { get; set; }
+
+    public static VariableTransfer Convert(IVariable item) {
+      VariableTransfer result = new VariableTransfer();
+
+      result.Name = item.Name;
+      result.Description = item.Description;
+      result.Value = ItemTransfer.Convert(item.Value);
+
+      return result;
+    }
+
+    public static IVariable Convert(VariableTransfer item, IExecutionContext globalScope) {
+      IVariable result = new Variable();
+
+      result.Name = item.Name;
+      result.Description = item.Description;
+      result.Value = ItemTransfer.Convert(item.Value, globalScope);
+
+      return result;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Data/DoubleValueTransfer.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Data/DoubleValueTransfer.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Data/DoubleValueTransfer.cs	(revision 7544)
@@ -0,0 +1,29 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
+  [Serializable]
+  class DoubleValueTransfer {
+    public double Value { get; set; }
+
+    public static DoubleValueTransfer Convert(DoubleValue item) {
+      DoubleValueTransfer result = new DoubleValueTransfer();
+
+      result.Value = item.Value;
+
+      return result;
+    }
+
+    public static DoubleValue Convert(DoubleValueTransfer item) {
+      DoubleValue result = new DoubleValue();
+
+      result.Value = item.Value;
+
+      return result;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Data/IntValueTransfer.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Data/IntValueTransfer.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Data/IntValueTransfer.cs	(revision 7544)
@@ -0,0 +1,29 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
+  [Serializable]
+  class IntValueTransfer {
+    public int Value { get; set; }
+
+    public static IntValueTransfer Convert(IntValue item) {
+      IntValueTransfer result = new IntValueTransfer();
+
+      result.Value = item.Value;
+
+      return result;
+    }
+
+    public static IntValue Convert(IntValueTransfer item) {
+      IntValue result = new IntValue();
+
+      result.Value = item.Value;
+
+      return result;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/ItemTransfer.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/ItemTransfer.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/ItemTransfer.cs	(revision 7544)
@@ -0,0 +1,46 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+
+namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
+  class ItemTransfer {
+    public static object Convert(IItem item) {
+      if (item is IScope)
+        return ScopeTransfer.Convert(item as IScope);
+      else if (item is IVariable)
+        return VariableTransfer.Convert(item as IVariable);
+      else if (item is DoubleValue)
+        return DoubleValueTransfer.Convert(item as DoubleValue);
+      else if (item is IntValue)
+        return IntValueTransfer.Convert(item as IntValue);
+      else if (item is IVRPEncoding)
+        return VRPTransfer.Convert(item as IVRPEncoding);
+      else if (item is Permutation)
+        return PermutationTransfer.Convert(item as Permutation);
+      else
+        return null;
+    }
+
+    public static IItem Convert(object item, IExecutionContext globalScope) {
+      if (item is ScopeTransfer)
+        return ScopeTransfer.Convert(item as ScopeTransfer, globalScope);
+      else if (item is VariableTransfer)
+        return VariableTransfer.Convert(item as VariableTransfer, globalScope);
+      else if (item is DoubleValueTransfer)
+        return DoubleValueTransfer.Convert(item as DoubleValueTransfer);
+      else if (item is IntValueTransfer)
+        return IntValueTransfer.Convert(item as IntValueTransfer);
+      else if (item is PermutationTransfer)
+        return PermutationTransfer.Convert(item as PermutationTransfer);
+      else if (item is VRPTransfer)
+        return VRPTransfer.Convert(item as VRPTransfer, globalScope);
+      else
+        return null;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/MPIBinaryTransportWrapper.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/MPIBinaryTransportWrapper.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/MPIBinaryTransportWrapper.cs	(revision 7544)
@@ -0,0 +1,91 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.Serialization;
+using HeuristicLab.Core;
+using System.IO;
+using HeuristicLab.Persistence.Default.Xml;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
+  /// <summary>
+  /// A simple wrapper to transport items over the message passing interface
+  /// </summary>
+  [Serializable]
+  public class MPIBinaryTransportWrapper: ISerializable {
+    [NonSerialized]
+    private object innerItem;
+
+    public IItem GetInnerItem(IExecutionContext globalScope) {
+        return ItemTransfer.Convert(innerItem, globalScope);
+    }
+
+    public MPIBinaryTransportWrapper(object item) {
+      innerItem = item;
+    }
+
+    public MPIBinaryTransportWrapper(IItem item) {
+      innerItem = ItemTransfer.Convert(item);
+    }
+
+    protected MPIBinaryTransportWrapper(SerializationInfo info, StreamingContext context) {
+      byte[] buffer = info.GetValue("Item", typeof(byte[])) as byte[];
+      IFormatter formatter = new BinaryFormatter();
+      if (buffer != null)
+        try {
+        innerItem = formatter.Deserialize(new MemoryStream(buffer));
+        }
+        catch (Exception e) {
+          Console.WriteLine(e);
+          throw e;
+        }
+      else
+        innerItem = null;
+    }
+
+    #region ISerializable Members
+
+    public void GetObjectData(SerializationInfo info, StreamingContext context) {
+      object value = null;
+
+      if (innerItem != null) {
+        MemoryStream stream = new MemoryStream();
+        IFormatter formatter = new BinaryFormatter();
+        try {
+          formatter.Serialize(stream, innerItem);
+        }
+        catch (Exception e) {
+          Console.WriteLine(e);
+          throw e;
+        }
+        value = stream.GetBuffer();
+      } 
+        
+      info.AddValue("Item", value);     
+    }
+
+    #endregion
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Permutation/PermutationTransfer.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Permutation/PermutationTransfer.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/Permutation/PermutationTransfer.cs	(revision 7544)
@@ -0,0 +1,31 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+
+namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
+  [Serializable]
+  class PermutationTransfer {
+    public PermutationTypes PermutationType { get; set; }
+
+    public int[] Elements { get; set; }
+
+    public static PermutationTransfer Convert(Permutation item) {
+      PermutationTransfer result = new PermutationTransfer();
+
+      result.PermutationType = item.PermutationType;
+      result.Elements = item.ToArray();
+
+      return result;
+    }
+
+    public static Permutation Convert(PermutationTransfer item) {
+      Permutation result = new Permutation(item.PermutationType, item.Elements);
+
+      return result;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/VRP/VRPTransfer.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/VRP/VRPTransfer.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/VRP/VRPTransfer.cs	(revision 7544)
@@ -0,0 +1,70 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
+using HeuristicLab.Core;
+using HeuristicLab.Problems.VehicleRouting.Encodings.GVR;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Prins;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Zhu;
+using HeuristicLab.Problems.VehicleRouting;
+
+namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
+  enum VRPEncodingTypes { Alba, GVR, Potvin, Prins, Zhu }
+  
+  [Serializable]
+  class VRPTransfer {
+    public VRPEncodingTypes VRPEncodingType { get; set; }
+
+    public List<int> Route { get; set; }
+
+    public static VRPTransfer Convert(IVRPEncoding item) {
+      VRPTransfer result = new VRPTransfer();
+
+      if (item is AlbaEncoding)
+        result.VRPEncodingType = VRPEncodingTypes.Alba;
+      else if (item is GVREncoding)
+        result.VRPEncodingType = VRPEncodingTypes.GVR;
+      else if (item is PotvinEncoding)
+        result.VRPEncodingType = VRPEncodingTypes.Potvin;
+      else if (item is PrinsEncoding)
+        result.VRPEncodingType = VRPEncodingTypes.Prins;
+      else if (item is ZhuEncoding)
+        result.VRPEncodingType = VRPEncodingTypes.Zhu;
+
+      int tourIdx = 0;
+      result.Route = new List<int>();
+      foreach (Tour tour in item.GetTours()) {
+        foreach (int stop in tour.Stops) {
+          result.Route.Add(stop);
+        }
+        result.Route.Add(-item.GetVehicleAssignment(tourIdx));
+        tourIdx++;
+      }
+
+      return result;
+    }
+
+    public static IVRPEncoding Convert(VRPTransfer item, IExecutionContext globalScope) {
+      IVRPEncoding result = null;
+
+      IVRPProblemInstance instance = (globalScope.Parameters["ProblemInstance"] as IValueParameter).Value as IVRPProblemInstance;
+
+      if (item.VRPEncodingType == VRPEncodingTypes.Alba)
+        result = AlbaEncoding.ConvertFrom(item.Route, instance);
+      else if (item.VRPEncodingType == VRPEncodingTypes.GVR)
+        result = GVREncoding.ConvertFrom(item.Route, instance);
+      else if (item.VRPEncodingType == VRPEncodingTypes.Potvin)
+        result = PotvinEncoding.ConvertFrom(item.Route, instance);
+      else if (item.VRPEncodingType == VRPEncodingTypes.Prins)
+        result = PrinsEncoding.ConvertFrom(item.Route, instance);
+      else if (item.VRPEncodingType == VRPEncodingTypes.Zhu)
+        result = ZhuEncoding.ConvertFrom(item.Route, instance);
+
+      return result;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/HeuristicLab.Operators.MPISupport-3.3.csproj
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/HeuristicLab.Operators.MPISupport-3.3.csproj	(revision 7543)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/HeuristicLab.Operators.MPISupport-3.3.csproj	(revision 7544)
@@ -108,4 +108,6 @@
       <Private>False</Private>
     </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Encodings.PermutationEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
@@ -116,4 +118,5 @@
       <Private>False</Private>
     </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
@@ -124,4 +127,5 @@
       <Private>False</Private>
     </Reference>
+    <Reference Include="HeuristicLab.Problems.VehicleRouting-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="MPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=29b4a045737654fe, processorArchitecture=MSIL">
       <HintPath>..\..\HeuristicLab.ExtLibs\HeuristicLab.MPInet\1.0.0\MPI.dll</HintPath>
@@ -140,6 +144,17 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BinaryTransport\Core\VariableTransfer.cs" />
+    <Compile Include="BinaryTransport\Core\ScopeTransfer.cs" />
+    <Compile Include="BinaryTransport\Data\IntValueTransfer.cs" />
+    <Compile Include="BinaryTransport\Data\DoubleValueTransfer.cs" />
+    <Compile Include="BinaryTransport\ItemTransfer.cs" />
+    <Compile Include="BinaryTransport\MPIBinaryTransportWrapper.cs" />
+    <Compile Include="BinaryTransport\Permutation\PermutationTransfer.cs" />
+    <Compile Include="BinaryTransport\VRP\VRPTransfer.cs" />
+    <Compile Include="MPIHelper.cs" />
+    <Compile Include="MPISolutionsCreator.cs" />
     <Compile Include="MPITransportWrapper.cs" />
     <Compile Include="MPIUnidirectionalRingMigrator.cs" />
+    <Compile Include="MPIUniformSubscopesProcessor.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
@@ -167,4 +182,5 @@
     </BootstrapperPackage>
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPIHelper.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPIHelper.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPIHelper.cs	(revision 7544)
@@ -0,0 +1,60 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using System.Threading;
+
+namespace HeuristicLab.Operators.MPISupport {
+  class MPIHelper {
+    public static IScope ShallowCopy(IScope scope) {
+      IScope copy = new Scope(scope.Name, scope.Description);
+
+      copy.Parent = null;
+
+      foreach (IVariable variable in scope.Variables) {
+        Variable copyVar = new Variable();
+        copyVar.Name = variable.Name;
+        copyVar.Value = variable.Value;
+        copy.Variables.Add(copyVar);
+      }
+
+      foreach (IScope subscope in scope.SubScopes) {
+        copy.SubScopes.Add(ShallowCopy(subscope));
+      }
+
+      return copy;
+    }
+
+    public static void Execute(IAtomicOperation op, CancellationToken cancellationToken) {
+      IOperation next;
+      OperationCollection coll;
+      IAtomicOperation operation;
+
+      Stack<IOperation> executionStack = new Stack<IOperation>();
+      executionStack.Push(op);
+
+      while (executionStack.Count > 0) {
+        cancellationToken.ThrowIfCancellationRequested();
+
+        next = executionStack.Pop();
+        if (next is OperationCollection) {
+          coll = (OperationCollection)next;
+          for (int i = coll.Count - 1; i >= 0; i--)
+            if (coll[i] != null) executionStack.Push(coll[i]);
+        } else if (next is IAtomicOperation) {
+          operation = (IAtomicOperation)next;
+          try {
+            next = operation.Operator.Execute((IExecutionContext)operation, cancellationToken);
+          }
+          catch (Exception ex) {
+            executionStack.Push(operation);
+            if (ex is OperationCanceledException) throw ex;
+            else throw new OperatorExecutionException(operation.Operator, ex);
+          }
+          if (next != null) executionStack.Push(next);
+        }
+      }
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPISolutionsCreator.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPISolutionsCreator.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPISolutionsCreator.cs	(revision 7544)
@@ -0,0 +1,159 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Operators.MPISupport.BinaryTransport;
+using System.Collections.Generic;
+using MPI;
+
+namespace HeuristicLab.Operators.MPISupport {
+  [Item("MPISolutionsCreator", "An operator which creates new solutions in parallel using MPI.")]
+  [StorableClass]
+  public sealed class MPISolutionsCreator : SingleSuccessorOperator {
+    public ValueLookupParameter<IntValue> NumberOfSolutionsParameter {
+      get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfSolutions"]; }
+    }
+    public ValueLookupParameter<IOperator> SolutionCreatorParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["SolutionCreator"]; }
+    }
+    public ValueLookupParameter<IOperator> EvaluatorParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["Evaluator"]; }
+    }
+    public ValueLookupParameter<BoolValue> ParallelParameter {
+      get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; }
+    }
+    private ScopeParameter CurrentScopeParameter {
+      get { return (ScopeParameter)Parameters["CurrentScope"]; }
+    }
+    public IScope CurrentScope {
+      get { return CurrentScopeParameter.ActualValue; }
+    }
+    public IntValue NumberOfSolutions {
+      get { return NumberOfSolutionsParameter.Value; }
+      set { NumberOfSolutionsParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    private MPISolutionsCreator(bool deserializing) : base(deserializing) { }
+    private MPISolutionsCreator(MPISolutionsCreator original, Cloner cloner) : base(original, cloner) { }
+    public MPISolutionsCreator()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSolutions", "The number of solutions that should be created."));
+      Parameters.Add(new ValueLookupParameter<IOperator>("SolutionCreator", "The operator which is used to create new solutions."));
+      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator which is used to evaluate new solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes."));
+    }
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey("Parallel")) Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(true))); // backwards compatibility
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MPISolutionsCreator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      int scopeCount = NumberOfSolutionsParameter.ActualValue.Value;
+      IOperator creator = SolutionCreatorParameter.ActualValue;
+      IOperator evaluator = EvaluatorParameter.ActualValue;
+      bool parallel = ParallelParameter.ActualValue.Value;
+
+      int current = CurrentScope.SubScopes.Count;
+      for (int i = 0; i < scopeCount; i++)
+        CurrentScope.SubScopes.Add(new Scope((current + i).ToString()));
+      ScopeList scopes = CurrentScope.SubScopes;
+
+      OperationCollection next = new OperationCollection();
+      if (MPI.Communicator.world != null && MPI.Communicator.world.Size > 2) {
+        int rank = MPI.Communicator.world.Rank;
+        int size = MPI.Communicator.world.Size - 1;
+
+        int count = scopes.Count / size;
+        int start = count * (rank - 1);
+        int end = (rank == size ? scopes.Count : start + count);
+
+        List<Request> requests = new List<Request>();
+        IScope parent = new Scope();
+
+        for (int i = start; i < end; i++) {
+          if (creator != null) {
+            IAtomicOperation op = ExecutionContext.CreateOperation(creator, scopes[i]);
+            MPIHelper.Execute(op, CancellationToken);
+          }
+
+          if (evaluator != null) {
+            IAtomicOperation op = ExecutionContext.CreateOperation(evaluator, scopes[i]);
+            MPIHelper.Execute(op, CancellationToken);
+          }
+
+          //SEND results to other clients
+          parent.SubScopes.Add(MPIHelper.ShallowCopy(scopes[i]));
+        }
+
+        for (int dest = 1; dest <= size; dest++) {
+          if (dest != rank) {
+            var result = new MPIBinaryTransportWrapper(parent);
+            requests.Add(MPI.Communicator.world.ImmediateSend<MPIBinaryTransportWrapper>(result, dest, 0));
+          }
+        }
+
+        IExecutionContext globalScope = ExecutionContext;
+        while (globalScope.Parent != null) {
+          globalScope = globalScope.Parent;
+        }
+
+        //RECEIVE results from other clients
+        for (int source = 1; source <= size; source++) {
+          if (source != rank) {
+            var result = MPI.Communicator.world.Receive<MPIBinaryTransportWrapper>(source, 0).GetInnerItem(globalScope) as IScope;
+
+            int offset = count * (source - 1);
+            for (int scopeIndex = 0; scopeIndex < result.SubScopes.Count; scopeIndex++) {
+              scopes[scopeIndex + offset] = result.SubScopes[scopeIndex];
+            }
+          }
+        }
+
+        foreach (Request request in requests) {
+          request.Wait();
+        }
+      } else {
+        OperationCollection creation = new OperationCollection();
+        OperationCollection evaluation = new OperationCollection() { Parallel = parallel };
+        for (int i = 0; i < scopeCount; i++) {
+          if (creator != null) creation.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[current + i]));
+          if (evaluator != null) evaluation.Add(ExecutionContext.CreateOperation(evaluator, CurrentScope.SubScopes[current + i]));
+        }
+
+        next.Add(creation);
+        next.Add(evaluation);
+      }
+      next.Add(base.Apply());
+      return next;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPIUniformSubscopesProcessor.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPIUniformSubscopesProcessor.cs	(revision 7544)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPIUniformSubscopesProcessor.cs	(revision 7544)
@@ -0,0 +1,123 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Common;
+using MPI;
+using HeuristicLab.Operators.MPISupport.BinaryTransport;
+
+namespace HeuristicLab.Operators.MPISupport {
+  [Item("MPIUniformSubscopesProcessor", "An operator which applies a specified operator on all sub-scopes at the given depth of the current scope.")]
+  [StorableClass]
+  public class MPIUniformSubscopesProcessor : SingleSuccessorOperator {
+    private OperatorParameter OperatorParameter {
+      get { return (OperatorParameter)Parameters["Operator"]; }
+    }
+    public ValueLookupParameter<BoolValue> ParallelParameter {
+      get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; }
+    }
+
+    public IOperator Operator {
+      get { return OperatorParameter.Value; }
+      set { OperatorParameter.Value = value; }
+    }
+    public BoolValue Parallel {
+      get { return ParallelParameter.Value; }
+      set { ParallelParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    private MPIUniformSubscopesProcessor(bool deserializing) : base(deserializing) { }
+    private MPIUniformSubscopesProcessor(MPIUniformSubscopesProcessor original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public MPIUniformSubscopesProcessor()
+      : base() {
+      Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on all sub-scopes of the current scope."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(false)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MPIUniformSubscopesProcessor(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      OperationCollection next = new OperationCollection(base.Apply());
+      ScopeList scopes = ExecutionContext.Scope.SubScopes;
+
+      if (Operator != null) {
+        if (MPI.Communicator.world != null && MPI.Communicator.world.Size > 2) {
+          int rank = MPI.Communicator.world.Rank;
+          int size = MPI.Communicator.world.Size -1;
+
+          int count = scopes.Count / size;
+          int start = count * (rank - 1);
+          int end = (rank == size ? scopes.Count : start + count);
+
+          List<Request> requests = new List<Request>();
+          IScope parent = new Scope();
+
+          for (int i = start; i < end; i++) {
+            IAtomicOperation op = ExecutionContext.CreateOperation(Operator, scopes[i]);
+            MPIHelper.Execute(op, CancellationToken);
+            
+            //SEND results to other clients
+            parent.SubScopes.Add(MPIHelper.ShallowCopy(scopes[i]));           
+          }
+
+          for (int dest = 1; dest <= size; dest++) {
+            if (dest != rank) {
+              var result = new MPIBinaryTransportWrapper(parent);
+              requests.Add(MPI.Communicator.world.ImmediateSend<MPIBinaryTransportWrapper>(result, dest, 0));
+            }
+          }
+
+          IExecutionContext globalScope = ExecutionContext;
+          while (globalScope.Parent != null) {
+            globalScope = globalScope.Parent;
+          }
+
+          //RECEIVE results from other clients
+          for (int source = 1; source <= size; source++) {
+            if (source != rank) {
+              var result = MPI.Communicator.world.Receive<MPIBinaryTransportWrapper>(source, 0).GetInnerItem(globalScope) as IScope;
+
+              /*Console.WriteLine(result.SubScopes.Count);
+              foreach (IVariable var in result.SubScopes[0].SubScopes[0].Variables) {
+                Console.WriteLine("VAR " + var.Name + " " + var.Value);
+              }*/ 
+
+              int offset = count * (source - 1);
+              for (int scopeIndex = 0; scopeIndex < result.SubScopes.Count; scopeIndex++) {
+                scopes[scopeIndex + offset] = result.SubScopes[scopeIndex];
+              } 
+
+              /*for (int scopeIndex = 0; scopeIndex < count; scopeIndex++) {
+                IScope root = new Scope();
+                root.SubScopes.Add(scopes[scopeIndex + offset]);
+                scopes[scopeIndex + offset] = root;
+              }*/
+            }
+          }
+
+          foreach (Request request in requests) {
+            request.Wait();
+          }
+        } else {
+          OperationCollection inner = new OperationCollection();
+          inner.Parallel = Parallel == null ? false : Parallel.Value;
+          for (int i = 0; i < scopes.Count; i++) {
+            inner.Add(ExecutionContext.CreateOperation(Operator, scopes[i]));
+          }
+          next.Insert(0, inner);
+        }
+      }
+
+      return next;
+    }
+  }
+}
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/Plugin.cs.frame
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/Plugin.cs.frame	(revision 7543)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/Plugin.cs.frame	(revision 7544)
@@ -35,4 +35,8 @@
   [PluginDependency("HeuristicLab.Collections", "3.3")]
   [PluginDependency("HeuristicLab.Optimization", "3.3")]
+  [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")]
+  [PluginDependency("HeuristicLab.Problems.VehicleRouting", "3.4")]
   public class HeuristicLabOperatorsMPISupportPlugin : PluginBase {
   }
