|
Go to the documentation of this file.
32 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE
34 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
59 static char __qsstr[1024];
68 #define __QS_PRINTLOC__ fprintf(stderr,", in (%s:%d)\n", __FILE__, __LINE__);
72 #define QS_TESTG(A,B,...) do{{ \
74 fprintf(stderr,__VA_ARGS__); \
79 #define QS_ERROR(A,...) do{{ \
81 fprintf(stderr,__VA_ARGS__); \
83 return SCIP_LPERROR;}}}while(0)
87 #define QS_RETURN(A) do{ \
88 const int __RVAL__ = (A); \
90 fprintf(stderr,"LP Error: QSopt returned %d",__RVAL__); \
93 return SCIP_OKAY;}while(0)
97 #define QS_CONDRET(A) do{ \
98 const int __RVAL__ = (A); \
100 fprintf(stderr,"LP Error: QSopt returned %d",__RVAL__); \
102 return SCIP_LPERROR;} \
147 assert(lpistate != NULL);
163 assert(lpistate != NULL);
180 assert(lpistate != NULL);
181 assert(blkmem != NULL);
199 assert(blkmem != NULL);
200 assert(lpistate != NULL);
201 assert(*lpistate != NULL);
270 const double* const lhs,
271 const double* const rhs
277 for( i = nrows ; i-- ; )
279 state = ((lhs[i] <= -QS_MAXDOUBLE ? 1U:0U) | (rhs[i] >= QS_MAXDOUBLE ? 2U:0U));
286 if( lhs[i] == rhs[i] )
289 lpi-> irhs[i] = lhs[i];
295 lpi-> irhs[i] = lhs[i];
296 lpi-> irng[i] = rhs[i] - lhs[i];
297 assert(lpi-> irng[i] >= 0.0);
302 lpi-> irhs[i] = rhs[i];
307 lpi-> irhs[i] = lhs[i];
334 char* vname = QSversion();
336 vnamelen = strlen(vname);
337 memcpy(__qsstr, vname, MIN( sizeof(__qsstr), vnamelen+1));
338 __qsstr[ sizeof(__qsstr)-1] = '\0';
348 return "Linear Programming Solver developed by D. Applegate, W. Cook, S. Dash, and M. Mevenkamp (www.isye.gatech.edu/~wcook/qsopt)";
356 return ( void*) lpi-> prob;
382 assert( sizeof ( SCIP_Real) == sizeof ( double));
383 assert( sizeof ( SCIP_Bool) == sizeof ( int));
390 memset(*lpi, 0, sizeof( struct SCIP_LPi));
392 (*lpi)->prob = QScreate_prob(name, ( int) objsen);
393 if ( (*lpi)->prob == NULL )
399 (*lpi)->rowspace = 1024;
406 (*lpi)->colspace = 1024;
414 (*lpi)->messagehdlr = messagehdlr;
425 assert(*lpi != NULL);
430 QSfree_prob((*lpi)->prob);
485 SCIPdebugMessage( "loading LP in column format into QSopt: %d cols, %d rows\n", ncols, nrows);
493 rval = QSchange_objsense(lpi-> prob, QS_MAX);
498 rval = QSchange_objsense(lpi-> prob, QS_MIN);
509 rval = QSadd_ranged_rows(lpi-> prob, nrows, lpi-> ircnt, lpi-> irbeg, 0, 0, lpi-> irhs, lpi-> isen, lpi-> irng, ( const char**)rownames);
516 for( i = 0; i < ncols-1; ++i )
518 lpi-> iccnt[i] = beg[i+1] - beg[i];
519 assert(lpi-> iccnt[i] >= 0);
523 lpi-> iccnt[ncols-1] = nnonz - beg[ncols-1];
524 assert(lpi-> iccnt[ncols-1] >= 0);
555 SCIPdebugMessage( "adding %d columns with %d nonzeros to QSopt\n", ncols, nnonz);
563 for( i = 0; i < ncols - 1; ++i )
565 lpi-> iccnt[i] = beg[i+1] - beg[i];
566 assert(lpi-> iccnt[i] >= 0);
570 lpi-> iccnt[ncols-1] = nnonz - beg[ncols-1];
571 assert(lpi-> iccnt[ncols-1] >= 0);
588 const int len = lastcol - firstcol +1;
596 assert(0 <= firstcol && len > 0 && lastcol < QSget_colcount(lpi-> prob));
601 for( i = firstcol ; i <= lastcol ; i++ )
602 lpi-> iccnt[i-firstcol] = i;
604 rval = QSdelete_cols(lpi-> prob, len, lpi-> iccnt);
617 int rval = 0, ncols, ccnt;
623 ncols = QSget_colcount(lpi-> prob);
628 rval = QSdelete_setcols(lpi-> prob,dstat);
631 for( i=0, ccnt=0; i < ncols; i++ )
662 SCIPdebugMessage( "adding %d rows with %d nonzeros to QSopt\n", nrows, nnonz);
677 for( i = 0 ; i < nrows -1 ; i++ )
679 lpi-> ircnt[i] = beg[i+1] - beg[i];
680 assert(lpi-> ircnt[i] >= 0);
684 lpi-> ircnt[nrows-1] = nnonz - beg[nrows-1];
685 assert(lpi-> ircnt[nrows-1] >= 0);
689 rval = QSadd_ranged_rows(lpi-> prob, nrows, lpi-> ircnt, ( int*) beg, ( int*) ind, ( SCIP_Real*) val, lpi-> irhs,
690 lpi-> isen, lpi-> irng, ( const char**)rownames);
691 QS_ERROR(rval, "failed adding %d rows with %d non-zeros", nrows, nnonz);
695 for( i = 0; i < nrows -1; ++i )
703 lpi-> isen, lpi-> irng, ( const char**)rownames);
704 QS_ERROR(rval, "failed adding %d rows with %d non-zeros", nrows, nnonz);
730 assert(colnames != NULL || namestoragesize == 0);
731 assert(namestorage != NULL || namestoragesize == 0);
732 assert(namestoragesize >= 0);
733 assert(storageleft != NULL);
734 assert(0 <= firstcol && firstcol <= lastcol && lastcol < QSget_colcount(lpi-> prob));
738 ncols = QSget_colcount(lpi-> prob);
741 rval = QSget_colnames(lpi-> prob, cnames);
742 QS_ERROR(rval, "failed getting column names");
746 sizeleft = namestoragesize;
747 for( j = firstcol; j <= lastcol; ++j )
751 if( colnames != NULL )
752 colnames[j-firstcol] = s;
761 *storageleft = sizeleft;
764 for( j = 0; j < ncols; ++j )
790 assert(rownames != NULL || namestoragesize == 0);
791 assert(namestorage != NULL || namestoragesize == 0);
792 assert(namestoragesize >= 0);
793 assert(storageleft != NULL);
794 assert(0 <= firstrow && firstrow <= lastrow && lastrow < QSget_rowcount(lpi-> prob));
798 nrows = QSget_rowcount(lpi-> prob);
801 rval = QSget_rownames(lpi-> prob, rnames);
802 QS_ERROR(rval, "failed getting row names");
805 sizeleft = namestoragesize;
806 for( i = firstrow; i <= lastrow; ++i )
810 if( rownames != NULL )
811 rownames[i-firstrow] = s;
820 *storageleft = sizeleft;
823 for( i = 0; i < nrows; ++i )
836 const int len = lastrow - firstrow +1;
844 assert(0 <= firstrow && len > 0 && lastrow < QSget_rowcount (lpi-> prob));
849 for( i = firstrow; i <= lastrow; i++ )
850 lpi-> ircnt[i-firstrow] = i;
851 rval = QSdelete_rows(lpi-> prob, len, lpi-> ircnt);
865 int rval = 0, nrows, ccnt, ndel=0;
871 nrows = QSget_rowcount(lpi-> prob);
874 for( i = 0; i < nrows; ++i )
882 rval = QSdelete_setrows(lpi-> prob,dstat);
885 for( i=0, ccnt=0; i < nrows; i++ )
901 int ncols, nrows, rval = 0;
909 ncols = QSget_colcount(lpi-> prob);
910 nrows = QSget_rowcount(lpi-> prob);
914 for( i = 0; i < ncols; ++i )
916 rval = QSdelete_cols(lpi-> prob, ncols, lpi-> iccnt);
923 for( i = 0; i < nrows; ++i )
925 rval = QSdelete_rows(lpi-> prob, nrows, lpi-> ircnt);
953 for( j = 0; j < ncols; ++j )
959 for( i = 0; i < ncols; ++i )
965 for( i = 0; i < ncols; ++i )
997 for( i = 0; i < nrows; ++i )
999 rval = QSchange_sense(lpi-> prob, ind[i], lpi-> isen[i]);
1002 rval = QSchange_rhscoef(lpi-> prob, ind[i], lpi-> irhs[i]);
1005 if( lpi-> isen[i] == 'R' )
1007 rval = QSchange_range(lpi-> prob, ind[i], lpi-> irng[i]);
1025 assert(lpi != NULL);
1030 SCIPdebugMessage( "changing coefficient row %d, column %d in QSopt to %g\n", row, col, newval);
1032 rval = QSchange_coef(lpi-> prob, row, col, newval);
1045 assert(lpi != NULL);
1054 rval = QSchange_objsense(lpi-> prob, QS_MAX);
1059 rval = QSchange_objsense(lpi-> prob, QS_MIN);
1076 assert(lpi != NULL);
1082 for( i = 0; i < ncols; ++i )
1084 rval = QSchange_objcoef(lpi-> prob, ind[i], obj[i]);
1104 assert(lpi != NULL);
1108 SCIPdebugMessage( "scaling row %d with factor %g in QSopt\n", row, scaleval);
1112 rval = QSget_ranged_rows_list(lpi-> prob, 1, rowlist, &rowcnt, &rowbeg, &rowind, &rowval, &rhs, &sense, &range, 0);
1116 for( i = 0; i < rowcnt[0]; ++i )
1118 rval = QSchange_coef(lpi-> prob, row, rowind[i], rowval[i] * scaleval);
1125 rval = QSchange_rhscoef(lpi-> prob, row, rhs[0] * scaleval);
1127 if( sense[0] == 'R' )
1129 rval = QSchange_range(lpi-> prob, row, range[0] * scaleval);
1139 rval = QSchange_rhscoef(lpi-> prob, row, rhs[0]*scaleval);
1143 rval = QSchange_rhscoef(lpi-> prob, row, rhs[0]*scaleval);
1145 rval = QSchange_sense(lpi-> prob, row, 'G');
1149 rval = QSchange_rhscoef(lpi-> prob, row, rhs[0]*scaleval);
1151 rval = QSchange_sense(lpi-> prob, row, 'L');
1155 rhs[0] = (rhs[0] + range[0]) * scaleval;
1156 range[0] = fabs(scaleval) * range[0];
1157 rval = QSchange_rhscoef(lpi-> prob, row, rhs[0]);
1159 rval = QSchange_range(lpi-> prob, row, range[0]);
1172 if( rowcnt != NULL )
1174 if( rowbeg != NULL )
1176 if( rowind != NULL )
1178 if( rowval != NULL )
1211 assert(lpi != NULL);
1215 SCIPdebugMessage( "scaling column %d with factor %g in QSopt\n", col, scaleval);
1219 rval = QSget_columns_list(lpi-> prob, 1, collist, &colcnt, &colbeg, &colind, &colval, &obj, &lb, &ub, 0);
1223 for( i = 0; i < colcnt[0]; ++i )
1225 rval = QSchange_coef(lpi-> prob, colind[i], col, colval[i]*scaleval);
1230 rval = QSchange_objcoef(lpi-> prob, col, obj[0]*scaleval);
1236 scaleval = -scaleval;
1241 if( lb[0] > -QS_MAXDOUBLE )
1243 if( ub[0] < QS_MAXDOUBLE )
1246 if( lb[0] < -QS_MAXDOUBLE )
1247 lb[0] = -QS_MAXDOUBLE;
1248 if( ub[0] > QS_MAXDOUBLE )
1249 ub[0] = QS_MAXDOUBLE;
1251 rval = QSchange_bound(lpi-> prob, col, 'L', lb[0]);
1253 rval = QSchange_bound(lpi-> prob, col, 'U', ub[0]);
1258 if( colcnt != NULL )
1260 if( colbeg != NULL )
1262 if( colind != NULL )
1264 if( colval != NULL )
1293 assert(lpi != NULL);
1295 assert(nrows != NULL);
1299 *nrows = QSget_rowcount(lpi-> prob);
1310 assert(lpi != NULL);
1312 assert(ncols != NULL);
1316 *ncols = QSget_colcount(lpi-> prob);
1327 assert(lpi != NULL);
1332 *nnonz = QSget_nzcount(lpi-> prob);
1355 double* lval = NULL;
1363 assert(lpi != NULL);
1365 assert(0 <= firstcol && firstcol <= lastcol && lastcol < QSget_colcount (lpi-> prob));
1366 assert((lb == 0 && ub == 0) || (lb != 0 && ub != 0));
1367 assert((nnonz != 0 && beg != 0 && ind != 0 && val != 0) || (nnonz == 0 && beg == 0 && ind == 0 && val == 0));
1372 len = lastcol - firstcol + 1;
1374 for( i = 0; i < len; ++i )
1375 lpi-> iccnt[i] = i + firstcol;
1378 rval = QSget_columns_list(lpi-> prob, len, lpi-> iccnt, nnonz ? (&lcnt) : 0, nnonz ? (&lbeg) : 0, nnonz ? (&lind) : 0,
1379 nnonz ? (&lval) : 0, 0, lb ? (&llb) : 0, lb ? (&lub) : 0, 0);
1386 assert(lbeg != NULL);
1387 assert(lcnt != NULL);
1388 assert(lind != NULL);
1389 assert(lval != NULL);
1391 *nnonz = lbeg[len-1] + lcnt[len-1];
1392 for( i = 0 ; i < len ; i++ )
1394 for( i = 0; i < *nnonz; ++i )
1402 assert(llb != NULL);
1403 assert(lub != NULL);
1405 for( i = 0; i < len; ++i )
1445 const int len = lastrow - firstrow + 1;
1447 double* lval = NULL;
1448 double* lrhs = NULL;
1449 double* lrng = NULL;
1454 char* lsense = NULL;
1456 assert(lpi != NULL);
1458 assert(0 <= firstrow && firstrow <= lastrow && lastrow < QSget_rowcount (lpi-> prob));
1459 assert((lhs == 0 && rhs == 0) || (rhs != 0 && lhs != 0));
1460 assert((nnonz != 0 && beg != 0 && ind != 0 && val != 0) || (nnonz == 0 && beg == 0 && ind == 0 && val == 0));
1466 for( i = 0; i < len; ++i )
1467 lpi-> ircnt[i] = i + firstrow;
1470 rval = QSget_ranged_rows_list(lpi-> prob, len, lpi-> ircnt, nnonz ? (&lcnt) : 0, nnonz ? (&lbeg) : 0, nnonz ? (&lind) : 0,
1471 nnonz ? (&lval) : 0, rhs ? (&lrhs) : 0, rhs ? (&lsense) : 0, rhs ? (&lrng) : 0, 0);
1477 assert(lbeg != NULL);
1478 assert(lcnt != NULL);
1479 assert(lind != NULL);
1480 assert(lval != NULL);
1482 *nnonz = lbeg[len-1] + lcnt[len-1];
1483 for( i = 0 ; i < len; i++ )
1485 for( i = 0; i < *nnonz; ++i )
1493 assert(lrhs != NULL);
1494 assert(lrng != NULL);
1495 assert(lsense != NULL);
1497 for( i = 0; i < len; ++i )
1503 rhs[i] = lrhs[i] + lrng[i];
1506 lhs[i] = rhs[i] = lrhs[i];
1510 lhs[i] = -QS_MAXDOUBLE;
1514 rhs[i] = QS_MAXDOUBLE;
1525 if( lsense != NULL )
1561 const int len = lastcol - firstcol + 1;
1565 assert(lpi != NULL);
1567 assert(0 <= firstcol && firstcol <= lastcol && lastcol < QSget_colcount (lpi-> prob));
1569 SCIPdebugMessage( "getting objective values %d to %d\n", firstcol, lastcol);
1573 for( i = 0; i < len; ++i )
1574 lpi-> iccnt[i] = i + firstcol;
1577 rval = QSget_obj_list(lpi-> prob, len, lpi-> iccnt, vals);
1591 const int len = lastcol - firstcol + 1;
1595 assert(lpi != NULL);
1597 assert(0 <= firstcol && firstcol <= lastcol&& lastcol < QSget_colcount (lpi-> prob));
1603 for( i = 0; i < len; ++i )
1604 lpi-> iccnt[i] = i + firstcol;
1607 rval = QSget_bounds_list(lpi-> prob, len, lpi-> iccnt, lbs, ubs);
1621 const int len = lastrow - firstrow + 1;
1623 double* lrhs=0, *lrng=0;
1627 assert(lpi != NULL);
1629 assert(0 <= firstrow && firstrow <= lastrow && lastrow < QSget_rowcount (lpi-> prob));
1630 assert(rhss != NULL);
1631 assert(lhss != NULL);
1637 for( i = 0; i < len; ++i )
1638 lpi-> ircnt[i] = i + firstrow;
1641 rval = QSget_ranged_rows_list(lpi-> prob, len, lpi-> ircnt, 0, 0, 0, 0, &lrhs, &lsense, &lrng, 0);
1645 for( i = 0; i < len; ++i )
1651 rhss[i] = lrhs[i] + lrng[i];
1654 lhss[i] = rhss[i] = lrhs[i];
1658 lhss[i] = -QS_MAXDOUBLE;
1662 rhss[i] = QS_MAXDOUBLE;
1672 if( lsense != NULL )
1692 assert(lpi != NULL);
1697 rval = QSget_coef(lpi-> prob, row, col, val);
1721 assert(lpi != NULL);
1724 SCIPdebugMessage( "calling QSopt primal simplex: %d cols, %d rows, %d nz\n", QSget_colcount(lpi-> prob),
1725 QSget_rowcount(lpi-> prob), QSget_nzcount(lpi-> prob));
1739 assert(lpi != NULL);
1742 SCIPdebugMessage( "calling QSopt dual simplex: %d cols, %d rows, %d nz\n", QSget_colcount(lpi-> prob),
1743 QSget_rowcount(lpi-> prob), QSget_nzcount(lpi-> prob));
1795 assert(lpi != NULL);
1797 assert(down != NULL);
1799 assert(downvalid != NULL);
1800 assert(upvalid != NULL);
1802 SCIPdebugMessage( "calling QSopt strong branching on variable %d with fractional value (%d it lim)\n", col, itlim);
1811 rval = QSopt_strongbranch(lpi-> prob, 1, &col, &psol, down, up, itlim, QS_MAXDOUBLE);
1814 rval = QSget_itcnt(lpi-> prob, 0, 0, 0, 0, &nit);
1818 *iter = nit - lpi-> previt;
1844 assert(lpi != NULL);
1846 assert(cols != NULL);
1847 assert(psols != NULL);
1848 assert(down != NULL);
1850 assert(downvalid != NULL);
1851 assert(upvalid != NULL);
1853 SCIPdebugMessage( "calling QSopt strong branching on %d variables with fractional value (%d it lim)\n", ncols, itlim);
1856 for( j = 0; j < ncols; ++j )
1858 downvalid[j] = TRUE;
1860 assert(! EPSISINT(psols[j], 1e-06));
1864 rval = QSopt_strongbranch(lpi-> prob, ncols, cols, psols, down, up, itlim, QS_MAXDOUBLE);
1867 rval = QSget_itcnt(lpi-> prob, 0, 0, 0, 0, &nit);
1871 *iter = nit - lpi-> previt;
1895 assert(lpi != NULL);
1897 assert(down != NULL);
1899 assert(downvalid != NULL);
1900 assert(upvalid != NULL);
1902 SCIPdebugMessage( "calling QSopt strong branching on variable %d with integral value (%d it lim)\n", col, itlim);
1909 rval = QSget_objval(lpi-> prob, &objval);
1943 assert(lpi != NULL);
1945 assert(down != NULL);
1947 assert(downvalid != NULL);
1948 assert(upvalid != NULL);
1950 SCIPdebugMessage( "calling QSopt strong branching on %d variables with integral value (%d it lim)\n", ncols, itlim);
1955 rval = QSget_objval(lpi-> prob, &objval);
1958 for( j = 0; j < ncols; ++j )
1963 downvalid[j] = TRUE;
2004 assert(lpi != NULL);
2011 if( lpi-> solstat == QS_LP_OPTIMAL || lpi-> solstat == QS_LP_UNBOUNDED )
2012 *primalfeasible = 1;
2014 if( lpi-> solstat == QS_LP_OPTIMAL || lpi-> solstat == QS_LP_INFEASIBLE || lpi-> solstat == QS_LP_OBJ_LIMIT )
2027 assert(lpi != NULL);
2034 return (lpi-> solstat == QS_LP_UNBOUNDED);
2044 assert(lpi != NULL);
2058 assert(lpi != NULL);
2065 return (lpi-> solstat == QS_LP_UNBOUNDED);
2073 assert(lpi != NULL);
2080 return (lpi-> solstat == QS_LP_INFEASIBLE);
2088 assert(lpi != NULL);
2095 return (lpi-> solstat == QS_LP_OPTIMAL || lpi-> solstat == QS_LP_UNBOUNDED);
2105 assert(lpi != NULL);
2112 return (lpi-> solstat == QS_LP_INFEASIBLE);
2122 assert(lpi != NULL);
2129 return (lpi-> solstat == QS_LP_INFEASIBLE);
2137 assert(lpi != NULL);
2144 return (lpi-> solstat == QS_LP_INFEASIBLE);
2152 assert(lpi != NULL);
2159 return (lpi-> solstat == QS_LP_UNBOUNDED);
2167 assert(lpi != NULL);
2174 return (lpi-> solstat == QS_LP_OPTIMAL || lpi-> solstat == QS_LP_OBJ_LIMIT);
2182 assert(lpi != NULL);
2189 return (lpi-> solstat == QS_LP_OPTIMAL);
2197 assert(lpi != NULL);
2204 return (lpi-> solstat != QS_LP_NUMERR);
2212 assert(lpi != NULL);
2219 return (lpi-> solstat == QS_LP_OBJ_LIMIT);
2227 assert(lpi != NULL);
2234 return (lpi-> solstat == QS_LP_ITER_LIMIT);
2242 assert(lpi != NULL);
2249 return (lpi-> solstat == QS_LP_TIME_LIMIT);
2257 assert(lpi != NULL);
2273 assert(lpi != NULL);
2292 assert(lpi != NULL);
2297 rval = QSget_objval(lpi-> prob, objval);
2312 int rval = 0, nrows;
2316 int stat, ncols, sense;
2317 char *icstat, *irstat;
2320 assert(lpi != NULL);
2325 nrows = QSget_rowcount(lpi-> prob);
2328 rval = QSget_solution(lpi-> prob, objval, primsol, dualsol, lpi-> irng, redcost);
2333 QSget_status(lpi-> prob, &stat);
2334 rval = QSget_objsense(lpi-> prob, &sense);
2335 if( stat == QS_LP_OPTIMAL )
2337 ncols = QSget_colcount(lpi-> prob);
2342 irstat = lpi-> ibas+ncols;
2344 rval = QSget_basis_array(lpi-> prob,icstat, irstat);
2347 for( i = ncols ; i-- ; )
2351 case QS_COL_BSTAT_BASIC:
2352 case QS_COL_BSTAT_FREE:
2353 if( fabs(redcost[i])> 1e-6 )
2355 SCIPerrorMessage( "stat col[%d] = %c, rd[%d] = %lg sense %d\n", i, icstat[i], i, redcost[i]*sense, sense);
2360 case QS_COL_BSTAT_UPPER:
2361 if( redcost[i]*sense > 1e-6 )
2363 SCIPerrorMessage( "stat col[%d] = %c, rd[%d] = %lg sense %d\n", i, icstat[i], i, redcost[i]*sense, sense);
2368 case QS_COL_BSTAT_LOWER:
2369 if( redcost[i]*sense < -1e-6 )
2371 SCIPerrorMessage( "stat col[%d] = %c, rd[%d] = %lg sense %d\n", i, icstat[i], i, redcost[i]*sense, sense);
2377 SCIPerrorMessage( "unknown stat col[%d] = %c, rd[%d] = %lg\n", i, icstat[i], i, redcost[i]*sense);
2390 rval = QSget_rhs(lpi-> prob, lpi-> irhs);
2392 rval = QSget_senses(lpi-> prob, lpi-> isen);
2398 for( i = 0; i < nrows; ++i )
2400 switch( lpi-> isen[i] )
2405 activity[i] = lpi-> irhs[i] + lpi-> irng[i];
2408 activity[i] = lpi-> irhs[i] - lpi-> irng[i];
2427 assert(lpi != NULL);
2443 assert(lpi != NULL);
2445 assert(dualfarkas != NULL);
2447 SCIPdebugMessage( "calling QSopt dual Farkas: %d cols, %d rows, %d non zeros\n", QSget_colcount (lpi-> prob),
2448 QSget_rowcount(lpi-> prob), QSget_nzcount(lpi-> prob));
2450 rval = QSget_infeas_array(lpi-> prob, dualfarkas);
2464 assert(lpi != NULL);
2467 rval = QSget_itcnt(lpi-> prob, 0, 0, 0, 0, &nit);
2470 *iterations = nit - lpi-> previt;
2487 assert(lpi != NULL);
2488 assert(quality != NULL);
2514 int rval = 0, ncols, nrows;
2515 char* icstat = NULL;
2516 char* irstat = NULL;
2519 assert(lpi != NULL);
2522 SCIPdebugMessage( "saving QSopt basis into %p/%p\n", ( void*)cstat, ( void*)rstat);
2524 ncols = QSget_colcount(lpi-> prob);
2525 nrows = QSget_rowcount(lpi-> prob);
2530 irstat = lpi-> ibas+ncols;
2531 rval = QSget_basis_array(lpi-> prob, icstat, irstat);
2535 for( i = 0; i < nrows; ++i )
2539 case QS_ROW_BSTAT_LOWER:
2542 case QS_ROW_BSTAT_BASIC:
2545 case QS_ROW_BSTAT_UPPER:
2554 for( i = 0; i < ncols; ++i )
2558 case QS_COL_BSTAT_LOWER:
2561 case QS_COL_BSTAT_BASIC:
2564 case QS_COL_BSTAT_UPPER:
2567 case QS_COL_BSTAT_FREE:
2586 int rval = 0, ncols, nrows;
2588 char* icstat=0, *irstat = 0;
2590 assert(lpi != NULL);
2593 SCIPdebugMessage( "loading basis %p/%p into QSopt\n", ( void*)cstat, ( void*)rstat);
2595 ncols = QSget_colcount(lpi-> prob);
2596 nrows = QSget_rowcount(lpi-> prob);
2601 irstat = lpi-> ibas + ncols;
2604 for( i = 0; i < nrows; ++i )
2609 irstat[i] = QS_ROW_BSTAT_LOWER;
2612 irstat[i] = QS_ROW_BSTAT_BASIC;
2615 irstat[i] = QS_ROW_BSTAT_UPPER;
2623 for( i = 0; i < ncols; ++i )
2628 icstat[i] = QS_COL_BSTAT_LOWER;
2631 icstat[i] = QS_COL_BSTAT_BASIC;
2634 icstat[i] = QS_COL_BSTAT_UPPER;
2637 icstat[i] = QS_COL_BSTAT_FREE;
2647 rval = QSget_basis_array(lpi-> prob, icstat, irstat);
2658 int rval = 0, nrows, ncols;
2666 nrows = QSget_rowcount(lpi-> prob);
2667 ncols = QSget_colcount(lpi-> prob);
2668 rval = QSget_basis_order( lpi-> prob, bind);
2672 for( i = 0; i < nrows; ++i )
2674 if( bind[i] >= ncols )
2675 bind[i] = -(bind[i] - ncols - 1);
2692 SCIPdebugMessage( "getting binv-row %d from Qsopt %d cols, %d rows, %d nonz\n", r, QSget_colcount(lpi-> prob),
2693 QSget_rowcount(lpi-> prob), QSget_nzcount(lpi-> prob));
2695 rval = QSget_binv_row(lpi-> prob, r, coef);
2727 int rval = 0,ncols,nrows;
2729 assert(lpi != NULL);
2734 ncols = QSget_colcount(lpi-> prob);
2735 nrows = QSget_rowcount(lpi-> prob);
2739 rval = QSget_tableau_row(lpi-> prob, r, lpi-> itab);
2743 memcpy(coef, lpi-> itab, sizeof( double)*ncols);
2785 assert(lpi != NULL);
2787 assert(blkmem != NULL);
2788 assert(lpistate != NULL);
2790 ncols = QSget_colcount(lpi-> prob);
2791 nrows = QSget_rowcount(lpi-> prob);
2798 SCIPdebugMessage( "storing QSopt LPI state in %p (%d cols, %d rows)\n", ( void*)*lpistate, ncols, nrows);
2806 (*lpistate)->ncols = ncols;
2807 (*lpistate)->nrows = nrows;
2829 assert(lpi != NULL);
2833 if( lpistate == NULL )
2837 ncols = QSget_colcount(lpi-> prob);
2838 nrows = QSget_rowcount(lpi-> prob);
2842 assert(lpistate-> ncols <= ncols);
2843 assert(lpistate-> nrows <= nrows);
2845 SCIPdebugMessage( "loading LPI state %p (%d cols, %d rows) into QSopt LP with %d cols and %d rows\n", ( void*)lpistate, lpistate-> ncols,
2846 lpistate-> nrows, ncols, nrows);
2848 if( lpistate-> ncols == 0 || lpistate-> nrows == 0 )
2857 irstat = lpi-> ibas + ncols;
2863 for( i = lpistate-> ncols; i < ncols; ++i )
2869 rval = QSget_bounds_list(lpi-> prob, 1, &i, &lb, &ub);
2881 for( i = lpistate-> nrows; i < nrows; ++i )
2885 for( i = 0; i < nrows; ++i )
2887 switch( lpi-> ircnt[i] )
2890 irstat[i] = QS_ROW_BSTAT_LOWER;
2893 irstat[i] = QS_ROW_BSTAT_BASIC;
2896 irstat[i] = QS_ROW_BSTAT_UPPER;
2904 for( i = 0; i < ncols; ++i )
2906 switch( lpi-> iccnt[i] )
2909 icstat[i] = QS_COL_BSTAT_LOWER;
2912 icstat[i] = QS_COL_BSTAT_BASIC;
2915 icstat[i] = QS_COL_BSTAT_UPPER;
2918 icstat[i] = QS_COL_BSTAT_FREE;
2928 rval = QSload_basis_array(lpi-> prob, icstat, irstat);
2937 assert(lpi != NULL);
2940 SCIPerrorMessage( "QSopt interface does not implement SCIPlpiClearState()\n");
2952 assert(lpi != NULL);
2953 assert(lpistate != NULL);
2955 if( *lpistate != NULL )
2967 return (lpistate != NULL);
2978 assert(lpi != NULL);
2983 rval = QSread_and_load_basis(lpi-> prob, fname);
3002 assert(lpi != NULL);
3007 bas = QSget_basis(lpi-> prob);
3008 QS_ERROR(bas == 0, "Could not get basis from problem.");
3011 rval = QSwrite_basis(lpi-> prob, bas, fname);
3043 assert(lpinorms != NULL);
3059 assert(lpinorms == NULL);
3072 assert(lpinorms == NULL);
3099 assert(lpi != NULL);
3101 assert(ival != NULL);
3112 rval = QSget_param(lpi-> prob, QS_PARAM_SIMPLEX_SCALING,ival);
3122 rval = QSget_param(lpi-> prob, QS_PARAM_SIMPLEX_DISPLAY, ival);
3129 rval = QSget_param(lpi-> prob, QS_PARAM_SIMPLEX_MAX_ITERATIONS, ival);
3147 assert(lpi != NULL);
3156 rval = QSset_param(lpi-> prob, QS_PARAM_SIMPLEX_SCALING, 1);
3158 rval = QSset_param(lpi-> prob, QS_PARAM_SIMPLEX_SCALING, 0);
3169 rval = QSset_param(lpi-> prob, QS_PARAM_PRIMAL_PRICING, QS_PRICE_PSTEEP);
3170 rval += QSset_param(lpi-> prob, QS_PARAM_DUAL_PRICING, QS_PRICE_DSTEEP);
3173 rval = QSset_param(lpi-> prob,QS_PARAM_PRIMAL_PRICING,QS_PRICE_PMULTPARTIAL);
3174 rval += QSset_param(lpi-> prob,QS_PARAM_DUAL_PRICING,QS_PRICE_DMULTPARTIAL);
3177 rval = QSset_param(lpi-> prob,QS_PARAM_PRIMAL_PRICING,QS_PRICE_PDEVEX);
3178 rval += QSset_param(lpi-> prob,QS_PARAM_DUAL_PRICING,QS_PRICE_DDEVEX);
3186 rval = QSset_param(lpi-> prob, QS_PARAM_SIMPLEX_DISPLAY, 1);
3188 rval = QSset_param(lpi-> prob, QS_PARAM_SIMPLEX_DISPLAY, 0);
3191 rval = QSset_param(lpi-> prob, QS_PARAM_SIMPLEX_MAX_ITERATIONS, ival);
3209 assert(lpi != NULL);
3211 assert(dval != NULL);
3218 rval = QSget_param_double(lpi-> prob, QS_PARAM_OBJLLIM, dval);
3221 rval = QSget_param_double(lpi-> prob, QS_PARAM_OBJULIM, dval);
3224 rval = QSget_param_double(lpi-> prob, QS_PARAM_SIMPLEX_MAX_TIME, dval);
3246 assert(lpi != NULL);
3254 rval = QSset_param_double(lpi-> prob, QS_PARAM_SIMPLEX_MAX_TIME, dval);
3257 rval = QSset_param_double(lpi-> prob, QS_PARAM_OBJLLIM, dval);
3260 rval = QSset_param_double(lpi-> prob, QS_PARAM_OBJULIM, dval);
3290 return QS_MAXDOUBLE;
3299 return (val >= QS_MAXDOUBLE);
3320 assert(lpi != NULL);
3326 QSfree_prob(lpi-> prob);
3331 lpi-> prob = QSread_prob(fname, "LP");
3332 if( lpi-> prob == 0 )
3344 assert(lpi != NULL);
3349 if( QSwrite_prob (lpi-> prob, fname, "LP") )
|