Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11756


Ignore:
Timestamp:
01/14/15 16:33:35 (10 years ago)
Author:
mkommend
Message:

#2293: Added Bounds parameter for Real- and IntegerVectorShakingOperators.

Location:
trunk/sources
Files:
2 edited

Legend:

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

    r11171 r11756  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Data;
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Optimization.Operators;
     
    3738  [Item("IntegerVectorShakingOperator", "A shaking operator for VNS which uses available manipulation operators to perform the shaking.")]
    3839  [StorableClass]
    39   public class IntegerVectorShakingOperator : ShakingOperator<IIntegerVectorManipulator>, IIntegerVectorMultiNeighborhoodShakingOperator, IStochasticOperator {
     40  public class IntegerVectorShakingOperator : ShakingOperator<IIntegerVectorManipulator>, IIntegerVectorMultiNeighborhoodShakingOperator, IStochasticOperator, IBoundedIntegerVectorOperator {
    4041
    4142    public ILookupParameter<IntegerVector> IntegerVectorParameter {
     
    4546    public ILookupParameter<IRandom> RandomParameter {
    4647      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
     48    }
     49
     50    public IValueLookupParameter<IntMatrix> BoundsParameter {
     51      get { return (IValueLookupParameter<IntMatrix>)Parameters["Bounds"]; }
    4752    }
    4853
     
    5762      Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", "The integer vector to shake."));
    5863      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator that will be used for stochastic shaking operators."));
     64      Parameters.Add(new ValueLookupParameter<IntMatrix>("Bounds", "A 2 column matrix specifying the lower and upper bound for each dimension. If there are less rows than dimension the bounds vector is cycled."));
     65
    5966      foreach (IIntegerVectorManipulator shaker in ApplicationManager.Manager.GetInstances<IIntegerVectorManipulator>().OrderBy(x => x.Name))
    6067        if (!(shaker is ISelfAdaptiveManipulator)) Operators.Add(shaker);
     68    }
     69
     70    [StorableHook(HookType.AfterDeserialization)]
     71    private void AfterDeserialization() {
     72      #region Backwards compatible code, remove with 3.4
     73      if (!Parameters.ContainsKey("Bounds"))
     74        Parameters.Add(new ValueLookupParameter<IntMatrix>("Bounds", "A 2 column matrix specifying the lower and upper bound for each dimension. If there are less rows than dimension the bounds vector is cycled."));
     75      #endregion
    6176    }
    6277
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ShakingOperators/RealVectorShakingOperator.cs

    r11171 r11756  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Data;
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Optimization.Operators;
     
    4748    }
    4849
     50    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
     51      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
     52    }
     53
     54
    4955    [StorableConstructor]
    5056    protected RealVectorShakingOperator(bool deserializing) : base(deserializing) { }
     
    5763      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The real vector to shake."));
    5864      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator that will be used for stochastic shaking operators."));
     65      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "A 2 column matrix specifying the lower and upper bound for each dimension. If there are less rows than dimension the bounds vector is cycled."));
    5966      foreach (IRealVectorManipulator shaker in ApplicationManager.Manager.GetInstances<IRealVectorManipulator>().OrderBy(x => x.Name))
    6067        if (!(shaker is MultiRealVectorManipulator)
    6168          && !(shaker is ISelfAdaptiveManipulator)) Operators.Add(shaker);
     69    }
     70
     71    [StorableHook(HookType.AfterDeserialization)]
     72    private void AfterDeserialization() {
     73      #region Backwards compatible code, remove with 3.4
     74      if (!Parameters.ContainsKey("Bounds"))
     75        Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "A 2 column matrix specifying the lower and upper bound for each dimension. If there are less rows than dimension the bounds vector is cycled."));
     76      #endregion
    6277    }
    6378
Note: See TracChangeset for help on using the changeset viewer.