CPXXcheckaddqconstr and CPXcheckaddqconstr

Checks data when a constraint containing a quadratic term is added to a model.

Signature


CPXCHECKLIBAPI
int CPXPUBLIC CPXXcheckaddqconstr (CPXCENVptr   env,
                                  CPXLPptr     lp,
                                  CPXDIM       linnzcnt,
                                  CPXNNZ       quadnzcnt,
                                  double       rhs,
                                  int          sense,
                                  const CPXDIM *linind,
                                  const double *linval,
                                  const CPXDIM *quadrow,
                                  const CPXDIM *quadcol,
                                  const double *quadval,
                                  const char   *constrname);
    

CPXCHECKLIBAPI
int CPXPUBLIC CPXcheckaddqconstr (CPXCENVptr   env,
                                  CPXLPptr     lp,
                                  CPXDIM       linnzcnt,
                                  CPXNNZ       quadnzcnt,
                                  double       rhs,
                                  int          sense,
                                  const CPXDIM *linind,
                                  const double *linval,
                                  const CPXDIM *quadrow,
                                  const CPXDIM *quadcol,
                                  const double *quadval,
                                  const char   *constrname);
    

Description

This routine validates the arguments of the corresponding routine CPXXaddqconstr and CPXaddqconstr. The source code of this data checking routine is in the file check.c, provided as part of the product.

To call this routine, you must compile and link check.c with your program as you compile and link with the CPLEX Callable Library.

Arguments

The arguments of this routine are the same as those of CPXXaddqconstr and CPXaddqconstr. The second argument, lp, is technically a pointer to a constant LP object of type CPXCLPptr rather than type CPXLPptr, because this routine does not modify the problem. For most user applications, this distinction is unimportant.

Name Description
env A pointer to the CPLEX environment as returned by CPXXopenCPLEX/CPXopenCPLEX.
lp A pointer to a CPLEX problem object as returned by CPXXcreateprob/CPXcreateprob.
linnzcnt An integer that specifies the number of nonzero constraint coefficients in the linear part of the constraint. This specifies the length of the arrays linind and linval.
quadnzcnt An integer that specifies the number of nonzero constraint coefficients in the quadratic part of the constraint. This specifies the length of the arrays quadrow, quadcol and quadval.
rhs The righthand side term for the constraint to be added.
sense The sense of the constraint to be added. Note that quadratic constraints may only be less-than-or-equal-to or greater-than-or-equal-to constraints. See the discussion of QCP in the CPLEX User's Manual.
linind An array that with linval defines the linear part of the quadratic constraint to be added.
linval An array that with linind defines the linear part of the constraint to be added. The nonzero coefficients of the linear terms must be stored in sequential locations in the arrays linind and linval from positions 0 to linnzcnt-1. Each entry, linind[i], specifies the variable index of the corresponding coefficient, linval[i]. May be NULL; then the constraint will have no linear terms.
quadrow An array that with quadcol and quadval defines the quadratic part of the quadratic constraint to be added.
quadcol An array that with quadrow and quadval defines the quadratic part of the quadratic constraint to be added.
quadval An array that with quadrow and quadcol define the quadratic part of the constraint to be added. The nonzero coefficients of the quadratic terms must be stored in sequential locations in the arrays quadrow, quadcol and quadval from positions 0 to quadnzcnt-1. Each pair, quadrow[i], quadcol[i], specifies the variable indices of the quadratic term, and quadval[i] the corresponding coefficient.
lname_str The name of the constraint to be added. May be NULL, in which case the new constraint is assigned a default name if the quadratic constraints already resident in the CPLEX problem object have names; otherwise, no name is associated with the constraint.

Return

The routine returns nonzero if it detects an error in the data; it returns zero if it does not detect any data errors.

Example


    status = CPXcheckaddqconstr (env, 
                                 lp, 
                                 linnzcnt, 
                                 quadnzcnt, 
                                 rhs, 
                                 sense,
                                 linind, 
                                 linval, 
                                 quadrow, 
                                 quadcol, 
                                 quadval,
                                 constrname);