XPRSgetgencons, XPRSgetgencons64
Purpose
Returns the general constraints
y = f(x1, ..., xn, c1, ..., cm) in a given range.
Synopsis
int XPRS_CC XPRSgetgencons(XPRSprob prob, int contype[], int resultant[], int colstart[], int colind[], int maxcols, int *p_ncols, int valstart[], double val[], int maxvals, int *p_nvals, int first, int last);
int XPRS_CC XPRSgetgencons64(XPRSprob prob, int contype[], int resultant[], XPRSint64 colstart[], int colind[], XPRSint64 maxcols, XPRSint64 *p_ncols, XPRSint64 valstart[], double val[], XPRSint64 maxvals, XPRSint64 *p_nvals, int first, int last);
Arguments
|
prob
|
The current problem.
|
||||||||||
|
contype
|
NULL if not required or an integer array of length at least
last-first+1 which will be filled with the types of the general constraints:
|
||||||||||
|
resultant
|
Integer array which will be filled with the indices of the output variables
y. It must be of length at least
last-first+1. May be
NULL if not required.
|
||||||||||
|
colstart
|
Integer array of length at least
last-first+2 which will be filled with the start index of each general constraint in the
colind array. May be
NULL if not required.
|
||||||||||
|
colind
|
Integer array which will be filled with the indices of the input variables
xi. May be
NULL if not required.
|
||||||||||
|
maxcols
|
Maximum number of input columns to be retrieved.
|
||||||||||
|
p_ncols
|
Pointer to return the number of input columns in the
colind array. If the number of input columns is greater than
maxcols, then only
maxcols elements will be returned. May be
NULL if not required.
|
||||||||||
|
valstart
|
Integer array of length at least
last-first+2 which will be filled with the start index of each general constraint in the
val array. May be
NULL if not required.
|
||||||||||
|
val
|
Integer array which will be filled with the constant values
ci. May be
NULL if not required.
|
||||||||||
|
maxvals
|
Maximum number of constant values to be retrieved.
|
||||||||||
|
p_nvals
|
Pointer to return the number of constant values in the
val array. If the number of constant values is greater than
maxvals, then only
maxvals elements will be returned.May be
NULL if not required.
|
||||||||||
|
first
|
First general constraint in the range.
|
||||||||||
|
last
|
Last general constraint in the range.
|
Example
The following example retrieves all general constraints:
int ngencons; int *contype; int *resultant; int *colstart; int *colind; int maxcols; int ncols; int *valstart; int *val; int maxvals; int nvals; ... XPRSgetdblattrib(prob, XPRS_GENCONS, &ngencons); XPRSgetgencons(prob, NULL, NULL, NULL, NULL, 0, &maxcols, NULL, NULL, 0, &maxvals, 0, ngencons - 1); contype = (int*) malloc(ngencons*sizeof(int)); resultant = (int*) malloc(ngencons*sizeof(int)); colstart = (int*) malloc((ngencons+1)*sizeof(int)); colind = (int*) malloc(maxcols*sizeof(int)); valstart = (int*) malloc((ngencons+1)*sizeof(int)); val = (double*) malloc(maxvals*sizeof(double)); XPRSgetgencons(prob, contype, resultant, colstart, colind, maxcols, &ncols, valstart, val, maxvals, &nvals, 0, ngencons - 1); ...
Further information
1. It is possible to obtain just the number of input columns and/or constant values in the range of general constraints by calling this function with
maxcols and
maxvals set to
0, in which case the required size for the arrays will be returned in
p_ncols and
p_nvals (one of them may be
NULL if only the other is required).
2. Since general constraints get transformed and replaced during presolve, this should not be called on the presolved problem.
Related topics
© 2001-2023 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation ("FICO"). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
