Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/09/11 11:17:48 (12 years ago)
Author:
svonolfe
Message:

Implemented wiring (#1425)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/ShakingOperator.cs

    r5609 r5642  
    3838  [Item("ShakingOperator", "A shaking operator for VNS.")]
    3939  [StorableClass]
    40   public class ShakingOperator: CheckedMultiOperator<IManipulator> {
     40  public class ShakingOperator<T> : CheckedMultiOperator<T>, IShakingOperator where T : class, IManipulator {
    4141    public IValueLookupParameter<IntValue> IndexParameter {
    4242      get { return (ValueLookupParameter<IntValue>)Parameters["Index"]; }
     
    4949    [StorableConstructor]
    5050    protected ShakingOperator(bool deserializing) : base(deserializing) { }
    51     protected ShakingOperator(ShakingOperator original, Cloner cloner) : base(original, cloner) { }
     51    protected ShakingOperator(ShakingOperator<T> original, Cloner cloner) : base(original, cloner) { }
    5252    public override IDeepCloneable Clone(Cloner cloner) {
    53       return new ShakingOperator(this, cloner);
     53      return new ShakingOperator<T>(this, cloner);
    5454    }
    5555    public ShakingOperator()
     
    5757      Parameters.Add(new ValueLookupParameter<IntValue>("Index", "The index of the operator that should be applied (k)."));
    5858      Parameters.Add(new LookupParameter<BoolValue>("Continue", "True if k <= available operators."));
     59    }
     60
     61    public void Parameterize(IProblem problem) {
     62      Operators.Clear();
     63
     64      if (problem != null) {
     65        foreach (T manipulator in problem.Operators.OfType<T>().OrderBy(x => x.Name))
     66          Operators.Add(manipulator);
     67      }
    5968    }
    6069
Note: See TracChangeset for help on using the changeset viewer.