Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17214


Ignore:
Timestamp:
08/13/19 19:02:36 (5 years ago)
Author:
gkronber
Message:

#2994: support for other NLOpt analysers, display trees for constraints for debugging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Extensions/ConstrainedNLS.cs

    r17204 r17214  
    1111using HeuristicLab.Analysis;
    1212
    13 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Extensions {
     13namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
    1414  [StorableType("676B237C-DD9C-4F24-B64F-D44B0FA1F6A6")]
    1515  [Creatable(CreatableAttribute.Categories.DataAnalysisRegression, Priority = 120)]
     
    6666      Parameters.Add(new FixedValueParameter<StringValue>(ModelStructureParameterName, "The function for which the parameters must be fit (only numeric constants are tuned).", new StringValue("1.0 * x*x + 0.0")));
    6767      Parameters.Add(new FixedValueParameter<IntValue>(IterationsParameterName, "Determines how many iterations should be calculated while optimizing the constant of a symbolic expression tree (0 indicates other or default stopping criterion).", new IntValue(10)));
    68       var validSolvers = new ItemSet<StringValue>(new[] { "MMA", "COBYLA", "CCSAQ", "ISRES" }.Select(s => new StringValue(s).AsReadOnly()));
     68      var validSolvers = new ItemSet<StringValue>(new[] {
     69        "MMA",
     70        "COBYLA",
     71        "CCSAQ",
     72        "ISRES",
     73        "DIRECT_G",
     74        "NLOPT_GN_DIRECT_L",
     75        "NLOPT_GN_DIRECT_L_RAND",
     76        "NLOPT_GN_ORIG_DIRECT",
     77        "NLOPT_GN_ORIG_DIRECT_L",
     78        "NLOPT_GD_STOGO",
     79        "NLOPT_GD_STOGO_RAND",
     80        "NLOPT_LD_LBFGS_NOCEDAL",
     81        "NLOPT_LD_LBFGS",
     82        "NLOPT_LN_PRAXIS",
     83        "NLOPT_LD_VAR1",
     84        "NLOPT_LD_VAR2",
     85        "NLOPT_LD_TNEWTON",
     86        "NLOPT_LD_TNEWTON_RESTART",
     87        "NLOPT_LD_TNEWTON_PRECOND",
     88        "NLOPT_LD_TNEWTON_PRECOND_RESTART",
     89        "NLOPT_GN_CRS2_LM",
     90        "NLOPT_GN_MLSL",
     91        "NLOPT_GD_MLSL",
     92        "NLOPT_GN_MLSL_LDS",
     93        "NLOPT_GD_MLSL_LDS",
     94        "NLOPT_LN_NEWUOA",
     95        "NLOPT_LN_NEWUOA_BOUND",
     96        "NLOPT_LN_NELDERMEAD",
     97        "NLOPT_LN_SBPLX",
     98        "NLOPT_LN_AUGLAG",
     99        "NLOPT_LD_AUGLAG",
     100        "NLOPT_LN_BOBYQA",
     101        "NLOPT_AUGLAG",
     102        "NLOPT_LD_SLSQP",
     103        "NLOPT_LD_CCSAQ",
     104        "NLOPT_GN_ESCH",
     105        "NLOPT_GN_AGS",
     106      }.Select(s => new StringValue(s).AsReadOnly()));
    69107      Parameters.Add(new ConstrainedValueParameter<StringValue>(SolverParameterName, "The solver algorithm", validSolvers, validSolvers.First()));
    70108      Parameters.Add(new FixedValueParameter<DoubleValue>("FuncToleranceRel", new DoubleValue(0)));
     
    135173      if (CheckGradient) state.CheckGradient = true;
    136174      int idx = 0;
     175      var formatter = new InfixExpressionFormatter();
    137176      foreach(var constraintTree in state.constraintTrees) {
    138         Results.AddOrUpdateResult($"Constraint {idx++}", constraintTree);
     177        // HACK to remove parameter nodes which occurr multiple times
     178        var reparsedTree = parser.Parse(formatter.Format(constraintTree));
     179        Results.AddOrUpdateResult($"Constraint {idx++}", reparsedTree);
    139180      }
    140181
Note: See TracChangeset for help on using the changeset viewer.