Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3022-FastFunctionExtraction/FFX/Approach.cs @ 17737

Last change on this file since 17737 was 17737, checked in by lleko, 4 years ago

#3022 implement ffx

File size: 1.9 KB
Line 
1using System;
2using System.Collections.Generic;
3
4namespace 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}
Note: See TracBrowser for help on using the repository browser.