Originally posted by: sjayaswal
Hi,
I am running a Cplex code (in C++ Concert Technology) wherein at each iteration I need to substitute one of the earlier added constraints by a newly generated one. The constraint is lhs = -1, where lhs is the left hand side expression of the constraint. This is how I am trying to do it:
IloCplex cplex_IIS(model_IIS);
....
....
IloRange r1(env, -1, lhs, -1, "r1");
model_IIS.add(r1);
lhs.end();
cplex_IIS.solve();
model_IIS.remove(r1);// to remove the constraint already added
.....
.....
IloRange r1(env, -1, lhs1, -1, "r1");
model_IIS.add(r1);
lhs1.end();
cplex_IIS.solve();
However, although the above code successfully adds a new constraint,
it fails to remove the old constraint.
This is my first experience at removing a constraint from a model.
Can someone tell me where am I going wrong?
Thanks and Regards,
Sachin
#CPLEXOptimizers#DecisionOptimization