Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9409


Ignore:
Timestamp:
04/30/13 11:11:45 (12 years ago)
Author:
gkronber
Message:

#1423:

  • removed setting of name and description in LBFGS constructor
  • changed names of placeholder operators in LBFGS
  • added parameter for gradient checking.
Location:
trunk/sources/HeuristicLab.Algorithms.GradientDescent/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.GradientDescent/3.3/Lbfgs.cs

    r9408 r9409  
    5555    private const string SeedParameterName = "Seed";
    5656    private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
     57    private const string GradientCheckStepSizeParameterName = "GradientCheckStepSize";
    5758
    5859    #region parameter properties
     
    6566    public IValueParameter<BoolValue> SetSeedRandomlyParameter {
    6667      get { return (IValueParameter<BoolValue>)Parameters[SetSeedRandomlyParameterName]; }
     68    }
     69    public IValueParameter<DoubleValue> GradientStepSizeParameter {
     70      get { return (IValueParameter<DoubleValue>)Parameters[GradientCheckStepSizeParameterName]; }
    6771    }
    6872    #endregion
     
    106110    public LbfgsAlgorithm()
    107111      : base() {
    108       this.name = ItemName;
    109       this.description = ItemDescription;
    110112
    111113      Parameters.Add(new ValueParameter<IntValue>(MaxIterationsParameterName, "The maximal number of iterations for.", new IntValue(20)));
     
    113115      Parameters.Add(new ValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    114116      Parameters.Add(new ValueParameter<BoolValue>(ApproximateGradientsParameterName, "Indicates that gradients should be approximated.", new BoolValue(true)));
    115       Parameters[ApproximateGradientsParameterName].Hidden = true; // should not be changed
     117      Parameters.Add(new OptionalValueParameter<DoubleValue>(GradientCheckStepSizeParameterName, "Step size for the gradient check (should be used for debugging the gradient calculation only)."));
     118      // these parameter should not be changed usually
     119      Parameters[ApproximateGradientsParameterName].Hidden = true;
     120      Parameters[GradientCheckStepSizeParameterName].Hidden = true;
    116121
    117122      var randomCreator = new RandomCreator();
     
    133138      randomCreator.Successor = solutionCreator;
    134139
    135       solutionCreator.Name = "Solution Creator (placeholder)";
     140      solutionCreator.Name = "(Solution Creator)";
    136141      solutionCreator.Successor = initializer;
    137142
     
    147152      branch.TrueBranch = finalAnalyzer;
    148153
    149       evaluator.Name = "Evaluator (placeholder)";
     154      evaluator.Name = "(Evaluator)";
    150155      evaluator.Successor = updateResults;
    151156
  • trunk/sources/HeuristicLab.Algorithms.GradientDescent/3.3/LbfgsInitializer.cs

    r9211 r9409  
    3838    private const string IterationsParameterName = "Iterations";
    3939    private const string ApproximateGradientsParameterName = "ApproximateGradients";
     40    private const string GradientCheckStepSizeParameterName = "GradientCheckStepSize";
    4041
    4142    #region Parameter Properties
     
    5354    public ILookupParameter<BoolValue> ApproximateGradientsParameter {
    5455      get { return (ILookupParameter<BoolValue>)Parameters[ApproximateGradientsParameterName]; }
     56    }
     57    public ILookupParameter<DoubleValue> GradientStepSizeParameter {
     58      get { return (ILookupParameter<DoubleValue>)Parameters[GradientCheckStepSizeParameterName]; }
    5559    }
    5660
     
    7478      Parameters.Add(new LookupParameter<BoolValue>(ApproximateGradientsParameterName,
    7579                                                    "Flag that indicates if gradients should be approximated."));
     80      Parameters.Add(new LookupParameter<DoubleValue>(GradientCheckStepSizeParameterName, "Step size for the gradient check (should be used for debugging the gradient calculation only)."));
    7681      // out
    7782      Parameters.Add(new LookupParameter<LbfgsState>(StateParameterName, "The state of the LM-BFGS algorithm."));
     
    9398      alglib.minlbfgs.minlbfgssetcond(state, 0.0, 0, 0, Iterations.Value);
    9499      alglib.minlbfgs.minlbfgssetxrep(state, true);
    95       // alglib.minlbfgs.minlbfgssetgradientcheck(state, 0.000001);
     100      if (GradientStepSizeParameter.ActualValue != null && GradientStepSizeParameter.ActualValue.Value > 0)
     101        alglib.minlbfgs.minlbfgssetgradientcheck(state, GradientStepSizeParameter.ActualValue.Value);
    96102
    97103      PointParameter.ActualValue = new RealVector(initialPoint);
Note: See TracChangeset for help on using the changeset viewer.