Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/13/10 13:54:30 (14 years ago)
Author:
svonolfe
Message:

Improved moves, fixed behavior for SA (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs

    r4376 r4383  
    8383    public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
    8484      AlbaEncoding clone = new AlbaEncoding(
    85         new Permutation(this.PermutationType, this.array), ProblemInstance);
     85        new Permutation(this.PermutationType, new IntArray(this.array)), ProblemInstance);
    8686      cloner.RegisterClonedObject(this, clone);
    8787      clone.readOnly = readOnly;
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionEvaluator.cs

    r4370 r4383  
    4848
    4949    protected override void EvaluateMove() {
    50       AlbaEncoding newSolution = VRPToursParameter.ActualValue.Clone() as AlbaEncoding;
     50      AlbaEncoding newSolution = IntraRouteInversionMoveParameter.ActualValue.Permutation.Clone() as AlbaEncoding;
    5151      AlbaIntraRouteInversionMoveMaker.Apply(newSolution, IntraRouteInversionMoveParameter.ActualValue);
    5252
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMove.cs

    r4370 r4383  
    2929
    3030namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    31   [Item("IntraRouteInversionMove", "Item that describes an intra route inversion 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.")]
     31  [Item("AlbaIntraRouteInversionMove", "Item that describes an intra route inversion 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.")]
    3232  [StorableClass]
    3333  public class AlbaIntraRouteInversionMove : TwoIndexMove, IVRPMove {
     
    4343
    4444    public AlbaIntraRouteInversionMove(int index1, int index2, AlbaEncoding permutation)
    45       : base(index1, index2, permutation) {
    46         this.Permutation = permutation.Clone() as AlbaEncoding;
    47     }
     45      : base(index1, index2, permutation.Clone() as AlbaEncoding) {
     46     }
    4847
    4948    public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
     
    5251
    5352      if (Permutation != null)
    54         clone.Permutation = (AlbaEncoding)cloner.Clone(Permutation);
     53        clone.Permutation = Permutation.Clone() as AlbaEncoding;
    5554
    5655      cloner.RegisterClonedObject(this, clone);
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveMaker.cs

    r4370 r4383  
    5454      AlbaIntraRouteInversionMove move = IntraRouteInversionMoveParameter.ActualValue;
    5555
    56       Apply(VRPToursParameter.ActualValue as AlbaEncoding, move);
     56      Apply(move.Individual as AlbaEncoding, move);
     57      VRPToursParameter.ActualValue = move.Individual as AlbaEncoding;
    5758    }
    5859  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMove.cs

    r4370 r4383  
    3030
    3131namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    32   [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.")]
     32  [Item("AlbaLambdaInterchangeMove", "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.")]
    3333  [StorableClass]
    3434  public class AlbaLambdaInterchangeMove: Item, IVRPMove {
     
    9191
    9292      if (Individual != null)
    93         clone.Individual = (AlbaEncoding)cloner.Clone(Individual);
     93        clone.Individual = Individual.Clone() as AlbaEncoding;
    9494
    9595      cloner.RegisterClonedObject(this, clone);
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveEvaluator.cs

    r4370 r4383  
    4848
    4949    protected override void EvaluateMove() {
    50       AlbaEncoding newSolution = VRPToursParameter.ActualValue.Clone() as AlbaEncoding;
     50      AlbaEncoding newSolution = LambdaInterchangeMoveParameter.ActualValue.Individual.Clone() as AlbaEncoding;
    5151      AlbaLambdaInterchangeMoveMaker.Apply(newSolution, LambdaInterchangeMoveParameter.ActualValue);
    5252
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveMaker.cs

    r4370 r4383  
    6161      AlbaLambdaInterchangeMove move = LambdaInterchangeMoveParameter.ActualValue;
    6262
    63       Apply(VRPToursParameter.ActualValue as AlbaEncoding, move);
     63      Apply(move.Individual as AlbaEncoding, move);
     64      VRPToursParameter.ActualValue = move.Individual;
    6465    }
    6566  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveEvaluator.cs

    r4370 r4383  
    5050      TranslocationMove move = TranslocationMoveParameter.ActualValue;
    5151      //perform move
    52       AlbaEncoding newSolution = VRPToursParameter.ActualValue.Clone() as AlbaEncoding;
     52      AlbaEncoding newSolution = move.Permutation.Clone() as AlbaEncoding;
    5353      TranslocationManipulator.Apply(newSolution, move.Index1, move.Index2, move.Index3);
    5454
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveMaker.cs

    r4370 r4383  
    5454
    5555    protected override void PerformMove() {
     56      IVariable moveVariable = this.ExecutionContext.Scope.Variables[
     57        TranslocationMoveParameter.ActualName];
     58      TranslocationMove move = moveVariable.Value as TranslocationMove;
     59      VRPToursParameter.ActualValue = move.Permutation as AlbaEncoding;
     60
    5661      moveMaker.PermutationParameter.ActualName = VRPToursParameter.ActualName;
    5762      IAtomicOperation op = this.ExecutionContext.CreateChildOperation(moveMaker);
Note: See TracChangeset for help on using the changeset viewer.