Changeset 12411 for branches/TerminationCriteria/HeuristicLab.Termination
- Timestamp:
- 06/01/15 16:47:32 (9 years ago)
- Location:
- branches/TerminationCriteria/HeuristicLab.Termination/3.3
- Files:
-
- 1 deleted
- 4 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/TerminationCriteria/HeuristicLab.Termination/3.3/ComparisonTerminator.cs
r12408 r12411 71 71 Comparison = comparison; 72 72 } 73 public ComparisonTerminator(string comparisonValueActualName, ComparisonType comparison, IFixedValueParameter<T> thresholdParameter) 74 : this() { 75 ComparisonValueParameter.ActualName = comparisonValueActualName; 76 Comparison = comparison; 77 ThresholdParameter = thresholdParameter; 78 } 73 79 74 80 private void Initialize() { -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/HeuristicLab.Termination-3.3.csproj
r12410 r12411 145 145 </ItemGroup> 146 146 <ItemGroup> 147 <Compile Include="IThresholdTerminator.cs" /> 148 <Compile Include="MaximumIterationsTerminator.cs" /> 147 <Compile Include="ISingleValueTerminator.cs" /> 149 148 <Compile Include="SingleObjectiveQualityTerminator.cs" /> 150 149 <Compile Include="ThresholdTerminator.cs" /> 151 <Compile Include="Views\ ThresholdTerminatorView.cs">150 <Compile Include="Views\SingleValueTerminatorView.cs"> 152 151 <SubType>UserControl</SubType> 153 152 </Compile> 154 <Compile Include="Views\ ThresholdTerminatorView.Designer.cs">155 <DependentUpon> ThresholdTerminatorView.cs</DependentUpon>153 <Compile Include="Views\SingleValueTerminatorView.Designer.cs"> 154 <DependentUpon>SingleValueTerminatorView.cs</DependentUpon> 156 155 </Compile> 157 156 <Compile Include="ITerminator.cs" /> -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/ISingleValueTerminator.cs
r12410 r12411 23 23 24 24 namespace HeuristicLab.Termination { 25 public interface I ThresholdTerminator : ITerminator {25 public interface ISingleValueTerminator : ITerminator { 26 26 IParameter ThresholdParameter { get; } 27 27 } -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/SingleObjectiveQualityTerminator.cs
r12410 r12411 27 27 [Item("SingleObjectiveQualityTerminator", "")] 28 28 public class SingleObjectiveQualityTerminator : ComparisonTerminator<DoubleValue> { 29 public SingleObjectiveQualityTerminator() { 30 Name = "Quality"; 31 } 29 public SingleObjectiveQualityTerminator() { } 32 30 33 31 public void Parameterize(IParameter qualityParameter, ISingleObjectiveHeuristicOptimizationProblem problem) { -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/ThresholdTerminator.cs
r12410 r12411 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 30 29 namespace HeuristicLab.Termination { 31 30 [Item("ThresholdTerminator", "Base class for all termination criteria which specifies some threshold.")] 32 31 [StorableClass] 33 public abstract class ThresholdTerminator<T> : Terminator, IThresholdTerminator where T : class, IItem, IStringConvertibleValue, new() { 32 public abstract class ThresholdTerminator<T> : Terminator, ISingleValueTerminator where T : class, IItem, IStringConvertibleValue, new() { 33 [Storable] 34 private IFixedValueParameter<T> thresholdParameter; 34 35 public IFixedValueParameter<T> ThresholdParameter { 35 get { return (IFixedValueParameter<T>)Parameters["Threshold"]; } 36 get { return thresholdParameter; } 37 set { 38 if (value == null) throw new ArgumentNullException("Threshold parameter must not be null."); 39 if (value.Value == null) throw new ArgumentNullException("Threshold parameter value must not be null."); 40 if (thresholdParameter == value) return; 41 42 if (thresholdParameter != null) Parameters.Remove(thresholdParameter); 43 thresholdParameter = value; 44 Parameters.Add(thresholdParameter); 45 OnThresholdParameterChanged(); 46 } 36 47 } 37 IParameter I ThresholdTerminator.ThresholdParameter {48 IParameter ISingleValueTerminator.ThresholdParameter { 38 49 get { return ThresholdParameter; } 39 50 } … … 51 62 protected ThresholdTerminator(ThresholdTerminator<T> original, Cloner cloner) 52 63 : base(original, cloner) { 64 thresholdParameter = cloner.Clone(original.thresholdParameter); 53 65 Initialize(); 54 66 } … … 58 70 : base() { 59 71 if (threshold == null) throw new ArgumentNullException("threshold"); 60 Parameters.Add(new FixedValueParameter<T>("Threshold", "The limit of the termiation criterion.", threshold)); 72 thresholdParameter = new FixedValueParameter<T>("Threshold", "The limit of the termiation criterion.", threshold); 73 Parameters.Add(thresholdParameter); 61 74 Initialize(); 62 75 } 63 76 64 77 private void Initialize() { 65 Threshold.ValueChanged += new EventHandler(Threshold_ValueChanged);78 RegisterThresholdParameterEvents(); 66 79 } 67 80 … … 73 86 } 74 87 88 private void OnThresholdParameterChanged() { 89 RegisterThresholdParameterEvents(); 90 } 91 92 private void RegisterThresholdParameterEvents() { 93 Threshold.ValueChanged += new EventHandler(Threshold_ValueChanged); 94 } 95 75 96 public override string ToString() { 76 97 if (ThresholdParameter.Value == null) return Name; -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/Views/SingleValueTerminatorView.Designer.cs
r12410 r12411 25 25 26 26 namespace HeuristicLab.Termination.Views { 27 partial class ThresholdTerminatorView {27 partial class SingleValueTerminatorView { 28 28 /// <summary> 29 29 /// Required designer variable. -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/Views/SingleValueTerminatorView.cs
r12410 r12411 26 26 27 27 [View("ThresholdTerminator View")] 28 [Content(typeof(I ThresholdTerminator), true)]29 public partial class ThresholdTerminatorView : ItemView {28 [Content(typeof(ISingleValueTerminator), true)] 29 public partial class SingleValueTerminatorView : ItemView { 30 30 31 public new I ThresholdTerminator Content {32 get { return (I ThresholdTerminator)base.Content; }31 public new ISingleValueTerminator Content { 32 get { return (ISingleValueTerminator)base.Content; } 33 33 set { base.Content = value; } 34 34 } 35 35 36 public ThresholdTerminatorView() {36 public SingleValueTerminatorView() { 37 37 InitializeComponent(); 38 38 }
Note: See TracChangeset
for help on using the changeset viewer.