I am performing an iterative optimization using the main function in CPLEX OPL. After each iteration, I want to write the values of the decision variables to an Excel sheet. The optimization runs for 100 iterations, and the variable x has a size of 100×96 (i.e., x[1..100][1..96]). While I am writing the variable values to an Excel sheet, I noticed that the values from the last iteration are not being saved. Currently, I am using a .dat file for this process. How can I ensure the values from all iterations, including the final one, are correctly written to Excel?
I am performing an iterative optimization using the main function in CPLEX OPL. After each iteration, I want to write the values of the decision variables to an Excel sheet. The optimization runs for 100 iterations, and the variable x has a size of 100×96 (i.e., x[1..100][1..96]). While I am writing the variable values to an Excel sheet, I noticed that the values from the last iteration are not being saved. Currently, I am using a .dat file for this process. How can I ensure the values from all iterations, including the final one, are correctly written to Excel?
Share Improve this question asked Mar 28 at 11:02 SUBHADARSHINI PANDASUBHADARSHINI PANDA 233 bronze badges 1- Please include an minimal reproducible example to help readers to answer your question. – Black cat Commented Mar 28 at 11:14
1 Answer
Reset to default 0If the values from the last iteration are not saved and the previous ones are, and if you use SheetWrite to write results into excel, then in your main loop you should check that you call postProcess for the last iteration.