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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

models and algorithm-objects can be created. The cplex object can be created by theconstructor:IloCplex cplex(env);To use it to solve the model, the model must first be extracted to cplex by a call like this:cplex.extract(model);This method copies the data from the model into the appropriate efficient data structures,which <strong>ILOG</strong> <strong>CPLEX</strong> uses for solving the problem. It does so by extracting each of themodeling objects added to the model and each of the objects referenced by them. For everyextracted modeling object, corresponding data structures are created internally in the cplexobject. For readers familiar with the sparse matrix representation used internally by<strong>ILOG</strong> <strong>CPLEX</strong>, a variable becomes a column and a constraint becomes a row. As discussedlater, these data structures are synchronized with the modeling objects even if the modelingobjects are modified.If you consider a variable to be part of your model, even though it is not (initially) used inany constraint, you should add this variable explicitly to the model. This practice makes surethat the variable will be extracted. This practice may also be important if you query solutioninformation for the variable, since solution information is available only for modelingobjects that are known to <strong>ILOG</strong> <strong>CPLEX</strong> because they have been extracted from a model.If you feel uncertain about whether or not an object will be extracted, you can add it to themodel to be sure. Even if an object is added multiple times, it will be extracted only once andthus will not slow the solution process down.Since the sequence of creating the cplex object and extracting the model to it is such acommon one, IloCplex provides the shortcut:IloCplex cplex(model);This shortcut is completely equivalent to separate calls and makes sure that the environmentused for the cplex object will be the same as that used for the model when it is extracted, asrequired by Concert Technology. The shortcut uses the environment from the model toconstruct the cplex object before extraction.Invoking a SolverAfter the model is extracted to the cplex object, you are ready to solve it by callingcplex.solve();For most problems this is all that is needed for solving the model. Nonetheless,<strong>ILOG</strong> <strong>CPLEX</strong> offers a variety of controls that allow you to tailor the solution process foryour specific needs.52 <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!