Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13669 for trunk/sources


Ignore:
Timestamp:
03/08/16 20:10:16 (9 years ago)
Author:
gkronber
Message:

#2581: made policies storable and added iteration of best solution to results

Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression/MctsSymbolicRegressionAlgorithm.cs

    r13658 r13669  
    209209      Results.Add(new Result("Iterations", iterations));
    210210
     211      var bestSolutionIteration = new IntValue(0);
     212      Results.Add(new Result("Best solution iteration", bestSolutionIteration));
     213
    211214      var table = new DataTable("Qualities");
    212215      table.Rows.Add(new DataRow("Best quality"));
     
    261264      double bestQ = 0.0;
    262265      double curBestQ = 0.0;
    263       double q = 0.0;
    264266      int n = 0;
    265267      // Loop until iteration limit reached or canceled.
     
    267269        cancellationToken.ThrowIfCancellationRequested();
    268270
    269         q = MctsSymbolicRegressionStatic.MakeStep(state);
     271        var q = MctsSymbolicRegressionStatic.MakeStep(state);
    270272        sumQ += q; // sum of qs in the last updateinterval iterations
    271273        curBestQ = Math.Max(q, curBestQ); // the best q in the last updateinterval iterations
     
    274276        // iteration results
    275277        if (n == updateInterval) {
     278          if (bestQ > bestQuality.Value) {
     279            bestSolutionIteration.Value = i;
     280          }
    276281          bestQuality.Value = bestQ;
    277282          curQuality.Value = curBestQ;
     
    295300      // final results
    296301      if (n > 0) {
     302        if (bestQ > bestQuality.Value) {
     303          bestSolutionIteration.Value = iterations.Value + n;
     304        }
    297305        bestQuality.Value = bestQ;
    298306        curQuality.Value = curBestQ;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression/MctsSymbolicRegressionStatic.cs

    r13658 r13669  
    418418        }
    419419      }
    420       // no final state -> select a random child
     420      // no final state -> select a the first child
    421421      if (selectedChildIdx == -1) {
    422         selectedChildIdx = rand.Next(tree.children.Length);
     422        selectedChildIdx = 0;
    423423      }
    424424      return tree.children[selectedChildIdx];
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression/Policies/EpsGreedy.cs

    r13662 r13669  
    99using HeuristicLab.Data;
    1010using HeuristicLab.Parameters;
     11using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    1112
    1213namespace HeuristicLab.Algorithms.DataAnalysis.MctsSymbolicRegression.Policies {
     14  [StorableClass]
    1315  [Item("EpsilonGreedy", "Epsilon greedy policy with parameter eps to balance between exploitation and exploration")]
    1416  public class EpsilonGreedy : PolicyBase {
     
    3032    }
    3133
     34    [StorableConstructor]
     35    protected EpsilonGreedy(bool deserializing) : base(deserializing) { }
    3236    protected EpsilonGreedy(EpsilonGreedy original, Cloner cloner)
    3337      : base(original, cloner) {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression/Policies/PolicyBase.cs

    r13661 r13669  
    1616
    1717    [StorableConstructor]
    18     private PolicyBase(bool deserializing) : base(deserializing) { }
     18    protected PolicyBase(bool deserializing) : base(deserializing) { }
    1919    protected PolicyBase(PolicyBase original, Cloner cloner)
    2020      : base(original, cloner) {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression/Policies/Ucb.cs

    r13662 r13669  
    99using HeuristicLab.Data;
    1010using HeuristicLab.Parameters;
     11using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    1112
    1213namespace HeuristicLab.Algorithms.DataAnalysis.MctsSymbolicRegression.Policies {
     14  [StorableClass]
    1315  [Item("Ucb Policy", "Ucb with parameter c to balance between exploitation and exploration")]
    1416  public class Ucb : PolicyBase {
     
    3032    }
    3133
     34    [StorableConstructor]
     35    protected Ucb(bool deserializing) : base(deserializing) { }
    3236    protected Ucb(Ucb original, Cloner cloner)
    3337      : base(original, cloner) {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression/Policies/UcbTuned.cs

    r13662 r13669  
    99using HeuristicLab.Data;
    1010using HeuristicLab.Parameters;
     11using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    1112
    1213namespace HeuristicLab.Algorithms.DataAnalysis.MctsSymbolicRegression.Policies {
     14  [StorableClass]
    1315  [Item("UcbTuned Policy", "UcbTuned is similar to Ucb but tracks empirical variance. Use parameter c to balance between exploitation and exploration")]
    1416  public class UcbTuned : PolicyBase {
     
    3234    }
    3335
     36    [StorableConstructor]
     37    protected UcbTuned(bool deserializing) : base(deserializing) { }
    3438    protected UcbTuned(UcbTuned original, Cloner cloner)
    3539      : base(original, cloner) {
Note: See TracChangeset for help on using the changeset viewer.