Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (14 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Problems.VehicleRouting

  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuCrossover.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
     24using HeuristicLab.Optimization;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    27 using HeuristicLab.Optimization;
    2827
    2928namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu {
     
    3433      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    3534    }
    36    
     35
    3736    [StorableConstructor]
    3837    protected ZhuCrossover(bool deserializing) : base(deserializing) { }
     38    protected ZhuCrossover(ZhuCrossover original, Cloner cloner)
     39      : base(original, cloner) {
     40    }
    3941
    4042    public ZhuCrossover()
     
    5254        if (!(solution is ZhuEncoding)) {
    5355          parents[i] = ZhuEncoding.ConvertFrom(solution,
    54             Cities, 
     56            Cities,
    5557            DueTimeParameter.ActualValue,
    5658            ServiceTimeParameter.ActualValue,
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover1.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
    24 using HeuristicLab.Parameters;
    2524using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    2725
    2826namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu {
    2927  [Item("ZhuHeuristicCrossover1", "The Zhu Heuristic Crossover (Version 1). It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")]
    3028  [StorableClass]
    31   public sealed class ZhuHeuristicCrossover1 : ZhuCrossover {   
     29  public sealed class ZhuHeuristicCrossover1 : ZhuCrossover {
    3230    [StorableConstructor]
    3331    private ZhuHeuristicCrossover1(bool deserializing) : base(deserializing) { }
    34 
     32    private ZhuHeuristicCrossover1(ZhuHeuristicCrossover1 original, Cloner cloner)
     33      : base(original, cloner) {
     34    }
     35    public override IDeepCloneable Clone(Cloner cloner) {
     36      return new ZhuHeuristicCrossover1(this, cloner);
     37    }
    3538    public ZhuHeuristicCrossover1()
    3639      : base() {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover2.cs

    r4352 r4722  
    2020#endregion
    2121
     22using System.Collections.Generic;
     23using HeuristicLab.Common;
    2224using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
    24 using HeuristicLab.Parameters;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    27 using System.Collections.Generic;
    2826
    2927namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu {
    3028  [Item("ZhuHeuristicCrossover2", "The Zhu Heuristic Crossover (Version 2). It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")]
    3129  [StorableClass]
    32   public sealed class ZhuHeuristicCrossover2 : ZhuCrossover {   
     30  public sealed class ZhuHeuristicCrossover2 : ZhuCrossover {
    3331    [StorableConstructor]
    3432    private ZhuHeuristicCrossover2(bool deserializing) : base(deserializing) { }
    35 
     33    private ZhuHeuristicCrossover2(ZhuHeuristicCrossover2 original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new ZhuHeuristicCrossover2(this, cloner);
     38    }
    3639    public ZhuHeuristicCrossover2()
    3740      : base() {
     
    4952      if (predecessor < 0)
    5053        predecessor = predecessor + child.Length;
    51      
     54
    5255      int parent1Index = i;
    5356      int parent2Index = i;
     
    5659        if (i == breakPoint) {
    5760          child[i] = p1[parent1Index];
    58          
     61
    5962          p1.Remove(child[i]);
    6063          if (parent1Index >= p1.Count)
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuMergeCrossover1.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
    24 using HeuristicLab.Parameters;
    2524using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    2725
    2826namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu {
    2927  [Item("ZhuMergeCrossover1", "The Zhu Merge Crossover (Version 1). It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")]
    3028  [StorableClass]
    31   public sealed class ZhuMergeCrossover1 : ZhuCrossover {   
     29  public sealed class ZhuMergeCrossover1 : ZhuCrossover {
    3230    [StorableConstructor]
    3331    private ZhuMergeCrossover1(bool deserializing) : base(deserializing) { }
    34 
     32    private ZhuMergeCrossover1(ZhuMergeCrossover1 original, Cloner cloner)
     33      : base(original, cloner) {
     34    }
     35    public override IDeepCloneable Clone(Cloner cloner) {
     36      return new ZhuMergeCrossover1(this, cloner);
     37    }
    3538    public ZhuMergeCrossover1()
    3639      : base() {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuMergeCrossover2.cs

    r4352 r4722  
    2020#endregion
    2121
     22using System.Collections.Generic;
     23using HeuristicLab.Common;
    2224using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
    24 using HeuristicLab.Parameters;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    27 using System.Collections.Generic;
    2826
    2927namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu {
    3028  [Item("ZhuMergeCrossover2", "The Zhu Merge Crossover (Version 2).  It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")]
    3129  [StorableClass]
    32   public sealed class ZhuMergeCrossover2 : ZhuCrossover {   
     30  public sealed class ZhuMergeCrossover2 : ZhuCrossover {
    3331    [StorableConstructor]
    3432    private ZhuMergeCrossover2(bool deserializing) : base(deserializing) { }
    35 
     33    private ZhuMergeCrossover2(ZhuMergeCrossover2 original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new ZhuMergeCrossover2(this, cloner);
     38    }
    3639    public ZhuMergeCrossover2()
    3740      : base() {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuPermutationCrossover.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.PermutationEncoding;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu {
    2929  [Item("ZhuPermutationCrossover", "An operator which crosses two VRP representations using a standard permutation operator. It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")]
    3030  [StorableClass]
    31   public sealed class PrinsPermutationCrossover : ZhuCrossover {   
     31  public sealed class PrinsPermutationCrossover : ZhuCrossover {
    3232    public IValueLookupParameter<IPermutationCrossover> InnerCrossoverParameter {
    3333      get { return (IValueLookupParameter<IPermutationCrossover>)Parameters["InnerCrossover"]; }
     
    3636    [StorableConstructor]
    3737    private PrinsPermutationCrossover(bool deserializing) : base(deserializing) { }
    38 
     38    private PrinsPermutationCrossover(PrinsPermutationCrossover original, Cloner cloner)
     39      : base(original, cloner) {
     40    }
     41    public override IDeepCloneable Clone(Cloner cloner) {
     42      return new PrinsPermutationCrossover(this, cloner);
     43    }
    3944    public PrinsPermutationCrossover()
    4045      : base() {
Note: See TracChangeset for help on using the changeset viewer.