Originally posted by: SystemAdmin
[prubin said:]
If you want to get rid of [i]all[/i] variables and [i]all[/i] constraints, clearModel will work. If you want to get rid of just selected variables and constraints, assign them to variables (I mean here ordinary programming variables, not IloNumVar type variables) and invoke the remove method on them. For instance,
IloCplex cplex;
// add some stuff
IloRange phase1Only = new IloRange[3];
for (int n = 0; n < 3; n++ ) {<br /> phase1Only[n] = ...; // add a constraint targeted for phase 1 only
}
// finish model
cplex.solve(); // solve and do something with result
cplex.remove(phase1Only); // drop the phase 1 only constraints
// ...
#CPLEXOptimizers#DecisionOptimization