Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/22/12 09:38:54 (13 years ago)
Author:
svonolfe
Message:

Moved adaptive penalties to parameter values (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPProblemInstance.cs

    r7852 r7864  
    5050    }
    5151
    52     [Storable]
    53     private DoubleValue currentOverloadPenalty;
     52    protected IValueParameter<DoubleValue> CurrentOverloadPenaltyParameter {
     53      get { return (IValueParameter<DoubleValue>)Parameters["CurrentOverloadPenalty"]; }
     54    }
    5455
    5556    public DoubleValue OverloadPenalty {
    5657      get {
     58        DoubleValue currentOverloadPenalty = CurrentOverloadPenaltyParameter.Value;
    5759        if (currentOverloadPenalty != null)
    5860          return currentOverloadPenalty;
    5961        else
    6062          return OverloadPenaltyParameter.Value; }
    61       set { currentOverloadPenalty = value; }
     63      set { CurrentOverloadPenaltyParameter.Value = value; }
    6264    }
    6365
     
    8587      Parameters.Add(new ValueParameter<DoubleValue>("Capacity", "The capacity of each vehicle.", new DoubleValue(0)));
    8688      Parameters.Add(new ValueParameter<DoubleValue>("EvalOverloadPenalty", "The overload penalty considered in the evaluation.", new DoubleValue(100)));
     89      Parameters.Add(new OptionalValueParameter<DoubleValue>("CurrentOverloadPenalty", "The current overload penalty considered in the evaluation."));
    8790
    8891      AttachEventHandlers();
     
    9598    protected CVRPProblemInstance(CVRPProblemInstance original, Cloner cloner)
    9699      : base(original, cloner) {
    97         currentOverloadPenalty = cloner.Clone(original.currentOverloadPenalty) as DoubleValue;
    98 
    99100        AttachEventHandlers();
    100101    }
     
    115116      base.InitializeState();
    116117
    117       currentOverloadPenalty = null;
     118      CurrentOverloadPenaltyParameter.Value = null;
    118119    }
    119120
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWProblemInstance.cs

    r6856 r7864  
    5050    }
    5151
    52     [Storable]
    53     private DoubleValue currentPickupViolationPenalty;
     52    protected IValueParameter<DoubleValue> CurrentPickupViolationPenaltyParameter {
     53      get { return (IValueParameter<DoubleValue>)Parameters["CurrentPickupViolationPenalty"]; }
     54    }
    5455
    5556    public DoubleValue PickupViolationPenalty {
    5657      get {
     58        DoubleValue currentPickupViolationPenalty = CurrentPickupViolationPenaltyParameter.Value;
    5759        if (currentPickupViolationPenalty != null)
    5860          return currentPickupViolationPenalty;
     
    6062          return PickupViolationPenaltyParameter.Value;
    6163      }
    62       set { currentPickupViolationPenalty = value; }
     64      set { CurrentPickupViolationPenaltyParameter.Value = value; }
    6365    }
    6466
     
    9395
    9496      Parameters.Add(new ValueParameter<DoubleValue>("EvalPickupViolationPenalty", "The pickup violation penalty considered in the evaluation.", new DoubleValue(100)));
     97      Parameters.Add(new OptionalValueParameter<DoubleValue>("CurrentPickupViolationPenalty", "The current pickup violation penalty considered in the evaluation."));
    9598
    9699      AttachEventHandlers();
     
    103106    protected CVRPPDTWProblemInstance(CVRPPDTWProblemInstance original, Cloner cloner)
    104107      : base(original, cloner) {
    105         currentPickupViolationPenalty = cloner.Clone(original.currentPickupViolationPenalty) as DoubleValue;
    106 
    107108        AttachEventHandlers();
    108109    }
     
    120121      base.InitializeState();
    121122
    122       currentPickupViolationPenalty = null;
     123      CurrentPickupViolationPenaltyParameter.Value = null;
    123124    }
    124125
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWProblemInstance.cs

    r6711 r7864  
    7272    }
    7373
    74     [Storable]
    75     private DoubleValue currentTardinessPenalty;
     74    protected IValueParameter<DoubleValue> CurrentTardinessPenaltyParameter {
     75      get { return (IValueParameter<DoubleValue>)Parameters["CurrentTardinessPenalty"]; }
     76    }
    7677
    7778    public DoubleValue TardinessPenalty {
    7879      get {
     80        DoubleValue currentTardinessPenalty = CurrentTardinessPenaltyParameter.Value;
    7981        if (currentTardinessPenalty != null)
    8082          return currentTardinessPenalty;
     
    8284          return TardinessPenaltyParameter.Value;
    8385      }
    84       set { currentTardinessPenalty = value; }
     86      set { CurrentTardinessPenaltyParameter.Value = value; }
    8587    }
    8688
     
    112114      Parameters.Add(new ValueParameter<DoubleValue>("EvalTimeFactor", "The time factor considered in the evaluation.", new DoubleValue(0)));
    113115      Parameters.Add(new ValueParameter<DoubleValue>("EvalTardinessPenalty", "The tardiness penalty considered in the evaluation.", new DoubleValue(100)));
     116      Parameters.Add(new OptionalValueParameter<DoubleValue>("CurrentTardinessPenalty", "The current tardiness penalty considered in the evaluation."));
    114117
    115118      AttachEventHandlers();
     
    122125    protected CVRPTWProblemInstance(CVRPTWProblemInstance original, Cloner cloner)
    123126      : base(original, cloner) {
    124         currentTardinessPenalty = cloner.Clone(original.currentTardinessPenalty) as DoubleValue;
    125 
    126127        AttachEventHandlers();
    127128    }
     
    142143      base.InitializeState();
    143144
    144       currentTardinessPenalty = null;
     145      CurrentTardinessPenaltyParameter.Value = null;
    145146    }
    146147
Note: See TracChangeset for help on using the changeset viewer.