Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/15/12 16:47:25 (12 years ago)
Author:
mkommend
Message:

#1763: merged changes from trunk into the tree simplifier branch.

Location:
branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariable.cs

    r7259 r8915  
    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.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariableTreeNode.cs

    r7259 r8915  
    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.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs

    r7259 r8915  
    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        VariableNames = value;
     112      }
     113    }
     114
     115    public override bool Enabled {
     116      get {
     117        if (variableNames.Count == 0) return false;
     118        return base.Enabled;
     119      }
     120      set {
     121        if (variableNames.Count == 0) base.Enabled = false;
     122        else base.Enabled = value;
     123      }
     124    }
     125
    103126    private const int minimumArity = 0;
    104127    private const int maximumArity = 0;
     
    112135    #endregion
    113136
     137    [StorableHook(HookType.AfterDeserialization)]
     138    private void AfterDeserialization() {
     139      if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
     140        allVariableNames = variableNames;
     141      }
     142    }
     143
    114144    [StorableConstructor]
    115145    protected Variable(bool deserializing)
    116146      : base(deserializing) {
    117147      variableNames = new List<string>();
     148      allVariableNames = new List<string>();
    118149    }
    119150    protected Variable(Variable original, Cloner cloner)
     
    122153      weightSigma = original.weightSigma;
    123154      variableNames = new List<string>(original.variableNames);
     155      allVariableNames = new List<string>(original.allVariableNames);
    124156      weightManipulatorMu = original.weightManipulatorMu;
    125157      weightManipulatorSigma = original.weightManipulatorSigma;
     
    135167      multiplicativeWeightManipulatorSigma = 0.03;
    136168      variableNames = new List<string>();
     169      allVariableNames = new List<string>();
    137170    }
    138171
  • branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableCondition.cs

    r8099 r8915  
    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.