Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/21/13 16:55:07 (12 years ago)
Author:
bburlacu
Message:

#1772: Merged trunk changes for HeuristicLab.Problems.DataAnalysis.Symbolic. Added SymbolicDataAnalysisSolutionTextRenderer, a class for displaying symbolic expression trees in the console.

Location:
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
Files:
9 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4

    • Property svn:ignore
      •  

        old new  
         1*.user
         2Plugin.cs
        13bin
        2 *.user
        3 HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs
        44obj
        5 *.vs10x
        6 Plugin.cs
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Constant.cs

    r7259 r9241  
    2828  [StorableClass]
    2929  [Item("Constant", "Represents a constant value.")]
    30   public sealed class Constant : Symbol {
     30  public class Constant : Symbol {
    3131    #region Properties
    3232    [Storable]
     
    100100
    101101    [StorableConstructor]
    102     private Constant(bool deserializing) : base(deserializing) { }
    103     private Constant(Constant original, Cloner cloner)
     102    protected Constant(bool deserializing) : base(deserializing) { }
     103    protected Constant(Constant original, Cloner cloner)
    104104      : base(original, cloner) {
    105105      minValue = original.minValue;
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ConstantTreeNode.cs

    r7259 r9241  
    2727namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    2828  [StorableClass]
    29   public sealed class ConstantTreeNode : SymbolicExpressionTreeTerminalNode {
     29  public class ConstantTreeNode : SymbolicExpressionTreeTerminalNode {
    3030    public new Constant Symbol {
    3131      get { return (Constant)base.Symbol; }
     
    3434    private double constantValue;
    3535    [Storable]
    36     public double Value {
     36    public virtual double Value {
    3737      get { return constantValue; }
    3838      set { constantValue = value; }
     
    4040
    4141    [StorableConstructor]
    42     private ConstantTreeNode(bool deserializing) : base(deserializing) { }
     42    protected ConstantTreeNode(bool deserializing) : base(deserializing) { }
    4343
    44     private ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
     44    protected ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
    4545      : base(original, cloner) {
    4646      constantValue = original.constantValue;
    4747    }
    4848
    49     private ConstantTreeNode() : base() { }
     49    protected ConstantTreeNode() : base() { }
    5050    public ConstantTreeNode(Constant constantSymbol) : base(constantSymbol) { }
    5151
     
    5555      }
    5656    }
    57     public override void ResetLocalParameters(IRandom random) {
     57    public virtual void ResetLocalParameters(IRandom random) {
    5858      base.ResetLocalParameters(random);
    5959      var range = Symbol.MaxValue - Symbol.MinValue;
     
    6161    }
    6262
    63     public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
     63    public virtual void ShakeLocalParameters(IRandom random, double shakingFactor) {
    6464      base.ShakeLocalParameters(random, shakingFactor);
    6565      // 50% additive & 50% multiplicative
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedSymbol.cs

    r5809 r9241  
    1 using HeuristicLab.Common;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Common;
    223using HeuristicLab.Core;
    324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariable.cs

    r7259 r9241  
    2727  [StorableClass]
    2828  [Item("LaggedVariable", "Represents a variable value with a time offset.")]
    29   public sealed class LaggedVariable : Variable {
     29  public class LaggedVariable : Variable {
    3030    [Storable]
    3131    private int minLag;
     
    4141    }
    4242    [StorableConstructor]
    43     private LaggedVariable(bool deserializing) : base(deserializing) { }
    44     private LaggedVariable(LaggedVariable original, Cloner cloner)
     43    protected LaggedVariable(bool deserializing) : base(deserializing) { }
     44    protected LaggedVariable(LaggedVariable original, Cloner cloner)
    4545      : base(original, cloner) {
    4646      minLag = original.minLag;
    4747      maxLag = original.maxLag;
    4848    }
    49     public LaggedVariable()
    50       : base("LaggedVariable", "Represents a variable value with a time offset.") {
    51       minLag = -1; maxLag = -1;
     49    public LaggedVariable() : this("LaggedVariable", "Represents a variable value with a time offset.") { }
     50    protected LaggedVariable(string name, string description)
     51      : base(name, description) {
     52      MinLag = -1;
     53      MaxLag = -1;
    5254    }
    5355
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariableTreeNode.cs

    r7259 r9241  
    3737    }
    3838
     39    public override bool HasLocalParameters {
     40      get { return true; }
     41    }
     42
    3943    [StorableConstructor]
    4044    private LaggedVariableTreeNode(bool deserializing) : base(deserializing) { }
     
    4347      lag = original.lag;
    4448    }
    45     private LaggedVariableTreeNode() { }
    4649
    4750    public LaggedVariableTreeNode(LaggedVariable variableSymbol) : base(variableSymbol) { }
    4851
    49     public override bool HasLocalParameters {
    50       get {
    51         return true;
    52       }
    53     }
    5452
    5553    public override void ResetLocalParameters(IRandom random) {
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs

    r7259 r9241  
    101101    }
    102102
     103    private List<string> allVariableNames;
     104    [Storable]
     105    public IEnumerable<string> AllVariableNames {
     106      get { return allVariableNames; }
     107      set {
     108        if (value == null) throw new ArgumentNullException();
     109        allVariableNames.Clear();
     110        allVariableNames.AddRange(value);
     111      }
     112    }
     113
     114    public override bool Enabled {
     115      get {
     116        if (variableNames.Count == 0) return false;
     117        return base.Enabled;
     118      }
     119      set {
     120        if (variableNames.Count == 0) base.Enabled = false;
     121        else base.Enabled = value;
     122      }
     123    }
     124
    103125    private const int minimumArity = 0;
    104126    private const int maximumArity = 0;
     
    112134    #endregion
    113135
     136    [StorableHook(HookType.AfterDeserialization)]
     137    private void AfterDeserialization() {
     138      if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
     139        allVariableNames = variableNames;
     140      }
     141    }
     142
    114143    [StorableConstructor]
    115144    protected Variable(bool deserializing)
    116145      : base(deserializing) {
    117146      variableNames = new List<string>();
     147      allVariableNames = new List<string>();
    118148    }
    119149    protected Variable(Variable original, Cloner cloner)
     
    122152      weightSigma = original.weightSigma;
    123153      variableNames = new List<string>(original.variableNames);
     154      allVariableNames = new List<string>(original.allVariableNames);
    124155      weightManipulatorMu = original.weightManipulatorMu;
    125156      weightManipulatorSigma = original.weightManipulatorSigma;
     
    135166      multiplicativeWeightManipulatorSigma = 0.03;
    136167      variableNames = new List<string>();
    137     }
    138 
    139     protected override void OnChanged(EventArgs e) {
    140       if (@Fixed) {
    141         weightManipulatorMu = 1;
    142         weightManipulatorSigma = 0;
    143         weightMu = 1;
    144         weightSigma = 0;
    145         multiplicativeWeightManipulatorSigma = 0;
    146       }
    147       base.OnChanged(e);
     168      allVariableNames = new List<string>();
    148169    }
    149170
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableCondition.cs

    r8099 r9241  
    8686      set {
    8787        if (value == null) throw new ArgumentNullException();
    88         variableNames = new List<string>(value);
     88        variableNames.Clear();
     89        variableNames.AddRange(value);
    8990        OnChanged(EventArgs.Empty);
     91      }
     92    }
     93
     94    private List<string> allVariableNames;
     95    [Storable]
     96    public IEnumerable<string> AllVariableNames {
     97      get { return allVariableNames; }
     98      set {
     99        if (value == null) throw new ArgumentNullException();
     100        allVariableNames.Clear();
     101        allVariableNames.AddRange(value);
     102        VariableNames = value;
    90103      }
    91104    }
     
    151164
    152165    #region persistence and cloning
     166    [StorableHook(HookType.AfterDeserialization)]
     167    private void AfterDeserialization() {
     168      if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
     169        allVariableNames = variableNames;
     170      }
     171    }
     172
    153173    [StorableConstructor]
    154     private VariableCondition(bool deserializing) : base(deserializing) { }
     174    private VariableCondition(bool deserializing)
     175      : base(deserializing) {
     176      variableNames = new List<string>();
     177      allVariableNames = new List<string>();
     178    }
    155179    private VariableCondition(VariableCondition original, Cloner cloner)
    156180      : base(original, cloner) {
     
    161185
    162186      variableNames = new List<string>(original.variableNames);
     187      allVariableNames = new List<string>(original.allVariableNames);
    163188
    164189      slopeInitializerMu = original.slopeInitializerMu;
     
    181206
    182207      variableNames = new List<string>();
     208      allVariableNames = new List<string>();
    183209
    184210      slopeInitializerMu = 0.0;
Note: See TracChangeset for help on using the changeset viewer.