static public void applySecMethod(Model model, ExcelFile excelFile, string methodChoice) { switch (methodChoice) { case "--GRAS": GRAS methodGRAS = new GRAS(1f, model, excelFile); methodGRAS.apply(); break; case "--SPT": SPT methodSPT = new SPT(model, excelFile); methodSPT.apply(); break; case "--LPT": LPT methodLPT = new LPT(model, excelFile); methodLPT.apply(); break; case "--EDD": EDD methodEDD = new EDD(model, excelFile); methodEDD.apply(); break; case "--CR": CR methodCR = new CR(model, excelFile); methodCR.apply(); break; case "--SES": SES methodSES = new SES(model, excelFile); methodSES.apply(); break; case "--SLACK": SES methodSLACK = new SES(model, excelFile); methodSLACK.apply(); break; case "A": MyConsole.displayError("Aborting operation...\n"); break; default: { MyConsole.displayError("Input invalid, applying GRAS anyway... \n"); GRAS methodDefault = new GRAS(1f, model, excelFile); methodDefault.apply(); } break; } }
private void Form1_Load_1(object sender, EventArgs e) { //Read SwordsDemand.csv containing 36 rows List <double> dataSet = Parser.Parse("SwordsDemand.csv", ','); SES ses = new SES(dataSet); DES des = new DES(dataSet); TES tes = new TES(dataSet); for (var i = 0; i < dataSet.Count; i++) { chart1.Series["Data"].Points.AddXY(i + 1, dataSet[i]); } List <double> dataSetSES = ses.CalculateSmoothing(12); for (var i = 0; i < dataSetSES.Count; i++) { chart1.Series["SES"].Points.AddXY(i + 1, dataSetSES[i]); } List <double> dataSetDES = des.CalculateSmoothing(12); for (var i = 0; i < dataSetDES.Count; i++) { chart1.Series["DES"].Points.AddXY(i + 2, dataSetDES[i]); } List <double> dataSetTES = tes.CalculateSmoothing(12); for (var i = 0; i < dataSetTES.Count; i++) { chart1.Series["TES"].Points.AddXY(i + 1, dataSetTES[i]); } Tuple <double, double> valuesSES = ses.GetBestValues(); Tuple <double, double, double> valuesDES = des.GetBestValues(); Tuple <double, double, double, double> valuesTES = tes.GetBestValues(); textBox1.AppendText("Best Alpha for SES: " + valuesSES.Item1 + Environment.NewLine); textBox1.AppendText("Best Error for SES: " + valuesSES.Item2 + Environment.NewLine + Environment.NewLine); textBox1.AppendText("Best Alpha for DES: " + valuesDES.Item1 + Environment.NewLine); textBox1.AppendText("Best Beta for DES: " + valuesDES.Item2 + Environment.NewLine); textBox1.AppendText("Best Error for DES: " + valuesDES.Item3 + Environment.NewLine + Environment.NewLine); textBox1.AppendText("Best Alpha for TES: " + valuesTES.Item1 + Environment.NewLine); textBox1.AppendText("Best Beta for TES: " + valuesTES.Item2 + Environment.NewLine); textBox1.AppendText("Best Gamma for TES: " + valuesTES.Item3 + Environment.NewLine); textBox1.AppendText("Best Error for TES: " + valuesTES.Item4 + Environment.NewLine); }
private static void Main(string[] args) { var data = File .ReadAllLines(@"SwordForecasting.csv") .Skip(1) .Select(x => x.Split(',')) .ToDictionary(y => double.Parse(y[0]), y => double.Parse(y[1])); var points = data.Values.ToArray(); var bestDES = DES.FindBestAlphaBeta(points, 0.1); var forecastDES = DES.ForeCast(points, 37, 48, bestDES.Item1, bestDES.Item2); var besSES = SES.FindBestAlpha(points, 0.01); var forecastSES = SES.ForeCast(points, besSES, 37, 48); string original = "["; foreach (var num in points) { original += num + ","; } original += "]"; string desforecastDES = "["; foreach (var num in forecastDES) { desforecastDES += num + ","; } desforecastDES += "]"; string desforecastSES = "["; foreach (var num in forecastSES) { desforecastSES += num + ","; } desforecastSES += "]"; var list = "[" + original + "," + desforecastDES + "," + desforecastSES + "]"; // var i = 0; // // foreach (var point in smoothedPoints) // // { // // Console.WriteLine(i + ": " + point); // // i++; // // } var socket = new Client_Socket(); socket.Publish(list); }
private void PredictionVisualization_Load(object sender, EventArgs e) { var dt = dataset.getData(); SES ses = new SES(dt); DES des = new DES(dt); TES tes = new TES(dt); // var sesSmoothing = ses.SmoothingCalculation(12); var sesSmoothing2 = ses.SmoothingCalculation2(12, 0.73, dt, 12); var desSmoothing2 = des.SmoothingCalculation2(12, 0.659100046560163, 0.0531171804609812, dt, 12, 155, 0.8369); //actual data ApplyActualDataToChart(chart1, dt, "Data"); ApplySESDataToChart(chart1, sesSmoothing2, "SES"); ApplyDESDataToChart(chart1, desSmoothing2, "DES"); //ApplyDataToChart(chart1, tes, "TES"); // ses data to gridview for (int i = 0; i < sesSmoothing2.Count; i++) { DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone(); row.Cells[0].Value = i + 1; //row number row.Cells[1].Value = sesSmoothing2[i].Item1; row.Cells[2].Value = sesSmoothing2[i].Item2; row.Cells[3].Value = sesSmoothing2[i].Item3; row.Cells[4].Value = sesSmoothing2[i].Item4; row.Cells[5].Value = sesSmoothing2[i].Item5; dataGridView1.Rows.Add(row); } // des data to gridview for (int i = 0; i < desSmoothing2.Count; i++) { DataGridViewRow row = (DataGridViewRow)dataGridView2.Rows[0].Clone(); row.Cells[0].Value = i + 1;//row number row.Cells[1].Value = desSmoothing2[i].Item1; row.Cells[2].Value = desSmoothing2[i].Item2; row.Cells[3].Value = desSmoothing2[i].Item3; row.Cells[4].Value = desSmoothing2[i].Item4; row.Cells[5].Value = desSmoothing2[i].Item5; row.Cells[6].Value = desSmoothing2[i].Item6; dataGridView2.Rows.Add(row); } }
private void Form1_Load(object sender, EventArgs e) { //Read SwordsDemand.csv containing 36 rows var data = Parser.Parse("SwordsDemand.csv", ','); var ses = new SES(data, 12); var des = new DES(data, 12); AddToChart(data, "Data"); AddToChart(ses.Calculate(), "SES"); AddToChart(des.Calculate(), "DES"); var bestSES = ses.GetBestValues(); var bestDES = des.GetBestValues(); // Write the best values in the textbox textBox1.AppendText("Forecasting Assignment" + Environment.NewLine + Environment.NewLine); textBox1.AppendText("Best Alpha for SES: " + bestSES.Item1 + Environment.NewLine); textBox1.AppendText("Best Error for SES: " + bestSES.Item2 + Environment.NewLine + Environment.NewLine); textBox1.AppendText("Best Alpha for SES: " + bestDES.Item1 + Environment.NewLine); textBox1.AppendText("Best Beta for SES: " + bestDES.Item2 + Environment.NewLine); textBox1.AppendText("Best Error for SES: " + bestDES.Item3 + Environment.NewLine); }