Originally posted by: nr-mz
Sorry, I was not clear...
Actually, in my model, I need to optimize an objective function subject to some constrains. Then, I need to remove some of the constraints and add another set of the constraints and then optimize the new model. So for that, as you proposed me, I name the constraints, which I wish remove them . for example I do like in following:
IloLinearNumExpr expr1 = solver.linearNumExpr();
.....
IloConstraint c = solver.addEq(expr1, 1);
After that, I solve the the model by using the following command:
solver.addMinimize(obj);
solver.solve();
Now, I wish to remove constraint c, and add new constraints and then solve my new model. So, directly after solver.solve(); I add this command: solver.remove(c);
But when I add solver.remove(c); I find an error message that appears on this command line in my java environment. when I click on the error, a dialogue window opens which propose to me to create local variable or, create local filed , or create parameter . That is to say, it acts on a way that c is not defined in my code !! but as you know wehave added befor c as an object of iloconstraints. So, now I wonder what I can do to overcome this error.
Thank you so much for your kind attention.
Best regards
#CPLEXOptimizers#DecisionOptimization