Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4690


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
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestAverageWorstVRPToursAnalyzer.cs

    r4416 r4690  
    150150    public BestAverageWorstVRPToursAnalyzer()
    151151      : base() {
    152       #region Create parameters     
     152      #region Create parameters
    153153      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Overload", "The overloads of the VRP solutions which should be analyzed."));
    154154      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestOverload", "The best overload value."));
     
    157157      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentWorstOverload", "The current worst overload value of all solutions."));
    158158      Parameters.Add(new ValueLookupParameter<DataTable>("Overloads", "The data table to store the current best, current average, current worst, best and best known overload value."));
    159  
     159
    160160      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Tardiness", "The tardiness of the VRP solutions which should be analyzed."));
    161161      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestTardiness", "The best tardiness value."));
     
    311311    [StorableConstructor]
    312312    private BestAverageWorstVRPToursAnalyzer(bool deserializing) : base() { }
     313    private BestAverageWorstVRPToursAnalyzer(BestAverageWorstVRPToursAnalyzer original, Cloner cloner)
     314      : base(original, cloner) {
     315      Initialize();
     316    }
     317    public override IDeepCloneable Clone(Cloner cloner) {
     318      return new BestAverageWorstVRPToursAnalyzer(this, cloner);
     319    }
    313320
    314321    [StorableHook(HookType.AfterDeserialization)]
     322    private void AfterDeserialization() {
     323      Initialize();
     324    }
    315325    private void Initialize() {
    316326      OverloadParameter.DepthChanged += new EventHandler(OverloadParameter_DepthChanged);
     
    321331    }
    322332
    323     public override IDeepCloneable Clone(Cloner cloner) {
    324       BestAverageWorstVRPToursAnalyzer clone = (BestAverageWorstVRPToursAnalyzer)base.Clone(cloner);
    325       clone.Initialize();
    326       return clone;
    327     }
    328333
    329334    void OverloadParameter_DepthChanged(object sender, EventArgs e) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestAverageWorstVRPToursCalculator.cs

    r4352 r4690  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting {
     
    9596    }
    9697
     98    [StorableConstructor]
     99    private BestAverageWorstVRPToursCalculator(bool deserializing) : base(deserializing) { }
     100    private BestAverageWorstVRPToursCalculator(BestAverageWorstVRPToursCalculator original, Cloner cloner)
     101      : base(original, cloner) {
     102    }
    97103    public BestAverageWorstVRPToursCalculator()
    98104      : base() {
     
    123129    }
    124130
     131    public override IDeepCloneable Clone(Cloner cloner) {
     132      return new BestAverageWorstVRPToursCalculator(this, cloner);
     133    }
     134
    125135    private void UpdateOverloads() {
    126136      ItemArray<DoubleValue> overloads = OverloadParameter.ActualValue;
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestVRPSolutionAnalyzer.cs

    r4513 r4690  
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting {
     
    8384    [StorableConstructor]
    8485    private BestVRPSolutionAnalyzer(bool deserializing) : base(deserializing) { }
    85 
     86    private BestVRPSolutionAnalyzer(BestVRPSolutionAnalyzer original, Cloner cloner)
     87      : base(original, cloner) {
     88    }
    8689    public BestVRPSolutionAnalyzer()
    8790      : base() {
     
    102105      Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best VRP solution."));
    103106      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored."));
     107    }
     108
     109    public override IDeepCloneable Clone(Cloner cloner) {
     110      return new BestVRPSolutionAnalyzer(this, cloner);
    104111    }
    105112
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestVRPToursMemorizer.cs

    r4352 r4690  
    2626using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting {
     
    6364    }
    6465
     66    [StorableConstructor]
     67    protected BestVRPToursMemorizer(bool deserializing) : base(deserializing) { }
     68    protected BestVRPToursMemorizer(BestVRPToursMemorizer original, Cloner cloner)
     69      : base(original, cloner) {
     70    }
    6571    public BestVRPToursMemorizer()
    6672      : base() {
     
    7783      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestVehiclesUtilized", "The best vehicles utilized found so far."));
    7884 
     85    }
     86
     87    public override IDeepCloneable Clone(Cloner cloner) {
     88      return new BestVRPToursMemorizer(this, cloner);
    7989    }
    8090
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/AlbaEncoding.cs

    r4352 r4690  
    3434    [Storable]
    3535    private int cities;
    36    
     36
    3737    #region IVRPEncoding Members
    3838    public override List<Tour> GetTours(ILookupParameter<DoubleMatrix> distanceMatrix = null, int maxVehicles = int.MaxValue) {
     
    6464
    6565    public int MaxVehicles {
    66       get { return Length - Cities + 1;  }
     66      get { return Length - Cities + 1; }
    6767    }
    6868
    6969    #endregion
    7070
    71     public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
    72       AlbaEncoding clone = new AlbaEncoding(
    73         new Permutation(this.PermutationType, this.array), cities);
    74       cloner.RegisterClonedObject(this, clone);
    75       clone.readOnly = readOnly;
    76       return clone;
     71
     72    [StorableConstructor]
     73    protected AlbaEncoding(bool deserializing) : base(deserializing) { }
     74    protected AlbaEncoding(AlbaEncoding original, Cloner cloner)
     75      : base(original, cloner) {
     76      cities = original.cities;
     77      readOnly = original.readOnly;
    7778    }
    7879
     
    8283    }
    8384
    84     [StorableConstructor]
    85     private AlbaEncoding(bool serializing)
    86       : base(serializing) {
     85    public override IDeepCloneable Clone(Cloner cloner) {
     86      return new AlbaEncoding(this, cloner);
    8787    }
    8888
     
    103103      foreach (Tour tour in tours) {
    104104        foreach (int city in tour.Cities) {
    105             array[arrayIndex] = city - 1;
    106             arrayIndex++;
     105          array[arrayIndex] = city - 1;
     106          arrayIndex++;
    107107        }
    108108
     
    119119        arrayIndex++;
    120120      }
    121            
     121
    122122      AlbaEncoding solution = new AlbaEncoding(new Permutation(PermutationTypes.RelativeUndirected, new IntArray(array)), cities);
    123123
     
    128128      List<int> route = new List<int>(routeParam);
    129129      route.RemoveAt(routeParam.Count - 1);
    130      
     130
    131131      int cities = 0;
    132132      for (int i = 0; i < route.Count; i++) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.cs

    r4352 r4690  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Optimization;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3435      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    3536    }
    36    
     37
    3738    [StorableConstructor]
    3839    protected AlbaCrossover(bool deserializing) : base(deserializing) { }
    39 
     40    protected AlbaCrossover(AlbaCrossover original, Cloner cloner) : base(original, cloner) { }
    4041    public AlbaCrossover()
    4142      : base() {
    4243      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    43    
     44
    4445      AlbaEncoding.RemoveUnusedParameters(Parameters);
    4546    }
     
    6162      ParentsParameter.ActualValue = parents;
    6263
    63       ChildParameter.ActualValue = 
     64      ChildParameter.ActualValue =
    6465        Crossover(RandomParameter.ActualValue, parents[0] as AlbaEncoding, parents[1] as AlbaEncoding);
    6566
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaPermutationCrossover.cs

    r4352 r4690  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3637    [StorableConstructor]
    3738    private AlbaPermutationCrossover(bool deserializing) : base(deserializing) { }
    38 
     39    private AlbaPermutationCrossover(AlbaPermutationCrossover original, Cloner cloner)
     40      : base(original, cloner) {
     41    }
    3942    public AlbaPermutationCrossover()
    4043      : base() {
  • 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
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveMaker.cs

    r4352 r4690  
    2424using HeuristicLab.Parameters;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Common;
    2627
    2728namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    6061      get { return (ILookupParameter<DoubleValue>)Parameters["Tardiness"]; }
    6162    }
    62    
     63
    6364    [StorableConstructor]
    6465    protected AlbaMoveMaker(bool deserializing) : base(deserializing) { }
    65 
     66    protected AlbaMoveMaker(AlbaMoveMaker original, Cloner cloner) : base(original, cloner) { }
    6667    public AlbaMoveMaker()
    6768      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveOperator.cs

    r4352 r4690  
    2525using HeuristicLab.Data;
    2626using HeuristicLab.Parameters;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    2930  [Item("AlbaMoveOperator", "A move operator for an Alba VRP representation.")]
    3031  [StorableClass]
    31   public abstract class AlbaMoveOperator : VRPMoveOperator {   
     32  public abstract class AlbaMoveOperator : VRPMoveOperator {
    3233    [StorableConstructor]
    3334    protected AlbaMoveOperator(bool deserializing) : base(deserializing) { }
    34 
    35     public AlbaMoveOperator() : base()
    36     {
     35    protected AlbaMoveOperator(AlbaMoveOperator original, Cloner cloner) : base(original, cloner) { }
     36    public AlbaMoveOperator()
     37      : base() {
    3738      AlbaEncoding.RemoveUnusedParameters(Parameters);
    3839    }
     
    4142      IVRPEncoding solution = VRPToursParameter.ActualValue;
    4243      if (!(solution is AlbaEncoding)) {
    43         VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value, 
     44        VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value,
    4445          DistanceMatrixParameter);
    4546      }
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaPermutationMoveOperator.cs

    r4352 r4690  
    2525using HeuristicLab.Data;
    2626using HeuristicLab.Parameters;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    2930  [Item("AlbaPermutationMoveOperator", "A move operator for an Alba VRP representation using an inner permutation move operator.")]
    3031  [StorableClass]
    31   public abstract class AlbaPermutationMoveOperator : AlbaMoveOperator {   
     32  public abstract class AlbaPermutationMoveOperator : AlbaMoveOperator {
    3233    [Storable]
    3334    protected abstract IPermutationMoveOperator PermutationMoveOperatorParameter { get; set; }
     
    3536    [StorableConstructor]
    3637    protected AlbaPermutationMoveOperator(bool deserializing) : base(deserializing) { }
    37 
     38    protected AlbaPermutationMoveOperator(AlbaPermutationMoveOperator original, Cloner cloner) : base(original, cloner) { }
    3839    public AlbaPermutationMoveOperator()
    39       : base()
    40     {
     40      : base() {
    4141    }
    4242
    4343    public override IOperation Apply() {
    4444      IOperation next = base.Apply();
    45      
     45
    4646      IVRPEncoding solution = VRPToursParameter.ActualValue;
    4747
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaExhaustiveIntraRouteInversionMoveGenerator.cs

    r4352 r4690  
    2727using HeuristicLab.Parameters;
    2828using System.Collections.Generic;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3435    [StorableConstructor]
    3536    private AlbaExhaustiveIntraRouteInversionGenerator(bool deserializing) : base(deserializing) { }
    36 
     37    private AlbaExhaustiveIntraRouteInversionGenerator(AlbaExhaustiveIntraRouteInversionGenerator original, Cloner cloner) : base(original, cloner) { }
    3738    public AlbaExhaustiveIntraRouteInversionGenerator()
    3839      : base() {
     40    }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new AlbaExhaustiveIntraRouteInversionGenerator(this, cloner);
    3944    }
    4045
     
    4449      int currentTourStart = 0;
    4550      int currentTourEnd = 0;
    46       while(currentTourEnd != individual.Length) {
     51      while (currentTourEnd != individual.Length) {
    4752        currentTourEnd = currentTourStart;
    48         while (individual[currentTourEnd] < individual.Cities && 
     53        while (individual[currentTourEnd] < individual.Cities &&
    4954          currentTourEnd < individual.Length) {
    5055          currentTourEnd++;
     
    5358        int tourLength = currentTourEnd - currentTourStart;
    5459        if (tourLength >= 4) {
    55           for (int i = 0; i <= tourLength - 4; i++ ) {
     60          for (int i = 0; i <= tourLength - 4; i++) {
    5661            for (int j = i + 2; j <= tourLength - 2; j++) {
    5762              AlbaIntraRouteInversionMove move = new AlbaIntraRouteInversionMove(
    58                 currentTourStart + i, 
    59                 currentTourStart + j, 
     63                currentTourStart + i,
     64                currentTourStart + j,
    6065                individual);
    6166
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionEvaluator.cs

    r4352 r4690  
    2626using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    2727using HeuristicLab.Data;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting {
     
    3738    [StorableConstructor]
    3839    private AlbaIntraRouteInversionMoveEvaluator(bool deserializing) : base(deserializing) { }
    39 
     40    private AlbaIntraRouteInversionMoveEvaluator(AlbaIntraRouteInversionMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
    4041    public AlbaIntraRouteInversionMoveEvaluator()
    4142      : base() {
    42         Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to evaluate."));
     43      Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to evaluate."));
     44    }
     45
     46    public override IDeepCloneable Clone(Cloner cloner) {
     47      return new AlbaIntraRouteInversionMoveEvaluator(this, cloner);
    4348    }
    4449
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMove.cs

    r4352 r4690  
    3232  public class AlbaIntraRouteInversionMove : TwoIndexMove, IVRPMove {
    3333    public IVRPEncoding Individual { get { return Permutation as AlbaEncoding; } }
    34    
     34
     35    [StorableConstructor]
     36    protected AlbaIntraRouteInversionMove(bool deserializing) : base(deserializing) { }
     37    protected AlbaIntraRouteInversionMove(AlbaIntraRouteInversionMove original, Cloner cloner)
     38      : base(original, cloner) {
     39      Permutation = cloner.Clone(original.Permutation);
     40    }
    3541    public AlbaIntraRouteInversionMove()
    3642      : base() {
     
    4349    public AlbaIntraRouteInversionMove(int index1, int index2, AlbaEncoding permutation)
    4450      : base(index1, index2, permutation) {
    45         this.Permutation = permutation.Clone() as AlbaEncoding;
     51      this.Permutation = permutation.Clone() as AlbaEncoding;
    4652    }
    4753
    48     public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
    49       AlbaIntraRouteInversionMove clone = new AlbaIntraRouteInversionMove(
    50         Index1, Index2);
    51 
    52       if (Permutation != null)
    53         clone.Permutation = (AlbaEncoding)cloner.Clone(Permutation);
    54 
    55       cloner.RegisterClonedObject(this, clone);
    56       return clone;
     54    public override IDeepCloneable Clone(Cloner cloner) {
     55      return new AlbaIntraRouteInversionMove(this, cloner);
    5756    }
    5857
     
    6160    public TourEvaluation GetMoveQuality(
    6261      IntValue vehicles,
    63       DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 
     62      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
    6463      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
    6564      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
    6665      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
    6766      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
    68         return AlbaIntraRouteInversionMoveEvaluator.GetMoveQuality(Permutation as AlbaEncoding, this, vehicles,
    69           dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
    70           coordinates, fleetUsageFactor, timeFactor, distanceFactor,
    71           overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix);
     67      return AlbaIntraRouteInversionMoveEvaluator.GetMoveQuality(Permutation as AlbaEncoding, this, vehicles,
     68        dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
     69        coordinates, fleetUsageFactor, timeFactor, distanceFactor,
     70        overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix);
    7271    }
    7372
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveGenerator.cs

    r4352 r4690  
    2727using HeuristicLab.Parameters;
    2828using System.Collections.Generic;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4243    [StorableConstructor]
    4344    protected AlbaIntraRouteInversionMoveGenerator(bool deserializing) : base(deserializing) { }
    44 
     45    protected AlbaIntraRouteInversionMoveGenerator(AlbaIntraRouteInversionMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4546    public AlbaIntraRouteInversionMoveGenerator()
    4647      : base() {
    47         Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The moves that should be generated in subscopes."));
    48         Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
     48      Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The moves that should be generated in subscopes."));
     49      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
    4950    }
    5051
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveMaker.cs

    r4352 r4690  
    2626using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4647    [StorableConstructor]
    4748    private AlbaIntraRouteInversionMoveMaker(bool deserializing) : base(deserializing) { }
    48 
     49    private AlbaIntraRouteInversionMoveMaker(AlbaIntraRouteInversionMoveMaker original, Cloner cloner)
     50      : base(original, cloner) {
     51    }
    4952    public AlbaIntraRouteInversionMoveMaker()
    5053      : base() {
     
    5255      Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to make."));
    5356      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move."));
     57    }
     58
     59    public override IDeepCloneable Clone(Cloner cloner) {
     60      return new AlbaIntraRouteInversionMoveMaker(this, cloner);
    5461    }
    5562
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaStochasticIntraRouteInversionMutliMoveGenerator.cs

    r4352 r4690  
    2828using System.Collections.Generic;
    2929using HeuristicLab.Data;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4041      get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; }
    4142    }
    42    
     43
    4344    [StorableConstructor]
    4445    private AlbaStochasticIntraRouteInversionMultiMoveGenerator(bool deserializing) : base(deserializing) { }
    45 
     46    private AlbaStochasticIntraRouteInversionMultiMoveGenerator(AlbaStochasticIntraRouteInversionMultiMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4647    public AlbaStochasticIntraRouteInversionMultiMoveGenerator()
    4748      : base() {
    48         Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
    49         Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
     49      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     50      Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
     51    }
     52
     53    public override IDeepCloneable Clone(Cloner cloner) {
     54      return new AlbaStochasticIntraRouteInversionMultiMoveGenerator(this, cloner);
    5055    }
    5156
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaStochasticIntraRouteInversionSingleMoveGenerator.cs

    r4352 r4690  
    2828using System.Collections.Generic;
    2929using HeuristicLab.Problems.VehicleRouting.Encodings.General;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4142
    4243    #endregion
    43    
     44
    4445    public ILookupParameter<IRandom> RandomParameter {
    4546      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    4647    }
    47    
     48
    4849    [StorableConstructor]
    4950    private AlbaStochasticIntraRouteInversionSingleMoveGenerator(bool deserializing) : base(deserializing) { }
    50 
     51    private AlbaStochasticIntraRouteInversionSingleMoveGenerator(AlbaStochasticIntraRouteInversionSingleMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    5152    public AlbaStochasticIntraRouteInversionSingleMoveGenerator()
    5253      : base() {
    53         Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     54      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     55    }
     56
     57    public override IDeepCloneable Clone(Cloner cloner) {
     58      return new AlbaStochasticIntraRouteInversionSingleMoveGenerator(this, cloner);
    5459    }
    5560
     
    7580
    7681        int currentTourEnd = currentTourStart;
    77         while (currentTourEnd < individual.Length && 
     82        while (currentTourEnd < individual.Length &&
    7883          individual[currentTourEnd] < individual.Cities) {
    7984          currentTourEnd++;
     
    9398
    9499      AlbaIntraRouteInversionMove move = Apply(individual, Cities, RandomParameter.ActualValue);
    95       if(move != null)
     100      if (move != null)
    96101        moves.Add(move);
    97102
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaExhaustiveLambdaInterchangeMoveGenerator.cs

    r4352 r4690  
    2727using HeuristicLab.Parameters;
    2828using System.Collections.Generic;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3435    [StorableConstructor]
    3536    private AlbaExhaustiveLambdaInterchangeMoveGenerator(bool deserializing) : base(deserializing) { }
    36 
    37     public AlbaExhaustiveLambdaInterchangeMoveGenerator()
    38       : base() {
     37    private AlbaExhaustiveLambdaInterchangeMoveGenerator(AlbaExhaustiveLambdaInterchangeMoveGenerator original, Cloner cloner) : base(original, cloner) { }
     38    public AlbaExhaustiveLambdaInterchangeMoveGenerator() : base() { }
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new AlbaExhaustiveLambdaInterchangeMoveGenerator(this, cloner);
    3941    }
    4042
     
    5052
    5153          for (int length1 = 0; length1 <= Math.Min(lambda, tour1.Cities.Count); length1++) {
    52             for(int length2 = 0; length2 <= Math.Min(lambda, tour2.Cities.Count); length2++) {
    53               if(length1 != 0 || length2 != 0) {
    54                 for(int index1 = 0; index1 < tour1.Cities.Count - length1 + 1; index1++) {
    55                   for(int index2 = 0; index2 < tour2.Cities.Count - length2 + 1; index2++) {
    56                     moves.Add(new AlbaLambdaInterchangeMove(tour1Index, index1, length1, 
     54            for (int length2 = 0; length2 <= Math.Min(lambda, tour2.Cities.Count); length2++) {
     55              if (length1 != 0 || length2 != 0) {
     56                for (int index1 = 0; index1 < tour1.Cities.Count - length1 + 1; index1++) {
     57                  for (int index2 = 0; index2 < tour2.Cities.Count - length2 + 1; index2++) {
     58                    moves.Add(new AlbaLambdaInterchangeMove(tour1Index, index1, length1,
    5759                      tour2Index, index2, length2, individual));
    5860                  }
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMove.cs

    r4352 r4690  
    5252    [Storable]
    5353    public int Length2 { get; protected set; }
    54    
     54
     55    [StorableConstructor]
     56    protected AlbaLambdaInterchangeMove(bool deserializing) : base(deserializing) { }
     57    protected AlbaLambdaInterchangeMove(AlbaLambdaInterchangeMove original, Cloner cloner)      : base(original, cloner) {
     58      Tour1 = original.Tour1;
     59      Position1 = original.Position1;
     60      Length1 = original.Length1;
     61
     62      Tour2 = original.Tour2;
     63      Position2 = original.Position2;
     64      Length2 = original.Length2;
     65
     66      Individual = cloner.Clone(original.Individual);
     67    }
     68
    5569    public AlbaLambdaInterchangeMove(): base() {
    5670      Tour1 = -1;
     
    7690
    7791        this.Individual = permutation.Clone() as AlbaEncoding;
    78     }
    79 
    80     public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
    81       AlbaLambdaInterchangeMove clone = new AlbaLambdaInterchangeMove();
    82 
    83       clone.Tour1 = Tour1;
    84       clone.Position1 = Position1;
    85       clone.Length1 = Length1;
    86 
    87       clone.Tour2 = Tour2;
    88       clone.Position2 = Position2;
    89       clone.Length2 = Length2;
    90 
    91       if (Individual != null)
    92         clone.Individual = (AlbaEncoding)cloner.Clone(Individual);
    93 
    94       cloner.RegisterClonedObject(this, clone);
    95       return clone;
    9692    }
    9793
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveEvaluator.cs

    r4352 r4690  
    2626using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    2727using HeuristicLab.Data;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting {
     
    3738    [StorableConstructor]
    3839    private AlbaLambdaInterchangeMoveEvaluator(bool deserializing) : base(deserializing) { }
    39 
     40    private AlbaLambdaInterchangeMoveEvaluator(AlbaLambdaInterchangeMoveEvaluator original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
    4043    public AlbaLambdaInterchangeMoveEvaluator()
    4144      : base() {
     
    4346    }
    4447
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new AlbaLambdaInterchangeMoveEvaluator(this, cloner);
     50    }
    4551    public static TourEvaluation GetMoveQuality(AlbaEncoding individual, AlbaLambdaInterchangeMove move,
    4652      IntValue vehicles,
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveGenerator.cs

    r4352 r4690  
    2828using System.Collections.Generic;
    2929using HeuristicLab.Data;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    5152    [StorableConstructor]
    5253    protected AlbaLambdaInterchangeMoveGenerator(bool deserializing) : base(deserializing) { }
    53 
     54    protected AlbaLambdaInterchangeMoveGenerator(AlbaLambdaInterchangeMoveGenerator original, Cloner cloner)
     55      : base(original, cloner) {
     56    }
    5457    public AlbaLambdaInterchangeMoveGenerator()
    5558      : base() {
    56         Parameters.Add(new LookupParameter<AlbaLambdaInterchangeMove>("AlbaLambdaInterchangeMove", "The moves that should be generated in subscopes."));
    57         Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
    58         Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1)));
     59      Parameters.Add(new LookupParameter<AlbaLambdaInterchangeMove>("AlbaLambdaInterchangeMove", "The moves that should be generated in subscopes."));
     60      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
     61      Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1)));
    5962    }
    6063
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveMaker.cs

    r4352 r4690  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828using System.Collections.Generic;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4748    [StorableConstructor]
    4849    private AlbaLambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { }
    49 
     50    protected AlbaLambdaInterchangeMoveMaker(AlbaLambdaInterchangeMoveMaker original, Cloner cloner)
     51      : base(original, cloner) {
     52    }
    5053    public AlbaLambdaInterchangeMoveMaker()
    5154      : base() {
     
    5356      Parameters.Add(new LookupParameter<AlbaLambdaInterchangeMove>("AlbaLambdaInterchangeMove", "The move to make."));
    5457      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move."));
     58    }
     59
     60    public override IDeepCloneable Clone(Cloner cloner) {
     61      return new AlbaLambdaInterchangeMoveMaker(this, cloner);
    5562    }
    5663
     
    6471    public override IOperation Apply() {
    6572      IOperation next = base.Apply();
    66      
     73
    6774      AlbaLambdaInterchangeMove move = LambdaInterchangeMoveParameter.ActualValue;
    6875      DoubleValue moveQuality = MoveQualityParameter.ActualValue;
    6976      DoubleValue quality = QualityParameter.ActualValue;
    70      
     77
    7178      //perform move
    7279      VRPToursParameter.ActualValue = move.MakeMove();
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaStochasticLambdaInterchangeMutliMoveGenerator.cs

    r4352 r4690  
    2828using System.Collections.Generic;
    2929using HeuristicLab.Data;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4041      get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; }
    4142    }
    42    
     43
    4344    [StorableConstructor]
    4445    private AlbaStochasticLambdaInterchangeMultiMoveGenerator(bool deserializing) : base(deserializing) { }
    45 
     46    private AlbaStochasticLambdaInterchangeMultiMoveGenerator(AlbaStochasticLambdaInterchangeMultiMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4647    public AlbaStochasticLambdaInterchangeMultiMoveGenerator()
    4748      : base() {
    48         Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
    49         Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
     49      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     50      Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
    5051    }
    51 
     52    public override IDeepCloneable Clone(Cloner cloner) {
     53      return new AlbaStochasticLambdaInterchangeMultiMoveGenerator(this, cloner);
     54    }
    5255    protected override AlbaLambdaInterchangeMove[] GenerateMoves(AlbaEncoding individual, int lambda) {
    5356      int sampleSize = SampleSizeParameter.ActualValue.Value;
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaStochasticLambdaInterchangeSingleMoveGenerator.cs

    r4352 r4690  
    2828using System.Collections.Generic;
    2929using HeuristicLab.Problems.VehicleRouting.Encodings.General;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4142
    4243    #endregion
    43    
     44
    4445    public ILookupParameter<IRandom> RandomParameter {
    4546      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    4647    }
    47    
     48
    4849    [StorableConstructor]
    4950    private AlbaStochasticLambdaInterchangeSingleMoveGenerator(bool deserializing) : base(deserializing) { }
    50 
     51    private AlbaStochasticLambdaInterchangeSingleMoveGenerator(AlbaStochasticLambdaInterchangeSingleMoveGenerator original, Cloner cloner)
     52      : base(original, cloner) {
     53    }
    5154    public AlbaStochasticLambdaInterchangeSingleMoveGenerator()
    5255      : base() {
    53         Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     56      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     57    }
     58
     59    public override IDeepCloneable Clone(Cloner cloner) {
     60      return new AlbaStochasticLambdaInterchangeSingleMoveGenerator(this, cloner);
    5461    }
    5562
     
    8188
    8289      AlbaLambdaInterchangeMove move = Apply(individual, Cities, lambda, RandomParameter.ActualValue);
    83       if(move != null)
     90      if (move != null)
    8491        moves.Add(move);
    8592
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveEvaluator.cs

    r4352 r4690  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting {
     
    3738    [StorableConstructor]
    3839    private AlbaTranslocationMoveEvaluator(bool deserializing) : base(deserializing) { }
    39 
     40    private AlbaTranslocationMoveEvaluator(AlbaTranslocationMoveEvaluator original, Cloner cloner)      : base(original, cloner) {    }
    4041    public AlbaTranslocationMoveEvaluator()
    4142      : base() {
    4243      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate."));
     44    }
     45
     46    public override IDeepCloneable Clone(Cloner cloner) {
     47      return new AlbaTranslocationMoveEvaluator(this, cloner);
    4348    }
    4449
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs

    r4352 r4690  
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    7071    [StorableConstructor]
    7172    private AlbaTranslocationMoveGenerator(bool deserializing) : base(deserializing) { }
    72 
     73    private AlbaTranslocationMoveGenerator(AlbaTranslocationMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    7374    public AlbaTranslocationMoveGenerator()
    7475      : base() {
     
    7879
    7980      ((IMultiMoveGenerator)TranslocationMoveGeneratorParameter.Value).SampleSizeParameter.ActualName = SampleSizeParameter.Name;
     81    }
     82
     83    public override IDeepCloneable Clone(Cloner cloner) {
     84      return new AlbaTranslocationMoveGenerator(this, cloner);
    8085    }
    8186
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveHardTabuCriterion.cs

    r4352 r4690  
    2525using HeuristicLab.Optimization;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    5859    [StorableConstructor]
    5960    private AlbaTranslocationMoveHardTabuCriterion(bool deserializing) : base(deserializing) { }
    60 
     61    private AlbaTranslocationMoveHardTabuCriterion(AlbaTranslocationMoveHardTabuCriterion original, Cloner cloner)
     62      : base(original, cloner) {
     63    }
    6164    public AlbaTranslocationMoveHardTabuCriterion()
    6265      : base() {
    6366      tabuChecker = new TranslocationMoveHardTabuCriterion();
    6467    }
     68    public override IDeepCloneable Clone(Cloner cloner) {
     69      return new AlbaTranslocationMoveHardTabuCriterion(this, cloner);
     70    }
    6571  }
    6672}
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveMaker.cs

    r4352 r4690  
    2525using HeuristicLab.Optimization;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    5051    [StorableConstructor]
    5152    private AlbaTranslocationMoveMaker(bool deserializing) : base(deserializing) { }
    52 
     53    private AlbaTranslocationMoveMaker(AlbaTranslocationMoveMaker original, Cloner cloner)
     54      : base(original, cloner) {
     55    }
    5356    public AlbaTranslocationMoveMaker()
    5457      : base() {
    5558      moveMaker = new TranslocationMoveMaker();
    5659    }
    57 
     60    public override IDeepCloneable Clone(Cloner cloner) {
     61      return new AlbaTranslocationMoveMaker(this, cloner);
     62    }
    5863    public override IOperation Apply() {
    5964      IOperation next = base.Apply();
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveSoftTabuCriterion.cs

    r4352 r4690  
    2525using HeuristicLab.Optimization;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    5859    [StorableConstructor]
    5960    private AlbaTranslocationMoveSoftTabuCriterion(bool deserializing) : base(deserializing) { }
    60 
     61    private AlbaTranslocationMoveSoftTabuCriterion(AlbaTranslocationMoveSoftTabuCriterion original, Cloner cloner)
     62      : base(original, cloner) {
     63    }
    6164    public AlbaTranslocationMoveSoftTabuCriterion()
    6265      : base() {
    6366      tabuChecker = new TranslocationMoveSoftTabuCriterion();
    6467    }
     68    public override IDeepCloneable Clone(Cloner cloner) {
     69      return new AlbaTranslocationMoveSoftTabuCriterion(this, cloner);
     70    }
    6571  }
    6672}
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveTabuMaker.cs

    r4352 r4690  
    2525using HeuristicLab.Optimization;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    5859    [StorableConstructor]
    5960    private AlbaTranslocationMoveTabuMaker(bool deserializing) : base(deserializing) { }
    60 
     61    private AlbaTranslocationMoveTabuMaker(AlbaTranslocationMoveTabuMaker original, Cloner cloner)
     62      : base(original, cloner) {
     63    }
    6164    public AlbaTranslocationMoveTabuMaker()
    6265      : base() {
    6366      moveTabuMaker = new TranslocationMoveTabuMaker();
    6467    }
     68    public override IDeepCloneable Clone(Cloner cloner) {
     69      return new AlbaTranslocationMoveTabuMaker(this, cloner);
     70    }
    6571  }
    6672}
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Evaluators/VRPEvaluator.cs

    r4352 r4690  
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2727using HeuristicLab.Problems.VehicleRouting.Encodings;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Problems.VehicleRouting {
     
    8283    }
    8384
     85    [StorableConstructor]
     86    private VRPEvaluator(bool deserializing) : base(deserializing) { }
     87    private VRPEvaluator(VRPEvaluator original, Cloner cloner)
     88      : base(original, cloner) {
     89    }
    8490    public VRPEvaluator()
    8591      : base() {
     
    98104    }
    99105
     106    public override IDeepCloneable Clone(Cloner cloner) {
     107      return new VRPEvaluator(this, cloner);
     108    }
     109
    100110    private double CalculateFleetUsage() {
    101111      IVRPEncoding vrpSolution = VRPToursParameter.ActualValue;
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/MoveEvaluators/VRPMoveEvaluator.cs

    r4179 r4690  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828using HeuristicLab.Problems.VehicleRouting.Encodings;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting {
     
    3940      get { return (ILookupParameter<IVRPEncoding>)Parameters["VRPTours"]; }
    4041    }
    41    
     42
    4243    public ILookupParameter<DoubleValue> FleetUsageFactor {
    4344      get { return (ILookupParameter<DoubleValue>)Parameters["EvalFleetUsageFactor"]; }
     
    8081    [StorableConstructor]
    8182    protected VRPMoveEvaluator(bool deserializing) : base(deserializing) { }
    82 
     83    protected VRPMoveEvaluator(VRPMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
    8384    protected VRPMoveEvaluator()
    8485      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/VRPOperator.cs

    r4352 r4690  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828using System;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting {
     
    110111    [StorableConstructor]
    111112    protected VRPOperator(bool deserializing) : base(deserializing) { }
    112 
     113    protected VRPOperator(VRPOperator original, Cloner cloner) : base(original, cloner) { }
    113114    public VRPOperator()
    114115      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/VRPSolution.cs

    r4185 r4690  
    195195    public VRPSolution() : base() { }
    196196
    197     public VRPSolution(DoubleMatrix coordinates): base() {
     197    public VRPSolution(DoubleMatrix coordinates)
     198      : base() {
    198199      this.coordinates = coordinates;
    199200    }
    200201
    201     public VRPSolution(DoubleMatrix coordinates, IVRPEncoding solution, DoubleValue quality, 
    202       DoubleValue distance, DoubleValue overload, DoubleValue tardiness, DoubleValue travelTime, 
     202    public VRPSolution(DoubleMatrix coordinates, IVRPEncoding solution, DoubleValue quality,
     203      DoubleValue distance, DoubleValue overload, DoubleValue tardiness, DoubleValue travelTime,
    203204      DoubleValue vehicleUtilization, DoubleMatrix distanceMatrix, BoolValue useDistanceMatrix,
    204205      DoubleArray readyTime, DoubleArray dueTime, DoubleArray serviceTime)
     
    222223    private VRPSolution(bool deserializing) : base(deserializing) { }
    223224
     225    protected VRPSolution(VRPSolution original, Cloner cloner)
     226      : base(original, cloner) {
     227      coordinates = cloner.Clone(original.coordinates);
     228      solution = cloner.Clone(original.solution);
     229      quality = cloner.Clone(original.quality);
     230      distance = cloner.Clone(original.distance);
     231      overload = cloner.Clone(original.overload);
     232      tardiness = cloner.Clone(original.tardiness);
     233      travelTime = cloner.Clone(original.travelTime);
     234      vehicleUtilization = cloner.Clone(original.vehicleUtilization);
     235      distanceMatrix = cloner.Clone(original.distanceMatrix);
     236      useDistanceMatrix = cloner.Clone(original.useDistanceMatrix);
     237      readyTime = cloner.Clone(original.readyTime);
     238      dueTime = cloner.Clone(original.dueTime);
     239      serviceTime = cloner.Clone(original.serviceTime);
     240      Initialize();
     241    }
     242
    224243    [StorableHook(HookType.AfterDeserialization)]
     244    private void AfterDeserialization() {
     245      Initialize();
     246    }
    225247    private void Initialize() {
    226248      if (coordinates != null) RegisterCoordinatesEvents();
     
    235257
    236258    public override IDeepCloneable Clone(Cloner cloner) {
    237       VRPSolution clone = new VRPSolution();
    238       cloner.RegisterClonedObject(this, clone);
    239       clone.coordinates = (DoubleMatrix)cloner.Clone(coordinates);
    240       clone.solution = (IVRPEncoding)cloner.Clone(solution);
    241       clone.quality = (DoubleValue)cloner.Clone(quality);
    242       clone.distance = (DoubleValue)cloner.Clone(distance);
    243       clone.overload = (DoubleValue)cloner.Clone(overload);
    244       clone.tardiness = (DoubleValue)cloner.Clone(tardiness);
    245       clone.travelTime = (DoubleValue)cloner.Clone(travelTime);
    246       clone.vehicleUtilization = (DoubleValue)cloner.Clone(vehicleUtilization);
    247       clone.distanceMatrix = (DoubleMatrix)cloner.Clone(distanceMatrix);
    248       clone.useDistanceMatrix = (BoolValue)cloner.Clone(useDistanceMatrix);
    249       clone.readyTime = (DoubleArray)cloner.Clone(readyTime);
    250       clone.dueTime = (DoubleArray)cloner.Clone(dueTime);
    251       clone.serviceTime = (DoubleArray)cloner.Clone(serviceTime);
    252       clone.Initialize();
    253       return clone;
     259      return new VRPSolution(this, cloner);
    254260    }
    255261
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs

    r4626 r4690  
    197197    [StorableConstructor]
    198198    private VehicleRoutingProblem(bool deserializing) : base(deserializing) { }
    199 
     199    private VehicleRoutingProblem(VehicleRoutingProblem original, Cloner cloner)
     200      : base(original, cloner) {
     201      operators = original.operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
     202      DistanceMatrixParameter.Value = DistanceMatrixParameter.Value;
     203      AttachEventHandlers();
     204    }
    200205    public VehicleRoutingProblem()
    201206      : base() {
     
    237242
    238243    public override IDeepCloneable Clone(Cloner cloner) {
    239       VehicleRoutingProblem clone = (VehicleRoutingProblem)base.Clone(cloner);
    240       clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
    241       clone.DistanceMatrixParameter.Value = DistanceMatrixParameter.Value;
    242       clone.AttachEventHandlers();
    243       return clone;
     244      return new VehicleRoutingProblem(this, cloner);
    244245    }
    245246
     
    454455
    455456      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    456      
     457
    457458      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
    458459      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
     
    563564    private void ParameterizeOperators() {
    564565      foreach (IVRPOperator op in Operators.OfType<IVRPOperator>()) {
    565         if(op.CoordinatesParameter != null) op.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
    566         if(op.DistanceMatrixParameter != null) op.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
    567         if(op.UseDistanceMatrixParameter != null) op.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;
    568         if(op.VehiclesParameter != null) op.VehiclesParameter.ActualName = VehiclesParameter.Name;
    569         if(op.CapacityParameter != null) op.CapacityParameter.ActualName = CapacityParameter.Name;
    570         if(op.DemandParameter != null) op.DemandParameter.ActualName = DemandParameter.Name;
    571         if(op.ReadyTimeParameter != null) op.ReadyTimeParameter.ActualName = ReadyTimeParameter.Name;
    572         if(op.DueTimeParameter != null) op.DueTimeParameter.ActualName = DueTimeParameter.Name;
    573         if(op.ServiceTimeParameter != null) op.ServiceTimeParameter.ActualName = ServiceTimeParameter.Name;
    574       }
    575      
     566        if (op.CoordinatesParameter != null) op.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
     567        if (op.DistanceMatrixParameter != null) op.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
     568        if (op.UseDistanceMatrixParameter != null) op.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;
     569        if (op.VehiclesParameter != null) op.VehiclesParameter.ActualName = VehiclesParameter.Name;
     570        if (op.CapacityParameter != null) op.CapacityParameter.ActualName = CapacityParameter.Name;
     571        if (op.DemandParameter != null) op.DemandParameter.ActualName = DemandParameter.Name;
     572        if (op.ReadyTimeParameter != null) op.ReadyTimeParameter.ActualName = ReadyTimeParameter.Name;
     573        if (op.DueTimeParameter != null) op.DueTimeParameter.ActualName = DueTimeParameter.Name;
     574        if (op.ServiceTimeParameter != null) op.ServiceTimeParameter.ActualName = ServiceTimeParameter.Name;
     575      }
     576
    576577      foreach (IVRPMoveOperator op in Operators.OfType<IVRPMoveOperator>()) {
    577578        op.VRPToursParameter.ActualName = SolutionCreator.VRPToursParameter.ActualName;
     
    641642      if (parser.Vehicles != -1)
    642643        Vehicles.Value = parser.Vehicles;
    643       else 
     644      else
    644645        Vehicles.Value = problemSize - 1;
    645646      Capacity.Value = parser.Capacity;
Note: See TracChangeset for help on using the changeset viewer.