/// <summary> /// This methods will check Max allows Sof % /// using the 2 possibilities : /// The ParameterMaxSofDiffValue /// or, if split SoF can be compared with the ParameterMaxSofFunct, /// it will use the relative value /// </summary> /// <param name="prediction"></param> /// <param name="diff"></param> /// <returns></returns> public bool CheckLimit(Data.PredictionOfSplits prediction, double diff) { //double splitSof = prediction.CurrentSplit.GlobalSof; int splitSof = prediction.CurrentSplit.GetMinClassSof(); AppendDebugDecisionMessage(""); AppendDebugDecisionMessage(" - Prediction " + prediction.Id + " has a Min SoF of " + splitSof); double maxDiff = ParameterMaxSofDiffValue; if (splitSof > ParameterMaxSofFunctStartingIRValue) { maxDiff = SofDifferenceEvaluator.EvalFormula(ParameterMaxSofFunctStartingIRValue, ParameterMaxSofFunctStartingThreshold, ParameterMaxSofFunctExtraThresoldPerK, splitSof); AppendDebugDecisionMessage(" Max allowed Diff is " + maxDiff + " (corresponding to MaxSofDiffValueFunction)"); } else { AppendDebugDecisionMessage(" Max allowed Diff is " + maxDiff + " (corresponding to MaxSofDiffValue)"); } bool result = diff < maxDiff; if (result) { AppendDebugDecisionMessage(" => OK. (under the limit)"); } else { AppendDebugDecisionMessage(" => Not Ok. (higher than the limit)"); } AppendDebugDecisionMessage(""); return(result); }
/// <summary> /// Test if the class have to be moved down to the next split /// </summary> /// <param name="s">The split to check</param> /// <param name="classIndex">The class index to check in the 's' split</param> /// <param name="splitSofs">The SoFs corresponding to classes</param> /// <returns></returns> internal virtual bool TestIfMoveDownNeeded(Split s, int classIndex, List <int> splitSofs) { if (s.Number == INTERRUPT_BEFORE_MOVEDOWN_SPLITNUMBER && classIndex == INTERRUPT_BEFORE_MOVEDOWN_CLASSINDEX) { // to help debugging, you can set breakpoint here } bool movedown = false; Calc.SofDifferenceEvaluator evaluator = new SofDifferenceEvaluator(s, classIndex); movedown = evaluator.MoreThanLimit(ParameterMaxSofDiffValue, ParameterMaxSofFunctStartingIRValue, ParameterMaxSofFunctStartingThreshold, ParameterMaxSofFunctStartingThreshold); // debug informations if (Tools.EnableDebugTraces) { string debug = "(Δ:$REFSOF/$MAX=$DIFF,L:$LIMIT,$MOVEDOWN) "; debug = debug.Replace("$REFSOF", evaluator.ClassSof.ToString()); debug = debug.Replace("$MAX", evaluator.MaxSofInSplit.ToString()); debug = debug.Replace("$DIFF", Convert.ToInt32(evaluator.PercentDifference).ToString()); debug = debug.Replace("$LIMIT", Convert.ToInt32(evaluator.MaxPercentDifferenceAllowed).ToString()); debug = debug.Replace("$MOVEDOWN", Convert.ToInt32(movedown).ToString()); s.Info += debug; } // --> return(movedown); }