Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/Capacitated/CapacityRelaxationVRPAnalyzer.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/Capacitated/CapacityRelaxationVRPAnalyzer.cs	(revision 6711)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/Capacitated/CapacityRelaxationVRPAnalyzer.cs	(revision 6711)
@@ -0,0 +1,140 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.VehicleRouting {
+  /// <summary>
+  /// An operator for adaptive constraint relaxation.
+  /// </summary>
+  [Item("CapacityRelaxationVRPAnalyzer", "An operator for adaptively relaxing the capacity constraints.")]
+  [StorableClass]
+  public class CapacityRelaxationVRPAnalyzer: SingleSuccessorOperator, IAnalyzer, ICapacitatedOperator {
+    public ILookupParameter<IVRPProblemInstance> ProblemInstanceParameter {
+      get { return (ILookupParameter<IVRPProblemInstance>)Parameters["ProblemInstance"]; }
+    }
+    public ScopeTreeLookupParameter<IVRPEncoding> VRPToursParameter {
+      get { return (ScopeTreeLookupParameter<IVRPEncoding>)Parameters["VRPTours"]; }
+    }
+    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+
+    public ScopeTreeLookupParameter<DoubleValue> OverloadParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Overload"]; }
+    }
+
+    public IValueParameter<DoubleValue> SigmaParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["Sigma"]; }
+    }
+    public IValueParameter<DoubleValue> PhiParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["Phi"]; }
+    }
+    public IValueParameter<DoubleValue> MinPenaltyFactorParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["MinPenaltyFactor"]; }
+    }
+
+    public ValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+
+    [StorableConstructor]
+    private CapacityRelaxationVRPAnalyzer(bool deserializing) : base(deserializing) { }
+
+    public CapacityRelaxationVRPAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The problem instance."));
+      Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the VRP solutions which should be analyzed."));
+
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Overload", "The overloads of the VRP solutions which should be analyzed."));
+
+      Parameters.Add(new ValueParameter<DoubleValue>("Sigma", "The sigma applied to the penalty factor.", new DoubleValue(0.04)));
+      Parameters.Add(new ValueParameter<DoubleValue>("Phi", "The phi applied to the penalty factor.", new DoubleValue(0.01)));
+      Parameters.Add(new ValueParameter<DoubleValue>("MinPenaltyFactor", "The minimum penalty factor.", new DoubleValue(0.01)));
+
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CapacityRelaxationVRPAnalyzer(this, cloner);
+    }
+
+    private CapacityRelaxationVRPAnalyzer(CapacityRelaxationVRPAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IOperation Apply() {
+      ICapacitatedProblemInstance cvrp = ProblemInstanceParameter.ActualValue as ICapacitatedProblemInstance;
+      ResultCollection results = ResultsParameter.ActualValue;
+      
+      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
+      ItemArray<DoubleValue> overloads = OverloadParameter.ActualValue;
+      
+      double sigma = SigmaParameter.Value.Value;
+      double phi = PhiParameter.Value.Value;
+      double minPenalty = MinPenaltyFactorParameter.Value.Value;
+
+      for (int j = 0; j < qualities.Length; j++) {
+        qualities[j].Value -= overloads[j].Value * cvrp.OverloadPenalty.Value;
+      }
+
+      int validCount = 0;
+      for (int j = 0; j < qualities.Length; j++) {
+        if (overloads[j].Value == 0)
+          validCount++;
+      }
+
+      double factor = 1.0 - ((double)validCount / (double)qualities.Length);
+
+      double min = cvrp.OverloadPenalty.Value / (1 + sigma);
+      double max = cvrp.OverloadPenalty.Value * (1 + phi);
+
+      cvrp.OverloadPenalty = new DoubleValue(min + (max - min) * factor);
+      if (cvrp.OverloadPenalty.Value < minPenalty)
+        cvrp.OverloadPenalty.Value = minPenalty;
+
+      for (int j = 0; j < qualities.Length; j++) {
+        qualities[j].Value += overloads[j].Value * cvrp.OverloadPenalty.Value;
+      }
+
+      if (!results.ContainsKey("Current Overload Penalty")) {
+        results.Add(new Result("Current Overload Penalty", new DoubleValue(cvrp.OverloadPenalty.Value)));
+      } else {
+        (results["Current Overload Penalty"].Value as DoubleValue).Value = cvrp.OverloadPenalty.Value;
+      }
+
+      return base.Apply();
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/PickupAndDelivery/PickupViolationsRelaxationVRPAnalyzer.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/PickupAndDelivery/PickupViolationsRelaxationVRPAnalyzer.cs	(revision 6711)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/PickupAndDelivery/PickupViolationsRelaxationVRPAnalyzer.cs	(revision 6711)
@@ -0,0 +1,140 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.VehicleRouting {
+  /// <summary>
+  /// An operator for adaptive constraint relaxation.
+  /// </summary>
+  [Item("PickupViolationsRelaxationVRPAnalyzer", "An operator for adaptively relaxing the pickup constraints.")]
+  [StorableClass]
+  public class PickupViolationsRelaxationVRPAnalyzer: SingleSuccessorOperator, IAnalyzer, ICapacitatedOperator {
+    public ILookupParameter<IVRPProblemInstance> ProblemInstanceParameter {
+      get { return (ILookupParameter<IVRPProblemInstance>)Parameters["ProblemInstance"]; }
+    }
+    public ScopeTreeLookupParameter<IVRPEncoding> VRPToursParameter {
+      get { return (ScopeTreeLookupParameter<IVRPEncoding>)Parameters["VRPTours"]; }
+    }
+    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+
+    public ScopeTreeLookupParameter<IntValue> PickupViolationsParameter {
+      get { return (ScopeTreeLookupParameter<IntValue>)Parameters["PickupViolations"]; }
+    }
+
+    public IValueParameter<DoubleValue> SigmaParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["Sigma"]; }
+    }
+    public IValueParameter<DoubleValue> PhiParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["Phi"]; }
+    }
+    public IValueParameter<DoubleValue> MinPenaltyFactorParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["MinPenaltyFactor"]; }
+    }
+
+    public ValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+
+    [StorableConstructor]
+    private PickupViolationsRelaxationVRPAnalyzer(bool deserializing) : base(deserializing) { }
+
+    public PickupViolationsRelaxationVRPAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The problem instance."));
+      Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the VRP solutions which should be analyzed."));
+
+      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("PickupViolations", "The pickup violation of the VRP solutions which should be analyzed."));
+
+      Parameters.Add(new ValueParameter<DoubleValue>("Sigma", "The sigma applied to the penalty factor.", new DoubleValue(0.04)));
+      Parameters.Add(new ValueParameter<DoubleValue>("Phi", "The phi applied to the penalty factor.", new DoubleValue(0.01)));
+      Parameters.Add(new ValueParameter<DoubleValue>("MinPenaltyFactor", "The minimum penalty factor.", new DoubleValue(0.01)));
+
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new PickupViolationsRelaxationVRPAnalyzer(this, cloner);
+    }
+
+    private PickupViolationsRelaxationVRPAnalyzer(PickupViolationsRelaxationVRPAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IOperation Apply() {
+      IPickupAndDeliveryProblemInstance pdp = ProblemInstanceParameter.ActualValue as IPickupAndDeliveryProblemInstance;
+      ResultCollection results = ResultsParameter.ActualValue;
+      
+      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
+      ItemArray<IntValue> pickupViolations = PickupViolationsParameter.ActualValue;
+      
+      double sigma = SigmaParameter.Value.Value;
+      double phi = PhiParameter.Value.Value;
+      double minPenalty = MinPenaltyFactorParameter.Value.Value;
+
+      for (int j = 0; j < qualities.Length; j++) {
+        qualities[j].Value -= pickupViolations[j].Value * pdp.PickupViolationPenalty.Value;
+      }
+
+      int validCount = 0;
+      for (int j = 0; j < qualities.Length; j++) {
+        if (pickupViolations[j].Value == 0)
+          validCount++;
+      }
+
+      double factor = 1.0 - ((double)validCount / (double)qualities.Length);
+
+      double min = pdp.PickupViolationPenalty.Value / (1 + sigma);
+      double max = pdp.PickupViolationPenalty.Value * (1 + phi);
+
+      pdp.PickupViolationPenalty = new DoubleValue(min + (max - min) * factor);
+      if (pdp.PickupViolationPenalty.Value < minPenalty)
+        pdp.PickupViolationPenalty.Value = minPenalty;
+
+      for (int j = 0; j < qualities.Length; j++) {
+        qualities[j].Value += pickupViolations[j].Value * pdp.PickupViolationPenalty.Value;
+      }
+
+      if (!results.ContainsKey("Current Pickup Violation Penalty")) {
+        results.Add(new Result("Current Pickup Violation Penalty", new DoubleValue(pdp.PickupViolationPenalty.Value)));
+      } else {
+        (results["Current Pickup Violation Penalty"].Value as DoubleValue).Value = pdp.PickupViolationPenalty.Value;
+      }
+
+      return base.Apply();
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/TimeWindowed/TimeWindowRelaxationVRPAnalyzer.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/TimeWindowed/TimeWindowRelaxationVRPAnalyzer.cs	(revision 6711)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/ConstraintRelaxation/TimeWindowed/TimeWindowRelaxationVRPAnalyzer.cs	(revision 6711)
@@ -0,0 +1,140 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.VehicleRouting {
+  /// <summary>
+  /// An operator for adaptive constraint relaxation.
+  /// </summary>
+  [Item("TimeWindowRelaxationVRPAnalyzer", "An operator for adaptively relaxing the time window constraints.")]
+  [StorableClass]
+  public class TimeWindowRelaxationVRPAnalyzer: SingleSuccessorOperator, IAnalyzer, ITimeWindowedOperator {
+    public ILookupParameter<IVRPProblemInstance> ProblemInstanceParameter {
+      get { return (ILookupParameter<IVRPProblemInstance>)Parameters["ProblemInstance"]; }
+    }
+    public ScopeTreeLookupParameter<IVRPEncoding> VRPToursParameter {
+      get { return (ScopeTreeLookupParameter<IVRPEncoding>)Parameters["VRPTours"]; }
+    }
+    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+
+    public ScopeTreeLookupParameter<DoubleValue> TardinessParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Tardiness"]; }
+    }
+
+    public IValueParameter<DoubleValue> SigmaParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["Sigma"]; }
+    }
+    public IValueParameter<DoubleValue> PhiParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["Phi"]; }
+    }
+    public IValueParameter<DoubleValue> MinPenaltyFactorParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["MinPenaltyFactor"]; }
+    }
+
+    public ValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+
+    [StorableConstructor]
+    private TimeWindowRelaxationVRPAnalyzer(bool deserializing) : base(deserializing) { }
+
+    public TimeWindowRelaxationVRPAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The problem instance."));
+      Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the VRP solutions which should be analyzed."));
+
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Tardiness", "The tardiness of the VRP solutions which should be analyzed."));
+
+      Parameters.Add(new ValueParameter<DoubleValue>("Sigma", "The sigma applied to the penalty factor.", new DoubleValue(0.04)));
+      Parameters.Add(new ValueParameter<DoubleValue>("Phi", "The phi applied to the penalty factor.", new DoubleValue(0.01)));
+      Parameters.Add(new ValueParameter<DoubleValue>("MinPenaltyFactor", "The minimum penalty factor.", new DoubleValue(0.01)));
+
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new TimeWindowRelaxationVRPAnalyzer(this, cloner);
+    }
+
+    private TimeWindowRelaxationVRPAnalyzer(TimeWindowRelaxationVRPAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IOperation Apply() {
+      ITimeWindowedProblemInstance vrptw = ProblemInstanceParameter.ActualValue as ITimeWindowedProblemInstance;
+      ResultCollection results = ResultsParameter.ActualValue;
+      
+      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
+      ItemArray<DoubleValue> tardiness = TardinessParameter.ActualValue;
+      
+      double sigma = SigmaParameter.Value.Value;
+      double phi = PhiParameter.Value.Value;
+      double minPenalty = MinPenaltyFactorParameter.Value.Value;
+
+      for (int j = 0; j < qualities.Length; j++) {
+        qualities[j].Value -= tardiness[j].Value * vrptw.TardinessPenalty.Value;
+      }
+
+      int validCount = 0;
+      for (int j = 0; j < qualities.Length; j++) {
+        if (tardiness[j].Value == 0)
+          validCount++;
+      }
+
+      double factor = 1.0 - ((double)validCount / (double)qualities.Length);
+
+      double min = vrptw.TardinessPenalty.Value / (1 + sigma);
+      double max = vrptw.TardinessPenalty.Value * (1 + phi);
+
+      vrptw.TardinessPenalty = new DoubleValue(min + (max - min) * factor);
+      if (vrptw.TardinessPenalty.Value < minPenalty)
+        vrptw.TardinessPenalty.Value = minPenalty;
+
+      for (int j = 0; j < qualities.Length; j++) {
+        qualities[j].Value += tardiness[j].Value * vrptw.TardinessPenalty.Value;
+      }
+
+      if (!results.ContainsKey("Current Tardiness Penalty")) {
+        results.Add(new Result("Current Tardiness Penalty", new DoubleValue(vrptw.TardinessPenalty.Value)));
+      } else {
+        (results["Current Tardiness Penalty"].Value as DoubleValue).Value = vrptw.TardinessPenalty.Value;
+      }
+
+      return base.Apply();
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj	(revision 6710)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj	(revision 6711)
@@ -123,4 +123,7 @@
     <Compile Include="Analyzer\BestSolution\PickupAndDelivery\BestPickupAndDeliveryVRPSolutionAnalyzer.cs" />
     <Compile Include="Analyzer\BestSolution\TimeWindowed\BestTimeWindowedVRPSolutionAnalyzer.cs" />
+    <Compile Include="Analyzer\ConstraintRelaxation\Capacitated\CapacityRelaxationVRPAnalyzer.cs" />
+    <Compile Include="Analyzer\ConstraintRelaxation\PickupAndDelivery\PickupViolationsRelaxationVRPAnalyzer.cs" />
+    <Compile Include="Analyzer\ConstraintRelaxation\TimeWindowed\TimeWindowRelaxationVRPAnalyzer.cs" />
     <Compile Include="Analyzer\VRPSolution.cs" />
     <Compile Include="Encodings\Alba\AlbaEncoding.cs" />
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPProblemInstance.cs	(revision 6710)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPProblemInstance.cs	(revision 6711)
@@ -49,7 +49,15 @@
       set { CapacityParameter.Value = value; }
     }
+
+    [Storable]
+    private DoubleValue currentOverloadPenalty;
+
     public DoubleValue OverloadPenalty {
-      get { return OverloadPenaltyParameter.Value; }
-      set { OverloadPenaltyParameter.Value = value; }
+      get {
+        if (currentOverloadPenalty != null)
+          return currentOverloadPenalty;
+        else
+          return OverloadPenaltyParameter.Value; }
+      set { currentOverloadPenalty = value; }
     }
 
@@ -87,4 +95,6 @@
     protected CVRPProblemInstance(CVRPProblemInstance original, Cloner cloner)
       : base(original, cloner) {
+        currentOverloadPenalty = cloner.Clone(original.currentOverloadPenalty) as DoubleValue;
+
         AttachEventHandlers();
     }
@@ -100,4 +110,10 @@
       OverloadPenaltyParameter.ValueChanged += new EventHandler(OverloadPenaltyParameter_ValueChanged);
       OverloadPenaltyParameter.Value.ValueChanged += new EventHandler(OverloadPenalty_ValueChanged);
+    }
+
+    public override void InitializeState() {
+      base.InitializeState();
+
+      currentOverloadPenalty = null;
     }
 
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWProblemInstance.cs	(revision 6710)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWProblemInstance.cs	(revision 6711)
@@ -50,7 +50,15 @@
     }
 
