Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/26/11 18:39:49 (14 years ago)
Author:
abeham
Message:

#1395

  • Allowed to select the bounds checker to use in all RealVectorManipulator and RealVectorCrossover operators
  • Added a second bounds checker, the ReflectiveBoundsChecker which does not cut at the bounds, but mirrors the vector at the bounds
  • Use a repeating strategy in the move generators
  • Removed obsolete IRealVectorPSODecoder and IRealVectorPSOEncoder interfaces
  • Marked RealVectorToRealVectorEncoder as obsolete, internal and removed all meaningful code from it (it slipped into the release and should be thrown out as soon as possible)
  • Use a repeating strategy to stick within the bounds in the StdDevStrategyVectorManipulator when manipulating the mutation strengths
  • By default use smaller initial bounds in the StdDevStrategyVectorCreator (parameterized by the problem)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVectorManipulator.cs

    r4722 r5381  
    4848      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
    4949    }
     50    public OptionalValueParameter<IRealVectorBoundsChecker> BoundsCheckerParameter {
     51      get { return (OptionalValueParameter<IRealVectorBoundsChecker>)Parameters["BoundsChecker"]; }
     52    }
    5053
    5154    [StorableConstructor]
     
    5760      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The vector which should be manipulated."));
    5861      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds of the real vector."));
     62      Parameters.Add(new OptionalValueParameter<IRealVectorBoundsChecker>("BoundsChecker", "The bounds checker that ensures that the values stay within the bounds.", new BoundsChecker()));
    5963    }
     64
     65    // BackwardsCompatibility3.3
     66    #region Backwards compatible code (remove with 3.4)
     67    [StorableHook(HookType.AfterDeserialization)]
     68    private void AfterDeserialization() {
     69      if (!Parameters.ContainsKey("BoundsChecker"))
     70        Parameters.Add(new OptionalValueParameter<IRealVectorBoundsChecker>("BoundsChecker", "The bounds checker that ensures that the values stay within the bounds.", new BoundsChecker()));
     71    }
     72    #endregion
    6073
    6174    public sealed override IOperation Apply() {
    6275      RealVector vector = RealVectorParameter.ActualValue;
    6376      Manipulate(RandomParameter.ActualValue, vector);
    64       DoubleMatrix bounds = BoundsParameter.ActualValue;
    65       if (bounds != null) BoundsChecker.Apply(vector, bounds);
    66       return base.Apply();
     77
     78      IRealVectorBoundsChecker checker = BoundsCheckerParameter.Value;
     79      IOperation successor = base.Apply();
     80      if (checker != null) {
     81        IOperation checkerOperation = ExecutionContext.CreateChildOperation(checker);
     82        if (successor == null) return checkerOperation;
     83        else return new OperationCollection(checkerOperation, successor);
     84      } else return successor;
    6785    }
    6886
Note: See TracChangeset for help on using the changeset viewer.