int QSadd_rows (QSprob p, int num, int *rmatcnt, int *rmatbeg, int *rmatind, double *rmatval, double *rhs, char *sense, char **names)
/* Assume p is initialized to the problem in the QSload_prob example. */ /* Add two new rows to obtain the following LP. */ /* Maximize 3.0x + 2.0y + 4.0z */ /* Subject to */ /* 3.1x + 2.3y + 1.4z <= 12.2 */ /* 5.0x + 1.1y = 10.0 */ /* 0.5x + 2.0y + 4.0z >= 6.0 New */ /* 3.0y + 2.0z <= 8.0 New */ /* x >= 2.0 */ /* y free */ /* 1.0 <= z <= 10.0 */ /* */ int rval; int rmatcnt[2] = { 3, 2 }; int rmatbeg[2] = { 0, 3 }; int rmatind[5] = { 0, 1, 2, 1, 2 }; double rmatval[5] = { 0.5, 2.0, 4.0, 3.0, 2.0 }; double rhs[2] = { 6.0, 8.0 }; char sense[2] = { 'G', 'L' }; rval = QSadd_rows (p, 2, rmatcnt, rmatbeg, rmatind, rmatval, rhs, sense, (char **) NULL); if (rval) { fprintf (stderr, "Add rows failed, error code %d\n", rval); } else { rval = QSwrite_prob (p, "new2small.lp", "LP"); if (rval) { fprintf (stderr, "Could not write LP, error code %d\n", rval); } }