[14278] | 1 | using HeuristicLab.Common;
|
---|
| 2 | using HeuristicLab.Core;
|
---|
| 3 | using HeuristicLab.Data.MoveVectorData;
|
---|
| 4 | using HeuristicLab.Encodings.MoveVectorEncoding.Interfaces;
|
---|
| 5 | using HeuristicLab.Optimization;
|
---|
| 6 | using HeuristicLab.Parameters;
|
---|
| 7 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 8 |
|
---|
| 9 | namespace HeuristicLab.Encodings.MoveVectorEncoding
|
---|
| 10 | {
|
---|
| 11 | [Item("MoveVectorManipulator", "A base class for operators that manipulate move vectors.")]
|
---|
| 12 | [StorableClass]
|
---|
| 13 | public abstract class MoveVectorManipulator : MoveVectorOperator, IMoveVectorManipulator, IStochasticOperator
|
---|
| 14 | {
|
---|
| 15 | public override bool CanChangeName
|
---|
| 16 | {
|
---|
| 17 | get { return false; }
|
---|
| 18 | }
|
---|
| 19 | public ILookupParameter<IRandom> RandomParameter
|
---|
| 20 | {
|
---|
| 21 | get { return (LookupParameter<IRandom>)Parameters["Random"]; }
|
---|
| 22 | }
|
---|
| 23 | public ILookupParameter<MoveVector> MoveVectorParameter
|
---|
| 24 | {
|
---|
| 25 | get { return (ILookupParameter<MoveVector>)Parameters["MoveVector"]; }
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | [StorableConstructor]
|
---|
| 29 | protected MoveVectorManipulator(bool deserializing) : base(deserializing) { }
|
---|
| 30 | protected MoveVectorManipulator(MoveVectorManipulator original, Cloner cloner) : base(original, cloner) { }
|
---|
| 31 | protected MoveVectorManipulator() : base()
|
---|
| 32 | {
|
---|
| 33 | Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
|
---|
| 34 | Parameters.Add(new LookupParameter<MoveVector>("MoveVector", "The vector which should be manipulated."));
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public sealed override IOperation InstrumentedApply()
|
---|
| 38 | {
|
---|
| 39 | Manipulate(RandomParameter.ActualValue, MoveVectorParameter.ActualValue);
|
---|
| 40 | return base.InstrumentedApply();
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | protected abstract void Manipulate(IRandom random, MoveVector moveVector);
|
---|
| 44 | }
|
---|
| 45 | }
|
---|