I am solving a multi-scenario optimization model where I am running the same model multiple times. Here, I am changing the parameters of the objective function each time. I want to check if my model is being developed correctly or not. So, I am using model.write(). But it is overwriting the previous content. Basically, I want to do an "append" to the previous content in the file. A snippet of the code is given below:
GRBLinExpr Return_Objective = 0;
for (i = 0; i < Scenarios; i++)
{
for (j = 0; j < Securities; j++)
{
Return_Objective += probabilty_matrix[k][i] * (return_matrix[i][j] * Weights[j]);
}
}
//Here, k represents the number of scenarios.
model.setObjective(Return_Objective);
//Now writing the model to file
model.write("C:/Users/Bharati/Desktop/Lee/mip1_Markowitz.lp");
Any suggestions would be of great help to me.