- Timestamp:
- 12/30/10 22:50:59 (14 years ago)
- 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 21 21 } 22 22 public ILookupParameter<ParameterConfigurationTree> InitialParameterConfigurationParameter { 23 get { return (ILookupParameter<ParameterConfigurationTree>)Parameters[ "InitialParameterConfigurationTree"]; }23 get { return (ILookupParameter<ParameterConfigurationTree>)Parameters[MetaOptimizationProblem.ParameterConfigurationTreeParameterName]; } 24 24 } 25 25 26 public I LookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter {27 get { return (I LookupParameter<ParameterConfigurationTree>)Parameters["ParameterConfigurationTree"]; }26 public IValueLookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter { 27 get { return (IValueLookupParameter<ParameterConfigurationTree>)Parameters["ParameterConfigurationTreeSolutionCandidate"]; } 28 28 } 29 29 … … 33 33 public RandomParameterConfigurationCreator() : base() { 34 34 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.")); 37 37 } 38 38 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/Crossovers/ParameterConfigurationCrossover.cs
r5112 r5184 15 15 [Item("ParameterConfigurationCrossover", "TODO")] 16 16 [StorableClass] 17 public class ParameterConfigurationCrossover : SingleSuccessorOperator, IParameterConfigurationOperator, I Crossover {17 public class ParameterConfigurationCrossover : SingleSuccessorOperator, IParameterConfigurationOperator, IParameterConfigurationCrossover { 18 18 public override bool CanChangeName { 19 19 get { return false; } … … 23 23 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 24 24 } 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"]; } 27 27 } 28 public ILookupParameter< IValueConfiguration> ChildParameter {29 get { return (ILookupParameter< IValueConfiguration>)Parameters["Child"]; }28 public ILookupParameter<ParameterConfigurationTree> ChildParameter { 29 get { return (ILookupParameter<ParameterConfigurationTree>)Parameters["Child"]; } 30 30 } 31 31 … … 43 43 : base() { 44 44 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.")); 49 47 50 48 Parameters.Add(new ValueLookupParameter<IIntValueCrossover>(MetaOptimizationProblem.IntValueCrossoverParameterName, "")); … … 56 54 57 55 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]; 60 58 61 59 //child1.Cross(child2, RandomParameter.ActualValue); -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterCombinationsEnumerator.cs
r5144 r5184 10 10 private IOptimizable node; 11 11 private List<IEnumerator> enumerators; 12 IEnumerator valueEnumerator; 12 private EnumeratorCollectionEnumerator<IItem> valueEnumerator; 13 private bool initialized = false; 13 14 14 15 public ParameterCombinationsEnumerator(IOptimizable node) { … … 21 22 } 22 23 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 } 24 29 } 25 30 … … 27 32 28 33 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 } 34 57 } else { 35 i++;58 return false; 36 59 } 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;46 60 } 47 61 … … 61 75 enumerators.Clear(); 62 76 valueEnumerator = null; 77 initialized = false; 63 78 64 79 var pc = node as IParameterConfiguration; 65 80 if (pc != null) { 66 valueEnumerator = pc.ValueConfigurations.CheckedItems.ToArray().GetEnumerator(); 67 //valueEnumerator.Reset(); 68 enumerators.Add(valueEnumerator); 81 valueEnumerator = new EnumeratorCollectionEnumerator<IItem>(); 69 82 70 83 foreach (var valueConfiguration in pc.ValueConfigurations.CheckedItems) { … … 72 85 var enumerator = new ParameterCombinationsEnumerator(valueConfiguration); 73 86 enumerator.Reset(); 74 enumerator.MoveNext(); 75 enumerators.Add(enumerator); 87 valueEnumerator.AddEnumerator(enumerator); 88 } else { 89 valueEnumerator.AddEnumerator(new List<IItem> { valueConfiguration }.GetEnumerator()); 76 90 } 77 91 } 92 valueEnumerator.Reset(); 93 enumerators.Add(valueEnumerator); 78 94 } 79 95 … … 81 97 if (vc != null) { 82 98 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(); 86 102 enumerators.Add(valueEnumerator); 87 103 } else { … … 90 106 var enumerator = new ParameterCombinationsEnumerator(parameterConfiguration); 91 107 enumerator.Reset(); 92 enumerator.MoveNext();93 108 enumerators.Add(enumerator); 94 109 } … … 97 112 } 98 113 } 114 } 99 115 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 } 100 160 } 101 161 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs
r5144 r5184 14 14 [StorableClass] 15 15 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 24 16 [Storable] 25 17 private DoubleValue bestQuality; … … 83 75 get { return runs; } 84 76 set { runs = value; } 85 } 86 77 } 78 79 [Storable] 87 80 protected IDictionary<string, IItem> parameters; 88 81 public IDictionary<string, IItem> Parameters { … … 109 102 : base(original, cloner) { 110 103 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); 111 111 this.parameters = new Dictionary<string, IItem>(); 112 112 foreach (var p in original.parameters) { … … 182 182 } 183 183 184 public Experiment GenerateExperiment(IAlgorithm algorithm ) {184 public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions) { 185 185 Experiment experiment = new Experiment(); 186 186 foreach (IValueConfiguration combination in this) { 187 187 IAlgorithm clonedAlg = (IAlgorithm)algorithm.Clone(); 188 clonedAlg.Name = combination. ToParameterInfoString();188 clonedAlg.Name = combination.ParameterInfoString; 189 189 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 } 191 199 } 192 200 return experiment; 201 } 202 203 public Experiment GenerateExperiment(IAlgorithm algorithm) { 204 return GenerateExperiment(algorithm, false, 0); 193 205 } 194 206 -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r5144 r5184 300 300 } 301 301 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 } 315 319 } 316 320 -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/DoubleValueRange.cs
r5144 r5184 44 44 45 45 while (value <= UpperBound.Value) { 46 //yield return new DoubleValue(value);47 46 solutions.Add(new DoubleValue(value)); 48 47 value += StepSize.Value; -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/IntValueRange.cs
r5144 r5184 44 44 45 45 while (value <= this.UpperBound.Value) { 46 //yield return new IntValue(value);47 46 solutions.Add(new IntValue(value)); 48 47 value += this.StepSize.Value; -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/PercentValueRange.cs
r5144 r5184 39 39 40 40 while (value <= UpperBound.Value) { 41 //yield return new PercentValue(value);42 41 solutions.Add(new PercentValue(value)); 43 42 value += StepSize.Value; -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs
r5144 r5184 95 95 RangeConstraint = new DoubleValueRange(new DoubleValue(0), (DoubleValue)value, new DoubleValue(0.01)); 96 96 } else if (actualValue.ValueDataType == typeof(PercentValue)) { 97 RangeConstraint = new PercentValueRange(new PercentValue(0), new PercentValue(1), new PercentValue(0.0 01));97 RangeConstraint = new PercentValueRange(new PercentValue(0), new PercentValue(1), new PercentValue(0.01)); 98 98 } else if (actualValue.ValueDataType == typeof(BoolValue)) { 99 99 this.IsOptimizable = false; // there is nothing to configure for bools … … 211 211 } 212 212 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 } 225 227 } 226 228 -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/ParameterConfigurationEvaluator.cs
r5111 r5184 19 19 public class ParameterConfigurationEvaluator : SingleSuccessorOperator, IParameterConfigurationEvaluator { 20 20 private bool algorithmStopped; 21 private bool algorithmExceptionOccured; 21 22 22 23 public ILookupParameter<DoubleValue> QualityParameter { … … 69 70 70 71 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); 72 76 73 77 List<double> qualities = new List<double>(); … … 85 89 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) 86 90 } 87 qualities.Add(((DoubleValue)algorithm.Results["BestQuality"].Value).Value);88 executionTimes.Add(algorithm.ExecutionTime);89 91 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 } 94 105 algorithmStopped = false; 106 algorithmExceptionOccured = false; 95 107 } 96 97 108 } 98 109 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); 101 113 algorithm.Prepare(); 102 114 … … 104 116 105 117 ParameterConfigurationParameter.ActualValue.AverageExecutionTime = new TimeSpanValue(TimeSpan.FromMilliseconds(executionTimes.Average(t => t.TotalMilliseconds))); 106 ParameterConfigurationParameter.ActualValue.Repetitions = Repetitions;118 ParameterConfigurationParameter.ActualValue.Repetitions = (IntValue)Repetitions.Clone(); 107 119 ParameterConfigurationParameter.ActualValue.BestQuality = new DoubleValue(qualities.First()); 108 120 ParameterConfigurationParameter.ActualValue.AverageQuality = new DoubleValue(qualities.Average()); … … 110 122 ParameterConfigurationParameter.ActualValue.QualityVariance = new DoubleValue(qualities.Variance()); 111 123 ParameterConfigurationParameter.ActualValue.QualityStandardDeviation = new DoubleValue(qualities.StandardDeviation()); 112 ParameterConfigurationParameter.ActualValue.Runs = algorithm.Runs;124 ParameterConfigurationParameter.ActualValue.Runs = (RunCollection)algorithm.Runs.Clone(); 113 125 114 126 double quality = ParameterConfigurationParameter.ActualValue.AverageQuality.Value; // todo: also include other measures (executiontime, variance) … … 116 128 117 129 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; 118 142 } 119 143 … … 128 152 } 129 153 130 void ActualValue_Stopped(object sender, EventArgs e) { 131 algorithmStopped = true; 132 } 154 133 155 } 134 156 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj
r5144 r5184 11 11 <RootNamespace>HeuristicLab.Problems.MetaOptimization</RootNamespace> 12 12 <AssemblyName>HeuristicLab.Problems.MetaOptimization-3.3</AssemblyName> 13 <TargetFrameworkVersion>v 3.5</TargetFrameworkVersion>13 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 14 14 <FileAlignment>512</FileAlignment> 15 15 <TargetFrameworkProfile /> … … 147 147 <Compile Include="Encoding\ValueConfigurations\ValueConfiguration.cs" /> 148 148 <Compile Include="Encoding\ValueConfigurations\CheckedValueConfigurationCollection.cs" /> 149 <Compile Include="Interfaces\IParameterConfigurationCrossover.cs" /> 149 150 <Compile Include="Interfaces\ICheckedValueConfigurationCollection.cs" /> 150 151 <Compile Include="Operators\Crossovers\DiscreteIntValueCrossover.cs" /> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IOptimizable.cs
r5144 r5184 18 18 void Mutate(IRandom random, MutateDelegate mutate, ParameterConfigurationManipulator pcmanip); 19 19 void Cross(IRandom random, IOptimizable other, CrossDelegate cross, ParameterConfigurationCrossover pccross); 20 string ToParameterInfoString();20 string ParameterInfoString { get; } 21 21 22 22 event EventHandler IsOptimizableChanged; -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IParameterConfigurationCreator.cs
r4839 r5184 2 2 3 3 namespace HeuristicLab.Problems.MetaOptimization { 4 public interface IParameterConfigurationCreator : ISolutionCreator {4 public interface IParameterConfigurationCreator : ISolutionCreator, IParameterConfigurationOperator { 5 5 } 6 6 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IParameterConfigurationEvaluator.cs
r5111 r5184 5 5 /// An interface which represents an evaluation operator for Meta Optimization Problems. 6 6 /// </summary> 7 public interface IParameterConfigurationEvaluator : ISingleObjectiveEvaluator {}7 public interface IParameterConfigurationEvaluator : ISingleObjectiveEvaluator, IParameterConfigurationOperator { } 8 8 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs
r5144 r5184 40 40 public const string ProblemTypeParameterName = "ProblemType"; 41 41 public const string ProblemsParameterName = "Problems"; 42 public const string ParameterConfigurationTreeParameterName = " ParameterConfigurationTree";42 public const string ParameterConfigurationTreeParameterName = "InitialParameterConfigurationTree"; 43 43 public const string RepetitionsParameterName = "Repetitions"; 44 44 … … 95 95 set { RepetitionsParameter.Value = value; } 96 96 } 97 private BestParameterConfigurationAnalyzer BestParameterConfigurationAnalyzer { 98 get { return Operators.OfType<BestParameterConfigurationAnalyzer>().FirstOrDefault(); } 99 } 97 100 #endregion 98 101 … … 101 104 Parameters.Add(new ValueParameter<ISingleObjectiveProblem>(ProblemTypeParameterName, "The problem type.", new SingleObjectiveTestFunctionProblem())); 102 105 Parameters.Add(new ValueParameter<ConstrainedItemList<ISingleObjectiveProblem>>(ProblemsParameterName, "The problems that should be evaluated.", new ConstrainedItemList<ISingleObjectiveProblem>())); 103 Parameters.Add(new ValueParameter<ParameterConfigurationTree>(ParameterConfigurationTreeParameterName, " Listof algorithm parameters that should be optimized."));106 Parameters.Add(new ValueParameter<ParameterConfigurationTree>(ParameterConfigurationTreeParameterName, "Tree of algorithm parameters that should be optimized.")); 104 107 Parameters.Add(new ValueParameter<IntValue>(RepetitionsParameterName, "The number of evaluations for each problem.", new IntValue(3))); 105 108 … … 109 112 Parameters.Add(new ConstrainedValueParameter<IDoubleValueManipulator>(DoubleValueManipulatorParameterName, "", validDoubleManipulators, new NormalDoubleValueManipulator())); 110 113 111 112 114 Maximization = new BoolValue(false); 113 115 SolutionCreator = new RandomParameterConfigurationCreator(); … … 116 118 InitializeOperators(); 117 119 RegisterParameterEvents(); 120 ParameterizeAnalyzer(); 118 121 ParameterizeSolutionCreator(); 119 122 ParameterizeEvaluator(); … … 158 161 } 159 162 private void ParameterizeAnalyzer() { 163 if (BestParameterConfigurationAnalyzer != null) { 164 BestParameterConfigurationAnalyzer.ParameterConfigurationParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName; 165 } 160 166 } 161 167 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 } 163 175 } 164 176
Note: See TracChangeset
for help on using the changeset viewer.