[17737] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 |
|
---|
| 4 | namespace HeuristicLab.Algorithms.DataAnalysis.FastFunctionExtraction {
|
---|
| 5 | internal struct Approach {
|
---|
| 6 | public bool AllowInter { get; set; }
|
---|
| 7 | public bool AllowDenom { get; set; }
|
---|
| 8 | public bool AllowExp { get; set; }
|
---|
| 9 | public bool AllowNonlinFuncs { get; set; }
|
---|
| 10 | public bool AllowHinge { get; set; }
|
---|
| 11 | public HashSet<double> Exponents { get; set; }
|
---|
| 12 | public HashSet<NonlinearOperator> NonlinFuncs { get; set; }
|
---|
| 13 | public double MinHingeThr { get; set; }
|
---|
| 14 | public double MaxHingeThr { get; set; }
|
---|
| 15 | public int NumHingeThrs { get; set; }
|
---|
| 16 | public double ElnetPenalty { get; set; }
|
---|
| 17 | public int MaxNumBases { get; set; }
|
---|
| 18 |
|
---|
| 19 | private static int Int(bool b) => b ? 1 : 0;
|
---|
| 20 |
|
---|
| 21 | public override string ToString() {
|
---|
| 22 | return $"Inter{Int(AllowInter)} Denom{Int(AllowDenom)} Exp{Int((AllowExp))} Nonlin{Int(AllowNonlinFuncs)} Hinge{Int(AllowHinge)}";
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | public Approach(bool inter, bool denom, bool exp, bool nonlin, bool hinge, HashSet<double> exponents, HashSet<NonlinearOperator> nonlinFuncs, int maxNumBases, double penalty, double minHingeThr, double maxHingeThr, int numHingeThrs) {
|
---|
| 26 | this.AllowInter = inter;
|
---|
| 27 | this.AllowDenom = denom;
|
---|
| 28 | this.AllowExp = exp;
|
---|
| 29 | this.AllowNonlinFuncs = nonlin;
|
---|
| 30 | this.AllowHinge = hinge;
|
---|
| 31 | if (AllowExp && exponents == null) throw new ArgumentNullException(nameof(exponents));
|
---|
| 32 | Exponents = exponents;
|
---|
| 33 | if (AllowNonlinFuncs && nonlinFuncs == null) throw new ArgumentNullException(nameof(nonlinFuncs));
|
---|
| 34 | NonlinFuncs = nonlinFuncs;
|
---|
| 35 | MinHingeThr = minHingeThr;
|
---|
| 36 | MaxHingeThr = maxHingeThr;
|
---|
| 37 | NumHingeThrs = numHingeThrs;
|
---|
| 38 | ElnetPenalty = penalty;
|
---|
| 39 | MaxNumBases = maxNumBases;
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 | } |
---|