using System; using System.Collections.Generic; namespace HeuristicLab.Algorithms.DataAnalysis.FastFunctionExtraction { internal struct Approach { public bool AllowInter { get; set; } public bool AllowDenom { get; set; } public bool AllowExp { get; set; } public bool AllowNonlinFuncs { get; set; } public bool AllowHinge { get; set; } public HashSet Exponents { get; set; } public HashSet NonlinFuncs { get; set; } public double MinHingeThr { get; set; } public double MaxHingeThr { get; set; } public int NumHingeThrs { get; set; } public double ElnetPenalty { get; set; } public int MaxNumBases { get; set; } private static int Int(bool b) => b ? 1 : 0; public override string ToString() { return $"Inter{Int(AllowInter)} Denom{Int(AllowDenom)} Exp{Int((AllowExp))} Nonlin{Int(AllowNonlinFuncs)} Hinge{Int(AllowHinge)}"; } public Approach(bool inter, bool denom, bool exp, bool nonlin, bool hinge, HashSet exponents, HashSet nonlinFuncs, int maxNumBases, double penalty, double minHingeThr, double maxHingeThr, int numHingeThrs) { this.AllowInter = inter; this.AllowDenom = denom; this.AllowExp = exp; this.AllowNonlinFuncs = nonlin; this.AllowHinge = hinge; if (AllowExp && exponents == null) throw new ArgumentNullException(nameof(exponents)); Exponents = exponents; if (AllowNonlinFuncs && nonlinFuncs == null) throw new ArgumentNullException(nameof(nonlinFuncs)); NonlinFuncs = nonlinFuncs; MinHingeThr = minHingeThr; MaxHingeThr = maxHingeThr; NumHingeThrs = numHingeThrs; ElnetPenalty = penalty; MaxNumBases = maxNumBases; } } }