Changeset 8738 for trunk/sources/HeuristicLab.Optimization
- Timestamp:
- 10/04/12 15:42:21 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
r8212 r8738 134 134 storeAlgorithmInEachRun = false; 135 135 runsCounter = 0; 136 Runs = new RunCollection ();136 Runs = new RunCollection { AlgorithmName = Name }; 137 137 } 138 138 protected Algorithm(string name) … … 142 142 storeAlgorithmInEachRun = false; 143 143 runsCounter = 0; 144 Runs = new RunCollection ();144 Runs = new RunCollection { AlgorithmName = Name }; 145 145 } 146 146 protected Algorithm(string name, ParameterCollection parameters) … … 150 150 storeAlgorithmInEachRun = false; 151 151 runsCounter = 0; 152 Runs = new RunCollection ();152 Runs = new RunCollection { AlgorithmName = Name }; 153 153 } 154 154 protected Algorithm(string name, string description) … … 158 158 storeAlgorithmInEachRun = false; 159 159 runsCounter = 0; 160 Runs = new RunCollection ();160 Runs = new RunCollection { AlgorithmName = Name }; 161 161 } 162 162 protected Algorithm(string name, string description, ParameterCollection parameters) … … 166 166 storeAlgorithmInEachRun = false; 167 167 runsCounter = 0; 168 Runs = new RunCollection ();168 Runs = new RunCollection { AlgorithmName = Name }; 169 169 } 170 170 [StorableConstructor] … … 250 250 251 251 #region Events 252 protected override void OnNameChanged() { 253 base.OnNameChanged(); 254 Runs.AlgorithmName = Name; 255 } 256 252 257 public event EventHandler ExecutionStateChanged; 253 258 protected virtual void OnExecutionStateChanged() { -
trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs
r8668 r8738 175 175 repetitions = 10; 176 176 repetitionsCounter = 0; 177 Runs = new RunCollection ();177 Runs = new RunCollection { AlgorithmName = Name }; 178 178 } 179 179 public BatchRun(string name) … … 185 185 repetitions = 10; 186 186 repetitionsCounter = 0; 187 Runs = new RunCollection ();187 Runs = new RunCollection { AlgorithmName = Name }; 188 188 } 189 189 public BatchRun(string name, string description) … … 194 194 repetitions = 10; 195 195 repetitionsCounter = 0; 196 Runs = new RunCollection ();196 Runs = new RunCollection { AlgorithmName = Name }; 197 197 } 198 198 [StorableConstructor] … … 278 278 279 279 #region Events 280 protected override void OnNameChanged() { 281 base.OnNameChanged(); 282 runs.AlgorithmName = Name; 283 } 284 280 285 public event EventHandler ExecutionStateChanged; 281 286 private void OnExecutionStateChanged() { -
trunk/sources/HeuristicLab.Optimization/3.3/Experiment.cs
r8194 r8738 117 117 executionTime = TimeSpan.Zero; 118 118 optimizers = new OptimizerList(); 119 Runs = new RunCollection ();119 Runs = new RunCollection { AlgorithmName = Name }; 120 120 Initialize(); 121 121 } … … 126 126 executionTime = TimeSpan.Zero; 127 127 optimizers = new OptimizerList(); 128 Runs = new RunCollection ();128 Runs = new RunCollection { AlgorithmName = Name }; 129 129 Initialize(); 130 130 } … … 134 134 executionTime = TimeSpan.Zero; 135 135 optimizers = new OptimizerList(); 136 Runs = new RunCollection ();136 Runs = new RunCollection { AlgorithmName = Name }; 137 137 Initialize(); 138 138 } … … 180 180 foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState != ExecutionState.Started)) { 181 181 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 182 try { optimizer.Prepare(clearRuns); } catch (InvalidOperationException) { } 182 try { optimizer.Prepare(clearRuns); } 183 catch (InvalidOperationException) { } 183 184 } 184 185 } … … 193 194 if (optimizer != null) { 194 195 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 195 try { optimizer.Start(); } catch (InvalidOperationException) { } 196 try { optimizer.Start(); } 197 catch (InvalidOperationException) { } 196 198 } 197 199 } … … 205 207 foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState == ExecutionState.Started)) { 206 208 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 207 try { optimizer.Pause(); } catch (InvalidOperationException) { } 209 try { optimizer.Pause(); } 210 catch (InvalidOperationException) { } 208 211 } 209 212 } … … 218 221 foreach (var optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) { 219 222 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 220 try { optimizer.Stop(); } catch (InvalidOperationException) { } 223 try { optimizer.Stop(); } 224 catch (InvalidOperationException) { } 221 225 } 222 226 } else { … … 226 230 227 231 #region Events 232 protected override void OnNameChanged() { 233 base.OnNameChanged(); 234 Runs.AlgorithmName = Name; 235 } 236 228 237 public event EventHandler ExecutionStateChanged; 229 238 private void OnExecutionStateChanged() { -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs
r7798 r8738 44 44 : base(original, cloner) { 45 45 updateOfRunsInProgress = false; 46 algorithmName = original.algorithmName; 47 46 48 resultNames = new List<string>(original.resultNames); 47 49 parameterNames = new List<string>(original.parameterNames); … … 104 106 } 105 107 108 private string algorithmName = string.Empty; 109 [Storable] 110 public string AlgorithmName { 111 get { return algorithmName; } 112 set { 113 if (value != algorithmName && !string.IsNullOrEmpty(value)) { 114 algorithmName = value; 115 OnAlgorithmNameChanged(); 116 } 117 } 118 } 119 106 120 [StorableHook(HookType.AfterDeserialization)] 107 121 private void AfterDeserialization() { … … 120 134 protected virtual void OnUpdateOfRunsInProgressChanged() { 121 135 var handler = UpdateOfRunsInProgressChanged; 136 if (handler != null) handler(this, EventArgs.Empty); 137 } 138 139 public event EventHandler AlgorithmNameChanged; 140 protected virtual void OnAlgorithmNameChanged() { 141 var handler = AlgorithmNameChanged; 122 142 if (handler != null) handler(this, EventArgs.Empty); 123 143 }
Note: See TracChangeset
for help on using the changeset viewer.