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.

model2.add(model1);model2.add(IloConversion(env, x, ILOFLOAT));A conversion object, that is, an instance of IloConversion, can specify a type only for avariable that is in a model. Converting the type more than once is an error, because there isno rule about which would have precedence. However, this convention is not too restrictive,since you can remove the conversion from a model and add a new one. To remove aconversion from a model, use the method IloExtractable::end. To add a new one, usethe methodIloModel::add. For a sample of code using these methods in this procedure,see the documentation of the class IloConversion in the <strong>ILOG</strong> <strong>CPLEX</strong> C++ Reference<strong>Manual</strong>.Handling ErrorsIn Concert Technology two kinds of errors are distinguished:1. Programming errors, such as:●●●accessing empty handle objects;mixing modeling objects from different environments;accessing Concert Technology array elements beyond an array’s size; and● passing arrays of incompatible size to functions.Such errors are usually an oversight of the programmer. After they are recognized andfixed there is usually no danger of corrupting an application. In a production application,it is not necessary to handle these kinds of errors.In Concert Technology such error conditions are handled using assert statements. Ifcompiled without -DNDEBUG, the error check is performed and the code aborts with anerror message indicating which assertion failed. A production application should then becompiled with the -DNDEBUG compiler option, which removes all the checking. In otherwords, no CPU cycles are consumed for checking the assertions.2. Runtime errors, such as memory exhaustion.A correct program assumes that such failures can occur and therefore must be treated,even in a production application. In Concert Technology, if such an error conditionoccurs, an exception is thrown.All exceptions thrown by Concert Technology classes (including IloCplex) are derivedfrom IloException. Exceptions thrown by algorithm classes such as IloCplex arederived from its child class IloAlgorithm::Exception. The most common exceptionsthrown by <strong>ILOG</strong> <strong>CPLEX</strong> are derived from IloCplex::Exception, a child class ofIloAlgorithm::Exception.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 63

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

Saved successfully!

Ooh no, something went wrong!