- Timestamp:
- 05/28/15 14:22:03 (9 years ago)
- Location:
- branches/TerminationCriteria
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs
r12407 r12408 504 504 } 505 505 private void ParameterizeTerminators() { 506 qualityTerminator.ComparisonValueParameter.ActualName = qualityAnalyzer.CurrentBestQualityParameter.Name; 506 507 if (Problem != null) { 507 508 var maximizationParameter = (IValueParameter<BoolValue>)Problem.MaximizationParameter; … … 509 510 bool maximization = maximizationParameter.Value.Value; 510 511 qualityTerminator.Comparison = maximization ? ComparisonType.Less : ComparisonType.Greater; 511 qualityTerminator.Threshold.Value = maximization ? double.M inValue : double.MaxValue;512 qualityTerminator.Threshold.Value = maximization ? double.MaxValue : double.MinValue; 512 513 } 513 514 } 514 qualityTerminator.ComparisonValueParameter.ActualName = qualityAnalyzer.CurrentBestQualityParameter.Name;515 515 } 516 516 private void ParameterizeComparisonFactorModifiers() { -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/ComparisonTerminator.cs
r12407 r12408 30 30 [Item("ComparisonTerminator", "An termination criterion which compares two values.")] 31 31 [StorableClass] 32 public class ComparisonTerminator<T> : ThresholdTerminator<T> where T : class, IItem, IComparable, new() {32 public class ComparisonTerminator<T> : ThresholdTerminator<T> where T : class, IItem, IComparable, IStringConvertibleValue, new() { 33 33 public ILookupParameter<T> ComparisonValueParameter { 34 34 get { return (ILookupParameter<T>)Parameters["ComparisonValue"]; } … … 57 57 return new ComparisonTerminator<T>(this, cloner); 58 58 } 59 60 public ComparisonTerminator() 61 : this(new T()) { } 59 62 public ComparisonTerminator(T threshold) 60 63 : base(threshold) { … … 70 73 71 74 private void Initialize() { 72 ComparisonParameter.ToStringChanged += (s, a) => OnToStringChanged(); 75 ComparisonParameter.Value.ValueChanged += new EventHandler(Comparison_ValueChanged); 76 } 77 78 private void Comparison_ValueChanged(object sender, EventArgs e) { 79 OnComparisonChanged(); 80 } 81 protected virtual void OnComparisonChanged() { 82 OnToStringChanged(); 73 83 } 74 84 -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/ThresholdTerminator.cs
r12405 r12408 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 24 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 29 31 [Item("ThresholdTerminator", "Base class for all termination criteria which specifies some threshold.")] 30 32 [StorableClass] 31 public abstract class ThresholdTerminator<T> : Terminator where T : class, IItem, new() {33 public abstract class ThresholdTerminator<T> : Terminator where T : class, IItem, IStringConvertibleValue, new() { 32 34 public IFixedValueParameter<T> ThresholdParameter { 33 35 get { return (IFixedValueParameter<T>)Parameters["Threshold"]; } … … 48 50 Initialize(); 49 51 } 50 protected ThresholdTerminator(T threshold = default(T)) 52 protected ThresholdTerminator() 53 : this(new T()) { } 54 protected ThresholdTerminator(T threshold) 51 55 : base() { 56 if (threshold == null) throw new ArgumentNullException("threshold"); 52 57 Parameters.Add(new FixedValueParameter<T>("Threshold", "The limit of the termiation criterion.", threshold)); 53 58 Initialize(); … … 55 60 56 61 private void Initialize() { 57 ThresholdParameter.ToStringChanged += (s, a) => OnToStringChanged(); 62 Threshold.ValueChanged += new EventHandler(Threshold_ValueChanged); 63 } 64 65 private void Threshold_ValueChanged(object sender, EventArgs e) { 66 OnThresholdChanged(); 67 } 68 protected virtual void OnThresholdChanged() { 69 OnToStringChanged(); 58 70 } 59 71 -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/Views/ThresholdTerminatorView.Designer.cs
r12405 r12408 22 22 using System; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 25 26 namespace HeuristicLab.Termination.Views { 26 partial class ThresholdTerminatorView<T> where T : class, IItem, IComparable, new() {27 partial class ThresholdTerminatorView<T> where T : class, IItem, IComparable, IStringConvertibleValue, new() { 27 28 /// <summary> 28 29 /// Required designer variable. -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/Views/ThresholdTerminatorView.cs
r12405 r12408 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Core.Views; 25 using HeuristicLab.Data; 25 26 using HeuristicLab.MainForm; 26 27 … … 29 30 [View("ThresholdTerminator View")] 30 31 [Content(typeof(ThresholdTerminator<>), true)] 31 public partial class ThresholdTerminatorView<T> : ItemView where T : class, IItem, IComparable, new() {32 public partial class ThresholdTerminatorView<T> : ItemView where T : class, IItem, IComparable, IStringConvertibleValue, new() { 32 33 33 34 public new ThresholdTerminator<T> Content {
Note: See TracChangeset
for help on using the changeset viewer.