Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/26/10 03:51:30 (14 years ago)
Author:
swagner
Message:

Removed property ExecutionContext in Operator (#1333)

Location:
branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.cs

    r4722 r5177  
    4444    }
    4545
    46     protected abstract AlbaEncoding Crossover(IRandom random, AlbaEncoding parent1, AlbaEncoding parent2);
     46    protected abstract AlbaEncoding Crossover(IExecutionContext context, IRandom random, AlbaEncoding parent1, AlbaEncoding parent2);
    4747
    48     public override IOperation Apply() {
     48    public override IOperation Apply(IExecutionContext context) {
    4949      ItemArray<IVRPEncoding> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);
    5050      for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) {
     
    6161
    6262      ChildParameter.ActualValue =
    63         Crossover(RandomParameter.ActualValue, parents[0] as AlbaEncoding, parents[1] as AlbaEncoding);
     63        Crossover(context, RandomParameter.ActualValue, parents[0] as AlbaEncoding, parents[1] as AlbaEncoding);
    6464
    65       return base.Apply();
     65      return base.Apply(context);
    6666    }
    6767  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaPermutationCrossover.cs

    r4722 r5177  
    4747    }
    4848
    49     protected override AlbaEncoding Crossover(IRandom random, AlbaEncoding parent1, AlbaEncoding parent2) {
     49    protected override AlbaEncoding Crossover(IExecutionContext context, IRandom random, AlbaEncoding parent1, AlbaEncoding parent2) {
    5050      //note - the inner crossover is called here and the result is converted to an alba representation
    5151      //some refactoring should be done here in the future - the crossover operation should be called directly
    5252
    5353      InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName;
    54       IAtomicOperation op = this.ExecutionContext.CreateOperation(
    55         InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope);
     54      IAtomicOperation op = context.CreateOperation(
     55        InnerCrossoverParameter.ActualValue, context.Scope);
    5656      op.Operator.Execute((IExecutionContext)op);
    5757
    5858      string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName;
    59       if (ExecutionContext.Scope.Variables.ContainsKey(childName)) {
    60         Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation;
    61         ExecutionContext.Scope.Variables.Remove(childName);
     59      if (context.Scope.Variables.ContainsKey(childName)) {
     60        Permutation permutation = context.Scope.Variables[childName].Value as Permutation;
     61        context.Scope.Variables.Remove(childName);
    6262
    6363        return new AlbaEncoding(permutation, Cities);
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerInsertionManipulator.cs

    r4722 r5177  
    4141    }
    4242
    43     protected override void Manipulate(IRandom random, AlbaEncoding individual) {
     43    protected override void Manipulate(IExecutionContext context, IRandom random, AlbaEncoding individual) {
    4444      AlbaEncoding original = (AlbaEncoding)individual.Clone();
    4545      int cutIndex, insertIndex, number;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerInversionManipulator.cs

    r4722 r5177  
    4141      return new AlbaCustomerInversionManipulator(this, cloner);
    4242    }
    43     protected override void Manipulate(IRandom random, AlbaEncoding individual) {
     43    protected override void Manipulate(IExecutionContext context, IRandom random, AlbaEncoding individual) {
    4444      int breakPoint1, breakPoint2;
    4545
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerSwapManipulator.cs

    r4722 r5177  
    3838    }
    3939
    40     protected override void Manipulate(IRandom random, AlbaEncoding individual) {
     40    protected override void Manipulate(IExecutionContext context, IRandom random, AlbaEncoding individual) {
    4141      int index1, index2, temp;
    4242
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaIntraRouteInversionManipulator.cs

    r4722 r5177  
    5252    }
    5353
    54     protected override void Manipulate(IRandom rand, AlbaEncoding individual) {
     54    protected override void Manipulate(IExecutionContext context, IRandom rand, AlbaEncoding individual) {
    5555      int index1 = -1;
    5656      int index2 = -1;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaLambdaInterchangeManipulator.cs

    r4722 r5177  
    102102    }
    103103
    104     protected override void Manipulate(IRandom rand, AlbaEncoding individual) {
     104    protected override void Manipulate(IExecutionContext context, IRandom rand, AlbaEncoding individual) {
    105105      List<Tour> tours = individual.GetTours();
    106106      int lambda = LambdaParameter.Value.Value;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaManipulator.cs

    r4722 r5177  
    4444    }
    4545
    46     protected abstract void Manipulate(IRandom random, AlbaEncoding individual);
     46    protected abstract void Manipulate(IExecutionContext context, IRandom random, AlbaEncoding individual);
    4747
    4848    protected int FindCustomerLocation(int customer, AlbaEncoding individual) {
     
    5858    }
    5959
    60     public override IOperation Apply() {
     60    public override IOperation Apply(IExecutionContext context) {
    6161      IVRPEncoding solution = VRPToursParameter.ActualValue;
    6262      if (!(solution is AlbaEncoding)) {
     
    6464      }
    6565
    66       Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as AlbaEncoding);
     66      Manipulate(context, RandomParameter.ActualValue, VRPToursParameter.ActualValue as AlbaEncoding);
    6767
    68       return base.Apply();
     68      return base.Apply(context);
    6969    }
    7070  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaPermutationManipulator.cs

    r4722 r5177  
    4646    }
    4747
    48     protected override void Manipulate(IRandom random, AlbaEncoding individual) {
     48    protected override void Manipulate(IExecutionContext context, IRandom random, AlbaEncoding individual) {
    4949      InnerManipulatorParameter.ActualValue.PermutationParameter.ActualName = VRPToursParameter.ActualName;
    5050
    51       IAtomicOperation op = this.ExecutionContext.CreateOperation(
    52         InnerManipulatorParameter.ActualValue, this.ExecutionContext.Scope);
     51      IAtomicOperation op = context.CreateOperation(
     52        InnerManipulatorParameter.ActualValue, context.Scope);
    5353      op.Operator.Execute((IExecutionContext)op);
    5454    }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveMaker.cs

    r4722 r5177  
    8080    }
    8181
    82     public override IOperation Apply() {
    83       IOperation successor = base.Apply();
     82    public override IOperation Apply(IExecutionContext context) {
     83      IOperation successor = base.Apply(context);
    8484
    8585      VehcilesUtilizedParameter.ActualValue = MoveVehcilesUtilizedParameter.ActualValue;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveOperator.cs

    r4722 r5177  
    3636    }
    3737
    38     public override IOperation Apply() {
     38    public override IOperation Apply(IExecutionContext context) {
    3939      IVRPEncoding solution = VRPToursParameter.ActualValue;
    4040      if (!(solution is AlbaEncoding)) {
     
    4343      }
    4444
    45       return base.Apply();
     45      return base.Apply(context);
    4646    }
    4747  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaPermutationMoveOperator.cs

    r4722 r5177  
    3939    }
    4040
    41     public override IOperation Apply() {
    42       IOperation next = base.Apply();
     41    public override IOperation Apply(IExecutionContext context) {
     42      IOperation next = base.Apply(context);
    4343
    4444      IVRPEncoding solution = VRPToursParameter.ActualValue;
    4545
    4646      PermutationMoveOperatorParameter.PermutationParameter.ActualName = VRPToursParameter.ActualName;
    47       IAtomicOperation op = this.ExecutionContext.CreateChildOperation(PermutationMoveOperatorParameter);
     47      IAtomicOperation op = context.CreateChildOperation(PermutationMoveOperatorParameter);
    4848      op.Operator.Execute((IExecutionContext)op);
    4949
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveGenerator.cs

    r4722 r5177  
    4949    protected abstract AlbaIntraRouteInversionMove[] GenerateMoves(AlbaEncoding individual);
    5050
    51     public override IOperation Apply() {
    52       IOperation next = base.Apply();
     51    public override IOperation Apply(IExecutionContext context) {
     52      IOperation next = base.Apply(context);
    5353
    5454      AlbaEncoding individual = VRPToursParameter.ActualValue as AlbaEncoding;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveMaker.cs

    r4722 r5177  
    6262    }
    6363
    64     public override IOperation Apply() {
    65       IOperation next = base.Apply();
     64    public override IOperation Apply(IExecutionContext context) {
     65      IOperation next = base.Apply(context);
    6666     
    6767      AlbaIntraRouteInversionMove move = IntraRouteInversionMoveParameter.ActualValue;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveGenerator.cs

    r4722 r5177  
    6161    protected abstract AlbaLambdaInterchangeMove[] GenerateMoves(AlbaEncoding individual, int lambda);
    6262
    63     public override IOperation Apply() {
    64       IOperation next = base.Apply();
     63    public override IOperation Apply(IExecutionContext context) {
     64      IOperation next = base.Apply(context);
    6565
    6666      AlbaEncoding individual = VRPToursParameter.ActualValue as AlbaEncoding;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveMaker.cs

    r4722 r5177  
    6767    }
    6868
    69     public override IOperation Apply() {
    70       IOperation next = base.Apply();
     69    public override IOperation Apply(IExecutionContext context) {
     70      IOperation next = base.Apply(context);
    7171
    7272      AlbaLambdaInterchangeMove move = LambdaInterchangeMoveParameter.ActualValue;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs

    r4722 r5177  
    8484    }
    8585
    86     public override IOperation Apply() {
    87       IOperation successor = base.Apply();
     86    public override IOperation Apply(IExecutionContext context) {
     87      IOperation successor = base.Apply(context);
    8888
    8989      Permutation permutation = VRPToursParameter.ActualValue as Permutation;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveMaker.cs

    r5129 r5177  
    6161      return new AlbaTranslocationMoveMaker(this, cloner);
    6262    }
    63     public override IOperation Apply() {
    64       IOperation next = base.Apply();
     63    public override IOperation Apply(IExecutionContext context) {
     64      IOperation next = base.Apply(context);
    6565
    6666      IVRPEncoding solution = VRPToursParameter.ActualValue;
    6767
    6868      moveMaker.PermutationParameter.ActualName = VRPToursParameter.ActualName;
    69       IAtomicOperation op = this.ExecutionContext.CreateChildOperation(moveMaker);
     69      IAtomicOperation op = context.CreateChildOperation(moveMaker);
    7070      op.Operator.Execute((IExecutionContext)op);
    7171
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Crossovers/GVRCrossover.cs

    r4722 r5177  
    101101    }
    102102   
    103     public override IOperation Apply() {
     103    public override IOperation Apply(IExecutionContext context) {
    104104      ItemArray<IVRPEncoding> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);
    105105      for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) {
     
    116116      ChildParameter.ActualValue = Crossover(RandomParameter.ActualValue, parents[0] as GVREncoding, parents[1] as GVREncoding);
    117117
    118       return base.Apply();
     118      return base.Apply(context);
    119119    }
    120120  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRManipulator.cs

    r4722 r5177  
    5050    protected abstract void Manipulate(IRandom random, GVREncoding individual);
    5151   
    52     public override IOperation Apply() {
     52    public override IOperation Apply(IExecutionContext context) {
    5353      IVRPEncoding solution = VRPToursParameter.ActualValue;
    5454      if (!(solution is GVREncoding)) {
     
    5959      Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as GVREncoding);
    6060
    61       return base.Apply();
     61      return base.Apply(context);
    6262    }
    6363  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Creators/DefaultRepresentationCreator.cs

    r4722 r5177  
    3838    public DefaultRepresentationCreator() : base() { }
    3939
    40     public override IOperation Apply() {
     40    public override IOperation Apply(IExecutionContext context) {
    4141      //choose default encoding here
    4242      VRPToursParameter.ActualValue = PotvinEncoding.ConvertFrom(CreateSolution());
    4343
    44       return base.Apply();
     44      return base.Apply(context);
    4545    }
    4646  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Creators/MultiVRPSolutionCreator.cs

    r4722 r5177  
    135135    }
    136136
    137     public override IOperation Apply() {
     137    public override IOperation Apply(IExecutionContext context) {
    138138      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one VRP creator to choose from.");
    139       return base.Apply();
     139      return base.Apply(context);
    140140    }
    141141  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Crossovers/MultiVRPSolutionCrossover.cs

    r4722 r5177  
    142142    }
    143143
    144     public override IOperation Apply() {
     144    public override IOperation Apply(IExecutionContext context) {
    145145      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one permutation crossover to choose from.");
    146       return base.Apply();
     146      return base.Apply(context);
    147147    }
    148148  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Crossovers/RandomParentCloneCrossover.cs

    r4722 r5177  
    5757    }
    5858
    59     public override IOperation Apply() {
     59    public override IOperation Apply(IExecutionContext context) {
    6060      if (RandomParameter.ActualValue.Next() < 0.5)
    6161        ChildParameter.ActualValue = ParentsParameter.ActualValue[0].Clone() as IVRPEncoding;
     
    6363        ChildParameter.ActualValue = ParentsParameter.ActualValue[1].Clone() as IVRPEncoding;
    6464
    65       return base.Apply();
     65      return base.Apply(context);
    6666    }
    6767  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Manipulators/MultiVRPSolutionManipulator.cs

    r4722 r5177  
    140140    }
    141141
    142     public override IOperation Apply() {
     142    public override IOperation Apply(IExecutionContext context) {
    143143      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one permutation manipulator to choose from.");
    144       return base.Apply();
     144      return base.Apply(context);
    145145    }
    146146  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveGenerator.cs

    r4722 r5177  
    187187    }
    188188
    189     public override IOperation Apply() {
     189    public override IOperation Apply(IExecutionContext context) {
    190190      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one VRP move generator choose from.");
    191       OperationCollection next = new OperationCollection(base.Apply());
     191      OperationCollection next = new OperationCollection(base.Apply(context));
    192192
    193193      for (int i = 0; i < SampleSizeParameter.ActualValue.Value; i++) {
     
    215215
    216216        if (successor != null) {
    217           next.Insert(0, ExecutionContext.CreateChildOperation(successor));
     217          next.Insert(0, context.CreateChildOperation(successor));
    218218        }
    219219      }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveMaker.cs

    r4722 r5177  
    107107    }
    108108
    109     public override IOperation Apply() {
    110       IOperation next = base.Apply();
     109    public override IOperation Apply(IExecutionContext context) {
     110      IOperation next = base.Apply(context);
    111111
    112112      IVRPEncoding solution = VRPToursParameter.ActualValue as IVRPEncoding;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinCrossover.cs

    r4722 r5177  
    125125    }
    126126
    127     public override IOperation Apply() {
     127    public override IOperation Apply(IExecutionContext context) {
    128128      ItemArray<IVRPEncoding> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);
    129129      for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) {
     
    140140      ChildParameter.ActualValue = Crossover(RandomParameter.ActualValue, parents[0] as PotvinEncoding, parents[1] as PotvinEncoding);
    141141
    142       return base.Apply();
     142      return base.Apply(context);
    143143    }
    144144  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinManipulator.cs

    r4722 r5177  
    8080    }
    8181
    82     public override IOperation Apply() {
     82    public override IOperation Apply(IExecutionContext context) {
    8383      IVRPEncoding solution = VRPToursParameter.ActualValue;
    8484      if (!(solution is PotvinEncoding)) {
     
    8888      Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as PotvinEncoding);
    8989
    90       return base.Apply();
     90      return base.Apply(context);
    9191    }
    9292  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Crossovers/PrinsCrossover.cs

    r4722 r5177  
    6565    }
    6666
    67     protected abstract PrinsEncoding Crossover(IRandom random, PrinsEncoding parent1, PrinsEncoding parent2);
     67    protected abstract PrinsEncoding Crossover(IExecutionContext context, IRandom random, PrinsEncoding parent1, PrinsEncoding parent2);
    6868
    69     public override IOperation Apply() {
     69    public override IOperation Apply(IExecutionContext context) {
    7070      ItemArray<IVRPEncoding> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);
    7171      for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) {
     
    9595
    9696      ChildParameter.ActualValue =
    97         Crossover(RandomParameter.ActualValue, parents[0] as PrinsEncoding, parents[1] as PrinsEncoding);
     97        Crossover(context, RandomParameter.ActualValue, parents[0] as PrinsEncoding, parents[1] as PrinsEncoding);
    9898
    99       return base.Apply();
     99      return base.Apply(context);
    100100    }
    101101  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Crossovers/PrinsPermutationCrossover.cs

    r4722 r5177  
    4545    }
    4646
    47     protected override PrinsEncoding Crossover(IRandom random, PrinsEncoding parent1, PrinsEncoding parent2) {
     47    protected override PrinsEncoding Crossover(IExecutionContext context, IRandom random, PrinsEncoding parent1, PrinsEncoding parent2) {
    4848      //note - the inner crossover is called here and the result is converted to a prins representation
    4949      //some refactoring should be done here in the future - the crossover operation should be called directly
    5050
    5151      InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName;
    52       IAtomicOperation op = this.ExecutionContext.CreateOperation(
    53         InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope);
     52      IAtomicOperation op = context.CreateOperation(
     53        InnerCrossoverParameter.ActualValue, context.Scope);
    5454      op.Operator.Execute((IExecutionContext)op);
    5555
    5656      string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName;
    57       if (ExecutionContext.Scope.Variables.ContainsKey(childName)) {
    58         Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation;
    59         ExecutionContext.Scope.Variables.Remove(childName);
     57      if (context.Scope.Variables.ContainsKey(childName)) {
     58        Permutation permutation = context.Scope.Variables[childName].Value as Permutation;
     59        context.Scope.Variables.Remove(childName);
    6060
    6161        return new PrinsEncoding(permutation, Cities,
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsExhaustiveLSManipulator.cs

    r4722 r5177  
    3939    }
    4040
    41     protected override void Manipulate(IRandom random, PrinsEncoding individual) {
     41    protected override void Manipulate(IExecutionContext context, IRandom random, PrinsEncoding individual) {
    4242      List<Tour> tours = individual.GetTours(DistanceMatrixParameter);
    4343      bool improvement = false;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsManipulator.cs

    r4722 r5177  
    6464    }
    6565
    66     protected abstract void Manipulate(IRandom random, PrinsEncoding individual);
     66    protected abstract void Manipulate(IExecutionContext context, IRandom random, PrinsEncoding individual);
    6767
    68     public override IOperation Apply() {
     68    public override IOperation Apply(IExecutionContext context) {
    6969      IVRPEncoding solution = VRPToursParameter.ActualValue;
    7070      if (!(solution is PrinsEncoding)) {
     
    8686      }
    8787
    88       Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as PrinsEncoding);
     88      Manipulate(context, RandomParameter.ActualValue, VRPToursParameter.ActualValue as PrinsEncoding);
    8989
    90       return base.Apply();
     90      return base.Apply(context);
    9191    }
    9292  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsPermutationManipulator.cs

    r4722 r5177  
    4545    }
    4646
    47     protected override void Manipulate(IRandom random, PrinsEncoding individual) {
     47    protected override void Manipulate(IExecutionContext context, IRandom random, PrinsEncoding individual) {
    4848      InnerManipulatorParameter.ActualValue.PermutationParameter.ActualName = VRPToursParameter.ActualName;
    4949
    50       IAtomicOperation op = this.ExecutionContext.CreateOperation(
    51         InnerManipulatorParameter.ActualValue, this.ExecutionContext.Scope);
     50      IAtomicOperation op = context.CreateOperation(
     51        InnerManipulatorParameter.ActualValue, context.Scope);
    5252      op.Operator.Execute((IExecutionContext)op);
    5353    }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsStochasticLSManipulator.cs

    r4722 r5177  
    4646    }
    4747
    48     protected override void Manipulate(IRandom random, PrinsEncoding individual) {
     48    protected override void Manipulate(IExecutionContext context, IRandom random, PrinsEncoding individual) {
    4949      List<Tour> tours = individual.GetTours(DistanceMatrixParameter);
    5050      bool improvement = false;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuCrossover.cs

    r4722 r5177  
    4545    }
    4646
    47     protected abstract ZhuEncoding Crossover(IRandom random, ZhuEncoding parent1, ZhuEncoding parent2);
     47    protected abstract ZhuEncoding Crossover(IExecutionContext context, IRandom random, ZhuEncoding parent1, ZhuEncoding parent2);
    4848
    49     public override IOperation Apply() {
     49    public override IOperation Apply(IExecutionContext context) {
    5050      ItemArray<IVRPEncoding> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);
    5151      for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) {
     
    7070
    7171      ChildParameter.ActualValue =
    72         Crossover(RandomParameter.ActualValue, parents[0] as ZhuEncoding, parents[1] as ZhuEncoding);
     72        Crossover(context, RandomParameter.ActualValue, parents[0] as ZhuEncoding, parents[1] as ZhuEncoding);
    7373
    74       return base.Apply();
     74      return base.Apply(context);
    7575    }
    7676  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover1.cs

    r4722 r5177  
    4949    }
    5050
    51     protected override ZhuEncoding Crossover(IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
     51    protected override ZhuEncoding Crossover(IExecutionContext context, IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
    5252      parent1 = parent1.Clone() as ZhuEncoding;
    5353      parent2 = parent2.Clone() as ZhuEncoding;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover2.cs

    r4722 r5177  
    4141    }
    4242
    43     protected override ZhuEncoding Crossover(IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
     43    protected override ZhuEncoding Crossover(IExecutionContext context, IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
    4444      List<int> p1 = new List<int>(parent1);
    4545      List<int> p2 = new List<int>(parent2);
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuMergeCrossover1.cs

    r4722 r5177  
    4949    }
    5050
    51     protected override ZhuEncoding Crossover(IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
     51    protected override ZhuEncoding Crossover(IExecutionContext context, IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
    5252      parent1 = parent1.Clone() as ZhuEncoding;
    5353      parent2 = parent2.Clone() as ZhuEncoding;
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuMergeCrossover2.cs

    r4722 r5177  
    4141    }
    4242
    43     protected override ZhuEncoding Crossover(IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
     43    protected override ZhuEncoding Crossover(IExecutionContext context, IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
    4444      List<int> p1 = new List<int>(parent1);
    4545      List<int> p2 = new List<int>(parent2);
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuPermutationCrossover.cs

    r4722 r5177  
    4747    }
    4848
    49     protected override ZhuEncoding Crossover(IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
     49    protected override ZhuEncoding Crossover(IExecutionContext context, IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) {
    5050      //note - the inner crossover is called here and the result is converted to a prins representation
    5151      //some refactoring should be done here in the future - the crossover operation should be called directly
    5252
    5353      InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName;
    54       IAtomicOperation op = this.ExecutionContext.CreateOperation(
    55         InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope);
     54      IAtomicOperation op = context.CreateOperation(
     55        InnerCrossoverParameter.ActualValue, context.Scope);
    5656      op.Operator.Execute((IExecutionContext)op);
    5757
    5858      string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName;
    59       if (ExecutionContext.Scope.Variables.ContainsKey(childName)) {
    60         Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation;
    61         ExecutionContext.Scope.Variables.Remove(childName);
     59      if (context.Scope.Variables.ContainsKey(childName)) {
     60        Permutation permutation = context.Scope.Variables[childName].Value as Permutation;
     61        context.Scope.Variables.Remove(childName);
    6262
    6363        return new ZhuEncoding(permutation, Cities,
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Manipulators/ZhuManipulator.cs

    r4722 r5177  
    4545    }
    4646
    47     protected abstract void Manipulate(IRandom random, ZhuEncoding individual);
     47    protected abstract void Manipulate(IExecutionContext context, IRandom random, ZhuEncoding individual);
    4848
    49     public override IOperation Apply() {
     49    public override IOperation Apply(IExecutionContext context) {
    5050      IVRPEncoding solution = VRPToursParameter.ActualValue;
    5151      if (!(solution is ZhuEncoding)) {
     
    6262      }
    6363
    64       Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as ZhuEncoding);
     64      Manipulate(context, RandomParameter.ActualValue, VRPToursParameter.ActualValue as ZhuEncoding);
    6565
    66       return base.Apply();
     66      return base.Apply(context);
    6767    }
    6868  }
  • branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Manipulators/ZhuPermutationManipulator.cs

    r4722 r5177  
    4747    }
    4848
    49     protected override void Manipulate(IRandom random, ZhuEncoding individual) {
     49    protected override void Manipulate(IExecutionContext context, IRandom random, ZhuEncoding individual) {
    5050      InnerManipulatorParameter.ActualValue.PermutationParameter.ActualName = VRPToursParameter.ActualName;
    5151
    52       IAtomicOperation op = this.ExecutionContext.CreateOperation(
    53         InnerManipulatorParameter.ActualValue, this.ExecutionContext.Scope);
     52      IAtomicOperation op = context.CreateOperation(
     53        InnerManipulatorParameter.ActualValue, context.Scope);
    5454      op.Operator.Execute((IExecutionContext)op);
    5555    }
Note: See TracChangeset for help on using the changeset viewer.