Changeset 1550
- Timestamp:
- 04/14/09 00:16:08 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SGA.Hardwired/3.3/CreateChildren.cs
r1543 r1550 34 34 class CreateChildren : OperatorBase { 35 35 ChildrenInitializer ci; 36 O rderCrossover oc;37 InversionManipulator im;38 RoundedEuclideanPathTSPEvaluator repTSPe;36 OperatorBase crossover; 37 OperatorBase mutator; 38 OperatorBase evaluator; 39 39 SubScopesRemover sr; 40 40 Counter counter; … … 50 50 : base() { 51 51 ci = new ChildrenInitializer(); 52 oc = new OrderCrossover();53 im = new InversionManipulator();54 repTSPe = new RoundedEuclideanPathTSPEvaluator();55 52 56 // variables for stochastic branch53 // variables infos 57 54 AddVariableInfo(new VariableInfo("Random", "Pseudo random number generator", typeof(IRandom), VariableKind.In)); 58 55 AddVariableInfo(new VariableInfo("MutationRate", "Probability to choose first branch", typeof(DoubleData), VariableKind.In)); 59 56 AddVariableInfo(new VariableInfo("Crossover", "Crossover strategy for SGA", typeof(OperatorBase), VariableKind.In)); 57 AddVariableInfo(new VariableInfo("Mutator", "Mutation strategy for SGA", typeof(OperatorBase), VariableKind.In)); 58 AddVariableInfo(new VariableInfo("Evaluator", "Evaluation strategy for SGA", typeof(OperatorBase), VariableKind.In)); 59 60 60 sr = new SubScopesRemover(); 61 61 sr.GetVariableInfo("SubScopeIndex").Local = true; … … 69 69 } 70 70 71 void valueInfo_ActualNameChanged(object sender, EventArgs e) { 72 throw new NotImplementedException(); 73 } // SGAMain() 71 public override IOperation Apply(IScope scope) { 74 72 75 public override IOperation Apply(IScope scope) { 73 ci = new ChildrenInitializer(); 74 crossover = (OperatorBase)GetVariableValue("Crossover", scope, true); 75 mutator = (OperatorBase)GetVariableValue("Mutator", scope, true); 76 evaluator = GetVariableValue<OperatorBase>("Evaluator", scope, true); 76 77 77 78 random = GetVariableValue<IRandom>("Random", scope, true); … … 82 83 // UniformSequentialSubScopesProcessor 83 84 foreach (IScope s in scope.SubScopes) { 84 oc.Execute(s);85 85 crossover.Execute(s); 86 // Stochastic Branch 86 87 if(random.NextDouble() < probability.Data) 87 im.Execute(s);88 repTSPe.Execute(s);88 mutator.Execute(s); 89 evaluator.Execute(s); 89 90 sr.Execute(s); 90 91 counter.Execute(s);
Note: See TracChangeset
for help on using the changeset viewer.