Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/26/11 18:39:49 (13 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/RealVectorCrossover.cs

    r4722 r5381  
    5151      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
    5252    }
     53    public OptionalValueParameter<IRealVectorBoundsChecker> BoundsCheckerParameter {
     54      get { return (OptionalValueParameter<IRealVectorBoundsChecker>)Parameters["BoundsChecker"]; }
     55    }
    5356
    5457    [StorableConstructor]
     
    6366      ChildParameter.ActualName = "RealVector";
    6467      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds of the real vector."));
     68      Parameters.Add(new OptionalValueParameter<IRealVectorBoundsChecker>("BoundsChecker", "The bounds checker that ensures that the values stay within the bounds.", new BoundsChecker()));
    6569    }
     70
     71    // BackwardsCompatibility3.3
     72    #region Backwards compatible code (remove with 3.4)
     73    [StorableHook(HookType.AfterDeserialization)]
     74    private void AfterDeserialization() {
     75      if (!Parameters.ContainsKey("BoundsChecker"))
     76        Parameters.Add(new OptionalValueParameter<IRealVectorBoundsChecker>("BoundsChecker", "The bounds checker that ensures that the values stay within the bounds.", new BoundsChecker()));
     77    }
     78    #endregion
    6679
    6780    public sealed override IOperation Apply() {
    6881      RealVector result = Cross(RandomParameter.ActualValue, ParentsParameter.ActualValue);
    69       DoubleMatrix bounds = BoundsParameter.ActualValue;
    70       if (bounds != null) BoundsChecker.Apply(result, bounds);
    71       ChildParameter.ActualValue = result;
    72       return base.Apply();
     82
     83      IRealVectorBoundsChecker checker = BoundsCheckerParameter.Value;
     84      IOperation successor = base.Apply();
     85      if (checker != null) {
     86        IOperation checkerOperation = ExecutionContext.CreateChildOperation(checker);
     87        if (successor == null) return checkerOperation;
     88        else return new OperationCollection(checkerOperation, successor);
     89      } else return successor;
    7390    }
    7491
Note: See TracChangeset for help on using the changeset viewer.