public List<Operation> operations; //List of operations to be considered in the combinatorics part #endregion Fields #region Constructors public Config() { exponents = new List<double>(); operations = new List<Operation>(); operations.Add(Operation.Multiplication); //Multiplication has always to be present fitConfig = new FitConfig(); limitVals = new LimitValues(); }
//Method returning the FitConfig instance (i.e., including the basic rules determining when a fit is valid) associated with the given input conditions private FitConfig getAssociatedFitConfig(Accuracy expectedAccuracy) { FitConfig curFitConfig = new FitConfig(); if (expectedAccuracy == Accuracy.High) { curFitConfig.averLimit = 0.05; curFitConfig.minPercBelowLimit = 0.85; curFitConfig.globalAver = 0.10; curFitConfig.minNoCases = 50; } else if (expectedAccuracy == Accuracy.Medium) { curFitConfig.averLimit = 0.15; curFitConfig.minPercBelowLimit = 0.8; curFitConfig.globalAver = 0.25; curFitConfig.minNoCases = 35; } else if (expectedAccuracy == Accuracy.Low) { curFitConfig.averLimit = 0.3; curFitConfig.minPercBelowLimit = 0.7; curFitConfig.globalAver = 0.35; curFitConfig.minNoCases = 20; } curFitConfig.expectedAccuracy = expectedAccuracy; return curFitConfig; }
//Method starting all the calculations (i.e., calling the corresponding method in the Combinatorics class) public Results startCalcs(List<Input> inputCols, int indepIndex, FitConfig curFitConfig) { Combinatorics curCombinatorics = new Combinatorics(); Results curResults = new Results(); curResults.allInputs = inputCols; curResults.config = new Config(); curResults.config.operations.Add(Operation.Addition); curResults.config.exponents = createListExponents(); curResults.config.maxNoCombs = 20; curResults.config.fitConfig = curFitConfig; //Due to the huge amount of (potential) information to be managed, the a-apriori logical structure "combinations -> calculations (regressions) -> analysis" is not present. //Both calculations and analysis are performed for each single combination and only the "good-enough" ones are kept in memory curResults = curCombinatorics.startCombinatorics(curResults, indepIndex); curResults.combinations = curResults.combinations.OrderByDescending(x => x.assessment.globalRating).ThenBy(x => x.averError).ThenBy(x => x.independentVar.input.displayedName).ThenBy(x => x.dependentVars.items.Count).ToList(); return curResults; }
//Method creating a ListView including all the required information about the currently selected accuracy level. //This ListView will be added to the popup form created right before calling this function private ListView createFitConfigLstVw(int curHeight, FitConfig curFitConfig) { ListView curLstVw = new ListView(); curLstVw.Width = 250; curLstVw.Height = curHeight; curLstVw.View = View.Details; curLstVw.Columns.Add("Factor to define a valid trend").Width = 150; curLstVw.Columns.Add("Value").TextAlign = HorizontalAlignment.Center; ListViewItem curItem = new ListViewItem(); curItem.Text = "Target error/case (%)"; curItem.SubItems.Add((curFitConfig.averLimit * 100).ToString("N0", Common.curCulture)); curLstVw.Items.Add(curItem); curItem = new ListViewItem(); curItem.Text = "Min. cases below target (%)"; curItem.SubItems.Add((curFitConfig.minPercBelowLimit * 100).ToString("N0", Common.curCulture)); curLstVw.Items.Add(curItem); curItem = new ListViewItem(); curItem.Text = "Max. aver. global error (%)"; curItem.SubItems.Add((curFitConfig.globalAver * 100).ToString("N0", Common.curCulture)); curLstVw.Items.Add(curItem); curItem = new ListViewItem(); curItem.Text = "Min. number of cases"; curItem.SubItems.Add(curFitConfig.minNoCases.ToString("N0", Common.curCulture)); curLstVw.Items.Add(curItem); return curLstVw; }