Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/19/10 18:49:17 (14 years ago)
Author:
gkronber
Message:

Removed max. and min. time offset constraints as algorithm parameters and from all engines. The time constraints were added to the relevant terminal symbols (variable & differential) instead. The time offset constraint can be changed by editing the symbols in the function library. #880 (Max and min time offsets for variable symbols are not set correctly by FunctionLibraryInjectors)

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Differential.cs

    r2222 r2843  
    3636      return new VariableFunctionTree(this);
    3737    }
     38
     39    public override HeuristicLab.Core.IView CreateView() {
     40      return new VariableView(this);
     41    }
    3842  }
    3943}
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Variable.cs

    r2365 r2843  
    2424using HeuristicLab.Random;
    2525using HeuristicLab.Data;
     26using System.Xml;
    2627
    2728namespace HeuristicLab.GP.StructureIdentification {
     
    3233
    3334    private int minOffset;
     35    public int MinTimeOffset {
     36      get {
     37        return minOffset;
     38      }
     39      set {
     40        if (value != minOffset) {
     41          minOffset = value;
     42          SetupInitialization();
     43          SetupManipulation();
     44        }
     45      }
     46    }
     47
    3448    private int maxOffset;
     49    public int MaxTimeOffset {
     50      get {
     51        return maxOffset;
     52      }
     53      set {
     54        if (value != maxOffset) {
     55          maxOffset = value;
     56          SetupManipulation();
     57          SetupInitialization();
     58        }
     59      }
     60    }
    3561
    3662    public override string Description {
     
    116142    }
    117143
    118     public void SetConstraints(int minSampleOffset, int maxSampleOffset) {
    119       this.minOffset = minSampleOffset;
    120       this.maxOffset = maxSampleOffset;
    121       SetupInitialization();
    122       SetupManipulation();
     144    public override HeuristicLab.Core.IView CreateView() {
     145      return new VariableView(this);
    123146    }
     147
     148    #region persistence
     149    public override object Clone(System.Collections.Generic.IDictionary<System.Guid, object> clonedObjects) {
     150      Variable clone = (Variable)base.Clone(clonedObjects);
     151      clone.MaxTimeOffset = MaxTimeOffset;
     152      clone.MinTimeOffset = MinTimeOffset;
     153      return clone;
     154    }
     155    public override System.Xml.XmlNode GetXmlNode(string name, System.Xml.XmlDocument document, System.Collections.Generic.IDictionary<System.Guid, HeuristicLab.Core.IStorable> persistedObjects) {
     156      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     157      var minTimeOffsetAttr = document.CreateAttribute("MinTimeOffset");
     158      minTimeOffsetAttr.Value = MinTimeOffset.ToString();
     159      var maxTimeOffsetAttr = document.CreateAttribute("MaxTimeOffset");
     160      maxTimeOffsetAttr.Value = MaxTimeOffset.ToString();
     161      node.Attributes.Append(minTimeOffsetAttr);
     162      node.Attributes.Append(maxTimeOffsetAttr);
     163      return node;
     164    }
     165    public override void Populate(System.Xml.XmlNode node, System.Collections.Generic.IDictionary<System.Guid, HeuristicLab.Core.IStorable> restoredObjects) {
     166      base.Populate(node, restoredObjects);
     167      MinTimeOffset = XmlConvert.ToInt32(node.Attributes["MinTimeOffset"].Value);
     168      MaxTimeOffset = XmlConvert.ToInt32(node.Attributes["MaxTimeOffset"].Value);
     169    }
     170    #endregion
    124171  }
    125172}
Note: See TracChangeset for help on using the changeset viewer.