Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 20:30:20 (14 years ago)
Author:
gkronber
Message:

Refactored cloning in HeuristicLab.Problems.VehicleRouting. #922

Location:
branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerInsertionManipulator.cs

    r4352 r4690  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3233    [StorableConstructor]
    3334    private AlbaCustomerInsertionManipulator(bool deserializing) : base(deserializing) { }
    34 
     35    private AlbaCustomerInsertionManipulator(AlbaCustomerInsertionManipulator original, Cloner cloner)
     36      : base(original, cloner) {
     37    }
    3538    public AlbaCustomerInsertionManipulator()
    3639      : base() {
     40    }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new AlbaCustomerInsertionManipulator(this, cloner);
    3744    }
    3845
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerInversionManipulator.cs

    r4352 r4690  
    2626using HeuristicLab.Data;
    2727using System.Collections.Generic;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3334    [StorableConstructor]
    3435    private AlbaCustomerInversionManipulator(bool deserializing) : base(deserializing) { }
    35 
     36    private AlbaCustomerInversionManipulator(AlbaCustomerInversionManipulator original, Cloner cloner)
     37      : base(original, cloner) {
     38    }
    3639    public AlbaCustomerInversionManipulator()
    3740      : base() {
    3841    }
    3942
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new AlbaCustomerInversionManipulator(this, cloner);
     45    }
    4046    protected override void Manipulate(IRandom random, AlbaEncoding individual) {
    4147      int breakPoint1, breakPoint2;
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerSwapManipulator.cs

    r4352 r4690  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3233    [StorableConstructor]
    3334    private AlbaCustomerSwapManipulator(bool deserializing) : base(deserializing) { }
    34 
     35    private AlbaCustomerSwapManipulator(AlbaCustomerSwapManipulator original, Cloner cloner) : base(original, cloner) { }
    3536    public AlbaCustomerSwapManipulator()
    3637      : base() {
     38    }
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new AlbaCustomerSwapManipulator(this, cloner);
    3741    }
    3842
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaIntraRouteInversionManipulator.cs

    r4352 r4690  
    2727using System;
    2828using System.Collections.Generic;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    3132  [Item("AlbaIntraRouteInversionManipulator", "An operator which applies the SLS operation to a VRP representation. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")]
    3233  [StorableClass]
    33   public sealed class AlbaIntraRouteInversionManipulator : AlbaManipulator {   
     34  public sealed class AlbaIntraRouteInversionManipulator : AlbaManipulator {
    3435    [StorableConstructor]
    3536    private AlbaIntraRouteInversionManipulator(bool deserializing) : base(deserializing) { }
    36 
     37    private AlbaIntraRouteInversionManipulator(AlbaIntraRouteInversionManipulator original, Cloner cloner) : base(original, cloner) { }
    3738    public AlbaIntraRouteInversionManipulator()
    3839      : base() {
    39      }
     40    }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new AlbaIntraRouteInversionManipulator(this, cloner);
     44    }
    4045
    4146    public static void Apply(AlbaEncoding individual, int index1, int index2) {
     
    7277
    7378        int currentTourEnd = currentTourStart;
    74         while (currentTourEnd < individual.Length && 
     79        while (currentTourEnd < individual.Length &&
    7580          individual[currentTourEnd] < individual.Cities) {
    7681          currentTourEnd++;
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaLambdaInterchangeManipulator.cs

    r4352 r4690  
    2727using System;
    2828using System.Collections.Generic;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3536      get { return (IValueParameter<IntValue>)Parameters["Lambda"]; }
    3637    }
    37    
     38
    3839    [StorableConstructor]
    3940    private AlbaLambdaInterchangeManipulator(bool deserializing) : base(deserializing) { }
    40 
     41    private AlbaLambdaInterchangeManipulator(AlbaLambdaInterchangeManipulator original, Cloner cloner) : base(original, cloner) { }
    4142    public AlbaLambdaInterchangeManipulator()
    4243      : base() {
    43         Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1)));
    44      }
     44      Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1)));
     45    }
    4546
    46     public static void Apply(AlbaEncoding individual, int tour1Index, int position1, int length1,
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new AlbaLambdaInterchangeManipulator(this, cloner);
     49    }
     50
     51    public static void Apply(AlbaEncoding individual, int tour1Index, int position1, int length1,
    4752      int tour2Index, int position2, int length2) {
    4853      List<Tour> tours = individual.GetTours();
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaManipulator.cs

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

    r4416 r4690  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3637    [StorableConstructor]
    3738    private AlbaPermutationManipualtor(bool deserializing) : base(deserializing) { }
    38 
     39    private AlbaPermutationManipualtor(AlbaPermutationManipualtor original, Cloner cloner) : base(original, cloner) { }
    3940    public AlbaPermutationManipualtor()
    4041      : base() {
    41         Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator()));
     42      Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator()));
     43    }
     44
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new AlbaPermutationManipualtor(this, cloner);
    4247    }
    4348
Note: See TracChangeset for help on using the changeset viewer.