Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/12/10 14:36:13 (14 years ago)
Author:
svonolfe
Message:

Added operations for the Alba encoding (#1039)

Location:
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveEvaluator.cs

    r4179 r4204  
    2929  [Item("AlbaTranslocationMoveEvaluator", "Evaluates a translocation or insertion move (3-opt) for the Alba representation.")]
    3030  [StorableClass]
    31   public sealed class AlbaTranslocationMoveEvaluator : VRPMoveEvaluator {
     31  public sealed class AlbaTranslocationMoveEvaluator : VRPMoveEvaluator, IAlbaTranslocationMoveOperator {
    3232    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
    3333      get { return (ILookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs

    r4179 r4204  
    3131  [Item("AlbaTranslocationMoveGenerator", "An operator which generates translocation moves for the Alba representation.")]
    3232  [StorableClass]
    33   public sealed class AlbaTranslocationMoveGenerator : AlbaMoveOperator, IAlbaTranslocationMoveOperator, IMultiMoveGenerator {
     33  public sealed class AlbaTranslocationMoveGenerator : PermutationMoveOperator, IAlbaTranslocationMoveOperator, IMultiMoveGenerator {
    3434    public IValueLookupParameter<TranslocationMoveGenerator> TranslocationMoveGeneratorParameter {
    3535      get { return (IValueLookupParameter<TranslocationMoveGenerator>)Parameters["TranslocationMoveGenerator"]; }
     
    8686      string moveName = TranslocationMoveGeneratorParameter.ActualValue.TranslocationMoveParameter.Name;
    8787
    88       List<Scope> toBeDeleted = new List<Scope>();
    89       foreach (Scope scope in this.ExecutionContext.Scope.SubScopes) {
    90         if (scope.Variables.ContainsKey(moveName)) {
    91           TranslocationMove move = scope.Variables[moveName].Value as TranslocationMove;
    92 
    93           if (move != null) {
    94             bool criteria1 = true;
    95             if (move.Index1 - 1 >= 0 &&
    96               move.Index3 - 1 >= 0)
    97               criteria1 = (permutation[move.Index1] >= Cities &&
    98                 permutation[move.Index1 - 1] >= Cities &&
    99                 permutation[move.Index3 - 1] >= Cities);
    100 
    101             int index3 = move.Index3 + (move.Index2 - move.Index1) + 1;
    102             bool criteria2 = true;
    103             if (move.Index2 + 1 < permutation.Length &&
    104               index3 < permutation.Length)
    105               criteria2 = (permutation[move.Index2] >= Cities &&
    106                 permutation[move.Index2 + 1] >= Cities &&
    107                 permutation[index3] >= Cities);
    108 
    109             if (criteria1 && criteria2)
    110               toBeDeleted.Add(scope);
    111           }
    112         }
    113       }
    114 
    115       foreach (Scope scope in toBeDeleted) {
    116         this.ExecutionContext.Scope.SubScopes.Remove(scope);
    117       }
    118 
    11988      return successor;
    12089    }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveHardTabuCriterion.cs

    r4179 r4204  
    2929  [Item("AlbaTranslocationMoveHardTabuCriterion", "An operator which checks if translocation moves are tabu using a hard criterion for the Alba representation.")]
    3030  [StorableClass]
    31   public sealed class AlbaTranslocationMoveHardTabuCriterion : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker {
     31  public sealed class AlbaTranslocationMoveHardTabuCriterion : PermutationMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker {
    3232    private TranslocationMoveHardTabuCriterion tabuChecker;
    3333    protected override IPermutationMoveOperator PermutationMoveOperatorParameter {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveMaker.cs

    r4179 r4204  
    3131  public sealed class AlbaTranslocationMoveMaker : AlbaMoveMaker, IAlbaTranslocationMoveOperator, IVRPMoveMaker {
    3232    private TranslocationMoveMaker moveMaker;
    33     protected override IPermutationMoveOperator PermutationMoveOperatorParameter {
    34       get { return moveMaker; }
    35       set { moveMaker = value as TranslocationMoveMaker; }
    36     }
    3733
    3834    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
     
    5955      moveMaker = new TranslocationMoveMaker();
    6056    }
     57
     58    public override IOperation Apply() {
     59      IOperation next = base.Apply();
     60
     61      IVRPEncoding solution = VRPToursParameter.ActualValue;
     62
     63      moveMaker.PermutationParameter.ActualName = VRPToursParameter.ActualName;
     64      IAtomicOperation op = this.ExecutionContext.CreateChildOperation(moveMaker);
     65      op.Operator.Execute((IExecutionContext)op);
     66
     67      return next;
     68    }
    6169  }
    6270}
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveSoftTabuCriterion.cs

    r4179 r4204  
    2929  [Item("AlbaTranslocationMoveSoftTabuCriterion", "An operator which checks if translocation moves are tabu using a soft criterion for the Alba representation.")]
    3030  [StorableClass]
    31   public sealed class AlbaTranslocationMoveSoftTabuCriterion : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker {
     31  public sealed class AlbaTranslocationMoveSoftTabuCriterion : PermutationMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker {
    3232    private TranslocationMoveSoftTabuCriterion tabuChecker;
    3333    protected override IPermutationMoveOperator PermutationMoveOperatorParameter {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveTabuMaker.cs

    r4179 r4204  
    2929  [Item("AlbaTranslocationMoveTabuMaker", "An operator which makes translocation moves tabu for the Alba representation.")]
    3030  [StorableClass]
    31   public sealed class AlbaTranslocationMoveTabuMaker : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuMaker {
     31  public sealed class AlbaTranslocationMoveTabuMaker : PermutationMoveOperator, IAlbaTranslocationMoveOperator, ITabuMaker {
    3232    private TranslocationMoveTabuMaker moveTabuMaker;
    3333    protected override IPermutationMoveOperator PermutationMoveOperatorParameter {
Note: See TracChangeset for help on using the changeset viewer.