Changeset 2129
- Timestamp:
- 07/02/09 12:25:32 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.FixedOperators/3.2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.FixedOperators/3.2/FixedGAMainBase.cs
r2120 r2129 180 180 Execute(mr, scope); 181 181 Execute(sorter, scope); 182 182 183 } // DoReplacement 183 184 -
trunk/sources/HeuristicLab.FixedOperators/3.2/FixedOSGAMain.cs
r2120 r2129 66 66 IScope s; 67 67 IScope s2; 68 bool loopSkipped = true; 69 bool running = false; 68 70 69 71 DoubleData selectionPressure = null; … … 105 107 Execute(wofc, s2); 106 108 Execute(sr, s2); 109 loopSkipped = false; 110 } // foreach 107 111 108 } // foreach 109 subscopeNr.Data = 0; 112 // if for loop skipped, we had to add skiped operations 113 // to execution pointer. 114 if (loopSkipped) 115 executionPointer += 5; 110 116 111 117 Execute(sorter, s); 112 118 ////// END Create Children ////// 113 114 115 } while (os.Execute(scope) != null); 119 120 running = ExecuteFirstOperator(os, scope); 121 if (running) subscopeNr.Data = 0; 122 } while (running); 116 123 117 124 DoReplacement(scope); … … 129 136 break; 130 137 138 subscopeNr.Data = 0; 131 139 ResetExecutionPointer(); 132 140 } // for i generations -
trunk/sources/HeuristicLab.FixedOperators/3.2/FixedOperatorBase.cs
r2120 r2129 70 70 } // SetRegion 71 71 72 /// <summary> 73 /// Executes only the operator op, suboperator are wont be executed. 74 /// </summary> 75 /// <param name="op">Operator to execute.</param> 76 /// <param name="scope">Scope on which operator is executed.</param> 77 /// <returns>True, if operator has suboperators after execution. </returns> 78 protected virtual bool ExecuteFirstOperator(IOperator op, IScope scope){ 79 bool suboperatorsExist = false; 80 81 if (!IsExecuted()) { 82 suboperatorsExist = op.Execute(scope) != null; 83 persistedExecutionPointer.Data++; 84 } // if not executed 85 executionPointer++; 86 87 if (Canceled) 88 throw new CancelException(); 89 90 return suboperatorsExist; 91 } // ExecuteFirstOperator 92 72 93 protected virtual void Execute(IOperator op, IScope scope) { 73 94 if (!IsExecuted()) { … … 90 111 } 91 112 } else { 92 executionStack = new Stack<IOperation>(persistedOperations); 113 executionStack = new Stack<IOperation>(persistedOperations); 114 persistedOperations.Clear(); 93 115 } 94 116 … … 121 143 122 144 private void SaveExecutionStack(Stack<IOperation> stack) { 123 persistedOperations = new ItemList<IOperation>();145 persistedOperations.Clear(); 124 146 persistedOperations.AddRange(stack.ToArray()); 125 147 } // SaveExecutionStack -
trunk/sources/HeuristicLab.FixedOperators/3.2/FixedSGAMain.cs
r2120 r2129 333 333 IScope s; 334 334 IScope s2; 335 335 bool loopSkipped = true; 336 337 tempExePointer = new int[10]; 338 tempPersExePointer = new int[10]; 339 336 340 try { 337 341 for (; nrOfGenerations.Data < maxGenerations.Data; nrOfGenerations.Data++) { … … 368 372 Execute(sr, s2); 369 373 Execute(counter, s2); 374 loopSkipped = false; 370 375 } // foreach 376 377 // if for loop skipped, we had to add skiped operations 378 // to execution pointer. 379 if (loopSkipped) 380 executionPointer += 5; 371 381 372 382 Execute(sorter, s); … … 394 404 return new AtomicOperation(this, scope); 395 405 } 406 catch (Exception ex) { 407 ex.ToString(); 408 } 396 409 397 410 return null;
Note: See TracChangeset
for help on using the changeset viewer.