Changeset 1900 for trunk/sources/HeuristicLab.FixedOperators
- Timestamp:
- 05/26/09 23:09:19 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.FixedOperators/3.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.FixedOperators/3.2/FixedOperatorBase.cs
r1875 r1900 65 65 ExecuteOperation(op, scope); 66 66 persistedExecutionPointer.Data++; 67 //Console.WriteLine("Execute: {0}", executionPointer); 67 68 } // if not executed 69 //else 70 //Console.WriteLine("Skip Execute: {0}", executionPointer); 68 71 executionPointer++; 69 72 -
trunk/sources/HeuristicLab.FixedOperators/3.2/FixedSGAMain.cs
r1875 r1900 143 143 IntData maxGenerations = GetVariableValue<IntData>("MaximumGenerations", scope, true); 144 144 IntData nrOfGenerations = GetVariableValue<IntData>("Generations", scope, true); 145 nrOfGenerations.Data = 0; 146 147 IntData subscopeNr = new IntData(0); 145 //nrOfGenerations.Data = 0; 146 147 IntData subscopeNr; 148 try { 149 subscopeNr = scope.GetVariableValue<IntData>("SubScopeNr", false); 150 } 151 catch (Exception) { 152 subscopeNr = new IntData(0); 153 scope.AddVariable(new Variable("SubScopeNr", subscopeNr)); 154 } 155 156 EmptyOperator empty = new EmptyOperator(); 148 157 149 158 IScope s; 150 159 IScope s2; 151 int tempExePointer ;152 int tempPersExePointer ;160 int tempExePointer = 0; 161 int tempPersExePointer = 0; 153 162 // fetch variables from scope for create children 154 163 InitializeExecuteCreateChildren(scope); 155 164 try { 156 165 for (int i = nrOfGenerations.Data; i < maxGenerations.Data; i++) { 166 if (executionPointer == persistedExecutionPointer.Data) 167 persistedExecutionPointer.Data = 0; 168 executionPointer = 0; 169 157 170 Execute(selector, scope); 158 171 … … 161 174 s = scope.SubScopes[1]; 162 175 Execute(ci, s); 176 163 177 tempExePointer = executionPointer; 164 178 tempPersExePointer = persistedExecutionPointer.Data; 165 179 // UniformSequentialSubScopesProcessor 166 180 for (int j = subscopeNr.Data; j < s.SubScopes.Count; j++ ) { 181 if (executionPointer == persistedExecutionPointer.Data) 182 persistedExecutionPointer.Data = tempExePointer; 167 183 executionPointer = tempExePointer; 168 persistedExecutionPointer.Data = tempPersExePointer;184 169 185 s2 = s.SubScopes[j]; 170 186 Execute(crossover, s2); … … 172 188 if (random.NextDouble() < probability.Data) 173 189 Execute(mutator, s2); 190 else 191 Execute(empty, s2); 174 192 Execute(evaluator, s2); 175 193 Execute(sr, s2); 176 194 Execute(counter, s2); 195 subscopeNr.Data++; 177 196 } // foreach 197 178 198 179 199 Execute(sorter, s); … … 185 205 Execute(dc, scope); 186 206 Execute(lci, scope); 207 subscopeNr.Data = 0; 187 208 nrOfGenerations.Data++; 188 209 } // for i
Note: See TracChangeset
for help on using the changeset viewer.