Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/05/12 11:11:56 (12 years ago)
Author:
jkarder
Message:

#1853:

  • extracted experiment generation from encoding
  • added creators
  • added crossovers
  • added manipulators
  • added support for parameters of type IFixedValueParameter
  • minor code improvements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ParameterConfigurationTree.cs

    r8535 r8574  
    166166      get { return parameters; }
    167167      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       }
    180168    }
    181169
     
    291279      CombinationsCount = GetCombinationCount(0);
    292280    }
    293 
    294     public event EventHandler ExperimentGenerationProgressChanged;
    295     private void OnExperimentGenerationProgressChanged() {
    296       var handler = ExperimentGenerationProgressChanged;
    297       if (handler != null) handler(this, EventArgs.Empty);
    298     }
    299281    #endregion
    300282
     
    308290
    309291      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);
    350292    }
    351293
Note: See TracChangeset for help on using the changeset viewer.