Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/07/16 14:50:02 (8 years ago)
Author:
gkronber
Message:

#2581: extracted policies from MCTS to allow experimentation with different policies for MCTS

File:
1 edited

Legend:

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

    r13652 r13658  
    2424using System.Runtime.CompilerServices;
    2525using System.Threading;
     26using HeuristicLab.Algorithms.DataAnalysis.MctsSymbolicRegression.Policies;
    2627using HeuristicLab.Analysis;
    2728using HeuristicLab.Common;
     
    5253    private const string AllowedFactorsParameterName = "Allowed factors";
    5354    private const string ConstantOptimizationIterationsParameterName = "Iterations (constant optimization)";
    54     private const string CParameterName = "C";
     55    private const string PolicyParameterName = "Policy";
    5556    private const string SeedParameterName = "Seed";
    5657    private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
     
    7980      get { return (IFixedValueParameter<IntValue>)Parameters[ConstantOptimizationIterationsParameterName]; }
    8081    }
    81     public IFixedValueParameter<DoubleValue> CParameter {
    82       get { return (IFixedValueParameter<DoubleValue>)Parameters[CParameterName]; }
     82    public IValueParameter<IPolicy> PolicyParameter {
     83      get { return (IValueParameter<IPolicy>)Parameters[PolicyParameterName]; }
    8384    }
    8485    public IFixedValueParameter<DoubleValue> PunishmentFactorParameter {
     
    119120      set { MaxVariableReferencesParameter.Value.Value = value; }
    120121    }
    121     public double C {
    122       get { return CParameter.Value.Value; }
    123       set { CParameter.Value.Value = value; }
    124     }
    125 
     122    public IPolicy Policy {
     123      get { return PolicyParameter.Value; }
     124      set { PolicyParameter.Value = value; }
     125    }
    126126    public double PunishmentFactor {
    127127      get { return PunishmentFactorParameter.Value.Value; }
     
    173173      Parameters.Add(new FixedValueParameter<IntValue>(MaxVariablesParameterName,
    174174        "Maximal number of variables references in the symbolic regression models (multiple usages of the same variable are counted)", new IntValue(5)));
    175       Parameters.Add(new FixedValueParameter<DoubleValue>(CParameterName,
    176         "Balancing parameter in UCT formula (0 < c < 1000). Small values: greedy search. Large values: enumeration. Default: 1.0", new DoubleValue(1.0)));
     175      // Parameters.Add(new FixedValueParameter<DoubleValue>(CParameterName,
     176      //   "Balancing parameter in UCT formula (0 < c < 1000). Small values: greedy search. Large values: enumeration. Default: 1.0", new DoubleValue(1.0)));
     177      Parameters.Add(new ValueParameter<IPolicy>(PolicyParameterName,
     178        "The policy to use for selecting nodes in MCTS (e.g. Ucb)", new Ucb()));
     179      PolicyParameter.Hidden = true;
    177180      Parameters.Add(new ValueParameter<ICheckedItemList<StringValue>>(AllowedFactorsParameterName,
    178181        "Choose which expressions are allowed as factors in the model.", defaultFactorsList));
     
    244247      var problemData = (IRegressionProblemData)Problem.ProblemData.Clone();
    245248      if (!AllowedFactors.CheckedItems.Any()) throw new ArgumentException("At least on type of factor must be allowed");
    246       var state = MctsSymbolicRegressionStatic.CreateState(problemData, (uint)Seed, MaxVariableReferences, C, ScaleVariables, ConstantOptimizationIterations,
     249      var state = MctsSymbolicRegressionStatic.CreateState(problemData, (uint)Seed, MaxVariableReferences, ScaleVariables, ConstantOptimizationIterations,
     250        Policy,
    247251        lowerLimit, upperLimit,
    248252        allowProdOfVars: AllowedFactors.CheckedItems.Any(s => s.Value.Value == VariableProductFactorName),
Note: See TracChangeset for help on using the changeset viewer.