Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Creators/RandomParameterConfigurationCreator.cs @ 4830

Last change on this file since 4830 was 4830, checked in by cneumuel, 13 years ago

#1215 worked on metaoptimization

File size: 2.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Core;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7using HeuristicLab.Operators;
8using HeuristicLab.Parameters;
9using HeuristicLab.Common;
10using HeuristicLab.Optimization;
11
12namespace HeuristicLab.Problems.MetaOptimization {
13  /// <summary>
14  /// An operator which creates a new random permutation of integer values.
15  /// </summary>
16  [Item("RandomParameterVectorCreator", "An operator which creates a new set of parameters TODO.")]
17  [StorableClass]
18  public sealed class RandomParameterConfigurationCreator : SingleSuccessorOperator, IStochasticOperator, IParameterConfigurationCreator {
19    public override bool CanChangeName {
20      get { return false; }
21    }
22
23    public ILookupParameter<IRandom> RandomParameter {
24      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
25    }
26    public ILookupParameter<IParameterConfiguration> ParameterConfigurationParameter {
27      get { return (ILookupParameter<IParameterConfiguration>)Parameters["ParameterConfiguration"]; }
28    }
29
30    public ILookupParameter<IParameterConfiguration> NewParameterConfigurationParameter {
31      get { return (ILookupParameter<IParameterConfiguration>)Parameters["NewParameterConfiguration"]; }
32    }
33
34    [StorableConstructor]
35    private RandomParameterConfigurationCreator(bool deserializing) : base(deserializing) { }
36    private RandomParameterConfigurationCreator(RandomParameterConfigurationCreator original, Cloner cloner) : base(original, cloner) { }
37    public RandomParameterConfigurationCreator()
38      : base() {
39        Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used to initialize the new random permutation."));
40        Parameters.Add(new LookupParameter<IParameterConfiguration>("ParameterConfiguration", "The new random parameter set."));
41    }
42    public override IDeepCloneable Clone(Cloner cloner) {
43      return new RandomParameterConfigurationCreator(this, cloner);
44    }
45
46    public override IOperation Apply() {
47      NewParameterConfigurationParameter.ActualValue = (IParameterConfiguration)ParameterConfigurationParameter.ActualValue.Clone();
48      //NewParameterConfigurationParameter.ActualValue.Randomize();
49      return base.Apply();
50    }
51  }
52}
Note: See TracBrowser for help on using the repository browser.