Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/07/17 15:32:26 (7 years ago)
Author:
pfleck
Message:

#1666:

  • Changed Progress interface (single parameterless ctor, overloads for Start-method).
  • Passed Impact-Calculator per ctor argument instead of virtual properties.
  • Created virtual OptimizeConstants-method instead of making the button-click event-handler virtual.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs

    r15319 r15353  
    156156      int maxIterations, bool updateVariableWeights = true,
    157157      double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue,
    158       bool updateConstantsInTree = true, Action<double[], double, int> iterationReport = null) {
     158      bool updateConstantsInTree = true, Action<double[], double, object> iterationCallback = null) {
    159159
    160160      // numeric constants in the tree become variables for constant opt
     
    210210      alglib.ndimensional_pfunc function_cx_1_func = CreatePFunc(func);
    211211      alglib.ndimensional_pgrad function_cx_1_grad = CreatePGrad(func_grad);
    212 
    213       int i = 0;
    214       var xrep = new alglib.ndimensional_rep((a, f, o) => {
    215         if (iterationReport != null) iterationReport(a, f, i++);
    216       });
     212      alglib.ndimensional_rep xrep = null;
     213      if (iterationCallback != null)
     214        xrep = new alglib.ndimensional_rep(iterationCallback);
    217215
    218216      try {
    219217        alglib.lsfitcreatefg(x, y, c, n, m, k, false, out state);
    220218        alglib.lsfitsetcond(state, 0.0, 0.0, maxIterations);
    221         alglib.lsfitsetxrep(state, iterationReport != null);
     219        alglib.lsfitsetxrep(state, iterationCallback != null);
    222220        //alglib.lsfitsetgradientcheck(state, 0.001);
    223221        alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, xrep, null);
Note: See TracChangeset for help on using the changeset viewer.