12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Concert Technology also provides a way to remove a modeling object from all othermodeling objects and algorithms exactly the same way as when deleting it, yet withoutdeleting the modeling object: call the method removeFromAll. This method may be helpfulto temporarily remove a variable from your model while keeping the option to add it backlater.It is important to understand the difference between calling end and callingmodel.remove(obj) for an object obj. In the case of a call to remove, obj is notnecessarily removed from the problem <strong>ILOG</strong> <strong>CPLEX</strong> maintains. Whether or not anythingappears to happen depends on whether the removed object is referenced by yet anotherextracted modeling object. For example, when you add a modeling object, such as a rangedconstraint, to a model, all the variables used by that modeling object implicitly become partof the model as well. However, when you remove that modeling object (for example, thatranged constraint), those variables are not implicitly removed because they may bereferenced by other elements (such as the objective function or a basis, for example). Forthat reason, variables can be explicitly removed from a model only by a call to its endmember function.Usually when a constraint is removed from the extracted model, the constraint is alsoremoved from <strong>ILOG</strong> <strong>CPLEX</strong> as well, unless it was added to the model more than once.Consider the case where a variable is removed from <strong>ILOG</strong> <strong>CPLEX</strong> after one of the end orremove operations. If the cplex object contains a simplex basis, by default the status forthat variable is removed from the basis as well. If the variable happens to be basic, theoperation corrupts the basis. If this is not desired, <strong>ILOG</strong> <strong>CPLEX</strong> provides a delete mode thatfirst pivots the variable out of the basis before removing it. The resulting basis is notguaranteed to be feasible or optimal, but it will still constitute a valid basis. To select thismode, call the method:cplex.setDeleteMode(IloCplex::FixBasis);Similarly, when removing a constraint with the FixBasis delete mode, <strong>ILOG</strong> <strong>CPLEX</strong> willpivot the corresponding slack or artificial variable into the basis before removing it, to makesure of maintaining a valid basis. In either case, if no valid basis was available in the firstplace, no pivot operation is performed. To set the delete mode back to its default setting, call:cplex.setDeleteMode(IloCplex::LeaveBasis);Changing Variable TypeThe type of a variable cannot be changed by calling modification methods. Instead, ConcertTechnology provides the modeling class IloConversion, the objects of which allow you tooverride the type of a variable in a model. This design allows you to use the same variable indifferent models with different types. Consider for example model1 containing integervariable x. You can then create model2, as a copy of model1, that treats x as a continuousvariable, with the following code:IloModel model2(env);62 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!