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.

As you modify a problem object through calls to modification routines from the CallableLibrary, <strong>ILOG</strong> <strong>CPLEX</strong> automatically handles memory allocations to accommodate theincreasing size of the problem. In other words, you do not have to keep track of the problemsize nor make corresponding memory allocations yourself as long as you are using librarymodification routines such as CPXaddrows or CPXaddcols.Status and Return ValuesMost routines in the Callable Library return an integer value, 0 (zero) indicating success ofthe call. A nonzero return value indicates a failure. Each failure value is unique anddocumented in the <strong>ILOG</strong> <strong>CPLEX</strong> Reference <strong>Manual</strong>. However, some routines are exceptionsto this general rule.The Callable Library routine CPXopen<strong>CPLEX</strong> returns a pointer to a <strong>ILOG</strong> <strong>CPLEX</strong>environment. In case of failure, it returns a NULL pointer. The parameter *status_p (that is,one of its arguments) is set to 0 if the routine is successful; in case of failure, that parameteris set to a nonzero value that indicates the reason for the failure.The Callable Library routine CPXcreateprob returns a pointer to a <strong>ILOG</strong> <strong>CPLEX</strong> problemobject and sets its parameter *status_p to 0 (zero) to indicate success. In case of failure,it returns a NULL pointer and sets *status_p to a nonzero value indicating the reason forthe failure.Some query routines in the Callable Library return a nonzero value when they aresuccessful. For example, CPXgetnumcols returns the number of columns in the constraintmatrix (that is, the number of variables in the problem object). However, most query routinesreturn 0 (zero) indicating success of the query and entail one or more parameters (such as abuffer or character string) to contain the results of the query. For example, CPXgetrownamereturns the name of a row in its name parameter.It is extremely important that your application check the status—whether the status isindicated by the return value or by a parameter—of the routine that it calls before itproceeds.Symbolic ConstantsMost <strong>ILOG</strong> <strong>CPLEX</strong> routines return or require values that are defined as symbolic constantsin the header file (that is, the include file) cplex.h. This practice of using symbolicconstants, rather than hard-coded numeric values, is highly recommend. Symbolic namesimprove the readability of calling applications. Moreover, if numeric values happen tochange in subsequent releases of the product, the symbolic names will remain the same, thusmaking applications easier to maintain.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 117

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

Saved successfully!

Ooh no, something went wrong!