public static void actionSelection(String option) { String mainMessage = "JOBSEC V" + version + "--------------------------------------------------\n" + "Designed by Ismail EL MOUANI- all rights reserved-----------\n\n\n" + "List of commands" + "--information : display information regarding the tool.....\n" + "--schedule : applying one of the method to schedule jobs\n" + " selection is done in a second time.........\n" + "--changeIO : changing the IO Excel file.................\n" + "--readIOFile : reding Input-Output file. Mandatory before.\n" + " scheduling\n" + "--quit : Quiting JOBSEC.............................\n"; switch (option) { case "--schedule": schedule(); break; case "--information": MyConsole.displayMain(mainMessage); break; case "--changeIO": MyConsole.displayResult("changingIO"); break; case "--readIOFile": string outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); string excelFilePath = Path.Combine(outPutDirectory, "res\\ExcelFile.xlsx"); excelFile = new ExcelFile(excelFilePath); model = new Model(excelFile); if (excelFile == null || model == null) { MyConsole.displayError("Couldn't red input file and/or initialize scheduling schema...."); } break; case "--quit": MyConsole.displayResult("quiting, press a key..."); break; default: MyConsole.displayResult("input parameter not identified !\n"); break; } }
// Reading input variables public void readInputs(ExcelFile excelFile) { // Reading input from the excel file MyConsole.displayMain("Reading input file ...."); excelFile.open(); I = Convert.ToInt32(excelFile.read(ExcelFile.MAIN_SHEET_INDEX, 1, 2)); K = Convert.ToInt32(excelFile.read(ExcelFile.MAIN_SHEET_INDEX, 2, 2)); J = Convert.ToInt32(excelFile.read(ExcelFile.MAIN_SHEET_INDEX, 3, 2)); T = Convert.ToInt32(excelFile.read(ExcelFile.MAIN_SHEET_INDEX, 4, 2)); dt = excelFile.read(ExcelFile.MAIN_SHEET_INDEX, 5, 2); C = excelFile.read(ExcelFile.MAIN_SHEET_INDEX, 6, 2); numOfIterations = Convert.ToInt32(excelFile.read(ExcelFile.MAIN_SHEET_INDEX, 7, 2)); S = Convert.ToInt32(excelFile.read(ExcelFile.MAIN_SHEET_INDEX, 8, 2)); MyConsole.display("\nReading job batch sizes 'q'.... \n"); q = new int[K]; for (int compt = 0; compt < K; compt++) { q[compt] = Convert.ToInt32(excelFile.read(ExcelFile.QUANTITY_PER_ORDER_SHEET_INDEX, compt + 1, 1)); } MyConsole.display("\nRelease dates 'a'.... \n"); a = new int[K]; for (int compt = 0; compt < K; compt++) { a[compt] = Convert.ToInt32(excelFile.read(ExcelFile.REFERENCE_RELASE_DATE_SHEET_INDEX, compt + 1, 1)); } MyConsole.display("\nRelease dates 'l'.... \n"); l = new int[K]; for (int compt = 0; compt < K; compt++) { l[compt] = Convert.ToInt32(excelFile.read(ExcelFile.l_SHEET_INDEX, compt + 1, 1)); } MyConsole.display("\nReading absolute due time 'd'.....\n"); d = new int[I]; for (int compt = 0; compt < I; compt++) { d[compt] = Convert.ToInt32(excelFile.read(ExcelFile.REFERENCE_DUE_DATE_SHEET_INDEX, compt + 1, 1)); } Console.WriteLine("\nProcessing times 'p'.....\n"); p = new int[I]; for (int compt = 0; compt < I; compt++) { p[compt] = Convert.ToInt32(excelFile.read(ExcelFile.REFERENCE_PROCESSING_SHEET_INDEX, compt + 1, 1)); } MyConsole.display("\nSetup times 's'....\n"); s = new int[I]; for (int compt = 0; compt < I; compt++) { s[compt] = Convert.ToInt32(excelFile.read(ExcelFile.REFERENCE_SETTING_TIME_SHEET_INDEX, compt + 1, 1)); } MyConsole.display("\nReading references fitness weights 'alpha'\n"); alpha = new float[I][]; for (int compt = 0; compt < I; compt++) { alpha[compt] = new float[3]; } for (int compt = 0; compt < I; compt++) { alpha[compt][0] = (float)excelFile.read(ExcelFile.REFERENCE_PRIORITY_SHEET_INDEX, compt + 1, 1); alpha[compt][1] = (float)excelFile.read(ExcelFile.REFERENCE_PRIORITY_SHEET_INDEX, compt + 1, 2); alpha[compt][2] = (float)excelFile.read(ExcelFile.REFERENCE_PRIORITY_SHEET_INDEX, compt + 1, 3); } MyConsole.display("\nReading task difficulties 'deta'....\n"); deta = new float[I]; for (int compt = 0; compt < I; compt++) { deta[compt] = (float)excelFile.read(ExcelFile.REFERENCE_DIFFICULTY_SHEET_INDEX, compt + 1, 1); } MyConsole.display("\nReading fatigue rate 'lamda'....\n"); lamda = new float[I]; mu = new float[I]; FatigueParametersGenerators fpg = new FatigueParametersGenerators(); for (int compt = 0; compt < I; compt++) { float[] stressFactors = new float[S]; for (int sfi = 0; sfi < S; sfi++) // sfi : Stress Factor Index { stressFactors[sfi] = Convert.ToSingle(excelFile.read(ExcelFile.REFERENCE_STRESS_FACTORS_SHEET_INDEX, sfi + 2, compt + 2)); } lamda[compt] = fpg.genFatigueRate(stressFactors)[FatigueParametersGenerators.IFATIGUE_RATE]; mu[compt] = fpg.genFatigueRate(stressFactors)[FatigueParametersGenerators.IRECOVERY_RATE]; } /*MyConsole.display("\nReading recovery rate 'mu'....\n"); * * for (int compt = 0; compt < I; compt++) * { * mu[compt] = excelFile.read(ExcelFile.REFERENCE_RECOVERY_RATE_SHEET_INDEX, compt + 1, 1); * * }*/ MyConsole.display("\nReading machine states 'v'....\n"); v = new int[T][]; for (int compt = 0; compt < T; compt++) { v[compt] = new int[J]; } ProgressBar progress = new ProgressBar(); { for (int compt = 0; compt < T; compt++) { for (int compt2 = 0; compt2 < J; compt2++) { v[compt][compt2] = Convert.ToInt32(excelFile.read(ExcelFile.MACHINE_LOAD_SHEET_INDEX, compt + 1, compt2 + 1)); } progress.Report((double)compt / T); } progress.Dispose(); } MyConsole.display("\nReading job's references 'z'....\n"); z = new int[K][]; for (int compt = 0; compt < K; compt++) { z[compt] = new int[I]; } for (int compt = 0; compt < K; compt++) { for (int compt2 = 0; compt2 < I; compt2++) { z[compt][compt2] = Convert.ToInt32(excelFile.read(ExcelFile.REFERENCE_PER_ORDER_SHEET_INDEX, compt + 1, compt2 + 1)); } } excelFile.close(); }