Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/16 12:16:23 (9 years ago)
Author:
pfleck
Message:

#2571:

  • Renamed SampleSize to BatchSize.
  • Fixed name of iterations in the results in operator graph.
  • Removed automatic recalculating of evaluated solutions or batch size when changing the maximum iterations.
File:
1 edited

Legend:

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

    r13679 r13680  
    6666      get { return (IFixedValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
    6767    }
    68     private IFixedValueParameter<IntValue> SampleSizeParameter {
    69       get { return (IFixedValueParameter<IntValue>)Parameters["SampleSize"]; }
     68    private IFixedValueParameter<IntValue> BatchSizeParameter {
     69      get { return (IFixedValueParameter<IntValue>)Parameters["BatchSize"]; }
    7070    }
    7171    private IFixedValueParameter<IntValue> MaximumIterationsParameter {
     
    9393      set { MaximumEvaluatedSolutionsParameter.Value.Value = value; }
    9494    }
    95     public int SampleSize {
    96       get { return SampleSizeParameter.Value.Value; }
    97       set { SampleSizeParameter.Value.Value = value; }
     95    public int BatchSize {
     96      get { return BatchSizeParameter.Value.Value; }
     97      set { BatchSizeParameter.Value.Value = value; }
    9898    }
    9999    public int MaximumIterations {
     
    151151      Parameters.Add(new FixedValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
    152152      Parameters.Add(new FixedValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    153       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>("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 });
     153      Parameters.Add(new FixedValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solutions each iteration.", new MultiAnalyzer()));
     154      Parameters.Add(new FixedValueParameter<IntValue>("MaximumEvaluatedSolutions", "The number of random solutions the algorithm should evaluate.", new IntValue(1000)));
     155      Parameters.Add(new FixedValueParameter<IntValue>("BatchSize", "The number of random solutions that are evaluated (in parallel) per iteration.", new IntValue(100)));
     156      Parameters.Add(new FixedValueParameter<IntValue>("MaximumIterations", "The number of 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
     
    166166      var evaluationsCounter = new IntCounter() { Name = "Increment EvaluatedSolutions" };
    167167      var subScopesRemover = new SubScopesRemover();
    168       var batchNumberCounter = new IntCounter() { Name = "Increment BatchNumber" };
     168      var iterationsCounter = new IntCounter() { Name = "Increment Iterations" };
    169169      var terminationOperator = new TerminationOperator();
    170170      #endregion
     
    179179      randomCreator.Successor = variableCreator;
    180180
    181       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("BatchNumber", new IntValue(0)));
     181      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
    182182      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
    183183      variableCreator.Successor = resultsCollector;
    184184
    185       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("BatchNumber", "The current batch number."));
     185      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations", "The current iteration number."));
    186186      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The current number of evaluated solutions."));
    187187      resultsCollector.Successor = solutionCreator;
    188188
    189       solutionCreator.NumberOfSolutionsParameter.ActualName = SampleSizeParameter.Name;
     189      solutionCreator.NumberOfSolutionsParameter.ActualName = BatchSizeParameter.Name;
    190190      solutionCreator.ParallelParameter.Value.Value = true;
    191191      solutionCreator.Successor = evaluationsCounter;
     
    193193      evaluationsCounter.ValueParameter.ActualName = "EvaluatedSolutions";
    194194      evaluationsCounter.Increment = null;
    195       evaluationsCounter.IncrementParameter.ActualName = SampleSizeParameter.Name;
     195      evaluationsCounter.IncrementParameter.ActualName = BatchSizeParameter.Name;
    196196      evaluationsCounter.Successor = analyzerPlaceholder;
    197197
     
    200200
    201201      subScopesRemover.RemoveAllSubScopes = true;
    202       subScopesRemover.Successor = batchNumberCounter;
    203 
    204       batchNumberCounter.ValueParameter.ActualName = "BatchNumber";
    205       batchNumberCounter.Increment = new IntValue(1);
    206       batchNumberCounter.Successor = terminationOperator;
     202      subScopesRemover.Successor = iterationsCounter;
     203
     204      iterationsCounter.ValueParameter.ActualName = "Iterations";
     205      iterationsCounter.Increment = new IntValue(1);
     206      iterationsCounter.Successor = terminationOperator;
    207207
    208208      terminationOperator.TerminatorParameter.ActualName = TerminatorParameter.Name;
     
    313313
    314314      MaximumEvaluatedSolutionsParameter.Value.ValueChanged += MaximumEvaluatedSolutions_ValueChanged;
    315       SampleSizeParameter.Value.ValueChanged += SampleSize_ValueChanged;
    316       MaximumIterationsParameter.Value.ValueChanged += MaximumIterations_ValueChanged;
     315      BatchSizeParameter.Value.ValueChanged += BatchSize_ValueChanged;
    317316    }
    318317    private void ParameterizeSolutionsCreator() {
     
    337336      if (Problem != null) {
    338337        foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
    339           op.IterationsParameter.ActualName = "BatchNumber";
     338          op.IterationsParameter.ActualName = "Iterations";
    340339          op.IterationsParameter.Hidden = true;
    341340          op.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
     
    355354    }
    356355    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;
     356      MaximumIterations = MaximumEvaluatedSolutions / BatchSize;
     357    }
     358    private void BatchSize_ValueChanged(object sender, EventArgs e) {
     359      MaximumIterations = MaximumEvaluatedSolutions / BatchSize;
    364360    }
    365361    #endregion
Note: See TracChangeset for help on using the changeset viewer.