Changeset 18143


Ignore:
Timestamp:
12/16/21 11:26:51 (7 months ago)
Author:
chaider
Message:

#3140 merged branch into trunk

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/HeuristicLab.Problems.DataAnalysis

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs

    r18132 r18143  
    104104        var symbol = dialog.SelectedSymbol;
    105105        var node = symbol.CreateTreeNode();
    106         if (node is INumericTreeNode numTreeNode) {
     106        if (node is NumberTreeNode numTreeNode) {
    107107          numTreeNode.Value = double.Parse(dialog.numberValueTextBox.Text);
    108108        } else if (node is VariableTreeNode) {
     
    132132      ISymbolicExpressionTreeNode newNode = null;
    133133      var result = DialogResult.Cancel;
    134       if (node is INumericTreeNode) {
     134      if (node is NumberTreeNode) {
    135135        using (var dialog = new NumberNodeEditDialog(node)) {
    136136          dialog.ShowDialog(this);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs

    r18132 r18143  
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3030  public partial class NumberNodeEditDialog : Form {
    31     private INumericTreeNode numberTreeNode;
    32     public INumericTreeNode NewNode {
     31    private NumberTreeNode numberTreeNode;
     32    public NumberTreeNode NewNode {
    3333      get { return numberTreeNode; }
    3434      set {
    3535        if (InvokeRequired)
    36           Invoke(new Action<SymbolicExpressionTreeNode>(x => numberTreeNode = (INumericTreeNode)x), value);
     36          Invoke(new Action<SymbolicExpressionTreeNode>(x => numberTreeNode = (NumberTreeNode)x), value);
    3737        else
    3838          numberTreeNode = value;
     
    4343      InitializeComponent();
    4444      oldValueTextBox.TabStop = false; // cannot receive focus using tab key
    45       NewNode = (INumericTreeNode)node;
     45      NewNode = (NumberTreeNode)node;
    4646      InitializeFields();
    4747    }
     
    103103      // we impose an extra validation condition: that the new value is different from the original value
    104104      if (numberTreeNode.Value.Equals(value)) return;
    105 
    106105      numberTreeNode.Value = value;
    107106      DialogResult = DialogResult.OK;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs

    r18132 r18143  
    156156          var newPower = (ISymbolicExpressionTreeNode)branch.Clone();
    157157          var f = (ISymbolicExpressionTreeNode)newPower.GetSubtree(0).Clone();
    158           var newExponent = (INumericTreeNode)numberSy.CreateTreeNode();
    159           newExponent.Value = ((INumericTreeNode)newPower.GetSubtree(1)).Value - 1;
     158          var newExponent = (NumberTreeNode)numberSy.CreateTreeNode();
     159          newExponent.Value = ((NumberTreeNode)newPower.GetSubtree(1)).Value - 1;
    160160          return Product(Product(CreateNumber(exponent.Value), newPower), Derive(f, variableName));
    161161        } else throw new NotSupportedException("Cannot derive non-integer powers");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs

    r18132 r18143  
    215215            variableTreeNode.Weight = variable.Weight;
    216216          } else if (node.Data is INumericTreeNode existingNumNode) {
    217             var newNumNode = (INumericTreeNode)treeNodes[i];
     217            var newNumNode = (NumberTreeNode)treeNodes[i];
    218218            newNumNode.Value = existingNumNode.Value;
    219219          }
     
    277277
    278278        var symbol = child.Data.Symbol;
    279         if (child.Data is INumericTreeNode firstNum) {
     279        if (child.Data is NumberTreeNode firstNum) {
    280280          // fold sibling number nodes into the first number
    281281          for (int k = j + 1; k < children.Length; ++k) {
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs

    r18132 r18143  
    162162        return tree;
    163163      } else if (tokens.Peek().Symbol == TokenSymbol.CONSTANT) {
    164         var t = (INumericTreeNode)number.CreateTreeNode();
    165         t.Value = tokens.Dequeue().DoubleValue;
    166         return t;
     164        var value = tokens.Dequeue().DoubleValue;
     165        var constant = new Constant() { Value = value };
     166        return constant.CreateTreeNode();
    167167      } else if (tokens.Peek().Symbol == TokenSymbol.LBRACKET) {
    168168        Expect(Token.LBRACKET, tokens);
    169169        Expect(Token.NUM, tokens);
    170         var t = (INumericTreeNode)number.CreateTreeNode();
     170        var t = (NumberTreeNode)number.CreateTreeNode();
    171171        if (tokens.Peek().Symbol == TokenSymbol.EQ) {
    172172          Expect(Token.EQ, tokens);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/INumericTreeNode.cs

    r18132 r18143  
    2626  [StorableType("194AFEE6-96E2-4F53-A5AD-D3CCFE928AE5")]
    2727  public interface INumericTreeNode : ISymbolicExpressionTreeNode {
    28     double Value { get; set; }
     28    double Value { get; }
    2929  }
    3030}
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ConstantTreeNode.cs

    r18132 r18143  
    3030    public new Constant Symbol => (Constant) base.Symbol;
    3131
    32     public double Value {
    33       get => Symbol.Value;
    34       set => throw new System.NotSupportedException("Cannot change the value of a constant.");
    35     }
     32    public double Value => Symbol.Value;
    3633
    3734    [StorableConstructor]
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4

  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs

    r18141 r18143  
    187187      Parameters.Add(new FixedValueParameter<ReadOnlyItemList<ITransformation>>(TransformationsParameterName, "", transformationsList.AsReadOnly()));
    188188
     189      IntervalCollection varRanges = null;
    189190      if (variableRanges == null) {
    190         variableRanges = Dataset.GetVariableRanges();
     191        varRanges = Dataset.GetVariableRanges();
    191192      }else {
    192         foreach (var entry in variableRanges.GetVariableIntervals())
    193           VariableRanges.SetInterval(entry.Item1, entry.Item2);
    194       }
    195 
    196       Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges));
     193        varRanges = (IntervalCollection) variableRanges.Clone();
     194      }
     195
     196      Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, varRanges));
    197197
    198198      TransformationsParameter.Hidden = true;
Note: See TracChangeset for help on using the changeset viewer.