Changeset 6760 for branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers
- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting
- Property svn:mergeinfo changed
-
branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaPermutationCrossover.cs
r5445 r6760 48 48 49 49 protected override AlbaEncoding Crossover(IRandom random, AlbaEncoding parent1, AlbaEncoding parent2) { 50 //note - the inner crossover is called here and the resultis converted to an alba representation50 //note - the inner crossover is called here and the solution is converted to an alba representation 51 51 //some refactoring should be done here in the future - the crossover operation should be called directly 52 52 53 InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName; 54 IAtomicOperation op = this.ExecutionContext.CreateOperation( 55 InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope); 56 op.Operator.Execute((IExecutionContext)op, CancellationToken); 53 if (parent1.Length == parent2.Length) { 54 InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName; 55 IAtomicOperation op = this.ExecutionContext.CreateOperation( 56 InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope); 57 op.Operator.Execute((IExecutionContext)op, CancellationToken); 57 58 58 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 string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName; 60 if (ExecutionContext.Scope.Variables.ContainsKey(childName)) { 61 Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation; 62 ExecutionContext.Scope.Variables.Remove(childName); 62 63 63 return new AlbaEncoding(permutation, Cities); 64 } else 65 return null; 64 return new AlbaEncoding(permutation, Cities); 65 } else 66 return null; 67 } else { 68 return parent1.Clone() as AlbaEncoding; 69 } 66 70 } 67 71 }
Note: See TracChangeset
for help on using the changeset viewer.