Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/10/17 13:49:26 (7 years ago)
Author:
pfleck
Message:

#1666 Made constant optimization and impact/replacement-values calculation async and added progress indication.

File:
1 edited

Legend:

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

    r14951 r15319  
    156156      int maxIterations, bool updateVariableWeights = true,
    157157      double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue,
    158       bool updateConstantsInTree = true) {
     158      bool updateConstantsInTree = true, Action<double[], double, int> iterationReport = null) {
    159159
    160160      // numeric constants in the tree become variables for constant opt
     
    211211      alglib.ndimensional_pgrad function_cx_1_grad = CreatePGrad(func_grad);
    212212
     213      int i = 0;
     214      var xrep = new alglib.ndimensional_rep((a, f, o) => {
     215        if (iterationReport != null) iterationReport(a, f, i++);
     216      });
     217
    213218      try {
    214219        alglib.lsfitcreatefg(x, y, c, n, m, k, false, out state);
    215220        alglib.lsfitsetcond(state, 0.0, 0.0, maxIterations);
     221        alglib.lsfitsetxrep(state, iterationReport != null);
    216222        //alglib.lsfitsetgradientcheck(state, 0.001);
    217         alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, null, null);
     223        alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, xrep, null);
    218224        alglib.lsfitresults(state, out retVal, out c, out rep);
    219       }
    220       catch (ArithmeticException) {
     225      } catch (ArithmeticException) {
    221226        return originalQuality;
    222       }
    223       catch (alglib.alglibexception) {
     227      } catch (alglib.alglibexception) {
    224228        return originalQuality;
    225229      }
Note: See TracChangeset for help on using the changeset viewer.