lpi_clp.cpp
Go to the documentation of this file.
26 * - Currently, Clp (Version 1.10) supports two ways of adding rows/columns from arrays: One uses a 29 * variant. Since for LPI there should be no gaps in the corresponding arrays, i.e., every entry in 30 * @p val and @a ind gives a nonzero entry, one can switch between the two formats. With the current 47 * - Clp allows the setting of several special flags. These are now set when the FASTMIP option in 53 * isProvenPrimalInfeasible(). Currently (version 1.10) no change in the Clp functions will be made, 56 /*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 84 /* for debugging: alternatingly write files "debug_[p|d]_[0|1].mps" after each run - use with care! */ 115 typedef SCIP_DUALPACKET COLPACKET; /* each column needs two bits of information (basic/on_lower/on_upper) */ 117 typedef SCIP_DUALPACKET ROWPACKET; /* each row needs two bit of information (basic/on_lower/on_upper) */ 366 * 256 - Normally Clp keeps a scaled row copy for speed. For very large problems you might want to turn it off. 369 * 8192 - If the primal has a perturbed problem and needs to clean up, it normally uses dual - but in some cases can be better to use primal. 446 return "COIN-OR Linear Programming Solver developed by J. Forrest et.al. (projects.coin-or.org/Clp)"; 719 // Current Clp version (1.8) can't delete a range of columns; we have to use deleteColumns (see SCIPlpiDelColset) 735 /** deletes columns from SCIP_LPI; the new position of a column must not be greater that its old position */ 858 // Current Clp version (1.8) can't delete a range of rows; we have to use deleteRows (see SCIPlpiDelRowset) 875 /** deletes rows from SCIP_LP; the new position of a row must not be greater that its old position */ 1098 clp->setObjCoeff(ind[j], obj[j]); // inlined version of clp->setObjectiveCoefficient(ind[j], obj[j]); 1104 /** multiplies a row with a non-zero scalar; for negative scalars, the row's sense is switched accordingly */ 1175 /** multiplies a column with a non-zero scalar; the objective value is multiplied with the scalar, and the bounds 1308 /** gets columns from LP problem object; the arrays have to be large enough to store all values 1336 const double* colLower = clp->getColLower(); // Here we can use the const versions (see SCIPchgBounds) 1401 const double* rowLower = clp->getRowLower(); // Here we can use the const versions (see SCIPchgSides) 1449 int namestoragesize, /**< size of namestorage (if 0, storageleft returns the storage needed) */ 1465 int namestoragesize, /**< size of namestorage (if 0, -storageleft returns the storage needed) */ 1474 /** tries to reset the internal status of the LP solver in order to ignore an instability of the last solving call */ 1527 const double* obj = lpi->clp->getObjCoefficients(); // Here we can use the const versions (see SCIPchgObj) 1552 const double* colLower = lpi->clp->getColLower(); // Here we can use the const versions (see SCIPchgBounds) 1583 const double* rowLower = lpi->clp->getRowLower(); // Here we can use the const versions (see SCIPchgSides) 1639 SCIPdebugMessage("calling Clp primal(): %d cols, %d rows\n", lpi->clp->numberColumns(), lpi->clp->numberRows()); 1712 SCIPdebugMessage("calling Clp dual(): %d cols, %d rows\n", lpi->clp->numberColumns(), lpi->clp->numberRows()); 1779 /** calls barrier or interior point algorithm to solve the LP with crossover to simplex basis */ 1788 SCIPdebugMessage("calling Clp barrier(): %d cols, %d rows\n", lpi->clp->numberColumns(), lpi->clp->numberRows()); 1854 SCIPdebugMessage("calling SCIPlpiStrongbranch() on variable %d (%d iterations)\n", col, itlim); 1962 //int res = clp->strongBranching(1, &col, up, down, outputSolution, outputStatus, outputIterations, false, false, startFinishOptions); 1963 int res = clp->strongBranching(1, &col, up, down, outputSolution, outputStatus, outputIterations, false, true, startFinishOptions); 2014 SCIPdebugMessage("calling SCIPlpiStrongbranches() on %d variables (%d iterations)\n", ncols, itlim); 2134 int res = clp->strongBranching(ncols, cols, up, down, outputSolution, outputStatus, outputIterations, false, true, startFinishOptions); 2209 SCIP_CALL( lpiStrongbranches(lpi, cols, ncols, psols, itlim, down, up, downvalid, upvalid, iter) ); 2255 SCIP_CALL( lpiStrongbranches(lpi, cols, ncols, psols, itlim, down, up, downvalid, upvalid, iter) ); 2323 /** returns TRUE iff LP is proven to have a primal unbounded ray (but not necessary a primal feasible point); 2341 /** returns TRUE iff LP is proven to have a primal unbounded ray (but not necessary a primal feasible point), 2386 * stop with objective limit exceedence). Hence we are infeasible only if status == 1 and we have 2388 return ( lpi->clp->status() == 1 && (lpi->clp->secondaryStatus() == 0 || lpi->clp->secondaryStatus() == 6) ); 2406 /** returns TRUE iff LP is proven to have a dual unbounded ray (but not necessary a dual feasible point); 2418 /* Clp assumes to have a dual ray whenever it concludes "primal infeasible" and the algorithm was 2420 return ( lpi->clp->status() == 1 && lpi->clp->secondaryStatus() == 0 && lpi->clp->algorithm() < 0 ); 2424 /** returns TRUE iff LP is proven to have a dual unbounded ray (but not necessary a dual feasible point), 2436 /* Clp assumes to have a dual ray whenever it concludes "primal infeasible" and the algorithm was 2464 /* The dual seems to be unbounded if the status is 1 (primal unbounded), the secondaryStatus is 2467 return ( lpi->clp->status() == 1 && lpi->clp->secondaryStatus() == 0 && lpi->clp->dualFeasible() ); 2513 return( lpi->clp->isProvenOptimal() && (lpi->clp->secondaryStatus() == 0 || lpi->clp->secondaryStatus() == 6)); 2538 * 1 - primal infeasible because dual limit reached OR (probably primal infeasible but can't prove it - main status was 4) 2549 SCIPdebugMessage("status: %d secondary: %d\n", lpi->clp->status(), lpi->clp->secondaryStatus()); 2551 return( (lpi->clp->status() <= 3) && (lpi->clp->secondaryStatus() <= 1 || lpi->clp->secondaryStatus() == 6 || lpi->clp->secondaryStatus() == 9) ); 2574 return ( lpi->clp->isObjectiveLimitTestValid() && (lpi->clp->isPrimalObjectiveLimitReached() || lpi->clp->isDualObjectiveLimitReached()) ); 2577 if ( lpi->clp->status() == 0 || (lpi->clp->status() == 1 && lpi->clp->algorithm() < 0) || (lpi->clp->status() == 2 && lpi->clp->algorithm() > 0) ) 2579 return ( lpi->clp->isPrimalObjectiveLimitReached() || lpi->clp->isDualObjectiveLimitReached() ); 2707 /** Unbounded ray (NULL returned if none/wrong). Up to user to use delete [] on these arrays. */ 2732 /** Infeasibility ray (NULL returned if none/wrong). Up to user to use delete [] on these arrays. */ 2768 * Such information is usually only available, if also a (maybe not optimal) solution is available. 2769 * The LPI should return SCIP_INVALID for @p quality, if the requested quantity is not available. 2797 /** gets current basis status for columns and rows; arrays must be large enough to store the basis status */ 3000 /** returns the indices of the basic columns and rows; basic column n gives value n, basic row m gives value -1-m */ 3048 * @note The LP interface defines slack variables to have coefficient +1. This means that if, internally, the LP solver 3049 * uses a -1 coefficient, then rows associated with slacks variables whose coefficient is -1, should be negated; 3083 * @note The LP interface defines slack variables to have coefficient +1. This means that if, internally, the LP solver 3084 * uses a -1 coefficient, then rows associated with slacks variables whose coefficient is -1, should be negated; 3121 * @note The LP interface defines slack variables to have coefficient +1. This means that if, internally, the LP solver 3122 * uses a -1 coefficient, then rows associated with slacks variables whose coefficient is -1, should be negated; 3156 * @note The LP interface defines slack variables to have coefficient +1. This means that if, internally, the LP solver 3157 * uses a -1 coefficient, then rows associated with slacks variables whose coefficient is -1, should be negated; 3239 /** loads LPi state (like basis information) into solver; note that the LP might have been extended with additional 3406 /** loads LPi pricing norms into solver; note that the LP might have been extended with additional 3465 if( lpi->clp->scalingFlag() != 0 ) // 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later) 3553 lpi->clp->scaling(ival == TRUE ? 3 : 0); // 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later)); SCIP_RETCODE SCIPlpiStrongbranchFrac(SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter) Definition: lpi_clp.cpp:2169 SCIP_RETCODE SCIPlpiWriteLP(SCIP_LPI *lpi, const char *fname) Definition: lpi_clp.cpp:3775 SCIP_RETCODE SCIPlpiGetPrimalRay(SCIP_LPI *lpi, SCIP_Real *ray) Definition: lpi_clp.cpp:2696 SCIP_RETCODE SCIPlpiSetBase(SCIP_LPI *lpi, int *cstat, int *rstat) Definition: lpi_clp.cpp:2886 SCIP_RETCODE SCIPlpiGetRows(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhs, SCIP_Real *rhs, int *nnonz, int *beg, int *ind, SCIP_Real *val) Definition: lpi_clp.cpp:1379 Definition: type_lpi.h:50 SCIP_RETCODE SCIPlpiGetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int *ival) Definition: lpi_clp.cpp:3447 SCIP_RETCODE SCIPlpiSetState(SCIP_LPI *lpi, BMS_BLKMEM *, SCIP_LPISTATE *lpistate) Definition: lpi_clp.cpp:3242 Definition: type_lpi.h:41 void SCIPdecodeDualBit(const SCIP_DUALPACKET *inp, int *out, int count) Definition: bitencode.c:298 SCIP_RETCODE SCIPlpiGetColNames(SCIP_LPI *lpi, int firstcol, int lastcol, char **colnames, char *namestorage, int namestoragesize, int *storageleft) Definition: lpi_clp.cpp:1443 interface methods for specific LP solvers Definition: type_lpi.h:52 SCIP_RETCODE SCIPlpiSetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int ival) Definition: lpi_clp.cpp:3491 Definition: type_lpi.h:72 SCIP_RETCODE SCIPlpiLoadColLP(SCIP_LPI *lpi, SCIP_OBJSEN objsen, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **colnames, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **rownames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val) Definition: lpi_clp.cpp:572 Definition: struct_message.h:35 static void lpistateFree(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem) Definition: lpi_clp.cpp:260 SCIP_RETCODE SCIPlpiReadLP(SCIP_LPI *lpi, const char *fname) Definition: lpi_clp.cpp:3747 Definition: type_retcode.h:38 SCIP_RETCODE SCIPlpiChgObjsen(SCIP_LPI *lpi, SCIP_OBJSEN objsen) Definition: lpi_clp.cpp:1058 SCIP_RETCODE SCIPlpiGetObjsen(SCIP_LPI *lpi, SCIP_OBJSEN *objsen) Definition: lpi_clp.cpp:1493 SCIP_RETCODE SCIPlpiGetRealSolQuality(SCIP_LPI *lpi, SCIP_LPSOLQUALITY qualityindicator, SCIP_Real *quality) Definition: lpi_clp.cpp:2771 Definition: lpi_cpx.c:191 Definition: type_lpi.h:53 Definition: type_lpi.h:70 SCIP_RETCODE SCIPlpiSolveBarrier(SCIP_LPI *lpi, SCIP_Bool crossover) Definition: lpi_clp.cpp:1780 static void lpistateUnpack(const SCIP_LPISTATE *lpistate, int *cstat, int *rstat) Definition: lpi_clp.cpp:223 SCIP_Bool SCIPlpiIsPrimalUnbounded(SCIP_LPI *lpi) Definition: lpi_clp.cpp:2360 SCIP_RETCODE SCIPlpiStrongbranchesFrac(SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter) Definition: lpi_clp.cpp:2190 SCIP_RETCODE SCIPlpiScaleRow(SCIP_LPI *lpi, int row, SCIP_Real scaleval) Definition: lpi_clp.cpp:1105 SCIP_Bool SCIPlpiHasStateBasis(SCIP_LPI *lpi, SCIP_LPISTATE *lpistate) Definition: lpi_clp.cpp:3330 SCIP_RETCODE SCIPlpiCreate(SCIP_LPI **lpi, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_OBJSEN objsen) Definition: lpi_clp.cpp:469 packing single and dual bit values SCIP_RETCODE SCIPlpiDelCols(SCIP_LPI *lpi, int firstcol, int lastcol) Definition: lpi_clp.cpp:705 Definition: type_retcode.h:36 SCIP_RETCODE SCIPlpiGetBounds(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lbs, SCIP_Real *ubs) Definition: lpi_clp.cpp:1536 SCIP_RETCODE SCIPlpiReadState(SCIP_LPI *lpi, const char *fname) Definition: lpi_clp.cpp:3339 SCIP_RETCODE SCIPlpiGetSides(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhss, SCIP_Real *rhss) Definition: lpi_clp.cpp:1567 static SCIP_RETCODE lpiStrongbranches(SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter) Definition: lpi_clp.cpp:1999 static SCIP_RETCODE lpistateCreate(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem, int ncols, int nrows) Definition: lpi_clp.cpp:239 SCIP_RETCODE SCIPlpiIgnoreInstability(SCIP_LPI *lpi, SCIP_Bool *success) Definition: lpi_clp.cpp:1475 Definition: type_lpi.h:34 SCIP_RETCODE SCIPlpiGetRowNames(SCIP_LPI *lpi, int firstrow, int lastrow, char **rownames, char *namestorage, int namestoragesize, int *storageleft) Definition: lpi_clp.cpp:1459 SCIP_RETCODE SCIPlpiScaleCol(SCIP_LPI *lpi, int col, SCIP_Real scaleval) Definition: lpi_clp.cpp:1178 SCIP_RETCODE SCIPlpiEndStrongbranch(SCIP_LPI *lpi) Definition: lpi_clp.cpp:1830 Definition: type_lpi.h:51 Definition: type_retcode.h:33 Definition: type_lpi.h:33 Definition: type_lpi.h:45 SCIP_RETCODE SCIPlpiGetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real *dval) Definition: lpi_clp.cpp:3593 Definition: type_retcode.h:46 SCIP_RETCODE SCIPlpiGetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms) Definition: lpi_clp.cpp:3393 void SCIPencodeDualBit(const int *inp, SCIP_DUALPACKET *out, int count) Definition: bitencode.c:228 Definition: type_lpi.h:68 SCIP_RETCODE SCIPlpiSetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS *lpinorms) Definition: lpi_clp.cpp:3409 SCIP_RETCODE SCIPlpiGetBInvACol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds) Definition: lpi_clp.cpp:3162 SCIP_RETCODE SCIPlpiGetBInvRow(SCIP_LPI *lpi, int r, SCIP_Real *coef, int *inds, int *ninds) Definition: lpi_clp.cpp:3054 Definition: type_lpi.h:71 SCIP_RETCODE SCIPlpiWriteState(SCIP_LPI *lpi, const char *fname) Definition: lpi_clp.cpp:3356 SCIP_RETCODE SCIPlpiGetCols(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lb, SCIP_Real *ub, int *nnonz, int *beg, int *ind, SCIP_Real *val) Definition: lpi_clp.cpp:1312 SCIP_RETCODE SCIPlpiChgBounds(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *lb, const SCIP_Real *ub) Definition: lpi_clp.cpp:941 Definition: type_lpi.h:67 SCIP_RETCODE SCIPlpiChgCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real newval) Definition: lpi_clp.cpp:1035 SCIP_RETCODE SCIPlpiGetObjval(SCIP_LPI *lpi, SCIP_Real *objval) Definition: lpi_clp.cpp:2634 Definition: type_lpi.h:43 SCIP_RETCODE SCIPlpiStartStrongbranch(SCIP_LPI *lpi) Definition: lpi_clp.cpp:1821 Definition: type_lpi.h:42 SCIP_RETCODE SCIPlpiFreeState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate) Definition: lpi_clp.cpp:3312 SCIP_RETCODE SCIPlpiGetBasisInd(SCIP_LPI *lpi, int *bind) Definition: lpi_clp.cpp:3002 SCIP_RETCODE SCIPlpiGetBase(SCIP_LPI *lpi, int *cstat, int *rstat) Definition: lpi_clp.cpp:2798 SCIP_RETCODE SCIPlpiSetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real dval) Definition: lpi_clp.cpp:3639 SCIP_RETCODE SCIPlpiGetBInvARow(SCIP_LPI *lpi, int r, const SCIP_Real *binvrow, SCIP_Real *coef, int *inds, int *ninds) Definition: lpi_clp.cpp:3127 SCIP_RETCODE SCIPlpiStrongbranchesInt(SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter) Definition: lpi_clp.cpp:2236 SCIP_RETCODE SCIPlpiStrongbranchInt(SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter) Definition: lpi_clp.cpp:2215 SCIP_RETCODE SCIPlpiGetSol(SCIP_LPI *lpi, SCIP_Real *objval, SCIP_Real *primsol, SCIP_Real *dualsol, SCIP_Real *activity, SCIP_Real *redcost) Definition: lpi_clp.cpp:2652 Definition: type_lpi.h:47 static void setFastmipClpParameters(SCIP_LPI *lpi) Definition: lpi_clp.cpp:308 Definition: type_retcode.h:40 Definition: lpi_clp.cpp:121 SCIP_RETCODE SCIPlpiAddRows(SCIP_LPI *lpi, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **rownames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val) Definition: lpi_clp.cpp:782 SCIP_RETCODE SCIPlpiChgObj(SCIP_LPI *lpi, int ncols, int *ind, SCIP_Real *obj) Definition: lpi_clp.cpp:1078 SCIP_RETCODE SCIPlpiGetBInvCol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds) Definition: lpi_clp.cpp:3089 SCIP_RETCODE SCIPlpiGetSolFeasibility(SCIP_LPI *lpi, SCIP_Bool *primalfeasible, SCIP_Bool *dualfeasible) Definition: lpi_clp.cpp:2281 public methods for message output SCIP_RETCODE SCIPlpiChgSides(SCIP_LPI *lpi, int nrows, const int *ind, const SCIP_Real *lhs, const SCIP_Real *rhs) Definition: lpi_clp.cpp:1007 Definition: type_lpi.h:79 Definition: lpi_clp.cpp:93 SCIP_RETCODE SCIPlpiGetIterations(SCIP_LPI *lpi, int *iterations) Definition: lpi_clp.cpp:2753 SCIP_RETCODE SCIPlpiDelRows(SCIP_LPI *lpi, int firstrow, int lastrow) Definition: lpi_clp.cpp:844 Definition: type_lpi.h:49 SCIP_RETCODE SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val) Definition: lpi_clp.cpp:1598 static SCIP_RETCODE lpiStrongbranch(SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter) Definition: lpi_clp.cpp:1840 SCIP_RETCODE SCIPlpiGetState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate) Definition: lpi_clp.cpp:3202 Definition: type_lpi.h:66 SCIP_RETCODE SCIPlpiAddCols(SCIP_LPI *lpi, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **colnames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val) Definition: lpi_clp.cpp:638 Definition: type_retcode.h:37 Definition: type_lpi.h:46 SCIP_RETCODE SCIPlpiFreeNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms) Definition: lpi_clp.cpp:3422 Definition: type_lpi.h:80 Definition: type_retcode.h:43 SCIP_RETCODE SCIPlpiGetDualfarkas(SCIP_LPI *lpi, SCIP_Real *dualfarkas) Definition: lpi_clp.cpp:2721 static void unsetFastmipClpParameters(SCIP_LPI *lpi) Definition: lpi_clp.cpp:403 SCIP_RETCODE SCIPlpiGetObj(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *vals) Definition: lpi_clp.cpp:1513 Definition: type_lpi.h:82 static void lpistatePack(SCIP_LPISTATE *lpistate, const int *cstat, const int *rstat) Definition: lpi_clp.cpp:207 Definition: type_lpi.h:48 Definition: type_lpi.h:81 SCIP_Bool SCIPlpiIsPrimalInfeasible(SCIP_LPI *lpi) Definition: lpi_clp.cpp:2374 |