XPRSgetnamelist
XPRSgetnamelist |
int XPRS_CC XPRSgetnamelist(XPRSprob prob, int type, char names[], int names_len, int * names_len_reqd, int first, int last);
prob
|
The current problem.
|
||||||||||
type
|
|
||||||||||
names
|
A buffer into which the names will be returned as a sequence of null-terminated strings. The buffer should be of length
names_len bytes. May be NULL if
names_len is
0.
|
||||||||||
names_len
|
The maximum number of bytes that may be written to the buffer
names.
|
||||||||||
names_len_reqd
|
A pointer to a variable into which will be written the number of bytes required to contain the names in the specified range. May be NULL if not required.
|
||||||||||
first
|
First row, column, set, piecewise linear or general constraint in the range.
|
||||||||||
last
|
Last row, column, set, piecewise linear or general constraint in the range.
|
int i, o, cols, rows, cnames_len, rnames_len; char *cnames, *rnames; ... /* Get problem size */ XPRSgetintattrib(prob,XPRS_COLS,&cols); XPRSgetintattrib(prob,XPRS_ROWS,&rows); /* Request number of bytes required to retrieve the names */ XPRSgetnamelist(prob,1,NULL,0,&rnames_len,0,rows-1); XPRSgetnamelist(prob,2,NULL,0,&cnames_len,0,cols-1); /* Now allocate buffers big enough then fetch the names */ cnames = (char *) malloc(sizeof(char)*cnames_len); rnames = (char *) malloc(sizeof(char)*rnames_len); XPRSgetnamelist(prob,1,rnames,rnames_len,NULL,0,rows-1); XPRSgetnamelist(prob,2,cnames,cnames_len,NULL,0,cols-1); /* Output row names */ o=0; for (i=0;i<rows;i++) { printf("Row #%d: %s\n", i, rnames+o); o += strlen(rnames+o)+1; } /* Output column names */ o=0; for (i=0;i<cols;i++) { printf("Col #%d: %s\n", i, cnames+o); o += strlen(cnames+o)+1; }
© 2001-2020 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.