Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 20:34:10 (14 years ago)
Author:
mkommend
Message:

Worked on VRP project (ticket #922).

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

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaPermutationCrossover.cs

    r4690 r4691  
    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;
    27 using HeuristicLab.Common;
    2827
    2928namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    3029  [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.")]
    3130  [StorableClass]
    32   public sealed class AlbaPermutationCrossover : AlbaCrossover {   
     31  public sealed class AlbaPermutationCrossover : AlbaCrossover {
    3332    public IValueLookupParameter<IPermutationCrossover> InnerCrossoverParameter {
    3433      get { return (IValueLookupParameter<IPermutationCrossover>)Parameters["InnerCrossover"]; }
     
    3938    private AlbaPermutationCrossover(AlbaPermutationCrossover original, Cloner cloner)
    4039      : base(original, cloner) {
     40    }
     41    public override IDeepCloneable Clone(Cloner cloner) {
     42      return new AlbaPermutationCrossover(this, cloner);
    4143    }
    4244    public AlbaPermutationCrossover()
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMove.cs

    r4690 r4691  
    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; }
     
    5553    [StorableConstructor]
    5654    protected AlbaLambdaInterchangeMove(bool deserializing) : base(deserializing) { }
    57     protected AlbaLambdaInterchangeMove(AlbaLambdaInterchangeMove original, Cloner cloner)      : base(original, cloner) {
     55    protected AlbaLambdaInterchangeMove(AlbaLambdaInterchangeMove original, Cloner cloner)
     56      : base(original, cloner) {
    5857      Tour1 = original.Tour1;
    5958      Position1 = original.Position1;
     
    6665      Individual = cloner.Clone(original.Individual);
    6766    }
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new AlbaLambdaInterchangeMove(this, cloner);
     69    }
    6870
    69     public AlbaLambdaInterchangeMove(): base() {
     71    public AlbaLambdaInterchangeMove()
     72      : base() {
    7073      Tour1 = -1;
    7174      Position1 = -1;
     
    7982    }
    8083
    81     public AlbaLambdaInterchangeMove(int tour1, int position1, int length1, 
     84    public AlbaLambdaInterchangeMove(int tour1, int position1, int length1,
    8285      int tour2, int position2, int length2, AlbaEncoding permutation) {
    83         Tour1 = tour1;
    84         Position1 = position1;
    85         Length1 = length1;
     86      Tour1 = tour1;
     87      Position1 = position1;
     88      Length1 = length1;
    8689
    87         Tour2 = tour2;
    88         Position2 = position2;
    89         Length2 = length2;
     90      Tour2 = tour2;
     91      Position2 = position2;
     92      Length2 = length2;
    9093
    91         this.Individual = permutation.Clone() as AlbaEncoding;
     94      this.Individual = permutation.Clone() as AlbaEncoding;
    9295    }
    9396
     
    9699    public TourEvaluation GetMoveQuality(
    97100      IntValue vehicles,
    98       DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 
     101      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
    99102      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
    100103      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
    101104      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
    102105      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
    103         return AlbaLambdaInterchangeMoveEvaluator.GetMoveQuality(Individual as AlbaEncoding, this, vehicles,
    104           dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
    105           coordinates, fleetUsageFactor, timeFactor, distanceFactor,
    106           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);
    107110    }
    108111
Note: See TracChangeset for help on using the changeset viewer.