Changeset 15332
- Timestamp:
- 08/17/17 16:26:58 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Algorithms/FLACharacterizer.cs
r15331 r15332 39 39 } 40 40 41 public ICharacteristicCalculator Calculator { 42 get { return CalculatorParameter.Value; } 43 } 44 41 45 [StorableConstructor] 42 46 private FLACharacterizer(bool deserializing) : base(deserializing) { } 43 private FLACharacterizer(FLACharacterizer original, Cloner cloner) : base(original, cloner) { } 47 private FLACharacterizer(FLACharacterizer original, Cloner cloner) 48 : base(original, cloner) { 49 RegisterEventHandlers(); 50 } 44 51 public FLACharacterizer() : base() { 45 52 Parameters.Add(new ValueParameter<ICharacteristicCalculator>("Calculator", "The FLA characteristic calculator.", new RandomWalkCalculator())); 53 RegisterEventHandlers(); 46 54 } 47 55 … … 49 57 return new FLACharacterizer(this, cloner); 50 58 } 59 60 [StorableHook(HookType.AfterDeserialization)] 61 private void AfterDeserialization() { 62 RegisterEventHandlers(); 63 } 64 65 private void RegisterEventHandlers() { 66 CalculatorParameter.ValueChanged += CalculatorParameterOnValueChanged; 67 } 68 69 private void CalculatorParameterOnValueChanged(object sender, EventArgs e) { 70 Calculator.Problem = Problem; 71 } 72 73 protected override void OnProblemChanged() { 74 base.OnProblemChanged(); 75 Calculator.Problem = Problem; 76 } 51 77 52 78 protected override void Run(CancellationToken cancellationToken) { 53 var calculator = CalculatorParameter.Value; 54 calculator.Problem = Problem; 79 var calculator = Calculator; 55 80 if (calculator.CanCalculate()) { 56 81 foreach (var result in calculator.Calculate()) {
Note: See TracChangeset
for help on using the changeset viewer.