Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4689


Ignore:
Timestamp:
10/29/10 20:28:04 (12 years ago)
Author:
abeham
Message:

#922

  • Refactored GVR encoding in HeuristicLab.Problems.VehicleRouting
Location:
branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Crossovers/GVRCrossover.cs

    r4352 r4689  
    2727using HeuristicLab.Optimization;
    2828using System.Collections.Generic;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.GVR {
     
    3839    [StorableConstructor]
    3940    private GVRCrossover(bool deserializing) : base(deserializing) { }
    40 
     41    private GVRCrossover(GVRCrossover original, Cloner cloner) : base(original, cloner) { }
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new GVRCrossover(this, cloner);
     44    }
    4145    public GVRCrossover() {
    4246      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    43 
    4447      //remove unused parameters
    4548      Parameters.Remove("ReadyTime");
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/GVREncoding.cs

    r4352 r4689  
    7575      return tours;
    7676    }
    77    
    78     public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
    79       GVREncoding clone = new GVREncoding(capacity, demand);
    80       cloner.RegisterClonedObject(this, clone);
    81       clone.Tours = (ItemList<Tour>)cloner.Clone(this.Tours);
    82      
    83       return clone;
     77
     78    [StorableConstructor]
     79    protected GVREncoding(bool deserializing) : base(deserializing) { }
     80    protected GVREncoding(GVREncoding original, Cloner cloner)
     81      : base(original, cloner) {
     82      this.capacity = original.capacity;
     83      this.demand = original.demand;
     84      this.Tours = cloner.Clone(original.Tours);
    8485    }
    85 
     86    public override IDeepCloneable Clone(Cloner cloner) {
     87      return new GVREncoding(this, cloner);
     88    }
    8689    public GVREncoding(DoubleValue capacity, DoubleArray demand)
    8790      : base() {
    8891        this.capacity = capacity;
    8992        this.demand = demand;
    90     }
    91 
    92     [StorableConstructor]
    93     private GVREncoding(bool serializing)
    94       : base() {
    9593    }
    9694
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRDisplacementManipulator.cs

    r4352 r4689  
    2626using HeuristicLab.Data;
    2727using System.Collections.Generic;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting.Encodings.GVR {
     
    3334    [StorableConstructor]
    3435    private GVRDisplacementManipulator(bool deserializing) : base(deserializing) { }
    35 
     36    private GVRDisplacementManipulator(GVRDisplacementManipulator original, Cloner cloner) : base(original, cloner) { }
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new GVRDisplacementManipulator(this, cloner);
     39    }
    3640    public GVRDisplacementManipulator()
    3741      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRInsertionManipulator.cs

    r4352 r4689  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.GVR {
     
    3233    [StorableConstructor]
    3334    private GVRInsertionManipulator(bool deserializing) : base(deserializing) { }
    34 
    35     public GVRInsertionManipulator()
    36       : base() {
     35    private GVRInsertionManipulator(GVRInsertionManipulator original, Cloner cloner) : base(original, cloner) { }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new GVRInsertionManipulator(this, cloner);
    3738    }
     39    public GVRInsertionManipulator() : base() { }
    3840
    3941    protected override void Manipulate(IRandom random, GVREncoding individual) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRInversionManipulator.cs

    r4352 r4689  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.GVR {
     
    3233    [StorableConstructor]
    3334    private GVRInversionManipulator(bool deserializing) : base(deserializing) { }
    34 
    35     public GVRInversionManipulator()
    36       : base() {
     35    private GVRInversionManipulator(GVRInversionManipulator original, Cloner cloner) : base(original, cloner) { }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new GVRInversionManipulator(this, cloner);
    3738    }
     39    public GVRInversionManipulator() : base() { }
    3840
    3941    protected override void Manipulate(IRandom random, GVREncoding individual) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRManipulator.cs

    r4352 r4689  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Optimization;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting.Encodings.GVR {
     
    3738    [StorableConstructor]
    3839    protected GVRManipulator(bool deserializing) : base(deserializing) { }
    39 
     40    protected GVRManipulator(GVRManipulator original, Cloner cloner) : base(original, cloner) { }
    4041    public GVRManipulator() {
    4142      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRSwapManipulator.cs

    r4352 r4689  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.GVR {
     
    3233    [StorableConstructor]
    3334    private GVRSwapManipulator(bool deserializing) : base(deserializing) { }
    34 
     35    private GVRSwapManipulator(GVRSwapManipulator original, Cloner cloner) : base(original, cloner) { }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new GVRSwapManipulator(this, cloner);
     38    }
    3539    public GVRSwapManipulator()
    3640      : base() {
Note: See TracChangeset for help on using the changeset viewer.