#region License Information /* HeuristicLab * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Encodings.VariableVector { [Item("Variable", "")] [StorableClass] public abstract class Variable : Item, IVariable { [Storable] protected string variableName; public string VariableName { get { return variableName; } } public abstract int VirtualLength { get; } public Type VariableType { get { return typeof(T); } } [StorableConstructor] protected Variable(bool deserializing) : base(deserializing) { } protected Variable(Variable original, Cloner cloner) : base(original, cloner) { this.variableName = (string)original.variableName.Clone(); } public Variable() : base() { } public Variable(string variableName) : base() { this.variableName = variableName; } public abstract IVariable GetEmptyCopy(); public abstract IVariable GetSetCopy(); public abstract void Randomize(IRandom random, double changeSymbolProbability); public virtual bool MatchVariable(IVariable target) { throw new NotSupportedException("This method is not supported by this kind of Variable."); } public abstract bool Match(T target); public abstract bool MatchInput(string target); public abstract bool Identical(IVariable target); public abstract double GetGenerality(); public abstract bool IsGreaterThanOrEquallyGeneral(IVariable target); public abstract IVariable CrossParentsAtPosition(IVariable parent2, int pos); public abstract void Manipulate(IRandom random, string stringValue, int pos); public abstract void Manipulate(IRandom random, string stringValue, int pos, double spreadPercentage); public abstract void Cover(IRandom random, string stringValue, double changeSymbolProbability); } }