- Timestamp:
- 11/24/15 16:01:02 (9 years ago)
- Location:
- branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Interfaces/IRealVectorCreator.cs
r12012 r13361 28 28 /// An interface which represents an operator for creating vectors of real-valued data. 29 29 /// </summary> 30 public interface IRealVectorCreator : IRealVectorOperator, ISolutionCreator {30 public interface IRealVectorCreator : IRealVectorOperator, ISolutionCreator<RealVector> { 31 31 IValueLookupParameter<IntValue> LengthParameter { get; } 32 32 IValueLookupParameter<DoubleMatrix> BoundsParameter { get; } -
branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVector.cs
r12012 r13361 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; 25 using HeuristicLab.Optimization; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 … … 28 29 [StorableClass] 29 30 [Item("RealVector", "Represents a vector of real values.")] 30 public class RealVector : DoubleArray {31 public class RealVector : DoubleArray, ISolution { 31 32 [StorableConstructor] 32 33 protected RealVector(bool deserializing) : base(deserializing) { } -
branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVectorEncoding.cs
r12837 r13361 34 34 [Item("RealVectorEncoding", "Describes a real vector encoding.")] 35 35 [StorableClass] 36 public sealed class RealVectorEncoding : Encoding< IRealVectorCreator> {36 public sealed class RealVectorEncoding : Encoding<RealVector> { 37 37 #region Encoding Parameters 38 38 [Storable] … … 95 95 public RealVectorEncoding(string name) : this(name, 10) { } 96 96 public RealVectorEncoding(int length) : this("RealVector", length) { } 97 public RealVectorEncoding(string name, int length, double min = double.MinValue, double max = double.MaxValue)97 public RealVectorEncoding(string name, int length, double min = -1000, double max = 1000) 98 98 : base(name) { 99 99 if (min >= max) throw new ArgumentException("min must be less than max", "min"); … … 318 318 #endregion 319 319 } 320 321 public static class IndividualExtensionMethods {322 public static RealVector RealVector(this Individual individual) {323 var encoding = individual.GetEncoding<RealVectorEncoding>();324 return individual.RealVector(encoding.Name);325 }326 public static RealVector RealVector(this Individual individual, string name) {327 return (RealVector)individual[name];328 }329 }330 320 }
Note: See TracChangeset
for help on using the changeset viewer.