Changeset 8574
- Timestamp:
- 09/05/12 11:11:56 (12 years ago)
- Location:
- branches/ParameterConfigurationEncoding
- Files:
-
- 40 added
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/CreateExperimentDialogV2.cs
r8535 r8574 37 37 public partial class CreateExperimentDialogV2 : Form { 38 38 private readonly IAlgorithm algorithm; 39 private readonly ExperimentFactory experimentFactory; 39 40 private readonly Progress progress; 40 41 private ParameterConfigurationTree parameterConfigurationTree; … … 69 70 progress.CancelRequested += (sender, args) => cts.Cancel(); 70 71 progress.ProgressValueChanged += (sender, args) => progress.Status = string.Format("Generating experiment. Please be patient. ({0} %)", (int)(progress.ProgressValue * 100)); 72 experimentFactory = new ExperimentFactory(); 71 73 cts = new CancellationTokenSource(); 72 74 } … … 92 94 if (algorithm.Problem != null) { 93 95 parameterConfigurationTreeView.Content = parameterConfigurationTree = new ParameterConfigurationTree(algorithm, algorithm.Problem); 94 parameterConfigurationTree.ExperimentGenerationProgressChanged += (o, args) => progress.ProgressValue = parameterConfigurationTree.ExperimentGenerationProgress;95 96 parameterConfigurationTree.CombinationsCountChanged += (o, args) => UpdateCombinationsCount(); 97 experimentFactory.ExperimentGenerationProgressChanged += (o, args) => progress.ProgressValue = experimentFactory.ExperimentGenerationProgress; 96 98 new ProgressView(parameterConfigurationTreeView, progress) { CancelTimeoutMs = 10000 }; 97 99 } else { … … 172 174 if (engineAlgorithm != null) engineAlgorithm.Engine = engine; 173 175 try { 174 Experiment = createBatchRun ? parameterConfigurationTree.GenerateExperiment(engineAlgorithm, true, repetitions, selectedProblemInstanceProviders, cts.Token)175 : parameterConfigurationTree.GenerateExperiment(engineAlgorithm, false, 0, selectedProblemInstanceProviders, cts.Token);176 Experiment = createBatchRun ? experimentFactory.GenerateExperiment(engineAlgorithm, parameterConfigurationTree, true, repetitions, selectedProblemInstanceProviders, cts.Token) 177 : experimentFactory.GenerateExperiment(engineAlgorithm, parameterConfigurationTree, false, 0, selectedProblemInstanceProviders, cts.Token); 176 178 } 177 179 finally { FinishProgressView(); } -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/HeuristicLab.Encodings.ParameterConfigurationEncoding-3.3.csproj
r8524 r8574 58 58 <Private>False</Private> 59 59 </Reference> 60 <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 61 <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 60 62 <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4"> 61 63 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath> 62 64 <Private>False</Private> 63 65 </Reference> 66 <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 64 67 <Reference Include="HeuristicLab.Optimization-3.3"> 65 68 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath> … … 78 81 <Private>False</Private> 79 82 </Reference> 83 <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 80 84 <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4"> 81 85 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath> … … 85 89 <Private>False</Private> 86 90 </Reference> 91 <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 92 <Reference Include="Microsoft.CSharp" /> 87 93 <Reference Include="System" /> 88 94 <Reference Include="System.Core" /> … … 94 100 <Compile Include="AlgorithmProblemItem.cs" /> 95 101 <None Include="Plugin.cs.frame" /> 96 <Compile Include="ConstrainedItemList.cs" /> 97 <Compile Include="ConstrainedTypeValue.cs" /> 102 <Compile Include="Creators\RandomParameterConfigurationCreator.cs" /> 103 <Compile Include="Crossovers\ParameterConfigurationCrossover.cs" /> 104 <Compile Include="ExperimentFactory.cs" /> 98 105 <Compile Include="Interfaces\ICheckedValueConfigurationCollection.cs" /> 99 106 <Compile Include="Interfaces\IOptimizable.cs" /> 100 107 <Compile Include="Interfaces\IParameterConfiguration.cs" /> 108 <Compile Include="Interfaces\IParameterConfigurationCreator.cs" /> 109 <Compile Include="Interfaces\IParameterConfigurationCrossover.cs" /> 110 <Compile Include="Interfaces\IParameterConfigurationEvaluator.cs" /> 111 <Compile Include="Interfaces\IParameterConfigurationManipulator.cs" /> 112 <Compile Include="Interfaces\IParameterConfigurationOperator.cs" /> 101 113 <Compile Include="Interfaces\IRange.cs" /> 102 114 <Compile Include="Interfaces\IValueConfiguration.cs" /> 115 <Compile Include="Manipulators\ParameterConfigurationAllPositionsManipulator.cs" /> 116 <Compile Include="Manipulators\ParameterConfigurationManipulator.cs" /> 117 <Compile Include="Manipulators\ParameterConfigurationOnePositionsManipulator.cs" /> 103 118 <Compile Include="NullValue.cs" /> 119 <Compile Include="Operators\Crossovers\DoubleValue\AverageDoubleValueCrossover.cs" /> 120 <Compile Include="Operators\Crossovers\DoubleValue\DiscreteDoubleValueCrossover.cs" /> 121 <Compile Include="Operators\Crossovers\DoubleValue\NormalDoubleValueCrossover.cs" /> 122 <Compile Include="Operators\Crossovers\IntValue\AverageIntValueCrossover.cs" /> 123 <Compile Include="Operators\Crossovers\IntValue\DiscreteIntValueCrossover.cs" /> 124 <Compile Include="Operators\Crossovers\IntValue\MultiIntValueCrossover.cs" /> 125 <Compile Include="Operators\Crossovers\IntValue\NormalIntValueCrossover.cs" /> 126 <Compile Include="Operators\Interfaces\IDoubleValueCrossover.cs" /> 127 <Compile Include="Operators\Interfaces\IDoubleValueManipulator.cs" /> 128 <Compile Include="Operators\Interfaces\IIntValueCrossover.cs" /> 129 <Compile Include="Operators\Interfaces\IIntValueManipulator.cs" /> 130 <Compile Include="Operators\Interfaces\IValueManipulator.cs" /> 131 <Compile Include="Operators\Manipulators\DoubleValue\NormalDoubleValueManipulator.cs" /> 132 <Compile Include="Operators\Manipulators\DoubleValue\UniformDoubleValueManipulator.cs" /> 133 <Compile Include="Operators\Manipulators\IntValue\NormalIntValueManipulator.cs" /> 134 <Compile Include="Operators\Manipulators\IntValue\UniformIntValueManipulator.cs" /> 104 135 <Compile Include="ParameterCombinationsEnumerator.cs" /> 105 136 <Compile Include="ParameterConfigurations\ParameterConfiguration.cs" /> … … 126 157 <None Include="HeuristicLab.snk" /> 127 158 </ItemGroup> 128 <ItemGroup /> 159 <ItemGroup> 160 <Folder Include="Operators\Crossovers\SymbolicExpressionGrammar\" /> 161 </ItemGroup> 129 162 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 130 163 <PropertyGroup> -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Interfaces/IRange.cs
r8517 r8574 42 42 } 43 43 44 public interface IRange<T> : IRange , IItemwhere T : class {44 public interface IRange<T> : IRange where T : class { 45 45 new T LowerBound { get; set; } 46 46 new T UpperBound { get; set; } -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ParameterConfigurationTree.cs
r8535 r8574 166 166 get { return parameters; } 167 167 set { parameters = value; } 168 }169 170 [Storable]171 private double experimentGenerationProgress;172 public double ExperimentGenerationProgress {173 get { return experimentGenerationProgress; }174 private set {175 if (experimentGenerationProgress != value) {176 experimentGenerationProgress = value;177 OnExperimentGenerationProgressChanged();178 }179 }180 168 } 181 169 … … 291 279 CombinationsCount = GetCombinationCount(0); 292 280 } 293 294 public event EventHandler ExperimentGenerationProgressChanged;295 private void OnExperimentGenerationProgressChanged() {296 var handler = ExperimentGenerationProgressChanged;297 if (handler != null) handler(this, EventArgs.Empty);298 }299 281 #endregion 300 282 … … 308 290 309 291 algorithm.CollectParameterValues(this.Parameters); 310 }311 312 public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions, Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>> problemInstances, CancellationToken ct) {313 Experiment experiment = new Experiment();314 var algorithms = new List<IAlgorithm>(1 + problemInstances.Values.Count) { (IAlgorithm)algorithm.Clone() };315 foreach (var provider in problemInstances) {316 foreach (var descriptor in provider.Value) {317 var alg = (IAlgorithm)algorithm.Clone();318 ProblemInstanceManager.LoadData(provider.Key, descriptor, (IProblemInstanceConsumer)alg.Problem);319 algorithms.Add(alg);320 }321 }322 ExperimentGenerationProgress = 0;323 foreach (var alg in algorithms) {324 foreach (ParameterizedValueConfiguration combination in this) {325 ct.ThrowIfCancellationRequested();326 var clonedAlg = (IAlgorithm)alg.Clone();327 clonedAlg.Name = combination.ParameterInfoString;328 combination.Parameterize(clonedAlg);329 clonedAlg.StoreAlgorithmInEachRun = false;330 if (createBatchRuns) {331 BatchRun batchRun = new BatchRun(string.Format("BatchRun: {0}", combination.ParameterInfoString));332 batchRun.Optimizer = clonedAlg;333 batchRun.Repetitions = repetitions;334 experiment.Optimizers.Add(batchRun);335 } else {336 experiment.Optimizers.Add(clonedAlg);337 }338 ExperimentGenerationProgress = (double)experiment.Optimizers.Count / (this.GetCombinationCount(0) * algorithms.Count);339 }340 }341 return experiment;342 }343 344 public Experiment GenerateExperiment(IAlgorithm algorithm) {345 return GenerateExperiment(algorithm, false, 0, null, CancellationToken.None);346 }347 348 public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions) {349 return GenerateExperiment(algorithm, createBatchRuns, repetitions, null, CancellationToken.None);350 292 } 351 293 -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ParameterConfigurations/ParameterConfiguration.cs
r8535 r8574 573 573 } 574 574 } 575 575 576 var clonedValue = this.ActualValue.Value != null ? (IItem)this.ActualValue.Value.Clone() : null; 576 577 if (clonedValue != null) AdaptValidValues(parameter, clonedValue); 577 parameter.Value = clonedValue; 578 579 if (!(parameter is IFixedValueParameter)) { 580 parameter.Value = clonedValue; 581 } else { 582 var original = (dynamic)parameter.Value; 583 var clone = (dynamic)clonedValue; 584 if (typeof(ValueTypeValue<>).IsAssignableFrom(parameter.DataType) && !original.ReadOnly) { 585 original.Value = clone.Value; 586 } else if (typeof(ValueTypeArray<>).IsAssignableFrom(parameter.DataType) && !original.ReadOnly) { 587 for (int i = 0; i < original.Length; i++) 588 original[i] = clone[i]; 589 } else if (typeof(ValueTypeMatrix<>).IsAssignableFrom(parameter.DataType) && !original.ReadOnly) { 590 for (int i = 0; i < original.Rows; i++) 591 for (int j = 0; j < original.Columns; j++) 592 original[i, j] = clone[i, j]; 593 } // StringConvertibleValueTuple<,> not supported 594 } 578 595 } 579 596 -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Plugin.cs.frame
r8524 r8574 33 33 [PluginDependency("HeuristicLab.Core", "3.3")] 34 34 [PluginDependency("HeuristicLab.Data", "3.3")] 35 [PluginDependency("HeuristicLab.Encodings.IntegerVectorEncoding", "3.3")] 36 [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")] 35 37 [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")] 38 [PluginDependency("HeuristicLab.Operators", "3.3")] 36 39 [PluginDependency("HeuristicLab.Optimization", "3.3")] 37 40 [PluginDependency("HeuristicLab.Parameters", "3.3")] 38 41 [PluginDependency("HeuristicLab.Persistence", "3.3")] 42 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")] 39 43 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")] 40 44 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 45 [PluginDependency("HeuristicLab.Random", "3.3")] 41 46 public class HeuristicLabEncodingsParameterConfigurationEncodingPlugin : PluginBase { 42 47 } -
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/RangeConstraints/Range.cs
r8535 r8574 219 219 errorMessage = "Could not parse range."; return false; 220 220 } 221 222 221 if (lowerBound.SetValue(parts2[0]) && 223 222 upperBound.SetValue(parts2[1]) &&
Note: See TracChangeset
for help on using the changeset viewer.