Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/14/22 15:58:30 (2 years ago)
Author:
mkommend
Message:

#3136: Fixed parsing of variables in subfunctions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/StructureTemplate.cs

    r18195 r18199  
    4141        if (value == template) return;
    4242
     43        var parsedTree = Parser.Parse(value);
     44        //assignment must be done after successfully parsing the tree
    4345        template = value;
    44         var parsedTree = Parser.Parse(template);
     46
    4547        if (applyLinearScaling)
    4648          parsedTree = LinearScaling.AddLinearScalingTerms(parsedTree);
     
    6264      private set {
    6365        containsNumericParameters = null;
    64         tree = value;
    6566
    66         var newFunctions = CreateSubFunctions(tree);
     67        var newFunctions = CreateSubFunctions(value);
    6768        var oldFunctions = subFunctions?.Intersect(newFunctions)
    6869                           ?? Enumerable.Empty<SubFunction>();
     
    7172        subFunctions = functionsToAdd.Concat(oldFunctions).ToList();
    7273        RegisterSubFunctionEventHandlers(functionsToAdd);
     74
     75        tree = value;
    7376      }
    7477    }
     
    104107
    105108    protected InfixExpressionParser Parser { get; set; } = new InfixExpressionParser();
    106 
    107109    #endregion
    108110
     
    150152      subFunctions = new List<SubFunction>();
    151153      tree = null;
     154      containsNumericParameters = null;
    152155      Template = "f(_)";
    153156    }
     
    183186        sf.Changed += (o, e) => OnChanged();
    184187      }
    185     }   
     188    }
    186189  }
    187190}
Note: See TracChangeset for help on using the changeset viewer.