NO FRAMES

CPXaddindconstr

public int CPXaddindconstr(CPXCENVptr env, CPXLPptr lp, int indvar, int complemented, int nzcnt, double rhs, int sense, const int * linind, const double * linval, const char * indname_str)
Definition file: cplex.h

The routine CPXaddindconstr adds an indicator constraint to the specified problem object. This routine may be called any time after a call to CPXcreateprob.

An indicator constraint is a linear constraint that is enforced only:

The linear constraint may be a less-than-or-equal-to constraint, a greater-than-or-equal-to constraint, or an equality constraint.

Example

 status = CPXaddindconstr (env, lp, indicator, complemented, nzcnt,
                           rhs, sense, ind, val, newindname);
 

Parameters:

env

A pointer to the CPLEX environment, as returned by CPXopenCPLEX.

lp

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

indvar

The binary variable that acts as the indicator for this constraint.

complemented

A Boolean value that specifies whether the indicator variable is complemented. The linear constraint must be satisfied when the indicator takes a value of 1 (one) if the indicator is not complemented, and similarly, the linear constraint must be satisfied when the indicator takes a value of 0 (zero) if the indicator is complemented.

nzcnt

An integer that specifies the number of nonzero coefficients in the linear portion of the indicator constraint. This argument gives the length of the arrays linind and linval.

rhs

The righthand side value for the linear portion of the indicator constraint.

sense

The sense of the linear portion of the indicator constraint.

linind

An array that with linval defines the linear portion of the indicator constraint.

linval

An array that with linind defines the linear portion of the indicator constraint. The nonzero coefficients of the linear terms must be stored in sequential locations in the arrays linind and linval from positions 0 to nzcnt-1. Each entry, linind[i], indicates the variable index of the corresponding coefficient, linval[i].

indname_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 indicator constraints already resident in the CPLEX problem object have names; otherwise, no name is associated with the constraint.

Returns:

The routine returns zero if successful and nonzero if an error occurs.