I have sonthing like this:
IloExtractable extractable(env);
...
extractable = model.add( x + y <= 4);
...
model.remove(extractable);
IloExpr soft_expr(extractable.asConstraint());
IloNumVar v = IloNumVar(env, 0.0, +IloInfinity,ILOFLOAT);
soft_expr += v;
model.add(soft_expr);
I'd like to remove the extractable from the model modify this one and add again to the model the modified one. This code doesn't work... Last instruction throws an exception. What could I do? Thanks.