public List <int[]> GenerateSequence() { StartPickGeneration(); int maximumPickCount = GetFieldParamValueForCount(0); int matchPerc = GetFieldParamValueForCount(1); int maxLoopBreaker = int.MaxValue - 100; int maxLoopCtr = 0; List <int[]> results = new List <int[]>(); DrawResultWinCountInputModel sampleData; LotteryDrawResultSetup lotteryDrawResult = new LotteryDrawResultSetup(); lotteryDrawResult.GameCode = lotteryDataServices.LotteryDetails.GameCode; Random ran = new Random(); while (results.Count < maximumPickCount) { int[] randomSeq = LuckyPickGenerator(ran); lotteryDrawResult.ResetSequenceToZero(); lotteryDrawResult.FillNumberBySeq(randomSeq); sampleData = lotteryDrawResult.GetDrawResultWinCountInputModel(true); DrawResultWinCountOutputModel output = DrawResultWinCountPredictor.Predict(sampleData); int score = (int)(output.Score * 100); PickGenerationProgressEvent.IncrementGenerationAttemptCount(); if (score >= matchPerc) { Array.Sort(randomSeq); results.Add(randomSeq); PickGenerationProgressEvent.IncrementGeneratedPickCount(); } if (!IsContinuePickGenerationProgress()) { break; } if (maxLoopCtr++ > maxLoopBreaker) { break; } } RaisePickGenerationProgress(); StopPickGeneration(); return(results); }
public List <int[]> GenerateSequence() { StartPickGeneration(); String drawDate = DateTimeConverterUtils.ConvertToFormat(this.lotteryDataServices.GetNextDrawDate(), DateTimeConverterUtils.STANDARD_DATE_FORMAT) + " 00:00:00.0"; List <int[]> results = new List <int[]>(); int selectedCoefficient = GetFieldParamValueForCount(1); int maximumPickCount = GetFieldParamValueForCount(0); Random rnd = new Random(); int loopBreaker = 0; int maxLoopBreaker = int.MaxValue - 100; while (true) { int[] lp = LuckyPickGenerator(rnd); // Create single instance of sample data from first line of dataset for model input FastTreeInputModel sampleData = new FastTreeInputModel() { Draw_date = drawDate, Num1 = lp[0], Num2 = lp[1], Num3 = lp[2], Num4 = lp[3], Num5 = lp[4], Num6 = lp[5], Game_cd = this.lotteryDataServices.LotteryDetails.GameCode }; // Make a single prediction on the sample data and print results var predictionResult = FastTreePredictor.Predict(sampleData); float tmpScore = predictionResult.Score; if (tmpScore <= 0) { tmpScore = (tmpScore * -1) + 1; } PickGenerationProgressEvent.IncrementGenerationAttemptCount(); if (int.Parse(tmpScore.ToString().Substring(0, 1)) >= selectedCoefficient) { if (IsUniqueSequence(results, lp)) { results.Add(lp); } PickGenerationProgressEvent.IncrementGeneratedPickCount(); } if (!IsContinuePickGenerationProgress()) { break; } if (loopBreaker++ >= maxLoopBreaker) { break; } if (results.Count >= maximumPickCount) { break; } } RaisePickGenerationProgress(); StopPickGeneration(); return(results); }