+    [Storable]
+    private DoubleValue currentPickupViolationPenalty;
+
     public DoubleValue PickupViolationPenalty {
-      get { return PickupViolationPenaltyParameter.Value; }
-      set { PickupViolationPenaltyParameter.Value = value; }
+      get {
+        if (currentPickupViolationPenalty != null)
+          return currentPickupViolationPenalty;
+        else
+          return PickupViolationPenaltyParameter.Value;
+      }
+      set { currentPickupViolationPenalty = value; }
     }
 
@@ -90,4 +98,6 @@
     protected CVRPPDTWProblemInstance(CVRPPDTWProblemInstance original, Cloner cloner)
       : base(original, cloner) {
+        currentPickupViolationPenalty = cloner.Clone(original.currentPickupViolationPenalty) as DoubleValue;
+
         AttachEventHandlers();
     }
@@ -100,4 +110,10 @@
     private void AttachEventHandlers() {
       PickupDeliveryLocationParameter.ValueChanged += new EventHandler(PickupDeliveryLocationParameter_ValueChanged);
+    }
+
+    public override void InitializeState() {
+      base.InitializeState();
+
+      currentPickupViolationPenalty = null;
     }
 
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWProblemInstance.cs	(revision 6710)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWProblemInstance.cs	(revision 6711)
@@ -71,7 +71,16 @@
       set { TimeFactorParameter.Value = value; }
     }
