- Timestamp:
- 08/09/10 18:08:14 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.cs
r4177 r4179 30 30 [StorableClass] 31 31 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"]; } 34 34 } 35 36 [StorableConstructor] 37 private AlbaCrossover(bool deserializing) : base(deserializing) { } 35 38 36 39 public AlbaCrossover() 37 40 : 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); 39 44 } 40 45 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; 43 51 IAtomicOperation op = this.ExecutionContext.CreateOperation( 44 PermutationCrossoverParameter.ActualValue, this.ExecutionContext.Scope);52 InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope); 45 53 op.Operator.Execute((IExecutionContext)op); 46 54 47 string childName = PermutationCrossoverParameter.ActualValue.ChildParameter.ActualName;55 string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName; 48 56 if (ExecutionContext.Scope.Variables.ContainsKey(childName)) { 49 57 Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation;
Note: See TracChangeset
for help on using the changeset viewer.