Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/16/21 11:08:18 (4 years ago)
Author:
gkronber
Message:

#3073: refactoring to prepare for trunk integration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3073_IA_constraint_splitting_reintegration/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/ShapeConstraintsView.cs

    r17894 r17896  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
     
    4848    protected override void OnContentChanged() {
    4949      base.OnContentChanged();
    50       this.intervalConstraintsView.Content = Content;
     50      this.shapeConstraintsView.Content = Content;
    5151      UpdateControl();
    5252    }
     
    8686        try {
    8787          var parsedConstraints = ShapeConstraintsParser.ParseConstraints(constraintsInput.Text);
    88           Content = parsedConstraints;
     88          Content.AddRange(parsedConstraints);
    8989          errorOutput.Text = "Constraints successfully parsed.";
    9090          errorOutput.ForeColor = Color.DarkGreen;
    91           //Catch the exception from the constraints parser and show it in the error dialog
    9291        } catch (ArgumentException ex) {
    93           Content.Clear();
    9492          errorOutput.Text = ex.Message.Replace("Parameter name", "@Line");
    9593          errorOutput.ForeColor = Color.DarkRed;
     94        } finally {
     95          suspendUpdates = false;
    9696        }
    97         suspendUpdates = false;
    98         UpdateControl();
    9997      } else {
    10098        errorOutput.Text = "No constraints were found!";
     
    107105        constraintsInput.Text = string.Empty;
    108106      } else {
    109         this.intervalConstraintsView.Content = Content;
    110         constraintsInput.Text = ToString(Content);
     107        var newText = ToString(Content);
     108        if (newText != constraintsInput.Text)
     109          constraintsInput.Text = newText;
    111110      }
    112111    }
     
    168167    }
    169168
    170     private void label1_DoubleClick(object sender, EventArgs e) {
    171       var infoText =
    172         "Within the text field you can define different types of shape constraints e.g. range constraints, monotonicity constraints, ..." +
    173         System.Environment.NewLine +
    174         "To define a model constraint: f in [0 .. 100], f is used for the selected target, the 'in' key word specifies the target in which the constraint should be, the interval is defined between square bracket." +
    175         System.Environment.NewLine +
    176         "The interval contains two bounds (lower and upper) this bounds are given as double values, to seperate both bounds from each other you can use (.., ;, ' ')" +
    177         System.Environment.NewLine +
    178         "To define monotonic or concave constraints you need to define the partial derivatives:" +
    179         System.Environment.NewLine +
    180         "∂f/∂x in [0 .. 1], therefore you have to define the partial fraction first, which can be done by using the \\partial symbol or 'd' followed by the target and the variable in the numerator and denominator respectively, after defining the fraction the interval is defined like in the model constraint." +
    181         System.Environment.NewLine +
    182         "To define constraints only on a specific range of the function you can define interval ranges" +
    183         System.Environment.NewLine +
    184         "f in [0 .. 100], x in [0 .. 1] the ranges are separated by commas and follow the same rules as before (giving the variable with the interval definition)" +
    185         System.Environment.NewLine + "To specify different weights on the constraints:" +
    186         System.Environment.NewLine + "f in [0 .. 100], x in [0 .. 1] weight: 2.0, you can add the keyword 'weight:' followed by a double value.";
    187 
    188       MessageBox.Show(infoText,"How to define shape constraints", MessageBoxButtons.OKCancel);
     169    private void helpButton_DoubleClick(object sender, EventArgs e) {
     170      using (InfoBox dialog = new InfoBox("Help for shape constraints",
     171        "HeuristicLab.Problems.DataAnalysis.Views.Resources.shapeConstraintsHelp.rtf",
     172        this)) {
     173        dialog.ShowDialog(this);
     174      }
    189175    }
    190176  }
Note: See TracChangeset for help on using the changeset viewer.