NO FRAMES

CPXaddqconstr

public int CPXaddqconstr(CPXCENVptr env, CPXLPptr lp, int linnzcnt, int quadnzcnt, double rhs, int sense, const int * linind, const double * linval, const int * quadrow, const int * quadcol, const double * quadval, const char * lname_str)
Definition file: cplex.h

The routine CPXaddqconstr adds a quadratic constraint to a specified CPLEX problem object. This routine may be called any time after a call to CPXcreateprob.

Codes for sense of constraints in QCPs
sense[i]= 'L'<= constraint
sense[i]= 'G'>= constraint

Example

 status = CPXaddqconstr (env, lp, linnzcnt, quadnzcnt, rhsval,
                         sense, linind, linval,
                         quadrow, quadcol, quadval, NULL);

See also the example qcpex1.c in the ILOG CPLEX User's Manual and in the standard distribution.

Parameters:

env

A pointer to the CPLEX environment as returned by CPXopenCPLEX.

lp

A pointer to a CPLEX problem object as returned by CPXcreateprob.

linnzcnt

An integer that indicates 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 indicates 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 ILOG 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], indicates 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], indicates 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.

Returns:

The routine returns zero on success and nonzero if an error occurs.