- Timestamp:
- 04/10/19 16:46:46 (5 years ago)
- Location:
- branches/2971_named_intervals
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.Designer.cs
r16772 r16774 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.components = new System.ComponentModel.Container(); 26 27 this.expressionLabel = new System.Windows.Forms.Label(); 27 28 this.definitionLabel = new System.Windows.Forms.Label(); … … 39 40 this.variableInput = new System.Windows.Forms.TextBox(); 40 41 this.numberderivationInput = new System.Windows.Forms.TextBox(); 42 this.upperCombo = new System.Windows.Forms.ComboBox(); 43 this.lowerCombo = new System.Windows.Forms.ComboBox(); 44 this.derivationInput = new System.Windows.Forms.TextBox(); 41 45 this.groupBox1 = new System.Windows.Forms.GroupBox(); 42 this.lowerCombo = new System.Windows.Forms.ComboBox(); 43 this.upperCombo = new System.Windows.Forms.ComboBox(); 44 this.derivationInput = new System.Windows.Forms.TextBox(); 46 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 45 47 this.groupBox1.SuspendLayout(); 48 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 46 49 this.SuspendLayout(); 47 50 // … … 129 132 // definitionInput 130 133 // 134 this.definitionInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 135 | System.Windows.Forms.AnchorStyles.Right))); 131 136 this.definitionInput.Location = new System.Drawing.Point(111, 42); 132 137 this.definitionInput.Name = "definitionInput"; … … 136 141 // expressionInput 137 142 // 143 this.expressionInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 144 | System.Windows.Forms.AnchorStyles.Right))); 138 145 this.expressionInput.Location = new System.Drawing.Point(111, 17); 139 146 this.expressionInput.Name = "expressionInput"; 140 147 this.expressionInput.Size = new System.Drawing.Size(473, 20); 141 148 this.expressionInput.TabIndex = 10; 149 this.expressionInput.TextChanged += new System.EventHandler(this.expressionInput_TextChanged); 142 150 // 143 151 // upperboundInput 144 152 // 153 this.upperboundInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 154 | System.Windows.Forms.AnchorStyles.Right))); 145 155 this.upperboundInput.Location = new System.Drawing.Point(111, 93); 146 156 this.upperboundInput.Name = "upperboundInput"; … … 150 160 // lowerboundInput 151 161 // 162 this.lowerboundInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 163 | System.Windows.Forms.AnchorStyles.Right))); 152 164 this.lowerboundInput.Location = new System.Drawing.Point(111, 68); 153 165 this.lowerboundInput.Name = "lowerboundInput"; 154 166 this.lowerboundInput.Size = new System.Drawing.Size(473, 20); 155 167 this.lowerboundInput.TabIndex = 12; 168 this.lowerboundInput.TextChanged += new System.EventHandler(this.lowerboundInput_TextChanged); 156 169 // 157 170 // variableInput 158 171 // 172 this.variableInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 173 | System.Windows.Forms.AnchorStyles.Right))); 159 174 this.variableInput.Location = new System.Drawing.Point(111, 195); 160 175 this.variableInput.Name = "variableInput"; 161 176 this.variableInput.Size = new System.Drawing.Size(473, 20); 162 177 this.variableInput.TabIndex = 15; 178 this.variableInput.TextChanged += new System.EventHandler(this.variableInput_TextChanged); 163 179 // 164 180 // numberderivationInput 165 181 // 182 this.numberderivationInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 183 | System.Windows.Forms.AnchorStyles.Right))); 166 184 this.numberderivationInput.Location = new System.Drawing.Point(111, 221); 167 185 this.numberderivationInput.Name = "numberderivationInput"; 168 186 this.numberderivationInput.Size = new System.Drawing.Size(473, 20); 169 187 this.numberderivationInput.TabIndex = 17; 188 this.numberderivationInput.TextChanged += new System.EventHandler(this.numberderivationInput_TextChanged); 189 // 190 // upperCombo 191 // 192 this.upperCombo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 193 | System.Windows.Forms.AnchorStyles.Right))); 194 this.upperCombo.FormattingEnabled = true; 195 this.upperCombo.Items.AddRange(new object[] { 196 "True", 197 "False"}); 198 this.upperCombo.Location = new System.Drawing.Point(111, 146); 199 this.upperCombo.Name = "upperCombo"; 200 this.upperCombo.Size = new System.Drawing.Size(473, 21); 201 this.upperCombo.TabIndex = 19; 202 // 203 // lowerCombo 204 // 205 this.lowerCombo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 206 | System.Windows.Forms.AnchorStyles.Right))); 207 this.lowerCombo.FormattingEnabled = true; 208 this.lowerCombo.Items.AddRange(new object[] { 209 "True", 210 "False"}); 211 this.lowerCombo.Location = new System.Drawing.Point(111, 119); 212 this.lowerCombo.Name = "lowerCombo"; 213 this.lowerCombo.Size = new System.Drawing.Size(473, 21); 214 this.lowerCombo.TabIndex = 20; 215 // 216 // derivationInput 217 // 218 this.derivationInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 219 | System.Windows.Forms.AnchorStyles.Right))); 220 this.derivationInput.Location = new System.Drawing.Point(111, 170); 221 this.derivationInput.Name = "derivationInput"; 222 this.derivationInput.Size = new System.Drawing.Size(473, 20); 223 this.derivationInput.TabIndex = 21; 170 224 // 171 225 // groupBox1 … … 197 251 this.groupBox1.Text = "Interval Constraints Detail"; 198 252 // 199 // lowerCombo 200 // 201 this.lowerCombo.FormattingEnabled = true; 202 this.lowerCombo.Items.AddRange(new object[] { 203 "True", 204 "False"}); 205 this.lowerCombo.Location = new System.Drawing.Point(111, 119); 206 this.lowerCombo.Name = "lowerCombo"; 207 this.lowerCombo.Size = new System.Drawing.Size(473, 21); 208 this.lowerCombo.TabIndex = 20; 209 // 210 // upperCombo 211 // 212 this.upperCombo.FormattingEnabled = true; 213 this.upperCombo.Items.AddRange(new object[] { 214 "True", 215 "False"}); 216 this.upperCombo.Location = new System.Drawing.Point(111, 146); 217 this.upperCombo.Name = "upperCombo"; 218 this.upperCombo.Size = new System.Drawing.Size(473, 21); 219 this.upperCombo.TabIndex = 19; 220 // 221 // derivationInput 222 // 223 this.derivationInput.Location = new System.Drawing.Point(111, 170); 224 this.derivationInput.Name = "derivationInput"; 225 this.derivationInput.Size = new System.Drawing.Size(473, 20); 226 this.derivationInput.TabIndex = 21; 253 // errorProvider 254 // 255 this.errorProvider.ContainerControl = this; 227 256 // 228 257 // IntervalConstraintView … … 234 263 this.groupBox1.ResumeLayout(false); 235 264 this.groupBox1.PerformLayout(); 265 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 236 266 this.ResumeLayout(false); 237 267 … … 255 285 private System.Windows.Forms.TextBox variableInput; 256 286 private System.Windows.Forms.TextBox numberderivationInput; 287 private System.Windows.Forms.ComboBox upperCombo; 288 private System.Windows.Forms.ComboBox lowerCombo; 289 private System.Windows.Forms.TextBox derivationInput; 257 290 private System.Windows.Forms.GroupBox groupBox1; 258 private System.Windows.Forms.ComboBox lowerCombo; 259 private System.Windows.Forms.ComboBox upperCombo; 260 private System.Windows.Forms.TextBox derivationInput; 291 private System.Windows.Forms.ErrorProvider errorProvider; 261 292 } 262 293 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.cs
r16772 r16774 22 22 set { base.Content = value; } 23 23 } 24 24 25 public IntervalConstraintView() { 25 26 InitializeComponent(); … … 27 28 definitionInput.ReadOnly = true; 28 29 derivationInput.ReadOnly = true; 30 if (derivationInput.Text == "False") 31 numberderivationInput.ReadOnly = true; 29 32 } 30 33 … … 46 49 base.OnContentChanged(); 47 50 UpdateControls(); 48 UpdateValues();49 51 } 52 50 53 51 54 protected override void SetEnabledStateOfControls() { … … 78 81 } 79 82 80 private void UpdateValues() {83 private void expressionInput_TextChanged(object sender, EventArgs e) { 81 84 85 } 86 87 private void variableInput_TextChanged(object sender, EventArgs e) { 88 89 } 90 91 private void numberderivationInput_TextChanged(object sender, EventArgs e) { 92 if (int.TryParse(numberderivationInput.Text, out var derivation)) { 93 if (derivation >= 0) { 94 Content.NumberOfDerivation = derivation; 95 errorProvider.SetError(numberderivationInput, string.Empty); 96 } else { 97 errorProvider.SetError(numberderivationInput, "Invalid Input: Derivation must be positive!"); 98 } 99 } else { 100 errorProvider.SetError(numberderivationInput, "Invalid Input: Derivation must be an integer!"); 101 } 102 } 103 104 private void lowerboundInput_TextChanged(object sender, EventArgs e) { 105 var value = ParseDoubleValue(lowerboundInput.Text, lowerboundInput); 106 if (!double.IsNaN(value)) { 107 if (value <= Content.Interval.UpperBound) { 108 Content.Interval = new Interval(value, Content.Interval.UpperBound); 109 errorProvider.SetError(lowerboundInput, string.Empty); 110 } else { 111 errorProvider.SetError(lowerboundInput, "Invalid Input: Lowerbound must be smaller than Upperbound!"); 112 } 113 } 114 } 115 116 private double ParseDoubleValue(string input, Control control) { 117 input = input.ToLower(); 118 switch (input) { 119 case "inf.": 120 case "+inf.": 121 return double.PositiveInfinity; 122 case "-inf.": 123 return double.NegativeInfinity; 124 default: { 125 if (double.TryParse(input, out var value)) 126 return value; 127 else { 128 errorProvider.SetError(control, "Invalid Input: Value must be a double!"); 129 return double.NaN; 130 } 131 } 132 } 82 133 } 83 134 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.resx
r16772 r16774 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 123 <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 124 <value>57</value> 125 </metadata> 120 126 </root> -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.cs
r16773 r16774 32 32 33 33 private ItemList<IntervalConstraint> ParseConstraints(string input) { 34 ItemList<IntervalConstraint> constraints = new ItemList<IntervalConstraint>(IntervalConstraintsParser.ParseInput(input, Content. TargetVariable, Content.AllowedVariables));34 ItemList<IntervalConstraint> constraints = new ItemList<IntervalConstraint>(IntervalConstraintsParser.ParseInput(input, Content.ProblemData.TargetVariable, Content.ProblemData.AllowedInputVariables)); 35 35 return constraints; 36 36 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.designer.cs
r16772 r16774 30 30 this.parseBtn = new System.Windows.Forms.Button(); 31 31 this.label1 = new System.Windows.Forms.Label(); 32 this.groupBox2 = new System.Windows.Forms.GroupBox();33 32 //this.constraintsOutput = new System.Windows.Forms.Label(); 34 33 this.constraintsOutput = new HeuristicLab.Core.Views.ItemListView<IntervalConstraint>(); … … 39 38 this.splitContainer1.SuspendLayout(); 40 39 this.groupBox1.SuspendLayout(); 41 this.groupBox2.SuspendLayout();42 40 this.SuspendLayout(); 43 41 // … … 54 52 // splitContainer1.Panel2 55 53 // 56 this.splitContainer1.Panel2.Controls.Add(this. groupBox2);54 this.splitContainer1.Panel2.Controls.Add(this.constraintsOutput); 57 55 this.splitContainer1.Size = new System.Drawing.Size(888, 629); 58 56 this.splitContainer1.SplitterDistance = 296; … … 105 103 this.label1.Text = resources.GetString("label1.Text"); 106 104 // 107 // groupBox2108 //109 this.groupBox2.Controls.Add(this.constraintsOutput);110 this.groupBox2.Controls.Add(this.errorOutput);111 this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;112 this.groupBox2.Location = new System.Drawing.Point(0, 0);113 this.groupBox2.Name = "groupBox2";114 this.groupBox2.Size = new System.Drawing.Size(588, 629);115 this.groupBox2.TabIndex = 0;116 this.groupBox2.TabStop = false;117 this.groupBox2.Text = "Parsed Constraints";118 //119 105 // constraintsOutput 120 106 // … … 149 135 this.groupBox1.ResumeLayout(false); 150 136 this.groupBox1.PerformLayout(); 151 this.groupBox2.ResumeLayout(false);152 137 this.ResumeLayout(false); 153 138 … … 161 146 private System.Windows.Forms.Label label1; 162 147 private System.Windows.Forms.TextBox constraintsInput; 163 private System.Windows.Forms.GroupBox groupBox2;164 148 private System.Windows.Forms.Label errorOutput; 165 149 -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraint.cs
r16773 r16774 18 18 public bool InclusiveUpperBound { get; set; } 19 19 public bool IsDerivation { get; set; } 20 public string Variable { get; set; } 20 21 private string variable; 22 public string Variable { 23 get => variable; 24 set { 25 if (value != variable) { 26 variable = value; 27 OnChanged(EventArgs.Empty); 28 } 29 } 30 } 21 31 public int NumberOfDerivation { get; set; } 22 32 … … 53 63 this.IsDerivation = original.IsDerivation; 54 64 this.Variable = original.Variable; 55 this.NumberOfDerivation = NumberOfDerivation;65 this.NumberOfDerivation = original.NumberOfDerivation; 56 66 } 57 67 -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraintsParser.cs
r16773 r16774 47 47 } 48 48 49 49 50 public static IEnumerable<IntervalConstraint> ParseInput(string input, string target = "", IEnumerable<string> variables = null) { 50 51 var lines = input.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); … … 132 133 } else if (trimmedLine.StartsWith("#") || trimmedLine == "") { 133 134 //If it is a comment just continue without saving anything 134 //TODO maybe save comment too.135 135 continue; 136 136 } else { -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r16773 r16774 192 192 193 193 Parameters.Add(new FixedValueParameter<NamedIntervals>(VariableRangesParameterName, namedIntervals)); 194 Parameters.Add(new FixedValueParameter<ParsedConstraint>(IntervalConstraintsParameterName, new ParsedConstraint(commentMessage, t argetVariable, allowedInputVariables)));194 Parameters.Add(new FixedValueParameter<ParsedConstraint>(IntervalConstraintsParameterName, new ParsedConstraint(commentMessage, this))); 195 195 RegisterParameterEvents(); 196 196 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/ParsedConstraint.cs
r16773 r16774 28 28 } 29 29 30 protected string targetVariable; 31 public string TargetVariable { 32 get => targetVariable; 33 set => targetVariable = value; 34 } 30 protected IRegressionProblemData problemData; 35 31 36 protected IEnumerable<string> allowedVariables; 37 38 public IEnumerable<string> AllowedVariables { 39 get => allowedVariables; 40 set => allowedVariables = value; 32 public IRegressionProblemData ProblemData { 33 get => problemData; 34 set => problemData = value; 41 35 } 42 36 … … 57 51 } 58 52 59 public ParsedConstraint(string input, string targetVariable, IEnumerable<string> allowedVariables) {53 public ParsedConstraint(string input, IRegressionProblemData problemData) { 60 54 this.input = input; 61 55 this.constraints = new ItemList<IntervalConstraint>(); 62 this.targetVariable = targetVariable; 63 this.allowedVariables = allowedVariables; 56 this.problemData = problemData; 64 57 } 65 58
Note: See TracChangeset
for help on using the changeset viewer.