Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/30/10 22:50:59 (14 years ago)
Author:
cneumuel
Message:

#1215

  • enhanced combinations generator (now with batchruns!)
  • fixed ActualNames for metaopt-alg
  • added penalty for invalid solution-candidates (algs which throw exceptions)
  • migrated to .NET 4.0
Location:
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Creators/RandomParameterConfigurationCreator.cs

    r5009 r5184  
    2121    }
    2222    public ILookupParameter<ParameterConfigurationTree> InitialParameterConfigurationParameter {
    23       get { return (ILookupParameter<ParameterConfigurationTree>)Parameters["InitialParameterConfigurationTree"]; }
     23      get { return (ILookupParameter<ParameterConfigurationTree>)Parameters[MetaOptimizationProblem.ParameterConfigurationTreeParameterName]; }
    2424    }
    2525
    26     public ILookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter {
    27       get { return (ILookupParameter<ParameterConfigurationTree>)Parameters["ParameterConfigurationTree"]; }
     26    public IValueLookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter {
     27      get { return (IValueLookupParameter<ParameterConfigurationTree>)Parameters["ParameterConfigurationTreeSolutionCandidate"]; }
    2828    }
    2929
     
    3333    public RandomParameterConfigurationCreator() : base() {
    3434      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used to initialize the new random permutation."));
    35       Parameters.Add(new LookupParameter<ParameterConfigurationTree>("InitialParameterConfigurationTree", "The parameter configuration tree on which the new solution will be based on."));
    36       Parameters.Add(new LookupParameter<ParameterConfigurationTree>("ParameterConfigurationTree", "The new random parameter set."));
     35      Parameters.Add(new LookupParameter<ParameterConfigurationTree>(MetaOptimizationProblem.ParameterConfigurationTreeParameterName, "The parameter configuration tree on which the new solution will be based on."));
     36      Parameters.Add(new ValueLookupParameter<ParameterConfigurationTree>("ParameterConfigurationTreeSolutionCandidate", "The new random parameter set."));
    3737    }
    3838    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/Crossovers/ParameterConfigurationCrossover.cs

    r5112 r5184  
    1515  [Item("ParameterConfigurationCrossover", "TODO")]
    1616  [StorableClass]
    17   public class ParameterConfigurationCrossover : SingleSuccessorOperator, IParameterConfigurationOperator, ICrossover {
     17  public class ParameterConfigurationCrossover : SingleSuccessorOperator, IParameterConfigurationOperator, IParameterConfigurationCrossover {
    1818    public override bool CanChangeName {
    1919      get { return false; }
     
    2323      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    2424    }
    25     public ILookupParameter<ItemArray<IValueConfiguration>> ParentsParameter {
    26       get { return (ScopeTreeLookupParameter<IValueConfiguration>)Parameters["Parents"]; }
     25    public ILookupParameter<ItemArray<ParameterConfigurationTree>> ParentsParameter {
     26      get { return (ScopeTreeLookupParameter<ParameterConfigurationTree>)Parameters["Parents"]; }
    2727    }
    28     public ILookupParameter<IValueConfiguration> ChildParameter {
    29       get { return (ILookupParameter<IValueConfiguration>)Parameters["Child"]; }
     28    public ILookupParameter<ParameterConfigurationTree> ChildParameter {
     29      get { return (ILookupParameter<ParameterConfigurationTree>)Parameters["Child"]; }
    3030    }
    3131
     
    4343      : base() {
    4444      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic crossover operators."));
    45       Parameters.Add(new ScopeTreeLookupParameter<IValueConfiguration>("Parents", "The parent vectors which should be crossed."));
    46       ParentsParameter.ActualName = "ParameterConfigurationTree";
    47       Parameters.Add(new LookupParameter<IValueConfiguration>("Child", "The child vector resulting from the crossover."));
    48       ChildParameter.ActualName = "ParameterConfigurationTree";
     45      Parameters.Add(new ScopeTreeLookupParameter<ParameterConfigurationTree>("Parents", "The parent vectors which should be crossed."));
     46      Parameters.Add(new LookupParameter<ParameterConfigurationTree>("Child", "The child vector resulting from the crossover."));
    4947
    5048      Parameters.Add(new ValueLookupParameter<IIntValueCrossover>(MetaOptimizationProblem.IntValueCrossoverParameterName, ""));
     
    5654
    5755    public override IOperation Apply() {
    58       IValueConfiguration child1 = (IValueConfiguration)ParentsParameter.ActualValue[0].Clone();
    59       IValueConfiguration child2 = (IValueConfiguration)ParentsParameter.ActualValue[1];
     56      ParameterConfigurationTree child1 = (ParameterConfigurationTree)ParentsParameter.ActualValue[0].Clone();
     57      ParameterConfigurationTree child2 = (ParameterConfigurationTree)ParentsParameter.ActualValue[1];
    6058
    6159      //child1.Cross(child2, RandomParameter.ActualValue);
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterCombinationsEnumerator.cs

    r5144 r5184  
    1010    private IOptimizable node;
    1111    private List<IEnumerator> enumerators;
    12     IEnumerator valueEnumerator;
     12    private EnumeratorCollectionEnumerator<IItem> valueEnumerator;
     13    private bool initialized = false;
    1314
    1415    public ParameterCombinationsEnumerator(IOptimizable node) {
     
    2122    }
    2223    object IEnumerator.Current {
    23       get { return Current; }
     24      get {
     25        if (!initialized)
     26          throw new SystemException("Enumeration not started. Call MoveNext!");
     27        return Current;
     28      }
    2429    }
    2530
     
    2732
    2833    public bool MoveNext() {
    29       int i = 0;
    30       bool ok = false;
    31       while (!ok && i < enumerators.Count) {
    32         if (enumerators[i].MoveNext()) {
    33           ok = true;
     34      if (!initialized) {
     35        foreach (var enu in enumerators) {
     36          enu.Reset();
     37          if (!enu.MoveNext())
     38            return false;
     39        }
     40        initialized = true;
     41      } else {
     42        int i = 0;
     43        bool ok = false;
     44        while (!ok && i < enumerators.Count) {
     45          if (enumerators[i].MoveNext()) {
     46            ok = true;
     47          } else {
     48            i++;
     49          }
     50        }
     51
     52        if (ok) {
     53          for (int k = i - 1; k >= 0; k--) {
     54            enumerators[k].Reset();
     55            enumerators[k].MoveNext();
     56          }
    3457        } else {
    35           i++;
     58          return false;
    3659        }
    37       }
    38 
    39       if (ok) {
    40         for (int k = i - 1; k >= 0; k--) {
    41           enumerators[k].Reset();
    42           enumerators[k].MoveNext();
    43         }
    44       } else {
    45         return false;
    4660      }
    4761
     
    6175      enumerators.Clear();
    6276      valueEnumerator = null;
     77      initialized = false;
    6378
    6479      var pc = node as IParameterConfiguration;
    6580      if (pc != null) {
    66         valueEnumerator = pc.ValueConfigurations.CheckedItems.ToArray().GetEnumerator();
    67         //valueEnumerator.Reset();
    68         enumerators.Add(valueEnumerator);
     81        valueEnumerator = new EnumeratorCollectionEnumerator<IItem>();
    6982
    7083        foreach (var valueConfiguration in pc.ValueConfigurations.CheckedItems) {
     
    7285            var enumerator = new ParameterCombinationsEnumerator(valueConfiguration);
    7386            enumerator.Reset();
    74             enumerator.MoveNext();
    75             enumerators.Add(enumerator);
     87            valueEnumerator.AddEnumerator(enumerator);
     88          } else {
     89            valueEnumerator.AddEnumerator(new List<IItem> { valueConfiguration }.GetEnumerator());
    7690          }
    7791        }
     92        valueEnumerator.Reset();
     93        enumerators.Add(valueEnumerator);
    7894      }
    7995
     
    8197      if (vc != null) {
    8298        if (vc.RangeConstraint != null) {
    83           valueEnumerator = vc.RangeConstraint.GetCombinations().ToArray().GetEnumerator();
    84           //valueEnumerator.Reset();
    85           //enumerator.MoveNext();
     99          valueEnumerator = new EnumeratorCollectionEnumerator<IItem>();
     100          valueEnumerator.AddEnumerator(vc.RangeConstraint.GetCombinations().GetEnumerator());
     101          valueEnumerator.Reset();
    86102          enumerators.Add(valueEnumerator);
    87103        } else {
     
    90106              var enumerator = new ParameterCombinationsEnumerator(parameterConfiguration);
    91107              enumerator.Reset();
    92               enumerator.MoveNext();
    93108              enumerators.Add(enumerator);
    94109            }
     
    97112      }
    98113    }
     114  }
    99115
     116  /// <summary>
     117  /// Enumerator which can enumerate all elements of a list of enumerators
     118  /// </summary>
     119  /// <typeparam name="T"></typeparam>
     120  public class EnumeratorCollectionEnumerator<T> : IEnumerator<T> {
     121    private List<IEnumerator<T>> enumerators = new List<IEnumerator<T>>();
     122    private IEnumerator<IEnumerator<T>> currentEnumerator;
     123
     124    public EnumeratorCollectionEnumerator() { }
     125
     126    public void AddEnumerator(IEnumerator<T> enumerator) {
     127      enumerators.Add(enumerator);
     128    }
     129
     130    public void Dispose() {  }
     131
     132    public T Current {
     133      get { return currentEnumerator.Current.Current; }
     134    }
     135
     136    object IEnumerator.Current {
     137      get { return this.Current; }
     138    }
     139
     140    public bool MoveNext() {
     141      bool ok = currentEnumerator.Current.MoveNext();
     142      if (!ok) {
     143        ok = currentEnumerator.MoveNext();
     144        if (!ok)
     145          return false;
     146        else
     147          return this.MoveNext();
     148      }
     149      return true;
     150    }
     151
     152    public void Reset() {
     153      foreach (var enu in enumerators) {
     154        enu.Reset();
     155      }
     156      currentEnumerator = enumerators.GetEnumerator();
     157      currentEnumerator.Reset();
     158      currentEnumerator.MoveNext();
     159    }
    100160  }
    101161}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs

    r5144 r5184  
    1414  [StorableClass]
    1515  public class ParameterConfigurationTree : ValueConfiguration, IEnumerable {
    16     //[Storable]
    17     //public EngineAlgorithm Algorithm {
    18     //  get { return (EngineAlgorithm)base.ActualValue.Value; }
    19     //  set {
    20     //    base.ActualValue.Value = value;
    21     //  }
    22     //}
    23 
    2416    [Storable]
    2517    private DoubleValue bestQuality;
     
    8375      get { return runs; }
    8476      set { runs = value; }
    85      }
    86 
     77    }
     78
     79    [Storable]
    8780    protected IDictionary<string, IItem> parameters;
    8881    public IDictionary<string, IItem> Parameters {
     
    109102      : base(original, cloner) {
    110103      this.bestQuality = cloner.Clone(original.BestQuality);
     104      this.averageQuality = cloner.Clone(original.averageQuality);
     105      this.worstQuality = cloner.Clone(original.worstQuality);
     106      this.qualityStandardDeviation = cloner.Clone(original.qualityStandardDeviation);
     107      this.qualityVariance = cloner.Clone(original.qualityVariance);
     108      this.averageExecutionTime = cloner.Clone(original.averageExecutionTime);
     109      this.repetitions = cloner.Clone(original.repetitions);
     110      this.runs = cloner.Clone(original.runs);
    111111      this.parameters = new Dictionary<string, IItem>();
    112112      foreach (var p in original.parameters) {
     
    182182    }
    183183
    184     public Experiment GenerateExperiment(IAlgorithm algorithm) {
     184    public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions) {
    185185      Experiment experiment = new Experiment();
    186186      foreach (IValueConfiguration combination in this) {
    187187        IAlgorithm clonedAlg = (IAlgorithm)algorithm.Clone();
    188         clonedAlg.Name = combination.ToParameterInfoString();
     188        clonedAlg.Name = combination.ParameterInfoString;
    189189        combination.Parameterize(clonedAlg);
    190         experiment.Optimizers.Add(clonedAlg);
     190        clonedAlg.StoreAlgorithmInEachRun = false;
     191        if (createBatchRuns) {
     192          BatchRun batchRun = new BatchRun(string.Format("BatchRun: {0}", combination.ParameterInfoString));
     193          batchRun.Algorithm = clonedAlg;
     194          batchRun.Repetitions = repetitions;
     195          experiment.Optimizers.Add(batchRun);
     196        } else {
     197          experiment.Optimizers.Add(clonedAlg);
     198        }
    191199      }
    192200      return experiment;
     201    }
     202
     203    public Experiment GenerateExperiment(IAlgorithm algorithm) {
     204      return GenerateExperiment(algorithm, false, 0);
    193205    }
    194206
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs

    r5144 r5184  
    300300    }
    301301
    302     public string ToParameterInfoString() {
    303       StringBuilder sb = new StringBuilder();
    304       if (this.Optimize) {
    305         sb.Append(string.Format("{0}: {1}", parameterName, this.ActualValue.Value));
    306         //sb.Append(" (");
    307         //var subParams = new List<string>();
    308         //if (this.ActualValue.Value is IParameterizedItem) {
    309         //  subParams.Add(this.ValueConfigurations.CheckedItems.ElementAt(actualValueConfigurationIndex).ToParameterInfoString());
    310         //}
    311         //sb.Append(string.Join(", ", subParams.ToArray()));
    312         //sb.Append(")");
    313       }
    314       return sb.ToString();
     302    public string ParameterInfoString {
     303      get {
     304        StringBuilder sb = new StringBuilder();
     305        if (this.Optimize) {
     306          sb.Append(string.Format("{0}: {1}", parameterName, this.ActualValue.Value != null ? this.ActualValue.Value.ToString() : "null"));
     307
     308          if (this.ActualValue.Value is IParameterizedItem) {
     309            string subParams = this.ValueConfigurations.CheckedItems.ElementAt(actualValueConfigurationIndex).ParameterInfoString;
     310            if (!string.IsNullOrEmpty(subParams)) {
     311              sb.Append(" (");
     312              sb.Append(subParams);
     313              sb.Append(")");
     314            }
     315          }
     316        }
     317        return sb.ToString();
     318      }
    315319    }
    316320
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/DoubleValueRange.cs

    r5144 r5184  
    4444
    4545      while (value <= UpperBound.Value) {
    46         //yield return new DoubleValue(value);
    4746        solutions.Add(new DoubleValue(value));
    4847        value += StepSize.Value;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/IntValueRange.cs

    r5144 r5184  
    4444
    4545      while (value <= this.UpperBound.Value) {
    46         //yield return new IntValue(value);
    4746        solutions.Add(new IntValue(value));
    4847        value += this.StepSize.Value;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/PercentValueRange.cs

    r5144 r5184  
    3939
    4040      while (value <= UpperBound.Value) {
    41         //yield return new PercentValue(value);
    4241        solutions.Add(new PercentValue(value));
    4342        value += StepSize.Value;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs

    r5144 r5184  
    9595        RangeConstraint = new DoubleValueRange(new DoubleValue(0), (DoubleValue)value, new DoubleValue(0.01));
    9696      } else if (actualValue.ValueDataType == typeof(PercentValue)) {
    97         RangeConstraint = new PercentValueRange(new PercentValue(0), new PercentValue(1), new PercentValue(0.001));
     97        RangeConstraint = new PercentValueRange(new PercentValue(0), new PercentValue(1), new PercentValue(0.01));
    9898      } else if (actualValue.ValueDataType == typeof(BoolValue)) {
    9999        this.IsOptimizable = false; // there is nothing to configure for bools
     
    211211    }
    212212
    213     public string ToParameterInfoString() {
    214       StringBuilder sb = new StringBuilder();
    215       if (this.Optimize) {
    216         if (this.ParameterConfigurations.Count > 0) {
    217           var parameterInfos = new List<string>();
    218           foreach (var pc in this.ParameterConfigurations) {
    219             if (pc.Optimize) parameterInfos.Add(pc.ToParameterInfoString());
    220           }
    221           sb.Append(string.Join(", ", parameterInfos.ToArray()));
    222         }
    223       }
    224       return sb.ToString();
     213    public string ParameterInfoString {
     214      get {
     215        StringBuilder sb = new StringBuilder();
     216        if (this.Optimize) {
     217          if (this.ParameterConfigurations.Count > 0) {
     218            var parameterInfos = new List<string>();
     219            foreach (var pc in this.ParameterConfigurations) {
     220              if (pc.Optimize) parameterInfos.Add(pc.ParameterInfoString);
     221            }
     222            sb.Append(string.Join(", ", parameterInfos.ToArray()));
     223          }
     224        }
     225        return sb.ToString();
     226      }
    225227    }
    226228
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/ParameterConfigurationEvaluator.cs

    r5111 r5184  
    1919  public class ParameterConfigurationEvaluator : SingleSuccessorOperator, IParameterConfigurationEvaluator {
    2020    private bool algorithmStopped;
     21    private bool algorithmExceptionOccured;
    2122
    2223    public ILookupParameter<DoubleValue> QualityParameter {
     
    6970
    7071      algorithmStopped = false;
    71       algorithm.Stopped += new EventHandler(ActualValue_Stopped);
     72      algorithmExceptionOccured = false;
     73      algorithm.Stopped += new EventHandler(algorithm_Stopped);
     74      algorithm.Paused += new EventHandler(algorithm_Paused);
     75      algorithm.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(algorithm_ExceptionOccurred);
    7276
    7377      List<double> qualities = new List<double>();
     
    8589            Thread.Sleep(200); // wait for algorithm to complete; do not rely on Algorithm.ExecutionState here, because change of ExecutionState happens before Run is added (which causes problems because Algorithm might get cloned when its started already)
    8690          }
    87           qualities.Add(((DoubleValue)algorithm.Results["BestQuality"].Value).Value);
    88           executionTimes.Add(algorithm.ExecutionTime);
    8991
    90           // parameters will be stored in ParameterConfigurationTree anyway. they would be redundant in runs
    91           algorithm.Runs.Last().Parameters.Clear();
    92           // but keep the problem, since this differs in runs
    93           algorithm.Runs.Last().Parameters.Add("Problem", problem);
     92          if (algorithmExceptionOccured) {
     93            // this parametercombination was bad. set penalty for this solution
     94            qualities.Add(double.MaxValue); // todo: respect Maximization
     95            executionTimes.Add(algorithm.ExecutionTime);
     96          } else {
     97            qualities.Add(((DoubleValue)algorithm.Results["BestQuality"].Value).Value);
     98            executionTimes.Add(algorithm.ExecutionTime);
     99
     100            // parameters will be stored in ParameterConfigurationTree anyway. they would be redundant in runs
     101            algorithm.Runs.Last().Parameters.Clear();
     102            // but keep the problem, since this differs in runs
     103            algorithm.Runs.Last().Parameters.Add("Problem", problem);
     104          }
    94105          algorithmStopped = false;
     106          algorithmExceptionOccured = false;
    95107        }
    96 
    97108      }
    98109
    99 
    100       algorithm.Stopped -= new EventHandler(ActualValue_Stopped);
     110      algorithm.Stopped -= new EventHandler(algorithm_Stopped);
     111      algorithm.Paused -= new EventHandler(algorithm_Paused);
     112      algorithm.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(algorithm_ExceptionOccurred);
    101113      algorithm.Prepare();
    102114
     
    104116
    105117      ParameterConfigurationParameter.ActualValue.AverageExecutionTime = new TimeSpanValue(TimeSpan.FromMilliseconds(executionTimes.Average(t => t.TotalMilliseconds)));
    106       ParameterConfigurationParameter.ActualValue.Repetitions = Repetitions;
     118      ParameterConfigurationParameter.ActualValue.Repetitions = (IntValue)Repetitions.Clone();
    107119      ParameterConfigurationParameter.ActualValue.BestQuality = new DoubleValue(qualities.First());
    108120      ParameterConfigurationParameter.ActualValue.AverageQuality = new DoubleValue(qualities.Average());
     
    110122      ParameterConfigurationParameter.ActualValue.QualityVariance = new DoubleValue(qualities.Variance());
    111123      ParameterConfigurationParameter.ActualValue.QualityStandardDeviation = new DoubleValue(qualities.StandardDeviation());
    112       ParameterConfigurationParameter.ActualValue.Runs = algorithm.Runs;
     124      ParameterConfigurationParameter.ActualValue.Runs = (RunCollection)algorithm.Runs.Clone();
    113125
    114126      double quality = ParameterConfigurationParameter.ActualValue.AverageQuality.Value; // todo: also include other measures (executiontime, variance)
     
    116128
    117129      return base.Apply();
     130    }
     131
     132    private void algorithm_Paused(object sender, EventArgs e) {
     133      algorithmStopped = true;
     134    }
     135
     136    private void algorithm_Stopped(object sender, EventArgs e) {
     137      algorithmStopped = true;
     138    }
     139
     140    void algorithm_ExceptionOccurred(object sender, EventArgs<Exception> e) {
     141      algorithmExceptionOccured = true;
    118142    }
    119143
     
    128152    }
    129153
    130     void ActualValue_Stopped(object sender, EventArgs e) {
    131       algorithmStopped = true;
    132     }
     154
    133155  }
    134156}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj

    r5144 r5184  
    1111    <RootNamespace>HeuristicLab.Problems.MetaOptimization</RootNamespace>
    1212    <AssemblyName>HeuristicLab.Problems.MetaOptimization-3.3</AssemblyName>
    13     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
     13    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    1414    <FileAlignment>512</FileAlignment>
    1515    <TargetFrameworkProfile />
     
    147147    <Compile Include="Encoding\ValueConfigurations\ValueConfiguration.cs" />
    148148    <Compile Include="Encoding\ValueConfigurations\CheckedValueConfigurationCollection.cs" />
     149    <Compile Include="Interfaces\IParameterConfigurationCrossover.cs" />
    149150    <Compile Include="Interfaces\ICheckedValueConfigurationCollection.cs" />
    150151    <Compile Include="Operators\Crossovers\DiscreteIntValueCrossover.cs" />
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IOptimizable.cs

    r5144 r5184  
    1818    void Mutate(IRandom random, MutateDelegate mutate, ParameterConfigurationManipulator pcmanip);
    1919    void Cross(IRandom random, IOptimizable other, CrossDelegate cross, ParameterConfigurationCrossover pccross);
    20     string ToParameterInfoString();
     20    string ParameterInfoString { get; }
    2121
    2222    event EventHandler IsOptimizableChanged;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IParameterConfigurationCreator.cs

    r4839 r5184  
    22
    33namespace HeuristicLab.Problems.MetaOptimization {
    4   public interface IParameterConfigurationCreator : ISolutionCreator {
     4  public interface IParameterConfigurationCreator : ISolutionCreator, IParameterConfigurationOperator {
    55  }
    66}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IParameterConfigurationEvaluator.cs

    r5111 r5184  
    55  /// An interface which represents an evaluation operator for Meta Optimization Problems.
    66  /// </summary>
    7   public interface IParameterConfigurationEvaluator : ISingleObjectiveEvaluator { }
     7  public interface IParameterConfigurationEvaluator : ISingleObjectiveEvaluator, IParameterConfigurationOperator { }
    88}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs

    r5144 r5184  
    4040    public const string ProblemTypeParameterName = "ProblemType";
    4141    public const string ProblemsParameterName = "Problems";
    42     public const string ParameterConfigurationTreeParameterName = "ParameterConfigurationTree";
     42    public const string ParameterConfigurationTreeParameterName = "InitialParameterConfigurationTree";
    4343    public const string RepetitionsParameterName = "Repetitions";
    4444
     
    9595      set { RepetitionsParameter.Value = value; }
    9696    }
     97    private BestParameterConfigurationAnalyzer BestParameterConfigurationAnalyzer {
     98      get { return Operators.OfType<BestParameterConfigurationAnalyzer>().FirstOrDefault(); }
     99    }
    97100    #endregion
    98101
     
    101104      Parameters.Add(new ValueParameter<ISingleObjectiveProblem>(ProblemTypeParameterName, "The problem type.", new SingleObjectiveTestFunctionProblem()));
    102105      Parameters.Add(new ValueParameter<ConstrainedItemList<ISingleObjectiveProblem>>(ProblemsParameterName, "The problems that should be evaluated.", new ConstrainedItemList<ISingleObjectiveProblem>()));
    103       Parameters.Add(new ValueParameter<ParameterConfigurationTree>(ParameterConfigurationTreeParameterName, "List of algorithm parameters that should be optimized."));
     106      Parameters.Add(new ValueParameter<ParameterConfigurationTree>(ParameterConfigurationTreeParameterName, "Tree of algorithm parameters that should be optimized."));
    104107      Parameters.Add(new ValueParameter<IntValue>(RepetitionsParameterName, "The number of evaluations for each problem.", new IntValue(3)));
    105108
     
    109112      Parameters.Add(new ConstrainedValueParameter<IDoubleValueManipulator>(DoubleValueManipulatorParameterName, "", validDoubleManipulators, new NormalDoubleValueManipulator()));
    110113
    111 
    112114      Maximization = new BoolValue(false);
    113115      SolutionCreator = new RandomParameterConfigurationCreator();
     
    116118      InitializeOperators();
    117119      RegisterParameterEvents();
     120      ParameterizeAnalyzer();
    118121      ParameterizeSolutionCreator();
    119122      ParameterizeEvaluator();
     
    158161    }
    159162    private void ParameterizeAnalyzer() {
     163      if (BestParameterConfigurationAnalyzer != null) {
     164        BestParameterConfigurationAnalyzer.ParameterConfigurationParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName;
     165      }
    160166    }
    161167    private void ParameterizeOperators() {
    162      
     168      foreach (IParameterConfigurationCrossover op in Operators.OfType<IParameterConfigurationCrossover>()) {
     169        op.ParentsParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName;
     170        op.ChildParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName;
     171      }
     172      foreach (IParameterConfigurationManipulator op in Operators.OfType<IParameterConfigurationManipulator>()) {
     173        op.ParameterConfigurationTreeParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName;
     174      }
    163175    }
    164176
Note: See TracChangeset for help on using the changeset viewer.