Index: branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/HeuristicLab.PDPSimulation-3.3.csproj
===================================================================
--- branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/HeuristicLab.PDPSimulation-3.3.csproj	(revision 8776)
+++ branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/HeuristicLab.PDPSimulation-3.3.csproj	(revision 8777)
@@ -189,4 +189,5 @@
     <Compile Include="Operators\DynPushForwardInsertionCreator.cs" />
     <Compile Include="Operators\DynPDPProblemInstance.cs" />
+    <Compile Include="Operators\PriorityDispatchingMetaOptEvaluator.cs" />
     <Compile Include="Optimizers\DynamicPDProblemInstance.cs" />
     <Compile Include="Optimizers\DynamicPDPOptimization.cs" />
Index: branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Operators/PriorityDispatchingMetaOptEvaluator.cs
===================================================================
--- branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Operators/PriorityDispatchingMetaOptEvaluator.cs	(revision 8777)
+++ branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Operators/PriorityDispatchingMetaOptEvaluator.cs	(revision 8777)
@@ -0,0 +1,113 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Common;
+using System.Threading;
+using System.Threading.Tasks;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using System.Diagnostics;
+
+namespace HeuristicLab.PDPSimulation.Operators {
+  [Item("PriorityDispatchingMetaOptEvaluator", "Metaoptimization of the priority dispatching parameters for the PDP simulation.")]
+  [StorableClass]
+  public class PriorityDispatchingMetaOptEvaluator : SingleSuccessorOperator, ISingleObjectiveEvaluator {
+    public ILookupParameter<DoubleValue> QualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+
+    public IValueLookupParameter<DoubleArray> VectorParameter {
+      get { return (IValueLookupParameter<DoubleArray>)Parameters["Vector"]; }
+    }
+
+    public IValueParameter<ItemList<PickupDeliverySimulation>> SimulationParameter {
+      get { return (IValueParameter<ItemList<PickupDeliverySimulation>>)Parameters["Simulation"]; }
+    }
+
+    public IValueParameter<IntValue> RepetitionsParameter {
+      get { return (IValueParameter<IntValue>)Parameters["Repetitions"]; }
+    }
+
+    public PriorityDispatchingMetaOptEvaluator() {
+      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "Result of the evaluation of a solution."));
+      Parameters.Add(new ValueLookupParameter<DoubleArray>("Vector", "The priority dispatching parameters."));
+      Parameters.Add(new ValueParameter<ItemList<PickupDeliverySimulation>>("Simulation", "The PDP simulation"));
+      Parameters.Add(new ValueParameter<IntValue>("Repetitions", "The number of repetitions", new IntValue(1)));
+    }
+
+    [StorableConstructor]
+    protected PriorityDispatchingMetaOptEvaluator(bool deserializing) : base(deserializing) { }
+    protected PriorityDispatchingMetaOptEvaluator(PriorityDispatchingMetaOptEvaluator original, Cloner cloner) : base(original, cloner) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new PriorityDispatchingMetaOptEvaluator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      double quality = 0;
+
+      ItemList<PickupDeliverySimulation> simulations = SimulationParameter.Value;
+      int repetitions = 0;
+
+      DoubleArray vector = VectorParameter.ActualValue;
+
+      object locker = new object();
+      var options = new ParallelOptions();
+      //options.MaxDegreeOfParallelism = Math.Max(Environment.ProcessorCount - 1, 1);
+      Parallel.ForEach<PickupDeliverySimulation>(simulations, options, originalSimulation => {
+        int index = simulations.IndexOf(originalSimulation);
+
+        PickupDeliverySimulation simulation = originalSimulation.Clone() as PickupDeliverySimulation;
+        PriorityDispatching dispatching = simulation.OptimizationParameter.Value as PriorityDispatching;
+        dispatching.WeightsParameter.Value = new RealVector(vector.ToArray());
+       
+        EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
+        EventHandler handler = new EventHandler(delegate(object o, EventArgs e) {
+            waitHandle.Set();                        
+          });
+
+        int executions = 0;
+        while (executions < RepetitionsParameter.Value.Value) {
+          waitHandle.Reset();
+
+          simulation.Prepared += handler;
+          simulation.Prepare(true);
+          waitHandle.WaitOne();
+          simulation.Prepared -= handler;
+
+          waitHandle.Reset();
+
+          simulation.Stopped += handler;
+          simulation.Start();
+          waitHandle.WaitOne();
+          simulation.Stopped -= handler;
+
+          Debug.Assert(simulation.Results.ContainsKey("Finished"));
+          double leadTime = (simulation.Results["LeadTime"].Value as DoubleValue).Value; 
+          double tardiness = (simulation.Results["Tardiness"].Value as DoubleValue).Value +
+                             (simulation.Results["VehicleTardiness"].Value as DoubleValue).Value;
+
+          lock (locker) {
+            double runQuality = leadTime + tardiness * (simulation.Problem as PickupDeliveryScenario).TardinessPenaltyParameter.Value.Value;
+
+            quality += runQuality;
+            repetitions++;
+          }
+
+          executions++;
+        }
+      });
+
+      QualityParameter.ActualValue = new DoubleValue(quality / (double)repetitions);
+
+      return base.Apply();
+    }
+  }
+}
Index: branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Optimizers/LocalUpdate/PriorityDispatching.cs
===================================================================
--- branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Optimizers/LocalUpdate/PriorityDispatching.cs	(revision 8776)
+++ branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Optimizers/LocalUpdate/PriorityDispatching.cs	(revision 8777)
@@ -76,5 +76,6 @@
           waitingOrders.Remove(order);
 
-          Debug.Assert(!GetOrders().Where(o => o.AssignedVehicle == bestVehicle.Id && o.OrderState == OrderState.Waiting).Any(), "An order has already been assigned to the vehicle");
+          foreach (var assignedOrder in GetOrders().Where(o => o.AssignedVehicle == bestVehicle.Id && o.OrderState == OrderState.Waiting))
+            assignedOrder.AssignedVehicle = Guid.Empty;
 
           order.AssignedVehicle = bestVehicle.Id;
@@ -85,5 +86,5 @@
 
     private void GetHighestPriorityOrder(DynPDPProblemInstance instance, Vehicle vehicle, IEnumerable<Order> orders, out Order order, out double priority) {
-      var weights = WeightsParameter.ActualValue;
+      var weights = WeightsParameter.Value;
       Order best = null;
       double bestPriority = double.MinValue;
Index: branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliveryAnalyzer.cs
===================================================================
--- branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliveryAnalyzer.cs	(revision 8776)
+++ branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliveryAnalyzer.cs	(revision 8777)
@@ -209,4 +209,6 @@
         row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
         data.Rows.Add(row);
+
+        results.Add(new Result("LeadTime", new DoubleValue()));
       }
 
@@ -235,9 +237,15 @@
 
       //lead time
+      double leadTime = 0;
+
       values = timeHistogram.Rows["LeadTime"].Values;
       values.Clear();
       foreach (Order order in simulation.Orders.Where(o => o.OrderState == OrderState.Delivered)) {
-        values.Add(order.DeliveryTime + order.DeliveryServiceTime - order.PickupReadyTime);
-      }
+        double orderLeadTime = order.DeliveryTime + order.DeliveryServiceTime - order.PickupReadyTime;
+        values.Add(orderLeadTime);
+        leadTime += orderLeadTime;
+      }
+
+      (results["LeadTime"].Value as DoubleValue).Value = leadTime;
 
       results["TimeHistogram"].Value = timeHistogram;
