Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/16 09:50:32 (9 years ago)
Author:
pfleck
Message:

#2571: Renamed some parameters to be more consistent with other algorithms.

  • Number of Samples -> Evaluated Solutions
  • Batch Size -> Sample Size
  • Number of Batches -> Iterations
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.RandomSearch/3.3/RandomSearchAlgorithm.cs

    r13580 r13677  
    3535
    3636namespace HeuristicLab.Algorithms.RandomSearch {
    37   [Item("Random Search Algorithm", "An random search algorithm.")]
     37  [Item("Random Search Algorithm (RS)", "An random search algorithm.")]
    3838  [Creatable(CreatableAttribute.Categories.Algorithms, Priority = 150)]
    3939  [StorableClass]
     
    6363      get { return (IFixedValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
    6464    }
    65     private IFixedValueParameter<IntValue> NumberOfSamplesParameter {
    66       get { return (IFixedValueParameter<IntValue>)Parameters["NumberOfSamples"]; }
    67     }
    68     private IFixedValueParameter<IntValue> BatchSizeParameter {
    69       get { return (IFixedValueParameter<IntValue>)Parameters["BatchSize"]; }
    70     }
    71     private IFixedValueParameter<IntValue> NumberOfBatchesParameter {
    72       get { return (IFixedValueParameter<IntValue>)Parameters["NumberOfBatches"]; }
     65    private IFixedValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
     66      get { return (IFixedValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
     67    }
     68    private IFixedValueParameter<IntValue> SampleSizeParameter {
     69      get { return (IFixedValueParameter<IntValue>)Parameters["SampleSize"]; }
     70    }
     71    private IFixedValueParameter<IntValue> MaximumIterationsParameter {
     72      get { return (IFixedValueParameter<IntValue>)Parameters["MaximumIterations"]; }
    7373    }
    7474    private IFixedValueParameter<MultiTerminator> TerminatorParameter {
     
    8989      get { return AnalyzerParameter.Value; }
    9090    }
    91     public int NumberOfSamples {
    92       get { return NumberOfSamplesParameter.Value.Value; }
    93       set { NumberOfSamplesParameter.Value.Value = value; }
    94     }
    95     public int BatchSize {
    96       get { return BatchSizeParameter.Value.Value; }
    97       set { BatchSizeParameter.Value.Value = value; }
    98     }
    99     public int NumberOfBatches {
    100       get { return NumberOfBatchesParameter.Value.Value; }
    101       set { NumberOfBatchesParameter.Value.Value = value; }
     91    public int MaximumEvaluatedSolutions {
     92      get { return MaximumEvaluatedSolutionsParameter.Value.Value; }
     93      set { MaximumEvaluatedSolutionsParameter.Value.Value = value; }
     94    }
     95    public int SampleSize {
     96      get { return SampleSizeParameter.Value.Value; }
     97      set { SampleSizeParameter.Value.Value = value; }
     98    }
     99    public int MaximumIterations {
     100      get { return MaximumIterationsParameter.Value.Value; }
     101      set { MaximumIterationsParameter.Value.Value = value; }
    102102    }
    103103    public MultiTerminator Terminators {
     
    152152      Parameters.Add(new FixedValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    153153      Parameters.Add(new FixedValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze all individuals from all layers combined.", new MultiAnalyzer()));
    154       Parameters.Add(new FixedValueParameter<IntValue>("NumberOfSamples", "The number of random samples the algorithm should evaluate.", new IntValue(1000)));
    155       Parameters.Add(new FixedValueParameter<IntValue>("BatchSize", "The number of random samples that are evaluated (in parallel) until they are analyzed.", new IntValue(100)));
    156       Parameters.Add(new FixedValueParameter<IntValue>("NumberOfBatches", "The number batch runs (iterations) that the algorithm will run.", new IntValue(10)) { Hidden = true });
     154      Parameters.Add(new FixedValueParameter<IntValue>("MaximumEvaluatedSolutions", "The number of random samples the algorithm should evaluate.", new IntValue(1000)));
     155      Parameters.Add(new FixedValueParameter<IntValue>("SampleSize", "The number of random samples that are evaluated (in parallel) per iteration.", new IntValue(100)));
     156      Parameters.Add(new FixedValueParameter<IntValue>("MaximumIterations", "The number iterations that the algorithm will run.", new IntValue(10)) { Hidden = true });
    157157      Parameters.Add(new FixedValueParameter<MultiTerminator>("Terminator", "The termination criteria that defines if the algorithm should continue or stop.", new MultiTerminator()) { Hidden = true });
    158158      #endregion
     
    187187      resultsCollector.Successor = solutionCreator;
    188188
    189       solutionCreator.NumberOfSolutionsParameter.ActualName = BatchSizeParameter.Name;
     189      solutionCreator.NumberOfSolutionsParameter.ActualName = SampleSizeParameter.Name;
    190190      solutionCreator.ParallelParameter.Value.Value = true;
    191191      solutionCreator.Successor = evaluationsCounter;
     
    193193      evaluationsCounter.ValueParameter.ActualName = "EvaluatedSolutions";
    194194      evaluationsCounter.Increment = null;
    195       evaluationsCounter.IncrementParameter.ActualName = BatchSizeParameter.Name;
     195      evaluationsCounter.IncrementParameter.ActualName = SampleSizeParameter.Name;
    196196      evaluationsCounter.Successor = analyzerPlaceholder;
    197197
     
    215215
    216216      #region Create terminators
    217       evaluationsTerminator = new ComparisonTerminator<IntValue>("EvaluatedSolutions", ComparisonType.Less, NumberOfSamplesParameter) { Name = "Number of Samples" };
     217      evaluationsTerminator = new ComparisonTerminator<IntValue>("EvaluatedSolutions", ComparisonType.Less, MaximumEvaluatedSolutionsParameter) { Name = "Evaluated solutions." };
    218218      qualityTerminator = new SingleObjectiveQualityTerminator() { Name = "Quality" };
    219219      executionTimeTerminator = new ExecutionTimeTerminator(this, new TimeSpanValue(TimeSpan.FromMinutes(5)));
     
    312312      singleObjectiveQualityAnalyzer.CurrentBestQualityParameter.NameChanged += QualityAnalyzer_CurrentBestQualityParameter_NameChanged;
    313313
    314       NumberOfSamplesParameter.Value.ValueChanged += NumberOfSamples_ValueChanged;
    315       BatchSizeParameter.Value.ValueChanged += BatchSize_ValueChanged;
    316       NumberOfBatchesParameter.Value.ValueChanged += NumberOfBatches_ValueChanged;
     314      MaximumEvaluatedSolutionsParameter.Value.ValueChanged += MaximumEvaluatedSolutions_ValueChanged;
     315      SampleSizeParameter.Value.ValueChanged += SampleSize_ValueChanged;
     316      MaximumIterationsParameter.Value.ValueChanged += MaximumIterations_ValueChanged;
    317317    }
    318318    private void ParameterizeSolutionsCreator() {
     
    339339          op.IterationsParameter.ActualName = "BatchNumber";
    340340          op.IterationsParameter.Hidden = true;
    341           op.MaximumIterationsParameter.ActualName = NumberOfBatchesParameter.Name;
     341          op.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
    342342        }
    343343      }
     
    354354      }
    355355    }
    356     private void NumberOfSamples_ValueChanged(object sender, EventArgs e) {
    357       NumberOfBatches = NumberOfSamples / BatchSize;
    358     }
    359     private void BatchSize_ValueChanged(object sender, EventArgs e) {
    360       NumberOfBatches = NumberOfSamples / BatchSize;
    361     }
    362     private void NumberOfBatches_ValueChanged(object sender, EventArgs e) {
    363       BatchSize = NumberOfSamples / NumberOfBatches;
     356    private void MaximumEvaluatedSolutions_ValueChanged(object sender, EventArgs e) {
     357      MaximumIterations = MaximumEvaluatedSolutions / SampleSize;
     358    }
     359    private void SampleSize_ValueChanged(object sender, EventArgs e) {
     360      MaximumIterations = MaximumEvaluatedSolutions / SampleSize;
     361    }
     362    private void MaximumIterations_ValueChanged(object sender, EventArgs e) {
     363      SampleSize = MaximumEvaluatedSolutions / MaximumIterations;
    364364    }
    365365    #endregion
Note: See TracChangeset for help on using the changeset viewer.