static void Main(string[] args) { Console.Write("number of elements to generate: "); int count = Convert.ToInt32(Console.ReadLine()); BreakdownEngine engine = new BreakdownEngine(GenerateTestData(count)); var breakdowns = engine.GetBreakdowns(); ChainWorker worker = new ChainWorker(breakdowns); worker.BuildChainMatrix(); var predictionProvider = new KolmogorovPedictionProvider(worker); string result = Model.ParseNextPosition(predictionProvider.Predict()); Console.WriteLine($"Next breakdown is: {result}"); Console.ReadLine(); }
public IActionResult Valid(IFormFile file) { List <DataViewModel> listViews = new List <DataViewModel>(); if (file.Length > 0) { ReadFile(file); var list = _fileReader.Read(); RemoveFile(file); BreakdownEngine engine = new BreakdownEngine(list.ToList()); var breakdowns = engine.GetBreakdowns(); for (int j = 0; j < list.Count(); j++) { for (int i = 0; i < breakdowns.Count; i++) { if (breakdowns[i].Position == j) { listViews.Add(new DataViewModel { Value = list.ElementAt(j), IsBreakdown = true }); } else { listViews.Add(new DataViewModel { Value = list.ElementAt(j), IsBreakdown = false }); } } } } string json = JsonConvert.SerializeObject(listViews); System.IO.File.WriteAllText(Path.Combine(_env.WebRootPath, "Data", "1.json"), json); return(Ok(listViews)); }