Changeset 1552
- Timestamp:
- 04/14/09 11:49:33 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.SGA.Hardwired/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SGA.Hardwired/3.3/CreateChildren.cs
r1550 r1552 44 44 45 45 public override string Description { 46 get { return @"Implements the functionality of method SGAMain hard wired."; }46 get { return @"Implements the control structures of CreateChildren hard wired. Operators are delegated."; } 47 47 } 48 48 … … 70 70 71 71 public override IOperation Apply(IScope scope) { 72 73 ci = new ChildrenInitializer();74 72 crossover = (OperatorBase)GetVariableValue("Crossover", scope, true); 75 73 mutator = (OperatorBase)GetVariableValue("Mutator", scope, true); … … 91 89 counter.Execute(s); 92 90 } // foreach 93 // set evaluated solutions94 //IntData value = GetVariableValue<IntData>("EvaluatedSolutions", scope, true);95 //value.Data = counter;96 91 97 // sort with using of operator98 92 sorter.Execute(scope); 99 100 // sort scopes101 //bool descending = false;//GetVariableValue<BoolData>("Descending", scope, true).Data;102 //double[] keys = new double[scope.SubScopes.Count];103 //int[] sequence = new int[keys.Length];104 105 //for (int i = 0; i < keys.Length; i++) {106 // keys[i] = scope.SubScopes[i].GetVariableValue<DoubleData>("Quality", false).Data;107 // sequence[i] = i;108 //}109 110 //Array.Sort<double, int>(keys, sequence);111 112 //if (descending) {113 // int temp;114 // for (int i = 0; i < sequence.Length / 2; i++) {115 // temp = sequence[i];116 // sequence[i] = sequence[sequence.Length - 1 - i];117 // sequence[sequence.Length - 1 - i] = temp;118 // }119 //}120 //scope.ReorderSubScopes(sequence);121 93 122 94 return null; 123 95 } // Apply 124 125 } // class SGAMain 126 127 } // namespace HeuristicLab.SGA 96 } // class CreateChildren 97 } // namespace HeuristicLab.SGA.Hardwired -
trunk/sources/HeuristicLab.SGA.Hardwired/3.3/CreateChildrenHardWired.cs
r1551 r1552 75 75 // UniformSequentialSubScopesProcessor 76 76 foreach (IScope s in scope.SubScopes) { 77 crossover.Execute(s); 77 if (crossover.Execute(s) != null) 78 throw new InvalidOperationException("ERROR: no support for combined operators!"); 79 78 80 // Stochastic Branch 79 if (random.NextDouble() < probability.Data) 80 mutator.Execute(s); 81 evaluator.Execute(s); 81 if (random.NextDouble() < probability.Data) { 82 if (mutator.Execute(s) != null) 83 throw new InvalidOperationException("ERROR: no support for combined operators!"); 84 } 85 86 if (evaluator.Execute(s) != null) 87 throw new InvalidOperationException("ERROR: no support for combined operators!"); 88 82 89 // subscopes remover 83 90 IntData index = GetVariableValue<IntData>("SubScopeIndex", s, true, false); … … 120 127 return null; 121 128 } // Apply 122 123 } // class SGAMain 124 125 } // namespace HeuristicLab.SGA 129 } // class CreateChildrenHardWired 130 } // namespace HeuristicLab.SGA.Hardwired
Note: See TracChangeset
for help on using the changeset viewer.