Originally posted by: albaska
Hello,
I have a question! I have the following code :
model.add(x_l[i][j] == val);
IloCplex heur_lp_cplex(model);
int nrows = heur_lp_cplex.getNrows();
int ncols = heur_lp_cplex.getNcols();
cout << "nrows and ncols before are = " << nrows << " , " << ncols << endl;
// solve the lp model
cout<<"#######################start"<<endl;
if ( !heur_lp_cplex.solve() ) {
env.error() << "Failed to optimize LP." << endl;
throw (-1);
}
model.remove(x_l[i][j] == val);
nrows = heur_lp_cplex.getNrows();
ncols = heur_lp_cplex.getNcols();
cout << "nrows and ncols aftere are = " << nrows << " , " << ncols << endl;
I added a constrain and then after solving the model I removed it, but when I ask to write down the number of constraints before and after removing that
constraint, it returns the same number, am I missing something in here?
another question, when we pass a model to a function, is this a pass by value or by reference? I passed a model to function(not by reference), and then I added a constraint and solve it, but I do not want this constraint to be added to my model, it seems that CPLEX pass the model by reference, because after I came back to the main function, the changes are still valid!! does anyone have any idea about this issues? thank you
#CPLEXOptimizers#DecisionOptimization