/// <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> /// This method will transform a prediction to a concrete split /// </summary> /// <param name="prediction"></param> private void Implement(Data.PredictionOfSplits prediction) { // create a split with the right number Data.Split split = new Split(); split.Number = prediction.CurrentSplit.Number; // add the split to the Splits List Splits.Add(split); // for each available queues for (int i = 0; i < classesQueues.Count; i++) { // get the number of car suggested in the prediction var take = prediction.CurrentSplit.CountClassCars(i); if (take > 0) { // dequeue the cars from the waiting queue // (it will takes car from the highest rating) // (it will remove them from the queue) int classId = classesIds[i]; var cars = classesQueues[i].PickCars(take); // move theses car the the split split.SetClass(i, cars, classId); } } }