> Languages and APIs > The ILOG CPLEX Callable Library > ILOG CPLEX Programming Practices > Checking Problem Data |
Checking Problem Data |
INDEX PREVIOUS NEXT |
If you inadvertently make an error entering problem data, the problem object will not correspond to your intentions. One possible result may be a segmentation fault or other disruption of your application. In other cases, ILOG CPLEX may solve a different model from the one you intended, and that situation may or may not result in error messages from ILOG CPLEX.
To help you detect this kind of error, you can set the parameter CPX_PARAM_DATACHECK
to the value CPX_ON
to activate additional checking of array arguments for CPXcopy
Data, CPXread
Data, and CPXchg
Data functions (where Data varies). The additional checks include:
sense
/ctype
/sostype
values
rowind
numrows
matbeg
or sosbeg
array with decreasing values
NAN
s in double arrays
NULL
s in name arrays
When the parameter is set to CPX_OFF
, only simple checks, for example checking for the existence of the environment, are performed.
ILOG CPLEX also provides diagnostic routines to look for common errors in the definition of problem data. In the standard distribution of ILOG CPLEX, the file check.c
contains the source code for these routines:
CPXcheckcopylp
CPXcheckcopylpwnames
CPXcheckcopyqpsep
CPXcheckcopyquad
CPXcheckaddrows
CPXcheckaddcols
CPXcheckchgcoeflist
CPXcheckvals
CPXcheckcopyctype
CPXcheckcopysos
CPXNETcheckcopynet
Each of those routines performs a series of diagnostic tests of the problem data and issues warnings or error messages whenever it detects a potential error. To use them, you must compile and link the file check.c
. After compiling and linking that file, you will be able to step through the source code of these routines with a debugger to help isolate problems.
If you have observed anomalies in your application, you can exploit this diagnostic capability by calling the appropriate routines just before a change or copy routine. The diagnostic routine may then detect errors in the problem data that could subsequently cause inexplicable behavior.
Those checking routines send all messages to one of the standard ILOG CPLEX message channels. You capture that output by setting the parameter CPX_PARAM_SCRIND
(if you want messages directed to your screen) or by calling the routine CPXsetlogfile
.
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |