Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8184


Ignore:
Timestamp:
07/02/12 18:08:52 (12 years ago)
Author:
abeham
Message:

#1775:

  • Updated documentation and error messages
  • Added an extra base class to unify the implementation of the round methods
Location:
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/BoundedIntegerVectorCrossover.cs

    r8019 r8184  
    5050
    5151    protected abstract IntegerVector CrossBounded(IRandom random, ItemArray<IntegerVector> parents, IntMatrix bounds);
    52 
    53     protected static int RoundFeasible(int min, int max, int step, double value) {
    54       return Math.Max(min, Math.Min(max, (int)Math.Round((value - min) / (double)step) * step + min));
    55     }
    56     protected static int FloorFeasible(int min, int max, int step, double value) {
    57       return Math.Max(min, Math.Min(max, (int)Math.Floor((value - min) / (double)step) * step + min));
    58     }
    59     protected static int CeilingFeasible(int min, int max, int step, double value) {
    60       return Math.Max(min, Math.Min(max, (int)Math.Ceiling((value - min) / (double)step) * step + min));
    61     }
    6252  }
    6353}
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/BoundedIntegerVectorManipulator.cs

    r8019 r8184  
    3131  [StorableClass]
    3232  public abstract class BoundedIntegerVectorManipulator : IntegerVectorManipulator, IBoundedIntegerVectorOperator {
    33    
     33
    3434    public IValueLookupParameter<IntMatrix> BoundsParameter {
    3535      get { return (IValueLookupParameter<IntMatrix>)Parameters["Bounds"]; }
     
    4545
    4646    protected sealed override void Manipulate(IRandom random, IntegerVector integerVector) {
    47       if (BoundsParameter.ActualValue == null) throw new InvalidOperationException("UniformSomePositionsManipulator: Parameter " + BoundsParameter.ActualName + " could not be found.");
     47      if (BoundsParameter.ActualValue == null) throw new InvalidOperationException("BoundedIntegerVectorManipulator: Parameter " + BoundsParameter.ActualName + " could not be found.");
    4848      ManipulateBounded(random, integerVector, BoundsParameter.ActualValue);
    4949    }
    5050
    5151    protected abstract void ManipulateBounded(IRandom random, IntegerVector integerVector, IntMatrix bounds);
    52 
    53     protected static int RoundFeasible(int min, int max, int step, double value) {
    54       return Math.Max(min, Math.Min(max, (int)Math.Round((value - min) / (double)step) * step + min));
    55     }
    56     protected static int FloorFeasible(int min, int max, int step, double value) {
    57       return Math.Max(min, Math.Min(max, (int)Math.Floor((value - min) / (double)step) * step + min));
    58     }
    59     protected static int CeilingFeasible(int min, int max, int step, double value) {
    60       return Math.Max(min, Math.Min(max, (int)Math.Ceiling((value - min) / (double)step) * step + min));
    61     }
    6252  }
    6353}
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Creators/UniformRandomIntegerVectorCreator.cs

    r8019 r8184  
    4646    /// <param name="random">The random number generator.</param>
    4747    /// <param name="length">The length of the int vector.</param>
    48     /// <param name="min">The minimum value of the sampling range for each vector element (inclusive).</param>
    49     /// <param name="max">The maximum value of the sampling range for each vector element (exclusive).</param>
     48    /// <param name="bounds">A matrix containing the inclusive lower and inclusive upper bound in the first and second column and a step size in the third column.
     49    /// Each line represents the bounds for a certain dimension. If fewer lines are given, the lines are cycled.</param>
    5050    /// <returns>The newly created integer vector.</returns>
    5151    public static IntegerVector Apply(IRandom random, int length, IntMatrix bounds) {
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/HeuristicLab.Encodings.IntegerVectorEncoding-3.3.csproj

    r8021 r8184  
    122122    </Compile>
    123123    <Compile Include="Crossovers\RoundedUniformArithmeticCrossover.cs" />
     124    <Compile Include="IntegerVectorOperator.cs" />
    124125    <Compile Include="Interfaces\IBoundedIntegerVectorOperator.cs" />
    125126    <Compile Include="Interfaces\IIntegerVectorCreator.cs" />
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCrossover.cs

    r7259 r8184  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
    24 using HeuristicLab.Operators;
    2524using HeuristicLab.Optimization;
    2625using HeuristicLab.Parameters;
     
    3332  [Item("IntegerVectorCrossover", "A base class for operators that perform a crossover of int-valued vectors.")]
    3433  [StorableClass]
    35   public abstract class IntegerVectorCrossover : SingleSuccessorOperator, IIntegerVectorCrossover, IStochasticOperator {
     34  public abstract class IntegerVectorCrossover : IntegerVectorOperator, IIntegerVectorCrossover, IStochasticOperator {
    3635    public override bool CanChangeName {
    3736      get { return false; }
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorManipulator.cs

    r7259 r8184  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
    24 using HeuristicLab.Operators;
    2524using HeuristicLab.Optimization;
    2625using HeuristicLab.Parameters;
     
    3332  [Item("IntegerVectorManipulator", "A base class for operators that manipulate int-valued vectors.")]
    3433  [StorableClass]
    35   public abstract class IntegerVectorManipulator : SingleSuccessorOperator, IIntegerVectorManipulator, IStochasticOperator {
     34  public abstract class IntegerVectorManipulator : IntegerVectorOperator, IIntegerVectorManipulator, IStochasticOperator {
    3635    public override bool CanChangeName {
    3736      get { return false; }
Note: See TracChangeset for help on using the changeset viewer.