+
+    [Storable]
+    private DoubleValue currentTardinessPenalty;
+
     public DoubleValue TardinessPenalty {
-      get { return TardinessPenaltyParameter.Value; }
-      set { TardinessPenaltyParameter.Value = value; }
+      get {
+        if (currentTardinessPenalty != null)
+          return currentTardinessPenalty;
+        else
+          return TardinessPenaltyParameter.Value;
+      }
+      set { currentTardinessPenalty = value; }
     }
 
@@ -113,4 +122,6 @@
     protected CVRPTWProblemInstance(CVRPTWProblemInstance original, Cloner cloner)
       : base(original, cloner) {
+        currentTardinessPenalty = cloner.Clone(original.currentTardinessPenalty) as DoubleValue;
+
         AttachEventHandlers();
     }
@@ -126,4 +137,10 @@
       TimeFactorParameter.ValueChanged += new EventHandler(TimeFactorParameter_ValueChanged);
       TimeFactorParameter.Value.ValueChanged += new EventHandler(TimeFactor_ValueChanged);
+    }
+
+    public override void InitializeState() {
+      base.InitializeState();
+
+      currentTardinessPenalty = null;
     }
 
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs	(revision 6710)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs	(revision 6711)
@@ -37,5 +37,5 @@
   [Item("VRPProblemInstance", "Represents a VRP instance.")]
   [StorableClass]
