Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/02/14 18:28:44 (9 years ago)
Author:
gkronber
Message:

#2171: minor changes while reviewing the source code for the parameter optimization problem plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.ParameterOptimization/3.3/ParameterOptimizationProblem.cs

    r10594 r11077  
    9494      : base(evaluator, new UniformRandomRealVectorCreator()) {
    9595      Parameters.Add(new FixedValueParameter<IntValue>(ProblemSizeParameterName, "The dimension of the parameter vector that is to be optimized.", new IntValue(1)));
    96       Parameters.Add(new ValueParameter<DoubleMatrix>(BoundsParameterName, "The bounds for each dimension of the parameter vector. If fewer bounds are", new DoubleMatrix(new double[,] { { 0, 100 } }, new string[] { "LowerBound", "UpperBound" })));
     96      Parameters.Add(new ValueParameter<DoubleMatrix>(BoundsParameterName, "The bounds for each dimension of the parameter vector. If the number of bounds is smaller than the problem size then the bounds are reused in a cyclic manner.", new DoubleMatrix(new double[,] { { 0, 100 } }, new string[] { "LowerBound", "UpperBound" })));
    9797      Parameters.Add(new ValueParameter<StringArray>(ParameterNamesParameterName, "The element names which are used to calculate the quality of a parameter vector.", new StringArray(new string[] { "Parameter0" })));
    9898
     
    121121    protected override void OnEvaluatorChanged() {
    122122      base.OnEvaluatorChanged();
    123       strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * ProblemSize));
    124       strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * Math.Sqrt(ProblemSize)));
    125123      UpdateParameters();
    126124    }
     
    136134      Evaluator.ParameterNamesParameter.ActualName = ParameterNamesParameter.Name;
    137135
    138       var bestSolutionAnalyzer = Operators.OfType<BestSolutionAnalyzer>().First();
    139       bestSolutionAnalyzer.ParameterVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
    140       bestSolutionAnalyzer.ParameterNamesParameter.ActualName = ParameterNamesParameter.Name;
    141 
     136      foreach (var bestSolutionAnalyzer in Operators.OfType<BestSolutionAnalyzer>()) {
     137        bestSolutionAnalyzer.ParameterVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
     138        bestSolutionAnalyzer.ParameterNamesParameter.ActualName = ParameterNamesParameter.Name;
     139      }
    142140      Bounds = new DoubleMatrix(ProblemSize, 2);
    143141      Bounds.RowNames = ParameterNames;
     
    171169        if (string.IsNullOrEmpty(ParameterNames[i])) ParameterNames[i] = "Parameter" + i;
    172170      }
     171
     172      strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * ProblemSize));
     173      strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * Math.Sqrt(ProblemSize)));
    173174    }
    174175
Note: See TracChangeset for help on using the changeset viewer.