Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/09/10 18:08:14 (14 years ago)
Author:
svonolfe
Message:

Refactored VRP based on the code review (#1039)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.cs

    r4177 r4179  
    3030  [StorableClass]
    3131  public sealed class AlbaCrossover : VRPCrossover {   
    32     public IValueLookupParameter<IPermutationCrossover> PermutationCrossoverParameter {
    33       get { return (IValueLookupParameter<IPermutationCrossover>)Parameters["PermutationCrossover"]; }
     32    public IValueLookupParameter<IPermutationCrossover> InnerCrossoverParameter {
     33      get { return (IValueLookupParameter<IPermutationCrossover>)Parameters["InnerCrossover"]; }
    3434    }
     35
     36    [StorableConstructor]
     37    private AlbaCrossover(bool deserializing) : base(deserializing) { }
    3538
    3639    public AlbaCrossover()
    3740      : base() {
    38       Parameters.Add(new ValueLookupParameter<IPermutationCrossover>("PermutationCrossover", "The permutation crossover.", new EdgeRecombinationCrossover()));
     41      Parameters.Add(new ValueLookupParameter<IPermutationCrossover>("InnerCrossover", "The permutation crossover.", new EdgeRecombinationCrossover()));
     42   
     43      AlbaEncoding.RemoveUnusedParameters(Parameters);
    3944    }
    4045
    41     void Crossover() {
    42       PermutationCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName;
     46    private void Crossover() {
     47      //note - the inner crossover is called here and the result is converted to an alba representation
     48      //some refactoring should be done here in the future - the crossover operation should be called directly
     49
     50      InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName;
    4351      IAtomicOperation op = this.ExecutionContext.CreateOperation(
    44         PermutationCrossoverParameter.ActualValue, this.ExecutionContext.Scope);
     52        InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope);
    4553      op.Operator.Execute((IExecutionContext)op);
    4654
    47       string childName = PermutationCrossoverParameter.ActualValue.ChildParameter.ActualName;
     55      string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName;
    4856      if (ExecutionContext.Scope.Variables.ContainsKey(childName)) {
    4957        Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation;
Note: See TracChangeset for help on using the changeset viewer.