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:
38 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Problems.VehicleRouting

  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/AlbaEncoding.cs

    r4352 r4722  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2526using HeuristicLab.Encodings.PermutationEncoding;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    27 using System.Collections.Generic;
    2828using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    2929
     
    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++) {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.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.Alba {
     
    3433      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    3534    }
    36    
     35
    3736    [StorableConstructor]
    3837    protected AlbaCrossover(bool deserializing) : base(deserializing) { }
    39 
     38    protected AlbaCrossover(AlbaCrossover original, Cloner cloner) : base(original, cloner) { }
    4039    public AlbaCrossover()
    4140      : base() {
    4241      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    43    
     42
    4443      AlbaEncoding.RemoveUnusedParameters(Parameters);
    4544    }
     
    6160      ParentsParameter.ActualValue = parents;
    6261
    63       ChildParameter.ActualValue = 
     62      ChildParameter.ActualValue =
    6463        Crossover(RandomParameter.ActualValue, parents[0] as AlbaEncoding, parents[1] as AlbaEncoding);
    6564
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaPermutationCrossover.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.Alba {
    2929  [Item("AlbaPermutationCrossover", "An operator which crosses two VRP representations using a standard permutation operator.  It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")]
    3030  [StorableClass]
    31   public sealed class AlbaPermutationCrossover : AlbaCrossover {   
     31  public sealed class AlbaPermutationCrossover : AlbaCrossover {
    3232    public IValueLookupParameter<IPermutationCrossover> InnerCrossoverParameter {
    3333      get { return (IValueLookupParameter<IPermutationCrossover>)Parameters["InnerCrossover"]; }
     
    3636    [StorableConstructor]
    3737    private AlbaPermutationCrossover(bool deserializing) : base(deserializing) { }
    38 
     38    private AlbaPermutationCrossover(AlbaPermutationCrossover original, Cloner cloner)
     39      : base(original, cloner) {
     40    }
     41    public override IDeepCloneable Clone(Cloner cloner) {
     42      return new AlbaPermutationCrossover(this, cloner);
     43    }
    3944    public AlbaPermutationCrossover()
    4045      : base() {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerInsertionManipulator.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.Alba {
     
    3230    [StorableConstructor]
    3331    private AlbaCustomerInsertionManipulator(bool deserializing) : base(deserializing) { }
    34 
     32    private AlbaCustomerInsertionManipulator(AlbaCustomerInsertionManipulator original, Cloner cloner)
     33      : base(original, cloner) {
     34    }
    3535    public AlbaCustomerInsertionManipulator()
    3636      : base() {
     37    }
     38
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new AlbaCustomerInsertionManipulator(this, cloner);
    3741    }
    3842
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerInversionManipulator.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.Alba {
     
    3331    [StorableConstructor]
    3432    private AlbaCustomerInversionManipulator(bool deserializing) : base(deserializing) { }
    35 
     33    private AlbaCustomerInversionManipulator(AlbaCustomerInversionManipulator original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
    3636    public AlbaCustomerInversionManipulator()
    3737      : base() {
    3838    }
    3939
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new AlbaCustomerInversionManipulator(this, cloner);
     42    }
    4043    protected override void Manipulate(IRandom random, AlbaEncoding individual) {
    4144      int breakPoint1, breakPoint2;
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerSwapManipulator.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.Alba {
     
    3230    [StorableConstructor]
    3331    private AlbaCustomerSwapManipulator(bool deserializing) : base(deserializing) { }
    34 
     32    private AlbaCustomerSwapManipulator(AlbaCustomerSwapManipulator original, Cloner cloner) : base(original, cloner) { }
    3533    public AlbaCustomerSwapManipulator()
    3634      : base() {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new AlbaCustomerSwapManipulator(this, cloner);
    3738    }
    3839
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaIntraRouteInversionManipulator.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;
    28 using System.Collections.Generic;
    2926
    3027namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    3128  [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.")]
    3229  [StorableClass]
    33   public sealed class AlbaIntraRouteInversionManipulator : AlbaManipulator {   
     30  public sealed class AlbaIntraRouteInversionManipulator : AlbaManipulator {
    3431    [StorableConstructor]
    3532    private AlbaIntraRouteInversionManipulator(bool deserializing) : base(deserializing) { }
    36 
     33    private AlbaIntraRouteInversionManipulator(AlbaIntraRouteInversionManipulator original, Cloner cloner) : base(original, cloner) { }
    3734    public AlbaIntraRouteInversionManipulator()
    3835      : base() {
    39      }
     36    }
     37
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new AlbaIntraRouteInversionManipulator(this, cloner);
     40    }
    4041
    4142    public static void Apply(AlbaEncoding individual, int index1, int index2) {
     
    7273
    7374        int currentTourEnd = currentTourStart;
    74         while (currentTourEnd < individual.Length && 
     75        while (currentTourEnd < individual.Length &&
    7576          individual[currentTourEnd] < individual.Cities) {
    7677          currentTourEnd++;
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaLambdaInterchangeManipulator.cs

    r4352 r4722  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
     24using HeuristicLab.Common;
    2225using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
     26using HeuristicLab.Data;
    2427using HeuristicLab.Parameters;
    2528using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    27 using System;
    28 using System.Collections.Generic;
    2929
    3030namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3535      get { return (IValueParameter<IntValue>)Parameters["Lambda"]; }
    3636    }
    37    
     37
    3838    [StorableConstructor]
    3939    private AlbaLambdaInterchangeManipulator(bool deserializing) : base(deserializing) { }
    40 
     40    private AlbaLambdaInterchangeManipulator(AlbaLambdaInterchangeManipulator original, Cloner cloner) : base(original, cloner) { }
    4141    public AlbaLambdaInterchangeManipulator()
    4242      : base() {
    43         Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1)));
    44      }
     43      Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1)));
     44    }
    4545
    46     public static void Apply(AlbaEncoding individual, int tour1Index, int position1, int length1,
     46    public override IDeepCloneable Clone(Cloner cloner) {
     47      return new AlbaLambdaInterchangeManipulator(this, cloner);
     48    }
     49
     50    public static void Apply(AlbaEncoding individual, int tour1Index, int position1, int length1,
    4751      int tour2Index, int position2, int length2) {
    4852      List<Tour> tours = individual.GetTours();
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaManipulator.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.Alba {
     
    3736    [StorableConstructor]
    3837    protected AlbaManipulator(bool deserializing) : base(deserializing) { }
    39 
     38    protected AlbaManipulator(AlbaManipulator original, Cloner cloner) : base(original, cloner) { }
    4039    public AlbaManipulator()
    4140      : base() {
    42         Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
     41      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    4342
    44         AlbaEncoding.RemoveUnusedParameters(Parameters);
     43      AlbaEncoding.RemoveUnusedParameters(Parameters);
    4544    }
    4645
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaPermutationManipulator.cs

    r4416 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.Alba {
     
    3636    [StorableConstructor]
    3737    private AlbaPermutationManipualtor(bool deserializing) : base(deserializing) { }
    38 
     38    private AlbaPermutationManipualtor(AlbaPermutationManipualtor original, Cloner cloner) : base(original, cloner) { }
    3939    public AlbaPermutationManipualtor()
    4040      : base() {
    41         Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator()));
     41      Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator()));
     42    }
     43
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new AlbaPermutationManipualtor(this, cloner);
    4246    }
    4347
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveMaker.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    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() {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveOperator.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    25 using HeuristicLab.Data;
    26 using HeuristicLab.Parameters;
    2725
    2826namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    2927  [Item("AlbaMoveOperator", "A move operator for an Alba VRP representation.")]
    3028  [StorableClass]
    31   public abstract class AlbaMoveOperator : VRPMoveOperator {   
     29  public abstract class AlbaMoveOperator : VRPMoveOperator {
    3230    [StorableConstructor]
    3331    protected AlbaMoveOperator(bool deserializing) : base(deserializing) { }
    34 
    35     public AlbaMoveOperator() : base()
    36     {
     32    protected AlbaMoveOperator(AlbaMoveOperator original, Cloner cloner) : base(original, cloner) { }
     33    public AlbaMoveOperator()
     34      : base() {
    3735      AlbaEncoding.RemoveUnusedParameters(Parameters);
    3836    }
     
    4139      IVRPEncoding solution = VRPToursParameter.ActualValue;
    4240      if (!(solution is AlbaEncoding)) {
    43         VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value, 
     41        VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value,
    4442          DistanceMatrixParameter);
    4543      }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaPermutationMoveOperator.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.PermutationEncoding;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    25 using HeuristicLab.Data;
    26 using HeuristicLab.Parameters;
    2726
    2827namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    2928  [Item("AlbaPermutationMoveOperator", "A move operator for an Alba VRP representation using an inner permutation move operator.")]
    3029  [StorableClass]
    31   public abstract class AlbaPermutationMoveOperator : AlbaMoveOperator {   
     30  public abstract class AlbaPermutationMoveOperator : AlbaMoveOperator {
    3231    [Storable]
    3332    protected abstract IPermutationMoveOperator PermutationMoveOperatorParameter { get; set; }
     
    3534    [StorableConstructor]
    3635    protected AlbaPermutationMoveOperator(bool deserializing) : base(deserializing) { }
    37 
     36    protected AlbaPermutationMoveOperator(AlbaPermutationMoveOperator original, Cloner cloner) : base(original, cloner) { }
    3837    public AlbaPermutationMoveOperator()
    39       : base()
    40     {
     38      : base() {
    4139    }
    4240
    4341    public override IOperation Apply() {
    4442      IOperation next = base.Apply();
    45      
     43
    4644      IVRPEncoding solution = VRPToursParameter.ActualValue;
    4745
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/Interfaces/IAlbaIntraRouteInversionMoveOperator.cs

    r4352 r4722  
    2121
    2222using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
    24 using HeuristicLab.Optimization;
    2523
    2624namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/Interfaces/IAlbaLambdaInterchangeMoveOperator.cs

    r4352 r4722  
    2121
    2222using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
    24 using HeuristicLab.Optimization;
    2523
    2624namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/Interfaces/IAlbaTranslocationMoveOperator.cs

    r4204 r4722  
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Encodings.PermutationEncoding;
    24 using HeuristicLab.Optimization;
    2524
    2625namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaExhaustiveIntraRouteInversionMoveGenerator.cs

    r4352 r4722  
    2020#endregion
    2121
    22 using System;
     22using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Parameters;
    28 using System.Collections.Generic;
    2927
    3028namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3432    [StorableConstructor]
    3533    private AlbaExhaustiveIntraRouteInversionGenerator(bool deserializing) : base(deserializing) { }
    36 
     34    private AlbaExhaustiveIntraRouteInversionGenerator(AlbaExhaustiveIntraRouteInversionGenerator original, Cloner cloner) : base(original, cloner) { }
    3735    public AlbaExhaustiveIntraRouteInversionGenerator()
    3836      : base() {
     37    }
     38
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new AlbaExhaustiveIntraRouteInversionGenerator(this, cloner);
    3941    }
    4042
     
    4446      int currentTourStart = 0;
    4547      int currentTourEnd = 0;
    46       while(currentTourEnd != individual.Length) {
     48      while (currentTourEnd != individual.Length) {
    4749        currentTourEnd = currentTourStart;
    48         while (individual[currentTourEnd] < individual.Cities && 
     50        while (individual[currentTourEnd] < individual.Cities &&
    4951          currentTourEnd < individual.Length) {
    5052          currentTourEnd++;
     
    5355        int tourLength = currentTourEnd - currentTourStart;
    5456        if (tourLength >= 4) {
    55           for (int i = 0; i <= tourLength - 4; i++ ) {
     57          for (int i = 0; i <= tourLength - 4; i++) {
    5658            for (int j = i + 2; j <= tourLength - 2; j++) {
    5759              AlbaIntraRouteInversionMove move = new AlbaIntraRouteInversionMove(
    58                 currentTourStart + i, 
    59                 currentTourStart + j, 
     60                currentTourStart + i,
     61                currentTourStart + j,
    6062                individual);
    6163
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionEvaluator.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2627using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Data;
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting {
     
    3737    [StorableConstructor]
    3838    private AlbaIntraRouteInversionMoveEvaluator(bool deserializing) : base(deserializing) { }
    39 
     39    private AlbaIntraRouteInversionMoveEvaluator(AlbaIntraRouteInversionMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
    4040    public AlbaIntraRouteInversionMoveEvaluator()
    4141      : base() {
    42         Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to evaluate."));
     42      Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to evaluate."));
     43    }
     44
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new AlbaIntraRouteInversionMoveEvaluator(this, cloner);
    4347    }
    4448
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMove.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.PermutationEncoding;
    2326using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    24 using HeuristicLab.Encodings.PermutationEncoding;
    25 using HeuristicLab.Common;
    2627using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    27 using HeuristicLab.Data;
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    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
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveGenerator.cs

    r4352 r4722  
    2020#endregion
    2121
    22 using System;
     22using HeuristicLab.Common;
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Optimization;
     25using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Parameters;
    28 using System.Collections.Generic;
    2927
    3028namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4240    [StorableConstructor]
    4341    protected AlbaIntraRouteInversionMoveGenerator(bool deserializing) : base(deserializing) { }
    44 
     42    protected AlbaIntraRouteInversionMoveGenerator(AlbaIntraRouteInversionMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4543    public AlbaIntraRouteInversionMoveGenerator()
    4644      : 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."));
     45      Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The moves that should be generated in subscopes."));
     46      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
    4947    }
    5048
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveMaker.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
    24 using HeuristicLab.Operators;
    2525using HeuristicLab.Optimization;
    2626using HeuristicLab.Parameters;
     
    4545
    4646    [StorableConstructor]
    47     private AlbaIntraRouteInversionMoveMaker(bool deserializing) : base(deserializing) { }
    48 
     47    protected AlbaIntraRouteInversionMoveMaker(bool deserializing) : base(deserializing) { }
     48    protected AlbaIntraRouteInversionMoveMaker(AlbaIntraRouteInversionMoveMaker original, Cloner cloner) : base(original, cloner) { }
    4949    public AlbaIntraRouteInversionMoveMaker()
    5050      : base() {
     
    5252      Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to make."));
    5353      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move."));
     54    }
     55
     56    public override IDeepCloneable Clone(Cloner cloner) {
     57      return new AlbaIntraRouteInversionMoveMaker(this, cloner);
    5458    }
    5559
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaStochasticIntraRouteInversionMutliMoveGenerator.cs

    r4352 r4722  
    2020#endregion
    2121
    22 using System;
     22using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Optimization;
     26using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Parameters;
    28 using System.Collections.Generic;
    29 using HeuristicLab.Data;
    3028
    3129namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4038      get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; }
    4139    }
    42    
     40
    4341    [StorableConstructor]
    4442    private AlbaStochasticIntraRouteInversionMultiMoveGenerator(bool deserializing) : base(deserializing) { }
    45 
     43    private AlbaStochasticIntraRouteInversionMultiMoveGenerator(AlbaStochasticIntraRouteInversionMultiMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4644    public AlbaStochasticIntraRouteInversionMultiMoveGenerator()
    4745      : 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."));
     46      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     47      Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
     48    }
     49
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new AlbaStochasticIntraRouteInversionMultiMoveGenerator(this, cloner);
    5052    }
    5153
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaStochasticIntraRouteInversionSingleMoveGenerator.cs

    r4352 r4722  
    2020#endregion
    2121
    22 using System;
     22using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     26using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Parameters;
    28 using System.Collections.Generic;
    2928using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    3029
     
    4140
    4241    #endregion
    43    
     42
    4443    public ILookupParameter<IRandom> RandomParameter {
    4544      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    4645    }
    47    
     46
    4847    [StorableConstructor]
    4948    private AlbaStochasticIntraRouteInversionSingleMoveGenerator(bool deserializing) : base(deserializing) { }
    50 
     49    private AlbaStochasticIntraRouteInversionSingleMoveGenerator(AlbaStochasticIntraRouteInversionSingleMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    5150    public AlbaStochasticIntraRouteInversionSingleMoveGenerator()
    5251      : base() {
    53         Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     52      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     53    }
     54
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new AlbaStochasticIntraRouteInversionSingleMoveGenerator(this, cloner);
    5457    }
    5558
     
    7578
    7679        int currentTourEnd = currentTourStart;
    77         while (currentTourEnd < individual.Length && 
     80        while (currentTourEnd < individual.Length &&
    7881          individual[currentTourEnd] < individual.Cities) {
    7982          currentTourEnd++;
     
    9396
    9497      AlbaIntraRouteInversionMove move = Apply(individual, Cities, RandomParameter.ActualValue);
    95       if(move != null)
     98      if (move != null)
    9699        moves.Add(move);
    97100
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaExhaustiveLambdaInterchangeMoveGenerator.cs

    r4352 r4722  
    2121
    2222using System;
     23using System.Collections.Generic;
     24using HeuristicLab.Common;
    2325using HeuristicLab.Core;
    2426using HeuristicLab.Optimization;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Parameters;
    28 using System.Collections.Generic;
    2928
    3029namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    3433    [StorableConstructor]
    3534    private AlbaExhaustiveLambdaInterchangeMoveGenerator(bool deserializing) : base(deserializing) { }
    36 
    37     public AlbaExhaustiveLambdaInterchangeMoveGenerator()
    38       : base() {
     35    private AlbaExhaustiveLambdaInterchangeMoveGenerator(AlbaExhaustiveLambdaInterchangeMoveGenerator original, Cloner cloner) : base(original, cloner) { }
     36    public AlbaExhaustiveLambdaInterchangeMoveGenerator() : base() { }
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new AlbaExhaustiveLambdaInterchangeMoveGenerator(this, cloner);
    3939    }
    4040
     
    5050
    5151          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, 
     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,
    5757                      tour2Index, index2, length2, individual));
    5858                  }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMove.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
     24using HeuristicLab.Data;
    2325using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    24 using HeuristicLab.Encodings.PermutationEncoding;
    25 using HeuristicLab.Common;
    26 using System.Collections.Generic;
    2726using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    28 using HeuristicLab.Data;
    2927
    3028namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    3129  [Item("InversionMove", "Item that describes a lambda move on 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.")]
    3230  [StorableClass]
    33   public class AlbaLambdaInterchangeMove: Item, IVRPMove {
     31  public class AlbaLambdaInterchangeMove : Item, IVRPMove {
    3432    [Storable]
    3533    public IVRPEncoding Individual { get; protected set; }
    36    
     34
    3735    [Storable]
    3836    public int Tour1 { get; protected set; }
     
    5250    [Storable]
    5351    public int Length2 { get; protected set; }
    54    
    55     public AlbaLambdaInterchangeMove(): base() {
     52
     53    [StorableConstructor]
     54    protected AlbaLambdaInterchangeMove(bool deserializing) : base(deserializing) { }
     55    protected AlbaLambdaInterchangeMove(AlbaLambdaInterchangeMove original, Cloner cloner)
     56      : base(original, cloner) {
     57      Tour1 = original.Tour1;
     58      Position1 = original.Position1;
     59      Length1 = original.Length1;
     60
     61      Tour2 = original.Tour2;
     62      Position2 = original.Position2;
     63      Length2 = original.Length2;
     64
     65      Individual = cloner.Clone(original.Individual);
     66    }
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new AlbaLambdaInterchangeMove(this, cloner);
     69    }
     70
     71    public AlbaLambdaInterchangeMove()
     72      : base() {
    5673      Tour1 = -1;
    5774      Position1 = -1;
     
    6582    }
    6683
    67     public AlbaLambdaInterchangeMove(int tour1, int position1, int length1, 
     84    public AlbaLambdaInterchangeMove(int tour1, int position1, int length1,
    6885      int tour2, int position2, int length2, AlbaEncoding permutation) {
    69         Tour1 = tour1;
    70         Position1 = position1;
    71         Length1 = length1;
     86      Tour1 = tour1;
     87      Position1 = position1;
     88      Length1 = length1;
    7289
    73         Tour2 = tour2;
    74         Position2 = position2;
    75         Length2 = length2;
     90      Tour2 = tour2;
     91      Position2 = position2;
     92      Length2 = length2;
    7693
    77         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;
     94      this.Individual = permutation.Clone() as AlbaEncoding;
    9695    }
    9796
     
    10099    public TourEvaluation GetMoveQuality(
    101100      IntValue vehicles,
    102       DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 
     101      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
    103102      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
    104103      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
    105104      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
    106105      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
    107         return AlbaLambdaInterchangeMoveEvaluator.GetMoveQuality(Individual as AlbaEncoding, this, vehicles,
    108           dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
    109           coordinates, fleetUsageFactor, timeFactor, distanceFactor,
    110           overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix);
     106      return AlbaLambdaInterchangeMoveEvaluator.GetMoveQuality(Individual as AlbaEncoding, this, vehicles,
     107        dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
     108        coordinates, fleetUsageFactor, timeFactor, distanceFactor,
     109        overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix);
    111110    }
    112111
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveEvaluator.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2627using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Data;
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting {
     
    3737    [StorableConstructor]
    3838    private AlbaLambdaInterchangeMoveEvaluator(bool deserializing) : base(deserializing) { }
    39 
     39    private AlbaLambdaInterchangeMoveEvaluator(AlbaLambdaInterchangeMoveEvaluator original, Cloner cloner)
     40      : base(original, cloner) {
     41    }
    4042    public AlbaLambdaInterchangeMoveEvaluator()
    4143      : base() {
     
    4345    }
    4446
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new AlbaLambdaInterchangeMoveEvaluator(this, cloner);
     49    }
    4550    public static TourEvaluation GetMoveQuality(AlbaEncoding individual, AlbaLambdaInterchangeMove move,
    4651      IntValue vehicles,
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveGenerator.cs

    r4352 r4722  
    2020#endregion
    2121
    22 using System;
     22using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Optimization;
     26using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Parameters;
    28 using System.Collections.Generic;
    29 using HeuristicLab.Data;
    3028
    3129namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    5149    [StorableConstructor]
    5250    protected AlbaLambdaInterchangeMoveGenerator(bool deserializing) : base(deserializing) { }
    53 
     51    protected AlbaLambdaInterchangeMoveGenerator(AlbaLambdaInterchangeMoveGenerator original, Cloner cloner)
     52      : base(original, cloner) {
     53    }
    5454    public AlbaLambdaInterchangeMoveGenerator()
    5555      : 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)));
     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)));
    5959    }
    6060
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveMaker.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
    24 using HeuristicLab.Operators;
    2525using HeuristicLab.Optimization;
    2626using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using System.Collections.Generic;
    2928
    3029namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4645
    4746    [StorableConstructor]
    48     private AlbaLambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { }
    49 
     47    protected AlbaLambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { }
     48    protected AlbaLambdaInterchangeMoveMaker(AlbaLambdaInterchangeMoveMaker original, Cloner cloner)
     49      : base(original, cloner) {
     50    }
    5051    public AlbaLambdaInterchangeMoveMaker()
    5152      : base() {
     
    5354      Parameters.Add(new LookupParameter<AlbaLambdaInterchangeMove>("AlbaLambdaInterchangeMove", "The move to make."));
    5455      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move."));
     56    }
     57
     58    public override IDeepCloneable Clone(Cloner cloner) {
     59      return new AlbaLambdaInterchangeMoveMaker(this, cloner);
    5560    }
    5661
     
    6469    public override IOperation Apply() {
    6570      IOperation next = base.Apply();
    66      
     71
    6772      AlbaLambdaInterchangeMove move = LambdaInterchangeMoveParameter.ActualValue;
    6873      DoubleValue moveQuality = MoveQualityParameter.ActualValue;
    6974      DoubleValue quality = QualityParameter.ActualValue;
    70      
     75
    7176      //perform move
    7277      VRPToursParameter.ActualValue = move.MakeMove();
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaStochasticLambdaInterchangeMutliMoveGenerator.cs

    r4352 r4722  
    2020#endregion
    2121
    22 using System;
     22using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Optimization;
     26using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Parameters;
    28 using System.Collections.Generic;
    29 using HeuristicLab.Data;
    3028
    3129namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    4038      get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; }
    4139    }
    42    
     40
    4341    [StorableConstructor]
    4442    private AlbaStochasticLambdaInterchangeMultiMoveGenerator(bool deserializing) : base(deserializing) { }
    45 
     43    private AlbaStochasticLambdaInterchangeMultiMoveGenerator(AlbaStochasticLambdaInterchangeMultiMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4644    public AlbaStochasticLambdaInterchangeMultiMoveGenerator()
    4745      : 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."));
     46      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     47      Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
    5048    }
    51 
     49    public override IDeepCloneable Clone(Cloner cloner) {
     50      return new AlbaStochasticLambdaInterchangeMultiMoveGenerator(this, cloner);
     51    }
    5252    protected override AlbaLambdaInterchangeMove[] GenerateMoves(AlbaEncoding individual, int lambda) {
    5353      int sampleSize = SampleSizeParameter.ActualValue.Value;
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaStochasticLambdaInterchangeSingleMoveGenerator.cs

    r4352 r4722  
    2121
    2222using System;
     23using System.Collections.Generic;
     24using HeuristicLab.Common;
    2325using HeuristicLab.Core;
    2426using HeuristicLab.Optimization;
     27using HeuristicLab.Parameters;
    2528using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    27 using HeuristicLab.Parameters;
    28 using System.Collections.Generic;
    2929using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    3030
     
    4141
    4242    #endregion
    43    
     43
    4444    public ILookupParameter<IRandom> RandomParameter {
    4545      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    4646    }
    47    
     47
    4848    [StorableConstructor]
    4949    private AlbaStochasticLambdaInterchangeSingleMoveGenerator(bool deserializing) : base(deserializing) { }
    50 
     50    private AlbaStochasticLambdaInterchangeSingleMoveGenerator(AlbaStochasticLambdaInterchangeSingleMoveGenerator original, Cloner cloner)
     51      : base(original, cloner) {
     52    }
    5153    public AlbaStochasticLambdaInterchangeSingleMoveGenerator()
    5254      : base() {
    53         Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     55      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     56    }
     57
     58    public override IDeepCloneable Clone(Cloner cloner) {
     59      return new AlbaStochasticLambdaInterchangeSingleMoveGenerator(this, cloner);
    5460    }
    5561
     
    8187
    8288      AlbaLambdaInterchangeMove move = Apply(individual, Cities, lambda, RandomParameter.ActualValue);
    83       if(move != null)
     89      if (move != null)
    8490        moves.Add(move);
    8591
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveEvaluator.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.PermutationEncoding;
     
    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
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs

    r4352 r4722  
    2020#endregion
    2121
    22 using System.Collections.Generic;
     22using HeuristicLab.Common;
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
     
    7070    [StorableConstructor]
    7171    private AlbaTranslocationMoveGenerator(bool deserializing) : base(deserializing) { }
    72 
     72    private AlbaTranslocationMoveGenerator(AlbaTranslocationMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    7373    public AlbaTranslocationMoveGenerator()
    7474      : base() {
     
    7878
    7979      ((IMultiMoveGenerator)TranslocationMoveGeneratorParameter.Value).SampleSizeParameter.ActualName = SampleSizeParameter.Name;
     80    }
     81
     82    public override IDeepCloneable Clone(Cloner cloner) {
     83      return new AlbaTranslocationMoveGenerator(this, cloner);
    8084    }
    8185
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveHardTabuCriterion.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    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}
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveMaker.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
    2425using HeuristicLab.Encodings.PermutationEncoding;
    25 using HeuristicLab.Optimization;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2727
     
    5050    [StorableConstructor]
    5151    private AlbaTranslocationMoveMaker(bool deserializing) : base(deserializing) { }
    52 
     52    private AlbaTranslocationMoveMaker(AlbaTranslocationMoveMaker original, Cloner cloner)
     53      : base(original, cloner) {
     54    }
    5355    public AlbaTranslocationMoveMaker()
    5456      : base() {
    5557      moveMaker = new TranslocationMoveMaker();
    5658    }
    57 
     59    public override IDeepCloneable Clone(Cloner cloner) {
     60      return new AlbaTranslocationMoveMaker(this, cloner);
     61    }
    5862    public override IOperation Apply() {
    5963      IOperation next = base.Apply();
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveSoftTabuCriterion.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    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}
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveTabuMaker.cs

    r4352 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    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}
Note: See TracChangeset for help on using the changeset viewer.