Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6711 for branches/VRP


Ignore:
Timestamp:
09/06/11 14:57:26 (13 years ago)
Author:
svonolfe
Message:

Added adaptive constraint relaxation for all VRP variants (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4
Files:
7 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj

    r6710 r6711  
    123123    <Compile Include="Analyzer\BestSolution\PickupAndDelivery\BestPickupAndDeliveryVRPSolutionAnalyzer.cs" />
    124124    <Compile Include="Analyzer\BestSolution\TimeWindowed\BestTimeWindowedVRPSolutionAnalyzer.cs" />
     125    <Compile Include="Analyzer\ConstraintRelaxation\Capacitated\CapacityRelaxationVRPAnalyzer.cs" />
     126    <Compile Include="Analyzer\ConstraintRelaxation\PickupAndDelivery\PickupViolationsRelaxationVRPAnalyzer.cs" />
     127    <Compile Include="Analyzer\ConstraintRelaxation\TimeWindowed\TimeWindowRelaxationVRPAnalyzer.cs" />
    125128    <Compile Include="Analyzer\VRPSolution.cs" />
    126129    <Compile Include="Encodings\Alba\AlbaEncoding.cs" />
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPProblemInstance.cs

    r6710 r6711  
    4949      set { CapacityParameter.Value = value; }
    5050    }
     51
     52    [Storable]
     53    private DoubleValue currentOverloadPenalty;
     54
    5155    public DoubleValue OverloadPenalty {
    52       get { return OverloadPenaltyParameter.Value; }
    53       set { OverloadPenaltyParameter.Value = value; }
     56      get {
     57        if (currentOverloadPenalty != null)
     58          return currentOverloadPenalty;
     59        else
     60          return OverloadPenaltyParameter.Value; }
     61      set { currentOverloadPenalty = value; }
    5462    }
    5563
     
    8795    protected CVRPProblemInstance(CVRPProblemInstance original, Cloner cloner)
    8896      : base(original, cloner) {
     97        currentOverloadPenalty = cloner.Clone(original.currentOverloadPenalty) as DoubleValue;
     98
    8999        AttachEventHandlers();
    90100    }
     
    100110      OverloadPenaltyParameter.ValueChanged += new EventHandler(OverloadPenaltyParameter_ValueChanged);
    101111      OverloadPenaltyParameter.Value.ValueChanged += new EventHandler(OverloadPenalty_ValueChanged);
     112    }
     113
     114    public override void InitializeState() {
     115      base.InitializeState();
     116
     117      currentOverloadPenalty = null;
    102118    }
    103119
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWProblemInstance.cs

    r6710 r6711  
    5050    }
    5151
     52    [Storable]
     53    private DoubleValue currentPickupViolationPenalty;
     54
    5255    public DoubleValue PickupViolationPenalty {
    53       get { return PickupViolationPenaltyParameter.Value; }
    54       set { PickupViolationPenaltyParameter.Value = value; }
     56      get {
     57        if (currentPickupViolationPenalty != null)
     58          return currentPickupViolationPenalty;
     59        else
     60          return PickupViolationPenaltyParameter.Value;
     61      }
     62      set { currentPickupViolationPenalty = value; }
    5563    }
    5664
     
    9098    protected CVRPPDTWProblemInstance(CVRPPDTWProblemInstance original, Cloner cloner)
    9199      : base(original, cloner) {
     100        currentPickupViolationPenalty = cloner.Clone(original.currentPickupViolationPenalty) as DoubleValue;
     101
    92102        AttachEventHandlers();
    93103    }
     
    100110    private void AttachEventHandlers() {
    101111      PickupDeliveryLocationParameter.ValueChanged += new EventHandler(PickupDeliveryLocationParameter_ValueChanged);
     112    }
     113
     114    public override void InitializeState() {
     115      base.InitializeState();
     116
     117      currentPickupViolationPenalty = null;
    102118    }
    103119
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWProblemInstance.cs

    r6710 r6711  
    7171      set { TimeFactorParameter.Value = value; }
    7272    }
     73
     74    [Storable]
     75    private DoubleValue currentTardinessPenalty;
     76
    7377    public DoubleValue TardinessPenalty {
    74       get { return TardinessPenaltyParameter.Value; }
    75       set { TardinessPenaltyParameter.Value = value; }
     78      get {
     79        if (currentTardinessPenalty != null)
     80          return currentTardinessPenalty;
     81        else
     82          return TardinessPenaltyParameter.Value;
     83      }
     84      set { currentTardinessPenalty = value; }
    7685    }
    7786
     
    113122    protected CVRPTWProblemInstance(CVRPTWProblemInstance original, Cloner cloner)
    114123      : base(original, cloner) {
     124        currentTardinessPenalty = cloner.Clone(original.currentTardinessPenalty) as DoubleValue;
     125
    115126        AttachEventHandlers();
    116127    }
     
    126137      TimeFactorParameter.ValueChanged += new EventHandler(TimeFactorParameter_ValueChanged);
    127138      TimeFactorParameter.Value.ValueChanged += new EventHandler(TimeFactor_ValueChanged);
     139    }
     140
     141    public override void InitializeState() {
     142      base.InitializeState();
     143
     144      currentTardinessPenalty = null;
    128145    }
    129146
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs

    r6607 r6711  
    3737  [Item("VRPProblemInstance", "Represents a VRP instance.")]
    3838  [StorableClass]
    39   public abstract class VRPProblemInstance: ParameterizedNamedItem, IVRPProblemInstance {
     39  public abstract class VRPProblemInstance : ParameterizedNamedItem, IVRPProblemInstance, IStatefulItem {
    4040    public IValueParameter<IVRPEvaluator> EvaluatorParameter {
    4141      get { return (ValueParameter<IVRPEvaluator>)Parameters["Evaluator"]; }
     
    273273    [StorableHook(HookType.AfterDeserialization)]
    274274    private void AfterDeserializationHook() {
    275       #region Backwards Compatibility
    276       if (!Parameters.ContainsKey("BestKnownSolution")) {
    277         Parameters.Add(new OptionalValueParameter<VRPSolution>("BestKnownSolution", "The best known solution of this TSP instance."));
    278       }
    279       if (!Parameters.ContainsKey("BestKnownQuality")) {
    280         Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this VRP instance."));
    281       }
    282       #endregion
    283 
    284275      AttachEventHandlers();
    285276    }
     
    302293    }
    303294
     295    public virtual void InitializeState() {
     296    }
     297
     298    public virtual void ClearState() {
     299    }
     300
    304301    #region Event handlers
    305302    void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/Capacitated/ICapacitatedProblemInstance.cs

    r4376 r6711  
    2929namespace HeuristicLab.Problems.VehicleRouting.Variants {
    3030  public interface ICapacitatedProblemInstance: IVRPProblemInstance {
    31     DoubleValue OverloadPenalty { get; }
     31    DoubleValue OverloadPenalty { get; set; }
    3232  }
    3333}
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/PickupAndDelivery/IPickupAndDeliveryProblemInstance.cs

    r6710 r6711  
    3030  public interface IPickupAndDeliveryProblemInstance: IVRPProblemInstance {
    3131    IntArray PickupDeliveryLocation { get; }
    32     DoubleValue PickupViolationPenalty { get; }
     32    DoubleValue PickupViolationPenalty { get; set; }
    3333  }
    3434}
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/TimeWindowed/ITimeWindowedProblemInstance.cs

    r4363 r6711  
    3333    DoubleArray ServiceTime { get; }
    3434    DoubleValue TimeFactor { get; }
    35     DoubleValue TardinessPenalty { get; }
     35    DoubleValue TardinessPenalty { get; set; }
    3636  }
    3737}
Note: See TracChangeset for help on using the changeset viewer.