Changeset 17149
- Timestamp:
- 07/22/19 14:15:55 (5 years ago)
- Location:
- stable
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk merged: 16872-16873,16875,16890
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.ALPS
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Algorithms.ALPS merged: 16875
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.ALPS/3.3/AlpsOffspringSelectionGeneticAlgorithmMainOperator.cs
r17097 r17149 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 26 27 using HeuristicLab.Optimization.Operators; 27 28 using HeuristicLab.Parameters; 28 using HEAL.Attic;29 29 using HeuristicLab.Selection; 30 30 … … 266 266 267 267 variableCreator1.Name = "MutatedOffspring = true"; 268 variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true) , false));268 variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true)) { GetsCollected = false }); 269 269 variableCreator1.Successor = null; 270 270 271 271 variableCreator2.Name = "MutatedOffspring = false"; 272 variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false) , false));272 variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false)) { GetsCollected = false }); 273 273 variableCreator2.Successor = null; 274 274 -
stable/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.cs
r17097 r17149 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 26 27 using HeuristicLab.Optimization.Operators; 27 28 using HeuristicLab.Parameters; 28 using HEAL.Attic;29 29 using HeuristicLab.Selection; 30 30 … … 218 218 219 219 variableCreator1.Name = "MutatedOffspring = true"; 220 variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true) , false));220 variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true)) { GetsCollected = false }); 221 221 222 222 variableCreator2.Name = "MutatedOffspring = false"; 223 variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false) , false));223 variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false)) { GetsCollected = false }); 224 224 225 225 conditionalSelector.ConditionParameter.ActualName = "MutatedOffspring"; -
stable/HeuristicLab.Analysis
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Analysis merged: 16875
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Analysis/3.3/DataVisualization/DataTableValuesCollector.cs
r17097 r17149 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; … … 27 28 using HeuristicLab.Operators; 28 29 using HeuristicLab.Parameters; 29 using HEAL.Attic;30 30 31 31 namespace HeuristicLab.Analysis { … … 59 59 : base() { 60 60 Parameters.Add(new ValueLookupParameter<DataTable>("DataTable", "The table of data values where the collected values should be stored.")); 61 Parameters.Add(new FixedValueParameter<BoolValue>("StartIndexZero", "True, if the collected data values should start with index 0, otherwise false.", new BoolValue(true) , false));61 Parameters.Add(new FixedValueParameter<BoolValue>("StartIndexZero", "True, if the collected data values should start with index 0, otherwise false.", new BoolValue(true)) { GetsCollected = false }); 62 62 StartIndexZeroParameter.Hidden = true; 63 63 } … … 68 68 #region Backwards compatible code (remove with 3.4) 69 69 if (!Parameters.ContainsKey("StartIndexZero")) { 70 Parameters.Add(new FixedValueParameter<BoolValue>("StartIndexZero", "True, if the collected data values should start with index 0, otherwise false.", new BoolValue(true) , false));70 Parameters.Add(new FixedValueParameter<BoolValue>("StartIndexZero", "True, if the collected data values should start with index 0, otherwise false.", new BoolValue(true)) { GetsCollected = false }); 71 71 StartIndexZeroParameter.Hidden = true; 72 72 } -
stable/HeuristicLab.Core
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Core merged: 16872
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Core/3.3/Interfaces/IValueParameter.cs
r17097 r17149 27 27 public interface IValueParameter : IParameter { 28 28 IItem Value { get; set; } 29 bool ReadOnly { get; set; } 29 30 bool GetsCollected { get; set; } 30 31 event EventHandler ValueChanged; 32 event EventHandler ReadOnlyChanged; 31 33 event EventHandler GetsCollectedChanged; 32 34 } -
stable/HeuristicLab.Optimization
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Optimization merged: 16875
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Optimization/3.3/Problems/Problem.cs
r17105 r17149 23 23 using System.Collections.Generic; 24 24 using System.Drawing; 25 using HEAL.Attic; 25 26 using HeuristicLab.Collections; 26 27 using HeuristicLab.Common; … … 28 29 using HeuristicLab.Data; 29 30 using HeuristicLab.Parameters; 30 using HEAL.Attic;31 31 32 32 namespace HeuristicLab.Optimization { … … 52 52 protected Problem() 53 53 : base() { 54 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>() , false));54 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>()) { GetsCollected = false }); 55 55 OperatorsParameter.Hidden = true; 56 56 RegisterEventHandlers(); … … 66 66 if (operators != null) { 67 67 Parameters.Remove(OperatorsParameterName); 68 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(operators) , false));68 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(operators)) { GetsCollected = false }); 69 69 OperatorsParameter.Hidden = true; 70 70 } … … 95 95 //necessary to convert old experiments files where no parameter was used for saving the operators 96 96 if (!Parameters.ContainsKey(OperatorsParameterName)) { 97 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>() , false));97 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>()) { GetsCollected = false }); 98 98 OperatorsParameter.Hidden = true; 99 99 } … … 107 107 #region Backwards compatible code, remove with 3.4 108 108 if (!Parameters.ContainsKey(OperatorsParameterName)) { 109 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>() , false));109 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>()) { GetsCollected = false }); 110 110 OperatorsParameter.Hidden = true; 111 111 } -
stable/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs
r17097 r17149 25 25 using System.Linq; 26 26 using System.Threading; 27 using HEAL.Attic; 27 28 using HeuristicLab.Collections; 28 29 using HeuristicLab.Common; … … 30 31 using HeuristicLab.Data; 31 32 using HeuristicLab.Parameters; 32 using HEAL.Attic;33 33 using HeuristicLab.PluginInfrastructure; 34 34 … … 130 130 ItemList<IOperator> tmp = ((ValueParameter<ItemList<IOperator>>)Parameters["Operators"]).Value; 131 131 Parameters.Remove("Operators"); 132 Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp) , false));132 Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp)) { GetsCollected = false }); 133 133 } 134 134 #endregion -
stable/HeuristicLab.Parameters.Views/3.3/ConstrainedValueParameterView.cs
r17097 r17149 62 62 protected override void DeregisterContentEvents() { 63 63 Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged); 64 Content.ReadOnlyChanged -= new EventHandler(Content_ReadOnlyChanged); 64 65 Content.ValidValues.ItemsAdded -= new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsAdded); 65 66 Content.ValidValues.ItemsRemoved -= new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved); … … 76 77 base.RegisterContentEvents(); 77 78 Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged); 79 Content.ReadOnlyChanged += new EventHandler(Content_ReadOnlyChanged); 78 80 Content.ValidValues.ItemsAdded += new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsAdded); 79 81 Content.ValidValues.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved); … … 100 102 base.SetEnabledStateOfControls(); 101 103 valueGroupBox.Enabled = Content != null; 102 valueComboBox.Enabled = (valueComboBox.Items.Count > 0)&& !ReadOnly;104 valueComboBox.Enabled = Content != null && valueComboBox.Items.Count > 0 && !Content.ReadOnly && !ReadOnly; 103 105 showInRunCheckBox.Enabled = Content != null && !ReadOnly; 104 106 } … … 153 155 FillValueComboBox(); 154 156 } 157 protected virtual void Content_ReadOnlyChanged(object sender, EventArgs e) { 158 if (InvokeRequired) 159 Invoke(new EventHandler(Content_ReadOnlyChanged), sender, e); 160 else { 161 SetEnabledStateOfControls(); 162 } 163 } 155 164 protected virtual void Content_GetsCollectedChanged(object sender, EventArgs e) { 156 165 if (InvokeRequired) -
stable/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.cs
r17097 r17149 74 74 Content.ActualNameChanged -= new EventHandler(Content_ActualNameChanged); 75 75 Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged); 76 Content.ReadOnlyChanged -= new EventHandler(Content_ReadOnlyChanged); 76 77 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 77 78 base.DeregisterContentEvents(); … … 86 87 Content.ActualNameChanged += new EventHandler(Content_ActualNameChanged); 87 88 Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged); 89 Content.ReadOnlyChanged += new EventHandler(Content_ReadOnlyChanged); 88 90 Content.ValueChanged += new EventHandler(Content_ValueChanged); 89 91 } … … 108 110 actualNameTextBox.Enabled = Content != null; 109 111 actualNameTextBox.ReadOnly = ReadOnly; 110 setValueButton.Enabled = Content != null && ! ReadOnly;111 clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;112 setValueButton.Enabled = Content != null && !Content.ReadOnly && !ReadOnly; 113 clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !ReadOnly; 112 114 showInRunCheckBox.Enabled = Content != null && !ReadOnly; 113 115 } … … 124 126 else { 125 127 SetDataTypeTextBoxText(); 126 clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;128 clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !ReadOnly; 127 129 valueViewHost.ViewType = null; 128 130 valueViewHost.Content = Content != null ? Content.Value : null; 131 } 132 } 133 protected virtual void Content_ReadOnlyChanged(object sender, EventArgs e) { 134 if (InvokeRequired) 135 Invoke(new EventHandler(Content_ReadOnlyChanged), sender, e); 136 else { 137 SetEnabledStateOfControls(); 129 138 } 130 139 } -
stable/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs
r17097 r17149 74 74 protected override void DeregisterContentEvents() { 75 75 Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged); 76 Content.ReadOnlyChanged -= new EventHandler(Content_ReadOnlyChanged); 76 77 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 77 78 base.DeregisterContentEvents(); … … 85 86 base.RegisterContentEvents(); 86 87 Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged); 88 Content.ReadOnlyChanged += new EventHandler(Content_ReadOnlyChanged); 87 89 Content.ValueChanged += new EventHandler(Content_ValueChanged); 88 90 } … … 103 105 protected override void SetEnabledStateOfControls() { 104 106 base.SetEnabledStateOfControls(); 105 setValueButton.Enabled = Content != null && ! (Content is IFixedValueParameter) && !ReadOnly;106 clearValueButton.Enabled = Content != null && Content.Value != null && !(Content is IFixedValueParameter) && !(Content is ValueParameter<T>) && !ReadOnly;107 setValueButton.Enabled = Content != null && !Content.ReadOnly && !(Content is IFixedValueParameter) && !ReadOnly; 108 clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !(Content is IFixedValueParameter) && !(Content is ValueParameter<T>) && !ReadOnly; 107 109 showInRunCheckBox.Enabled = Content != null && !ReadOnly; 108 110 } … … 113 115 else { 114 116 SetDataTypeTextBoxText(); 115 setValueButton.Enabled = Content != null && ! (Content is IFixedValueParameter) && !ReadOnly;116 clearValueButton.Enabled = Content != null && Content.Value != null && !(Content is IFixedValueParameter<T>) && !(Content is ValueParameter<T>) && !ReadOnly;117 setValueButton.Enabled = Content != null && !Content.ReadOnly && !(Content is IFixedValueParameter) && !ReadOnly; 118 clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !(Content is IFixedValueParameter<T>) && !(Content is ValueParameter<T>) && !ReadOnly; 117 119 valueViewHost.ViewType = null; 118 120 valueViewHost.Content = Content != null ? Content.Value : null; 121 } 122 } 123 124 protected virtual void Content_ReadOnlyChanged(object sender, EventArgs e) { 125 if (InvokeRequired) 126 Invoke(new EventHandler(Content_ReadOnlyChanged), sender, e); 127 else { 128 SetEnabledStateOfControls(); 119 129 } 120 130 } … … 135 145 try { 136 146 Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 137 } 138 catch (Exception ex) { 147 } catch (Exception ex) { 139 148 ErrorHandling.ShowErrorDialog(this, ex); 140 149 } -
stable/HeuristicLab.Parameters/3.3/ConstrainedValueParameter.cs
r17097 r17149 22 22 using System; 23 23 using System.Linq; 24 using HEAL.Attic; 24 25 using HeuristicLab.Collections; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Parameters { … … 47 47 public ConstrainedValueParameter() : base() { } 48 48 public ConstrainedValueParameter(string name) : base(name) { } 49 public ConstrainedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }50 49 public ConstrainedValueParameter(string name, ItemSet<T> validValues) : base(name, validValues) { } 51 public ConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) : base(name, validValues, getsCollected) { }52 50 public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value) : base(name, validValues, value) { } 53 public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) : base(name, validValues, value, getsCollected) { }54 51 public ConstrainedValueParameter(string name, string description) : base(name, description) { } 55 public ConstrainedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }56 52 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues) : base(name, description, validValues) { } 57 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) : base(name, description, validValues, getsCollected) { }58 53 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value) : base(name, description, validValues, value) { } 59 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) : base(name, description, validValues, value, getsCollected) { }60 54 61 55 public override IDeepCloneable Clone(Cloner cloner) { -
stable/HeuristicLab.Parameters/3.3/FixedValueParameter.cs
r17097 r17149 21 21 22 22 using System; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HEAL.Attic;26 26 27 27 namespace HeuristicLab.Parameters { … … 31 31 [Item("FixedValueParameter", "A parameter whose value is defined in the parameter itself and cannot be set.")] 32 32 [StorableType("7787B99D-5F32-4639-B47A-76CB4D204392")] 33 public class FixedValueParameter<T> : ValueParameter<T>, IFixedValueParameter<T> where T : class, IItem, new() {33 public class FixedValueParameter<T> : ValueParameter<T>, IFixedValueParameter<T> where T : class, IItem, new() { 34 34 35 35 public override T Value { … … 46 46 public FixedValueParameter() : base() { } 47 47 public FixedValueParameter(string name) : base(name) { } 48 public FixedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }49 48 public FixedValueParameter(string name, T value) : base(name, value) { } 50 public FixedValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }51 49 public FixedValueParameter(string name, string description) : base(name, description) { } 52 public FixedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }53 50 public FixedValueParameter(string name, string description, T value) : base(name, description, value) { } 54 public FixedValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { }55 51 56 52 public override IDeepCloneable Clone(Cloner cloner) { -
stable/HeuristicLab.Parameters/3.3/OperatorParameter.cs
r17097 r17149 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using HEAL.Attic;25 25 26 26 namespace HeuristicLab.Parameters { … … 36 36 public OperatorParameter() : base("Anonymous") { } 37 37 public OperatorParameter(string name) : base(name) { } 38 public OperatorParameter(string name, bool getsCollected) : base(name, getsCollected) { }39 38 public OperatorParameter(string name, IOperator value) : base(name, value) { } 40 public OperatorParameter(string name, IOperator value, bool getsCollected) : base(name, value, getsCollected) { }41 39 public OperatorParameter(string name, string description) : base(name, description) { } 42 public OperatorParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }43 40 public OperatorParameter(string name, string description, IOperator value) : base(name, description, value) { } 44 public OperatorParameter(string name, string description, IOperator value, bool getsCollected) : base(name, description, value, getsCollected) { }45 41 46 42 public override IDeepCloneable Clone(Cloner cloner) { -
stable/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs
r17097 r17149 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Collections; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Parameters { … … 40 40 } 41 41 } 42 42 43 43 [Storable] 44 44 private ItemSet<T> validValues; … … 52 52 get { return this.value; } 53 53 set { 54 if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter."); 54 55 if (value != this.value) { 55 56 if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value."); … … 74 75 } 75 76 77 [Storable(DefaultValue = false)] 78 private bool readOnly; 79 public bool ReadOnly { 80 get { return readOnly; } 81 set { 82 if (value == readOnly) return; 83 readOnly = value; 84 OnReadOnlyChanged(); 85 } 86 } 87 76 88 [Storable(DefaultValue = true)] 77 89 private bool getsCollected; … … 93 105 validValues = cloner.Clone(original.validValues); 94 106 value = cloner.Clone(original.value); 107 readOnly = original.readOnly; 95 108 getsCollected = original.getsCollected; 96 109 Initialize(); … … 99 112 : base("Anonymous", typeof(T)) { 100 113 this.validValues = new ItemSet<T>(); 114 this.readOnly = false; 101 115 this.getsCollected = true; 102 116 Initialize(); … … 105 119 : base(name, typeof(T)) { 106 120 this.validValues = new ItemSet<T>(); 107 this.getsCollected = true; 108 Initialize(); 109 } 110 public OptionalConstrainedValueParameter(string name, bool getsCollected) 111 : base(name, typeof(T)) { 112 this.validValues = new ItemSet<T>(); 113 this.getsCollected = getsCollected; 121 this.readOnly = false; 122 this.getsCollected = true; 114 123 Initialize(); 115 124 } … … 117 126 : base(name, typeof(T)) { 118 127 this.validValues = validValues; 119 this.getsCollected = true; 120 Initialize(); 121 } 122 public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) 123 : base(name, typeof(T)) { 124 this.validValues = validValues; 125 this.getsCollected = getsCollected; 128 this.readOnly = false; 129 this.getsCollected = true; 126 130 Initialize(); 127 131 } … … 130 134 this.validValues = validValues; 131 135 this.value = value; 132 this.getsCollected = true; 133 Initialize(); 134 } 135 public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) 136 : base(name, typeof(T)) { 137 this.validValues = validValues; 138 this.value = value; 139 this.getsCollected = getsCollected; 136 this.readOnly = false; 137 this.getsCollected = true; 140 138 Initialize(); 141 139 } … … 143 141 : base(name, description, typeof(T)) { 144 142 this.validValues = new ItemSet<T>(); 145 this.getsCollected = true; 146 Initialize(); 147 } 148 public OptionalConstrainedValueParameter(string name, string description, bool getsCollected) 149 : base(name, description, typeof(T)) { 150 this.validValues = new ItemSet<T>(); 151 this.getsCollected = getsCollected; 143 this.readOnly = false; 144 this.getsCollected = true; 152 145 Initialize(); 153 146 } … … 155 148 : base(name, description, typeof(T)) { 156 149 this.validValues = validValues; 157 this.getsCollected = true; 158 Initialize(); 159 } 160 public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) 161 : base(name, description, typeof(T)) { 162 this.validValues = validValues; 163 this.getsCollected = getsCollected; 150 this.readOnly = false; 151 this.getsCollected = true; 164 152 Initialize(); 165 153 } … … 168 156 this.validValues = validValues; 169 157 this.value = value; 170 this.getsCollected = true; 171 Initialize(); 172 } 173 public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) 174 : base(name, description, typeof(T)) { 175 this.validValues = validValues; 176 this.value = value; 177 this.getsCollected = getsCollected; 158 this.readOnly = false; 159 this.getsCollected = true; 178 160 Initialize(); 179 161 } … … 212 194 OnToStringChanged(); 213 195 } 196 public event EventHandler ReadOnlyChanged; 197 protected virtual void OnReadOnlyChanged() { 198 EventHandler handler = ReadOnlyChanged; 199 if (handler != null) handler(this, EventArgs.Empty); 200 } 214 201 public event EventHandler GetsCollectedChanged; 215 202 protected virtual void OnGetsCollectedChanged() { -
stable/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs
r17097 r17149 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Parameters { … … 45 45 get { return this.value; } 46 46 set { 47 if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter."); 47 48 if (value != this.value) { 48 49 DeregisterValueEvents(); … … 63 64 ); 64 65 Value = val; 66 } 67 } 68 69 [Storable(DefaultValue = false)] 70 private bool readOnly; 71 public bool ReadOnly { 72 get { return readOnly; } 73 set { 74 if (value == readOnly) return; 75 readOnly = value; 76 OnReadOnlyChanged(); 65 77 } 66 78 } … … 108 120 : base(original, cloner) { 109 121 value = cloner.Clone(original.value); 122 readOnly = original.readOnly; 110 123 getsCollected = original.getsCollected; 111 124 reactOnValueToStringChangedAndValueItemImageChanged = original.reactOnValueToStringChangedAndValueItemImageChanged; … … 114 127 public OptionalValueParameter() 115 128 : base("Anonymous", typeof(T)) { 129 this.readOnly = false; 116 130 this.getsCollected = true; 117 131 this.reactOnValueToStringChangedAndValueItemImageChanged = true; … … 119 133 public OptionalValueParameter(string name) 120 134 : base(name, typeof(T)) { 121 this.getsCollected = true; 122 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 123 } 124 public OptionalValueParameter(string name, bool getsCollected) 125 : base(name, typeof(T)) { 126 this.getsCollected = getsCollected; 135 this.readOnly = false; 136 this.getsCollected = true; 127 137 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 128 138 } … … 130 140 : base(name, typeof(T)) { 131 141 this.value = value; 132 this.getsCollected = true; 133 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 134 RegisterValueEvents(); 135 } 136 public OptionalValueParameter(string name, T value, bool getsCollected) 137 : base(name, typeof(T)) { 138 this.value = value; 139 this.getsCollected = getsCollected; 142 this.readOnly = false; 143 this.getsCollected = true; 140 144 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 141 145 RegisterValueEvents(); … … 143 147 public OptionalValueParameter(string name, string description) 144 148 : base(name, description, typeof(T)) { 145 this.getsCollected = true; 146 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 147 } 148 public OptionalValueParameter(string name, string description, bool getsCollected) 149 : base(name, description, typeof(T)) { 150 this.getsCollected = getsCollected; 151 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 152 } 149 this.readOnly = false; 150 this.getsCollected = true; 151 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 152 } 153 153 154 public OptionalValueParameter(string name, string description, T value) 154 155 : base(name, description, typeof(T)) { 155 156 this.value = value; 156 this.getsCollected = true; 157 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 158 RegisterValueEvents(); 159 } 160 public OptionalValueParameter(string name, string description, T value, bool getsCollected) 161 : base(name, description, typeof(T)) { 162 this.value = value; 163 this.getsCollected = getsCollected; 157 this.readOnly = false; 158 this.getsCollected = true; 164 159 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 165 160 RegisterValueEvents(); … … 197 192 OnToStringChanged(); 198 193 } 194 195 public event EventHandler ReadOnlyChanged; 196 protected virtual void OnReadOnlyChanged() { 197 EventHandler handler = ReadOnlyChanged; 198 if (handler != null) handler(this, EventArgs.Empty); 199 } 199 200 public event EventHandler GetsCollectedChanged; 200 201 protected virtual void OnGetsCollectedChanged() { -
stable/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs
r17097 r17149 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Parameters { … … 45 45 get { return this.value; } 46 46 set { 47 if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter."); 47 48 if (value != this.value) { 48 49 DeregisterValueEvents(); … … 66 67 } 67 68 69 [Storable(DefaultValue = false)] 70 private bool readOnly; 71 public bool ReadOnly { 72 get { return readOnly; } 73 set { 74 if (value == readOnly) return; 75 readOnly = value; 76 OnReadOnlyChanged(); 77 } 78 } 79 68 80 [Storable(DefaultValue = true)] 69 81 private bool getsCollected; … … 84 96 : base(original, cloner) { 85 97 value = cloner.Clone(original.value); 98 readOnly = original.readOnly; 86 99 getsCollected = original.getsCollected; 87 100 RegisterValueEvents(); … … 89 102 public ValueLookupParameter() 90 103 : base() { 104 this.readOnly = false; 91 105 this.Hidden = false; 92 106 this.getsCollected = true; … … 94 108 public ValueLookupParameter(string name) 95 109 : base(name) { 110 this.readOnly = false; 96 111 this.Hidden = false; 97 112 this.getsCollected = true; 98 }99 public ValueLookupParameter(string name, bool getsCollected)100 : base(name) {101 this.Hidden = false;102 this.getsCollected = getsCollected;103 113 } 104 114 public ValueLookupParameter(string name, T value) 105 115 : base(name) { 106 116 this.value = value; 117 this.readOnly = false; 107 118 this.Hidden = false; 108 119 this.getsCollected = true; 109 120 RegisterValueEvents(); 110 121 } 111 public ValueLookupParameter(string name, T value, bool getsCollected)112 : base(name) {113 this.value = value;114 this.Hidden = false;115 this.getsCollected = getsCollected;116 RegisterValueEvents();117 }118 122 public ValueLookupParameter(string name, string description) 119 123 : base(name, description) { 124 this.readOnly = false; 120 125 this.Hidden = false; 121 126 this.getsCollected = true; 122 }123 public ValueLookupParameter(string name, string description, bool getsCollected)124 : base(name, description) {125 this.Hidden = false;126 this.getsCollected = getsCollected;127 127 } 128 128 public ValueLookupParameter(string name, string description, T value) 129 129 : base(name, description) { 130 130 this.value = value; 131 this.readOnly = false; 131 132 this.Hidden = false; 132 133 this.getsCollected = true; 133 134 RegisterValueEvents(); 134 135 } 135 public ValueLookupParameter(string name, string description, T value, bool getsCollected)136 : base(name, description) {137 this.value = value;138 this.Hidden = false;139 this.getsCollected = getsCollected;140 RegisterValueEvents();141 }142 136 public ValueLookupParameter(string name, string description, string actualName) 143 137 : base(name, description, actualName) { 138 this.readOnly = false; 144 139 this.Hidden = false; 145 140 this.getsCollected = true; 146 }147 public ValueLookupParameter(string name, string description, string actualName, bool getsCollected)148 : base(name, description, actualName) {149 this.Hidden = false;150 this.getsCollected = getsCollected;151 141 } 152 142 #endregion … … 177 167 OnToStringChanged(); 178 168 } 169 public event EventHandler ReadOnlyChanged; 170 protected virtual void OnReadOnlyChanged() { 171 EventHandler handler = ReadOnlyChanged; 172 if (handler != null) handler(this, EventArgs.Empty); 173 } 179 174 public event EventHandler GetsCollectedChanged; 180 175 protected virtual void OnGetsCollectedChanged() { -
stable/HeuristicLab.Parameters/3.3/ValueParameter.cs
r17097 r17149 22 22 using System; 23 23 using System.Reflection; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Parameters { … … 47 47 public ValueParameter() : base() { } 48 48 public ValueParameter(string name) : base(name) { base.Value = CreateDefaultValue(); } 49 public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { base.Value = CreateDefaultValue(); }50 49 public ValueParameter(string name, T value) : base(name, value) { } 51 public ValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }52 50 public ValueParameter(string name, string description) : base(name, description) { base.Value = CreateDefaultValue(); } 53 public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { base.Value = CreateDefaultValue(); }54 51 public ValueParameter(string name, string description, T value) : base(name, description, value) { } 55 public ValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { } 56 52 57 53 protected T CreateDefaultValue() { 58 54 Type type = typeof(T); -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression merged: 16875
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 merged: 16875
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r17097 r17149 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; … … 29 30 using HeuristicLab.Optimization; 30 31 using HeuristicLab.Parameters; 31 using HEAL.Attic;32 32 33 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { … … 114 114 public SymbolicRegressionConstantOptimizationEvaluator() 115 115 : base() { 116 Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "Determines how many iterations should be calculated while optimizing the constant of a symbolic expression tree (0 indicates other or default stopping criterion).", new IntValue(10) , true));117 Parameters.Add(new FixedValueParameter<DoubleValue>(ConstantOptimizationImprovementParameterName, "Determines the relative improvement which must be achieved in the constant optimization to continue with it (0 indicates other or default stopping criterion).", new DoubleValue(0) , true) { Hidden = true });118 Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationProbabilityParameterName, "Determines the probability that the constants are optimized", new PercentValue(1) , true));119 Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationRowsPercentageParameterName, "Determines the percentage of the rows which should be used for constant optimization", new PercentValue(1) , true));116 Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "Determines how many iterations should be calculated while optimizing the constant of a symbolic expression tree (0 indicates other or default stopping criterion).", new IntValue(10))); 117 Parameters.Add(new FixedValueParameter<DoubleValue>(ConstantOptimizationImprovementParameterName, "Determines the relative improvement which must be achieved in the constant optimization to continue with it (0 indicates other or default stopping criterion).", new DoubleValue(0)) { Hidden = true }); 118 Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationProbabilityParameterName, "Determines the probability that the constants are optimized", new PercentValue(1))); 119 Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationRowsPercentageParameterName, "Determines the percentage of the rows which should be used for constant optimization", new PercentValue(1))); 120 120 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateConstantsInTreeParameterName, "Determines if the constants in the tree should be overwritten by the optimized constants.", new BoolValue(true)) { Hidden = true }); 121 121 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized.", new BoolValue(true)) { Hidden = true }); -
stable/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Problem.cs
r17097 r17149 23 23 using System.Diagnostics.Contracts; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; … … 29 30 using HeuristicLab.Optimization; 30 31 using HeuristicLab.Parameters; 31 using HEAL.Attic;32 32 33 33 … … 128 128 g.AddTerminalSymbols(new string[] { "Move", "Left", "Right" }); 129 129 base.Encoding = new SymbolicExpressionTreeEncoding(g, 20, 10); 130 base.Encoding.GrammarParameter.ReadOnly = true; 130 131 } 131 132 -
stable/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs
r17097 r17149 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 29 using HeuristicLab.Parameters; 29 using HEAL.Attic;30 30 using HeuristicLab.Problems.DataAnalysis; 31 31 using HeuristicLab.Problems.Instances; … … 87 87 var g = new SimpleSymbolicExpressionGrammar(); // empty grammar is replaced in UpdateGrammar() 88 88 base.Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17); 89 Encoding.GrammarParameter.ReadOnly = true; 89 90 90 91 UpdateGrammar(); … … 177 178 } 178 179 180 Encoding.GrammarParameter.ReadOnly = false; 179 181 Encoding.Grammar = g; 182 Encoding.GrammarParameter.ReadOnly = true; 180 183 } 181 184 #endregion -
stable/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs
r17097 r17149 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; … … 28 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 30 using HeuristicLab.Parameters; 30 using HEAL.Attic;31 31 32 32 -
stable/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs
r17097 r17149 24 24 using System.Diagnostics.Contracts; 25 25 using System.Linq; 26 using HEAL.Attic; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; … … 29 30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 30 31 using HeuristicLab.Parameters; 31 using HEAL.Attic;32 32 33 33 … … 88 88 var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar 89 89 Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17); 90 Encoding.GrammarParameter.ReadOnly = true; 90 91 91 92 UpdateGrammar(); … … 110 111 g.AddTerminalSymbol(string.Format("d{0}", i)); 111 112 113 Encoding.GrammarParameter.ReadOnly = false; 112 114 Encoding.Grammar = g; 115 Encoding.GrammarParameter.ReadOnly = true; 113 116 114 117 BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits) -
stable/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs
r17097 r17149 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 26 27 using HeuristicLab.Optimization; 27 28 using HeuristicLab.Parameters; 28 using HEAL.Attic;29 29 30 30 namespace HeuristicLab.Problems.GeneticProgramming.Robocode { … … 86 86 87 87 Encoding = new SymbolicExpressionTreeEncoding(new Grammar(), 1000, 10); 88 Encoding.GrammarParameter.ReadOnly = true; 88 89 Encoding.FunctionArguments = 0; 89 90 Encoding.FunctionDefinitions = 0; … … 134 135 } 135 136 136 void RobocodePathParameter_ValueChanged(object sender, System.EventArgs e) {137 private void RobocodePathParameter_ValueChanged(object sender, System.EventArgs e) { 137 138 EnemiesParameter.Value.RobocodePath = RobocodePathParameter.Value.Value; 138 139 } -
stable/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r17097 r17149 24 24 using System.IO; 25 25 using System.Linq; 26 using HEAL.Attic; 26 27 using HeuristicLab.Analysis; 27 28 using HeuristicLab.Common; … … 32 33 using HeuristicLab.Optimization.Operators; 33 34 using HeuristicLab.Parameters; 34 using HEAL.Attic;35 35 using HeuristicLab.PluginInfrastructure; 36 36 using HeuristicLab.Problems.Instances; … … 210 210 if (oldCoordinates != null) { 211 211 Parameters.Remove(oldCoordinates); 212 Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", oldCoordinates.Value , oldCoordinates.GetsCollected));212 Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", oldCoordinates.Value) { GetsCollected = oldCoordinates.GetsCollected }); 213 213 } 214 214
Note: See TracChangeset
for help on using the changeset viewer.