Free cookie consent management tool by TermsFeed Policy Generator

source: branches/StackingProblems/HeuristicLab.Encodings.MoveVectorEncoding/3.3/MoveVectorManipulator.cs @ 14728

Last change on this file since 14728 was 14278, checked in by mzehetho, 8 years ago

Initial Commit for ticket #2605

Implemented:

  • Encoding
  • Moves
  • Views
  • Blocks World Problem
  • Blocks Relocation Problem
  • Stacking Problem
File size: 1.9 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Data.MoveVectorData;
4using HeuristicLab.Encodings.MoveVectorEncoding.Interfaces;
5using HeuristicLab.Optimization;
6using HeuristicLab.Parameters;
7using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
8
9namespace 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}
Note: See TracBrowser for help on using the repository browser.