Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/22/10 08:51:33 (15 years ago)
Author:
gkronber
Message:

Bug fixes in cloning and persistence. #937 (Data types and operators for symbolic expression tree encoding)

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Argument.cs

    r3462 r3484  
    3535      }
    3636    }
    37 
     37    [Storable]
    3838    private int argumentIndex;
    3939    public int ArgumentIndex {
    4040      get { return argumentIndex; }
    4141    }
     42
     43    private Argument() : base() { }
    4244
    4345    public Argument(int argumentIndex)
     
    5052      return new ArgumentTreeNode(this);
    5153    }
     54
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      Argument clone = (Argument)base.Clone(cloner);
     57      clone.argumentIndex = argumentIndex;
     58      clone.name = "ARG" + argumentIndex;
     59      return clone;
     60    }
    5261  }
    5362}
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ArgumentTreeNode.cs

    r3462 r3484  
    2929      set {
    3030        if (value == null) throw new ArgumentNullException();
    31         if(!(value is Argument)) throw new ArgumentException();
    32         base.Symbol = value; 
     31        if (!(value is Argument)) throw new ArgumentException();
     32        base.Symbol = value;
    3333      }
    3434    }
    35    
     35
     36    private ArgumentTreeNode() : base() { }
     37
    3638    // copy constructor
    3739    private ArgumentTreeNode(ArgumentTreeNode original)
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/DefunTreeNode.cs

    r3462 r3484  
    4040    }
    4141
     42    private DefunTreeNode() : base() { }
     43
    4244    // copy constructor
    4345    private DefunTreeNode(DefunTreeNode original)
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunction.cs

    r3462 r3484  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using System;
    2526namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
    2627  /// <summary>
     
    3536      }
    3637    }
    37     public string FunctionName { get; set; }
     38    [Storable]
     39    private string functionName;
     40    public string FunctionName {
     41      get { return functionName; }
     42      set {
     43        if (value == null) throw new ArgumentNullException();
     44        functionName = value;
     45      }
     46    }
     47
     48    private InvokeFunction() : base() { }
    3849
    3950    public InvokeFunction(string functionName)
     
    4657      return new InvokeFunctionTreeNode(this);
    4758    }
     59
     60    public override IDeepCloneable Clone(Cloner cloner) {
     61      InvokeFunction clone = (InvokeFunction)base.Clone(cloner);
     62      clone.functionName = functionName;
     63      clone.name = "Invoke: " + functionName;
     64      return clone;
     65    }
    4866  }
    4967}
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunctionTreeNode.cs

    r3462 r3484  
    3434    }
    3535
     36    private InvokeFunctionTreeNode() : base() { }
     37
    3638    // copy constructor
    3739    private InvokeFunctionTreeNode(InvokeFunctionTreeNode original)
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs

    r3462 r3484  
    3535  public abstract class Symbol : NamedItem {
    3636    #region Properties
     37    [Storable]
    3738    private double initialFrequency;
    3839    public double InitialFrequency {
     
    5556      return new SymbolicExpressionTreeNode(this);
    5657    }
     58
     59    public override IDeepCloneable Clone(Cloner cloner) {
     60      Symbol clone = (Symbol) base.Clone(cloner);
     61      clone.initialFrequency = initialFrequency;
     62      return clone;
     63    }
    5764  }
    5865}
Note: See TracChangeset for help on using the changeset viewer.