Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/25/13 12:37:18 (11 years ago)
Author:
sforsten
Message:

#1980:

  • fixed several bugs (crossover, subsumption, serialization etc.)
  • added ModuloOperator
  • CombinedIntegerVectorClassificationProblem\Data and VariableVectorClassificationProblem\Data inherit from ConditionActionClassificationProblem\Data
  • it can now be set how often the analyzers have to be executed
  • VariableVectorAction, VariableVectorCondition and VariableVectorInput now inherit from Item
Location:
branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3

    • Property svn:ignore
      •  

        old new  
        11obj
         2Plugin.cs
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/VariableVectorInput.cs

    r9226 r9242  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Drawing;
    2524using System.Linq;
    2625using System.Text;
     
    3332  [StorableClass]
    3433  [Item("VariableVectorInput", "")]
    35   public class VariableVectorInput : Dictionary<string, string>, IInput {
     34  public class VariableVectorInput : Item, IInput {
    3635
    37     public IOrderedEnumerable<string> Order { get { return this.Keys.OrderBy(x => x); } }
     36    [Storable]
     37    private Dictionary<string, string> inputDictionary;
     38    public Dictionary<string, string> InputDictionary {
     39      get { return inputDictionary; }
     40      protected set {
     41        inputDictionary = value;
     42      }
     43    }
     44
     45    public IOrderedEnumerable<string> Order { get { return InputDictionary.Keys.OrderBy(x => x); } }
    3846
    3947    [StorableConstructor]
    4048    protected VariableVectorInput(bool deserializing) { }
    4149    protected VariableVectorInput(VariableVectorInput original, Cloner cloner) {
    42       foreach (var item in original) {
    43         Add((string)item.Key.Clone(), (string)item.Value.Clone());
     50      InputDictionary = new Dictionary<string, string>(original.InputDictionary.Count);
     51      foreach (var item in original.InputDictionary) {
     52        InputDictionary.Add(item.Key, item.Value);
    4453      }
    4554    }
    46     public VariableVectorInput() : base() { }
    47     public VariableVectorInput(int capacity) : base(capacity) { }
    48     public VariableVectorInput(IDictionary<string, string> dictionary) : base(dictionary) { }
     55    public VariableVectorInput()
     56      : base() {
     57      InputDictionary = new Dictionary<string, string>();
     58    }
     59    public VariableVectorInput(int capacity)
     60      : base() {
     61      InputDictionary = new Dictionary<string, string>(capacity);
     62    }
     63    public VariableVectorInput(IDictionary<string, string> dictionary)
     64      : base() {
     65      InputDictionary = new Dictionary<string, string>(dictionary);
     66    }
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new VariableVectorInput(this, cloner);
     69    }
    4970
    5071    public override string ToString() {
    5172      StringBuilder sb = new StringBuilder();
    5273      bool first = true;
    53       foreach (var item in this) {
     74      foreach (var item in InputDictionary) {
    5475        if (first) {
    5576          first = false;
     
    6182      return sb.ToString();
    6283    }
    63 
    64     public virtual string ItemName {
    65       get { return ItemAttribute.GetName(this.GetType()); }
    66     }
    67     public virtual string ItemDescription {
    68       get { return ItemAttribute.GetDescription(this.GetType()); }
    69     }
    70     public Version ItemVersion {
    71       get { return ItemAttribute.GetVersion(this.GetType()); }
    72     }
    73     public static Image StaticItemImage {
    74       get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
    75     }
    76     public virtual Image ItemImage {
    77       get { return ItemAttribute.GetImage(this.GetType()); }
    78     }
    79 
    80     public virtual IDeepCloneable Clone(Cloner cloner) {
    81       return new VariableVectorInput(this, cloner);
    82     }
    83 
    84     public object Clone() {
    85       return Clone(new Cloner());
    86     }
    87 
    88     public event EventHandler ItemImageChanged;
    89     protected virtual void OnItemImageChanged() {
    90       EventHandler handler = ItemImageChanged;
    91       if (handler != null) handler(this, EventArgs.Empty);
    92     }
    93     public event EventHandler ToStringChanged;
    94     protected virtual void OnToStringChanged() {
    95       EventHandler handler = ToStringChanged;
    96       if (handler != null) handler(this, EventArgs.Empty);
    97     }
    9884  }
    9985}
Note: See TracChangeset for help on using the changeset viewer.