private void compareProcess() { float t_time = 0; AlgorithmHelper lcrData = new AlgorithmHelper(); AlgorithmHelper kwmData = new AlgorithmHelper(); AlgorithmHelper rpwData = new AlgorithmHelper(); if (float.TryParse(tbTAKTTime.Text, out t_time)) { if (time_sequence != null) { if (t_time > 0) { // LCR implementation LCRAlgorithm lcr = new LCRAlgorithm(t_time, time_sequence.Count, precedence_data, time_sequence); precedence = lcr.AnalyzePrecedence(); lcrData.Workstations = lcr.AnalyzeWorkLoad(out efficiency, out totalTime, out numberOfWorkStation); lcrData.Efficiency = efficiency; lcrData.TotalTime = totalTime; lcrData.NumberOfWorkstations = numberOfWorkStation; lcrData.Type = AlgorithmType.LCR; // KWM Implementation KWMAlgorithm kwm = new KWMAlgorithm(t_time, time_sequence.Count, precedence_data, time_sequence); precedence = kwm.AnalyzePrecedence(); kwmData.Workstations = kwm.AnalyzeWorkload(out efficiency, out totalTime, out numberOfWorkStation); kwmData.Efficiency = efficiency; kwmData.TotalTime = totalTime; kwmData.NumberOfWorkstations = numberOfWorkStation; kwmData.Type = AlgorithmType.KWM; // RPW Implementation List <string[]> precedenceSequence = parsePrecedenceData(time_sequence); RPWAlgorithm rpw = new RPWAlgorithm(t_time, time_sequence.Count, precedence_data, precedenceSequence, time_sequence); //precedence = rpw.AnalyzePrecedence(); rpwData.Workstations = rpw.AnalyzeWorkload(out efficiency, out totalTime, out numberOfWorkStation); rpwData.Efficiency = efficiency; rpwData.TotalTime = totalTime; rpwData.NumberOfWorkstations = numberOfWorkStation; rpwData.Type = AlgorithmType.RPW; lcrData.WorkElements = kwmData.WorkElements = rpwData.WorkElements = work_element; lcrData.MachineNames = kwmData.MachineNames = rpwData.MachineNames = machine_data; lcrData.TimeSequence = kwmData.TimeSequence = rpwData.TimeSequence = time_sequence; } else { MessageBox.Show("Max time per workstation must be greater than zero", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Please add data", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Max time per workstation must be a decimal value", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Dictionary <object, object> bundle = new Dictionary <object, object>(); bundle.Add(lcrData.Type, lcrData); bundle.Add(kwmData.Type, kwmData); bundle.Add(rpwData.Type, rpwData); new FormCompare(bundle).ShowDialog(this); }
private void analyzeData(AlgorithmType algoType) { float t_time = 0; if (float.TryParse(tbTAKTTime.Text, out t_time)) { // pass to function // time_sequence // precedence if (time_sequence != null) { if (t_time > 0) { switch (algoType) { case AlgorithmType.LCR: // LCR implementation LCRAlgorithm lcr = new LCRAlgorithm(t_time, time_sequence.Count, precedence_data, time_sequence); precedence = lcr.AnalyzePrecedence(); workstations = lcr.AnalyzeWorkLoad(out efficiency, out totalTime, out numberOfWorkStation); break; case AlgorithmType.KWM: KWMAlgorithm kwm = new KWMAlgorithm(t_time, time_sequence.Count, precedence_data, time_sequence); precedence = kwm.AnalyzePrecedence(); workstations = kwm.AnalyzeWorkload(out efficiency, out totalTime, out numberOfWorkStation); break; case AlgorithmType.RPW: List <string[]> precedenceSequence = parsePrecedenceData(time_sequence); RPWAlgorithm rpw = new RPWAlgorithm(t_time, time_sequence.Count, precedence_data, precedenceSequence, time_sequence); //precedence = rpw.AnalyzePrecedence(); workstations = rpw.AnalyzeWorkload(out efficiency, out totalTime, out numberOfWorkStation); break; default: break; } // workstation output // pack bundle for journey string[] meta = { tbSample.Text, tbStyleNo.Text, comboTypes.SelectedItem.ToString(), tbTAKTTime.Text }; Dictionary <string, object> bundle = new Dictionary <string, object>(); bundle.Add("p", precedence); bundle.Add("w", workstations); bundle.Add("e", efficiency); bundle.Add("t", totalTime); bundle.Add("n", numberOfWorkStation); bundle.Add("m", meta); bundle.Add("we", work_element); bundle.Add("mn", machine_data); bundle.Add("ts", time_sequence); bundle.Add("at", algoType.ToString()); new FormOutput(bundle).ShowDialog(this); } else { MessageBox.Show("Max time per workstation must be greater than zero", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Please add data", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Max time per workstation must be a decimal value", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }