Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5109


Ignore:
Timestamp:
12/15/10 13:53:59 (13 years ago)
Author:
mkommend
Message:

Corrected SymbolicSimplifier.Negate in GP.Symbols branch (ticket #1340).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SymbolicSimplifier.cs

    r4477 r5109  
    482482      } else if (IsAddition(x)) {
    483483        // (x0 + x1 + .. + xn) * -1 => (-x0 + -x1 + .. + -xn)       
    484         foreach (var subTree in x.SubTrees) {
    485           Negate(subTree);
    486         }
     484        for (int i = 0; i < x.SubTrees.Count; i++)
     485          x.SubTrees[i] = Negate(x.SubTrees[i]);
    487486      } else if (IsMultiplication(x) || IsDivision(x)) {
    488487        // x0 * x1 * .. * xn * -1 => x0 * x1 * .. * -xn
    489         Negate(x.SubTrees.Last()); // last is maybe a constant, prefer to negate the constant
     488        x.SubTrees[x.SubTrees.Count - 1] = Negate(x.SubTrees.Last()); // last is maybe a constant, prefer to negate the constant
    490489      } else {
    491490        // any other function
Note: See TracChangeset for help on using the changeset viewer.