-  public abstract class VRPProblemInstance: ParameterizedNamedItem, IVRPProblemInstance {
+  public abstract class VRPProblemInstance : ParameterizedNamedItem, IVRPProblemInstance, IStatefulItem {
     public IValueParameter<IVRPEvaluator> EvaluatorParameter {
       get { return (ValueParameter<IVRPEvaluator>)Parameters["Evaluator"]; } 
@@ -273,13 +273,4 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserializationHook() {
-      #region Backwards Compatibility
-      if (!Parameters.ContainsKey("BestKnownSolution")) {
-        Parameters.Add(new OptionalValueParameter<VRPSolution>("BestKnownSolution", "The best known solution of this TSP instance."));
-      }
-      if (!Parameters.ContainsKey("BestKnownQuality")) {
-        Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this VRP instance."));
-      }
-      #endregion
-
       AttachEventHandlers();
     }
@@ -302,4 +293,10 @@
     }
 
+    public virtual void InitializeState() {
+    }
+
+    public virtual void ClearState() {
+    }
+
     #region Event handlers
     void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/Capacitated/ICapacitatedProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/Capacitated/ICapacitatedProblemInstance.cs	(revision 6710)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/Capacitated/ICapacitatedProblemInstance.cs	(revision 6711)
@@ -29,5 +29,5 @@
 namespace HeuristicLab.Problems.VehicleRouting.Variants {
   public interface ICapacitatedProblemInstance: IVRPProblemInstance {
-    DoubleValue OverloadPenalty { get; }
+    DoubleValue OverloadPenalty { get; set; }
   }
 }
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/PickupAndDelivery/IPickupAndDeliveryProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/PickupAndDelivery/IPickupAndDeliveryProblemInstance.cs	(revision 6710)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/PickupAndDelivery/IPickupAndDeliveryProblemInstance.cs	(revision 6711)
@@ -30,5 +30,5 @@
   public interface IPickupAndDeliveryProblemInstance: IVRPProblemInstance {
     IntArray PickupDeliveryLocation { get; }
-    DoubleValue PickupViolationPenalty { get; }
+    DoubleValue PickupViolationPenalty { get; set; }
   }
 }
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/TimeWindowed/ITimeWindowedProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/TimeWindowed/ITimeWindowedProblemInstance.cs	(revision 6710)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/TimeWindowed/ITimeWindowedProblemInstance.cs	(revision 6711)
@@ -33,5 +33,5 @@
     DoubleArray ServiceTime { get; }
     DoubleValue TimeFactor { get; }
-    DoubleValue TardinessPenalty { get; }
+    DoubleValue TardinessPenalty { get; set; }
   }
 }
