Hello,
I have multiple input files named "input1.txt", "input2.txt",...,"input10.txt". I have to solve a separate optimization problem for each of these input files and save the results in "output1.txt", "output2.txt",...,"output10.txt" respectively.
In C/C++, I would roughly do the following.
int number_of_problems = 10;
#include <string>
#include <iostream>
int main(){
for(int probno = 1; probno <= number_of_problems; probno++){
std::string ifile = "input"+std::to_string(probno)+".txt";
//Read input file
//Using functions such as fscanf() etc.
//Create optimization model based on inputfile
std::string ofile = "output"+std::to_string(probno)+".txt";
//Output file
//Save output such as objective function value
//time, number of nodes explored, etc
//via fprintf(), etc.
std::cout<<"Input "<<ifile<<" gave output "<<ofile<<std::endl;
}
}
The output of the above code can be seen
here.
What is the equivalent way in OPL IDE to obtain this functionality? That is, based on the loop counter value, how does one go about concatenating them into string/character array variables and then passing these variable to appropriate OPL functions?
Are there any examples that ship with CPLEX that demonstrate this functionality?
Thank you.
------------------------------
CPLEX User
------------------------------
#DecisionOptimization