Ticket #1569: 1569.patch
File 1569.patch, 5.5 KB (added by cneumuel, 13 years ago) |
---|
-
HeuristicLab.Core/3.3/Interfaces/IStatefulItem.cs
23 23 public interface IStatefulItem : IItem { 24 24 void InitializeState(); 25 25 void ClearState(); 26 void SetControl(object obj); 26 27 } 27 28 } -
HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs
33 33 [Item("ProbabilisticTreeCreator", "An operator that creates new symbolic expression trees with uniformly distributed length")] 34 34 public class ProbabilisticTreeCreator : SymbolicExpressionTreeCreator, 35 35 ISymbolicExpressionTreeSizeConstraintOperator, ISymbolicExpressionTreeGrammarBasedOperator { 36 private const int MAX_TRIES = 100 ;36 private const int MAX_TRIES = 1000; 37 37 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 38 38 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; 39 39 private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar"; -
HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionGrammar.cs
20 20 #endregion 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using System.Collections.Generic;28 28 29 29 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { 30 30 [StorableClass] … … 237 237 ClearCaches(); 238 238 } 239 239 #endregion 240 241 242 private object controlObject = null; 243 public void SetControl(object obj) { 244 if (controlObject != obj) 245 throw new InvalidOperationException("Another obj has control!"); 246 controlObject = obj; 247 } 240 248 } 241 249 } -
HeuristicLab.Operators/3.3/Operator.cs
141 141 Executed(this, EventArgs.Empty); 142 142 } 143 143 } 144 145 146 private object controlObject = null; 147 public void SetControl(object obj) { 148 if (controlObject != obj) 149 throw new InvalidOperationException("Another obj has control!"); 150 controlObject = obj; 151 } 144 152 } 145 153 } -
HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
282 282 public event EventHandler Stopped; 283 283 protected virtual void OnStopped() { 284 284 ExecutionState = ExecutionState.Stopped; 285 foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects().OfType<IStatefulItem>()) { 285 var objects = this.GetObjectGraphObjects().OfType<IStatefulItem>(); 286 Console.WriteLine("{0}; Objects before cleanup: {1}", this.Name, this.GetObjectGraphObjects().Count()); 287 foreach (IStatefulItem statefulObject in objects) { 288 statefulObject.SetControl(this); // debug purposes 286 289 statefulObject.ClearState(); 287 290 } 291 Console.WriteLine("{0}; Objects after cleanup: {1}", this.Name, this.GetObjectGraphObjects().Count()); 292 288 293 runsCounter++; 289 294 runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this)); 290 295 EventHandler handler = Stopped; -
HeuristicLab.Parameters/3.3/Parameter.cs
143 143 EventHandler handler = HiddenChanged; 144 144 if (handler != null) handler(this, EventArgs.Empty); 145 145 } 146 147 148 private object controlObject = null; 149 public void SetControl(object obj) { 150 if (controlObject != obj) 151 throw new InvalidOperationException("Another obj has control!"); 152 controlObject = obj; 153 } 146 154 } 147 155 } -
HeuristicLab/3.3/Tests/CollectObjectGraphTest.cs
132 132 ga.Name = "Alg " + locali; 133 133 ga.PopulationSize.Value = 5; 134 134 ga.MaximumGenerations.Value = 5; 135 ga.Seed.Value = 0; 136 ga.SetSeedRandomly.Value = false; 135 137 ga.Engine = new SequentialEngine(); 136 138 ga.Problem = new SingleObjectiveTestFunctionProblem(); 137 139 ga.Prepare(true);