[4516] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using HeuristicLab.Core;
|
---|
| 6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 7 | using HeuristicLab.Operators;
|
---|
| 8 | using HeuristicLab.Parameters;
|
---|
[4525] | 9 | using HeuristicLab.Common;
|
---|
[4516] | 10 |
|
---|
| 11 | namespace HeuristicLab.Problems.MetaOptimization {
|
---|
| 12 | /// <summary>
|
---|
| 13 | /// An operator which creates a new random permutation of integer values.
|
---|
| 14 | /// </summary>
|
---|
| 15 | [Item("RandomParameterSetCreator", "An operator which creates a new set of parameters TODO.")]
|
---|
| 16 | [StorableClass]
|
---|
| 17 | public sealed class RandomParameterSetCreator : SingleSuccessorOperator, IParameterSetCreator {
|
---|
| 18 | public override bool CanChangeName {
|
---|
| 19 | get { return false; }
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | public ILookupParameter<IRandom> RandomParameter {
|
---|
| 23 | get { return (LookupParameter<IRandom>)Parameters["Random"]; }
|
---|
| 24 | }
|
---|
| 25 | public ILookupParameter<IParameterSet> ParameterSetParameter {
|
---|
| 26 | get { return (ILookupParameter<IParameterSet>)Parameters["ParameterSet"]; }
|
---|
| 27 | }
|
---|
| 28 |
|
---|
[4525] | 29 | [Storable]
|
---|
[4516] | 30 | private ParameterConfigurationList parametersToOptimize;
|
---|
| 31 | public ParameterConfigurationList ParametersToOptimize {
|
---|
| 32 | get { return parametersToOptimize; }
|
---|
| 33 | set { parametersToOptimize = value; }
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | public RandomParameterSetCreator()
|
---|
| 37 | : base() {
|
---|
| 38 | Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used to initialize the new random permutation."));
|
---|
| 39 | Parameters.Add(new LookupParameter<IParameterSet>("ParameterSet", "The new random parameter set."));
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | public override IOperation Apply() {
|
---|
| 43 | ParameterSetParameter.ActualValue = new ParameterSet(ParametersToOptimize, RandomParameter.ActualValue);
|
---|
| 44 | return base.Apply();
|
---|
| 45 | }
|
---|
[4525] | 46 |
|
---|
| 47 | #region Cloning
|
---|
| 48 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 49 | RandomParameterSetCreator clone = (RandomParameterSetCreator) base.Clone(cloner);
|
---|
| 50 | clone.parametersToOptimize = (ParameterConfigurationList)this.parametersToOptimize.Clone();
|
---|
| 51 | return clone;
|
---|
| 52 | }
|
---|
| 53 | #endregion
|
---|
[4516] | 54 | }
|
---|
| 55 | }
|
---|