|
Go to the documentation of this file.
59 #include <ClpSimplex.hpp>
60 #include <ClpPrimalColumnSteepest.hpp>
61 #include <ClpDualRowSteepest.hpp>
62 #include <CoinIndexedVector.hpp>
63 #include <ClpConfig.h>
65 #include <config_clp.h>
66 #define CLP_VERSION VERSION
80 #if defined(_WIN32) || defined(_WIN64)
81 #define snprintf _snprintf
85 #ifdef LPI_CLP_DEBUG_WRITE_FILES
86 static int fileNr = 0;
90 #define SUMINFEASBOUND 1.0e-3
116 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE
118 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
153 assert(num <= lpi->cstatsize);
175 assert(num <= lpi->rstatsize);
213 assert(lpistate != 0);
229 assert(lpistate != 0);
246 assert(lpistate != 0);
266 assert(lpistate != 0);
267 assert(*lpistate != 0);
302 lpi-> clp->defaultFactorizationFrequency();
324 lpi-> clp->setPerturbation(50);
388 lpi-> clp->setSpecialOptions(32|64|512|1024|32768);
390 lpi-> clp->setSpecialOptions(32|64|128|512|1024|4096|32768);
394 lpi-> clp->setMoreSpecialOptions(8192 | lpi-> clp->moreSpecialOptions());
410 lpi-> clp->setPerturbation(100);
413 lpi-> clp->setSpecialOptions(0);
416 lpi-> clp->setPersistenceFlag(0);
446 return "COIN-OR Linear Programming Solver developed by J. Forrest et.al. (projects.coin-or.org/Clp)";
454 return ( void*) lpi-> clp;
482 (*lpi)->clp = new ClpSimplex();
485 (*lpi)->cstatsize = 0;
486 (*lpi)->rstatsize = 0;
487 (*lpi)->startscratch = true;
489 (*lpi)->validFactorization = false;
490 (*lpi)->setFactorizationFrequency = false;
491 (*lpi)->fastmip = FALSE;
506 ClpPrimalColumnSteepest primalSteepest;
507 (*lpi)->clp->setPrimalColumnPivotAlgorithm(primalSteepest);
515 ClpDualRowSteepest dualSteepest;
516 (*lpi)->clp->setDualRowPivotAlgorithm(dualSteepest);
519 (*lpi)->clp->setStrParam(ClpProbName, std::string(name) );
522 (*lpi)->clp->setOptimizationDirection(objsen);
525 (*lpi)->clp->setLogLevel(0);
528 (*lpi)->clp->scaling(0);
544 assert((*lpi)->clp != 0);
593 assert(lpi-> clp != 0);
596 assert( nnonz > beg[ncols-1] );
600 ClpSimplex* clp = lpi-> clp;
606 mybeg[ncols] = nnonz;
609 clp->loadProblem(ncols, nrows, mybeg, ind, val, lb, ub, obj, lhs, rhs);
613 clp->setOptimizationDirection(objsen);
616 if ( colnames || rownames )
618 std::vector<std::string> columnNames(ncols);
619 std::vector<std::string> rowNames(nrows);
622 for ( int j = 0; j < ncols; ++j)
623 columnNames[j].assign(colnames[j]);
627 for ( int i = 0; i < ncols; ++i)
628 rowNames[i].assign(rownames[i]);
630 clp->copyNames(rowNames, columnNames);
654 assert(lpi-> clp != 0);
658 assert(nnonz == 0 || beg != 0);
659 assert(nnonz == 0 || ind != 0);
660 assert(nnonz == 0 || val != 0);
667 int numCols = lpi-> clp->getNumCols();
677 mybeg[ncols] = nnonz;
680 lpi-> clp->addColumns(ncols, lb, ub, obj, mybeg, ind, val);
684 for ( int j = 0; j <= ncols; ++j)
687 lpi-> clp->addColumns(ncols, lb, ub, obj, mybeg, 0, 0);
694 std::vector<std::string> columnNames(ncols);
695 for ( int j = 0; j < ncols; ++j)
696 columnNames[j].assign(colnames[j]);
697 lpi-> clp->copyColumnNames(columnNames, numCols, numCols + ncols);
714 assert(lpi-> clp != 0);
715 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->clp->numberColumns());
720 int num = lastcol-firstcol+1;
725 for ( int j = firstcol; j <= lastcol; ++j)
726 which[j - firstcol] = j;
728 lpi-> clp->deleteColumns(num, which);
746 assert(lpi-> clp != 0);
752 int ncols = lpi-> clp->getNumCols();
756 for ( int j = 0; j < ncols; ++j)
761 lpi-> clp->deleteColumns(cnt, which);
766 for ( int j = 0; j < ncols; ++j)
797 assert(lpi-> clp != 0);
800 assert(nnonz == 0 || beg != 0);
801 assert(nnonz == 0 || ind != 0);
802 assert(nnonz == 0 || val != 0);
807 int numRows = lpi-> clp->getNumRows();
816 mybeg[nrows] = nnonz;
819 lpi-> clp->addRows(nrows, lhs, rhs, mybeg, ind, val);
824 for ( int i = 0; i <= nrows; ++i)
826 lpi-> clp->addRows(nrows, lhs, rhs, mybeg, 0, 0);
833 std::vector<std::string> rowNames(nrows);
834 for ( int j = 0; j < nrows; ++j)
835 rowNames[j].assign(rownames[j]);
836 lpi-> clp->copyRowNames(rowNames, numRows, numRows + nrows);
850 SCIPdebugMessage( "calling SCIPlpiDelRows() (number: %d)\n", lastrow-firstrow+1);
853 assert(lpi-> clp != 0);
854 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->clp->numberRows());
859 int num = lastrow-firstrow+1;
864 for ( int i = firstrow; i <= lastrow; ++i)
865 which[i - firstrow] = i;
867 lpi-> clp->deleteRows(num, which);
886 assert(lpi-> clp != 0);
892 int nrows = lpi-> clp->getNumRows();
896 for ( int i = 0; i < nrows; ++i)
901 lpi-> clp->deleteRows(cnt, which);
906 for ( int i = 0; i < nrows; ++i)
929 assert(lpi-> clp != 0);
934 lpi-> clp->resize(0,0);
952 assert(lpi-> clp != 0);
959 ClpSimplex* clp = lpi-> clp;
963 double* sol = lpi-> clp->primalColumnSolution();
964 const double* colLower = lpi-> clp->getColLower();
965 const double* colUpper = lpi-> clp->getColUpper();
967 for ( int j = 0; j < ncols; ++j)
969 clp->setColumnBounds(ind[j], lb[j], ub[j]);
972 if( clp->statusExists() )
974 assert( colLower != 0 );
975 assert( colUpper != 0 );
977 switch ( clp->getColumnStatus(k) )
979 case ClpSimplex::isFree:
980 case ClpSimplex::superBasic:
983 case ClpSimplex::atUpperBound:
984 sol[k] = colUpper[k];
985 assert( colUpper[k] == ub[j] );
987 case ClpSimplex::isFixed:
988 case ClpSimplex::atLowerBound:
989 sol[k] = colLower[k];
990 assert( colLower[k] == lb[j] );
1018 assert(lpi-> clp != 0);
1025 ClpSimplex* clp = lpi-> clp;
1027 for ( int i = 0; i < nrows; ++i)
1028 clp->setRowBounds(ind[i], lhs[i], rhs[i]);
1045 assert(lpi-> clp != 0);
1046 assert(0 <= row && row < lpi->clp->numberRows());
1047 assert(0 <= col && col < lpi->clp->numberColumns());
1051 lpi-> clp->matrix()->modifyCoefficient(row, col, newval);
1066 assert(lpi-> clp != 0);
1071 lpi-> clp->setOptimizationDirection(objsen);
1088 assert(lpi-> clp != 0);
1094 ClpSimplex* clp = lpi-> clp;
1097 for( int j = 0; j < ncols; ++j )
1098 clp->setObjCoeff(ind[j], obj[j]);
1114 assert(lpi-> clp != 0);
1115 assert(scaleval != 0.0);
1116 assert(0 <= row && row <= lpi->clp->numberRows() );
1124 ClpSimplex* clp = lpi-> clp;
1127 double* lhs = clp->rowLower();
1128 double* rhs = clp->rowUpper();
1130 double lhsval = lhs[row];
1131 if( lhsval > -COIN_DBL_MAX )
1133 else if( scaleval < 0.0 )
1134 lhsval = COIN_DBL_MAX;
1135 double rhsval = rhs[row];
1136 if( rhsval < COIN_DBL_MAX)
1138 else if( scaleval < 0.0 )
1139 rhsval = -COIN_DBL_MAX;
1140 if( scaleval < 0.0 )
1154 CoinPackedMatrix* M = clp->matrix();
1155 assert( M->getNumCols() == clp->numberColumns() );
1157 const CoinBigIndex* beg = M->getVectorStarts();
1158 const int* length = M->getVectorLengths();
1159 const int* ind = M->getIndices();
1160 double* val = M->getMutableElements();
1162 for ( int j = 0; j < M->getNumCols(); ++j)
1164 for (CoinBigIndex k = beg[j]; k < beg[j] + length[j]; ++k)
1187 assert(lpi-> clp != 0);
1188 assert(scaleval != 0.0);
1189 assert(0 <= col && col <= lpi->clp->numberColumns() );
1197 ClpSimplex* clp = lpi-> clp;
1200 double* objvec = clp->objective();
1201 objvec[col] *= scaleval;
1204 double* lb = clp->columnLower();
1205 double* ub = clp->columnUpper();
1206 double lbval = lb[col];
1207 double ubval = ub[col];
1209 if( lbval > -COIN_DBL_MAX )
1211 else if( scaleval < 0.0 )
1212 lbval = COIN_DBL_MAX;
1213 if( ubval < COIN_DBL_MAX )
1215 else if( scaleval < 0.0 )
1216 ubval = -COIN_DBL_MAX;
1217 if( scaleval < 0.0 )
1228 CoinPackedMatrix* M = clp->matrix();
1229 assert( M->getNumCols() == clp->numberColumns() );
1231 const CoinBigIndex* beg = M->getVectorStarts();
1232 const int* length = M->getVectorLengths();
1233 double* val = M->getMutableElements();
1234 for (CoinBigIndex k = beg[col]; k < beg[col] + length[col]; ++k)
1263 assert(lpi-> clp != 0);
1266 *nrows = lpi-> clp->numberRows();
1281 assert(lpi-> clp != 0);
1284 *ncols = lpi-> clp->numberColumns();
1299 assert(lpi-> clp != 0);
1302 *nnonz = lpi-> clp->getNumElements();
1327 assert(lpi-> clp != 0);
1328 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->clp->numberColumns());
1330 ClpSimplex* clp = lpi-> clp;
1333 assert( (lb != 0 && ub != 0) || (lb == 0 && ub == 0) );
1336 const double* colLower = clp->getColLower();
1337 const double* colUpper = clp->getColUpper();
1343 assert( nnonz != 0 || beg == 0);
1344 assert( nnonz != 0 || ind == 0);
1345 assert( nnonz != 0 || val == 0);
1349 CoinPackedMatrix* M = clp->matrix();
1351 assert( M->getNumCols() == clp->numberColumns() );
1353 const CoinBigIndex* Mbeg = M->getVectorStarts();
1354 const int* Mlength = M->getVectorLengths();
1355 const int* Mind = M->getIndices();
1356 const double* Mval = M->getElements();
1360 for ( int j = firstcol; j <= lastcol; ++j)
1362 beg[j-firstcol] = *nnonz;
1367 (*nnonz) += Mlength[j];
1394 assert(lpi-> clp != 0);
1395 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->clp->numberRows());
1397 ClpSimplex* clp = lpi-> clp;
1398 assert( (lhs != 0 && rhs != 0) || (lhs == 0 && rhs == 0) );
1401 const double* rowLower = clp->getRowLower();
1402 const double* rowUpper = clp->getRowUpper();
1408 assert( nnonz != 0 || beg == 0);
1409 assert( nnonz != 0 || ind == 0);
1410 assert( nnonz != 0 || val == 0);
1414 ClpMatrixBase* M = clp->rowCopy();
1416 M = clp->clpMatrix()->reverseOrderedCopy();
1418 assert( M->getNumRows() == clp->numberRows() );
1420 const CoinBigIndex* Mbeg = M->getVectorStarts();
1421 const int* Mlength = M->getVectorLengths();
1422 const int* Mind = M->getIndices();
1423 const double* Mval = M->getElements();
1426 for( int i = firstrow; i <= lastrow; ++i )
1428 beg[i-firstrow] = *nnonz;
1429 for( CoinBigIndex k = Mbeg[i]; k < Mbeg[i] + Mlength[i]; ++k )
1431 ind[*nnonz] = Mind[k];
1432 val[*nnonz] = Mval[k];
1449 int namestoragesize,
1465 int namestoragesize,
1482 assert(lpi != NULL);
1498 assert( lpi != NULL );
1500 assert( objsen != NULL );
1503 if ( lpi-> clp->getObjSense() < 0 )
1523 assert(lpi-> clp != 0);
1524 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->clp->numberColumns());
1527 const double* obj = lpi-> clp->getObjCoefficients();
1547 assert(lpi-> clp != 0);
1548 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->clp->numberColumns());
1552 const double* colLower = lpi-> clp->getColLower();
1558 const double* colUpper = lpi-> clp->getColUpper();
1578 assert(lpi-> clp != 0);
1579 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->clp->numberRows());
1583 const double* rowLower = lpi-> clp->getRowLower();
1589 const double* rowUpper = lpi-> clp->getRowUpper();
1608 assert(lpi-> clp != 0);
1609 assert(0 <= col && col < lpi->clp->numberColumns());
1610 assert(0 <= row && row < lpi->clp->numberRows());
1613 *val = lpi-> clp->matrix()->getCoefficient(row, col);
1637 assert(lpi-> clp != 0);
1639 SCIPdebugMessage( "calling Clp primal(): %d cols, %d rows\n", lpi-> clp->numberColumns(), lpi-> clp->numberRows());
1641 #ifdef LPI_CLP_DEBUG_WRITE_FILES
1643 snprintf(filename, 255, "debug_p_%d.mps", fileNr);
1644 fileNr = fileNr % 2;
1657 lpi-> clp->allSlackBasis( true);
1668 int startFinishOptions = 1;
1670 startFinishOptions = startFinishOptions | 2;
1673 int status = lpi-> clp->primal(0, startFinishOptions);
1675 #ifdef LPI_CLP_DEBUG_WRITE_FILES
1676 char basisname[255];
1677 snprintf(basisname, 255, "debug_p_%d.bas", fileNr);
1681 fileNr = fileNr % 2;
1695 assert( status != -1 );
1696 assert( status != 5 );
1697 if ( status == 4 || status == 5 || status == -1 )
1710 assert(lpi-> clp != 0);
1712 SCIPdebugMessage( "calling Clp dual(): %d cols, %d rows\n", lpi-> clp->numberColumns(), lpi-> clp->numberRows());
1714 #ifdef LPI_CLP_DEBUG_WRITE_FILES
1716 snprintf(filename, 255, "debug_d_%d.mps", fileNr);
1719 snprintf(filename, 255, "debug_d_%d.sav", fileNr);
1732 lpi-> clp->allSlackBasis( true);
1743 int startFinishOptions = 1;
1745 startFinishOptions = startFinishOptions | 2;
1748 int status = lpi-> clp->dual(0, startFinishOptions);
1750 #ifdef LPI_CLP_DEBUG_WRITE_FILES
1751 char basisname[255];
1752 snprintf(basisname, 255, "debug_d_%d.bas", fileNr);
1756 fileNr = fileNr % 2;
1770 assert( status != -1 );
1771 assert( status != 5 );
1772 if ( status == 4 || status == 5 || status == -1 )
1786 assert(lpi-> clp != 0);
1788 SCIPdebugMessage( "calling Clp barrier(): %d cols, %d rows\n", lpi-> clp->numberColumns(), lpi-> clp->numberRows());
1799 int status = lpi-> clp->barrier(crossover);
1812 assert( status != -1 );
1813 assert( status != 5 );
1814 if ( status == 4 || status == 5 || status == -1 )
1854 SCIPdebugMessage( "calling SCIPlpiStrongbranch() on variable %d (%d iterations)\n", col, itlim);
1857 assert(lpi-> clp != 0);
1860 assert(downvalid != 0);
1861 assert(upvalid != 0);
1863 ClpSimplex* clp = lpi-> clp;
1866 int ncols = clp->numberColumns();
1867 assert( 0 <= col && col < ncols );
1868 double** outputSolution = NULL;
1873 int* outputStatus = NULL;
1876 int* outputIterations = NULL;
1880 int iterlimit = clp->maximumIterations();
1881 clp->setMaximumIterations(itlim);
1884 double objval = clp->objectiveValue();
1887 int specialoptions = clp->specialOptions();
1926 clp->setSpecialOptions(64|512|1024);
1928 clp->setSpecialOptions(64|128|512|1024|4096);
1939 int startFinishOptions = 1;
1941 startFinishOptions = startFinishOptions | 2;
1944 *down = EPSCEIL(psol - 1.0, 1e-06);
1963 int res = clp->strongBranching(1, &col, up, down, outputSolution, outputStatus, outputIterations, false, true, startFinishOptions);
1966 clp->setSpecialOptions(specialoptions);
1979 *iter = outputIterations[0] + outputIterations[1];
1982 clp->setMaximumIterations(iterlimit);
2014 SCIPdebugMessage( "calling SCIPlpiStrongbranches() on %d variables (%d iterations)\n", ncols, itlim);
2017 assert( lpi-> clp != 0 );
2018 assert( cols != 0 );
2019 assert( psols != 0 );
2020 assert( down != 0 );
2022 assert( downvalid != 0 );
2023 assert( upvalid != 0 );
2025 ClpSimplex* clp = lpi-> clp;
2028 int n = clp->numberColumns();
2029 assert( 0 < ncols && ncols <= n );
2030 double** outputSolution = NULL;
2032 for ( int j = 0; j < 2*ncols; ++j)
2037 int* outputStatus = NULL;
2040 int* outputIterations = NULL;
2044 int iterlimit = clp->maximumIterations();
2045 clp->setMaximumIterations(itlim);
2048 double objval = clp->objectiveValue();
2051 int specialoptions = clp->specialOptions();
2090 clp->setSpecialOptions(64|512|1024);
2092 clp->setSpecialOptions(64|128|512|1024|4096);
2103 int startFinishOptions = 1;
2105 startFinishOptions = startFinishOptions | 2;
2108 for ( int j = 0; j < ncols; ++j)
2110 assert( 0 <= cols[j] && cols[j] < n );
2111 down[j] = EPSCEIL(psols[j] - 1.0, 1e-06);
2112 up[j] = EPSFLOOR(psols[j] + 1.0, 1e-06);
2115 downvalid[j] = TRUE;
2134 int res = clp->strongBranching(ncols, cols, up, down, outputSolution, outputStatus, outputIterations, false, true, startFinishOptions);
2137 clp->setSpecialOptions(specialoptions);
2141 for ( int j = 0; j < ncols; ++j)
2148 *iter += outputIterations[2*j] + outputIterations[2*j+1];
2155 clp->setMaximumIterations(iterlimit);
2275 assert(lpi != NULL);
2290 assert(lpi-> clp != 0);
2291 assert(primalfeasible != 0);
2292 assert(dualfeasible != 0);
2294 if ( lpi-> clp->primalFeasible() )
2295 *primalfeasible = TRUE;
2297 *primalfeasible = FALSE;
2299 if ( lpi-> clp->dualFeasible() )
2300 *dualfeasible = TRUE;
2302 *dualfeasible = FALSE;
2305 if (lpi-> clp->status()==0 && ( ! (*primalfeasible) || ! (*dualfeasible)) )
2307 if ( !(*primalfeasible) && lpi-> clp->sumPrimalInfeasibilities() < SUMINFEASBOUND )
2309 lpi-> clp->setNumberPrimalInfeasibilities(0);
2310 *primalfeasible = TRUE;
2314 lpi-> clp->setNumberDualInfeasibilities(0);
2315 *dualfeasible = TRUE;
2333 assert(lpi-> clp != 0);
2337 return ( lpi-> clp->status() == 2 );
2351 assert(lpi-> clp != 0);
2355 return ( lpi-> clp->status() == 2 );
2367 assert(lpi-> clp != 0);
2369 return ( lpi-> clp->isProvenDualInfeasible() && lpi-> clp->primalFeasible() );
2381 assert(lpi-> clp != 0);
2388 return ( lpi-> clp->status() == 1 && (lpi-> clp->secondaryStatus() == 0 || lpi-> clp->secondaryStatus() == 6) );
2400 assert(lpi-> clp != 0);
2402 return ( lpi-> clp->primalFeasible() );
2416 assert(lpi-> clp != 0);
2420 return ( lpi-> clp->status() == 1 && lpi-> clp->secondaryStatus() == 0 && lpi-> clp->algorithm() < 0 );
2434 assert(lpi-> clp != 0);
2438 if ( lpi-> clp->rayExists() )
2440 if ( lpi-> clp->status() == 1 && lpi-> clp->secondaryStatus() == 0 && lpi-> clp->algorithm() < 0)
2444 if ( lpi-> clp->status() != 2 || lpi-> clp->algorithm() <= 0 )
2445 lpi-> clp->deleteRay();
2462 assert(lpi-> clp != 0);
2467 return ( lpi-> clp->status() == 1 && lpi-> clp->secondaryStatus() == 0 && lpi-> clp->dualFeasible() );
2479 assert(lpi-> clp != 0);
2481 return ( lpi-> clp->isProvenDualInfeasible() );
2493 assert(lpi-> clp != 0);
2495 return ( lpi-> clp->dualFeasible() );
2507 assert(lpi-> clp != 0);
2513 return( lpi-> clp->isProvenOptimal() && (lpi-> clp->secondaryStatus() == 0 || lpi-> clp->secondaryStatus() == 6));
2525 assert(lpi-> clp != 0);
2550 assert( 0 <= lpi-> clp->status() && lpi-> clp->status() <= 5 );
2551 return( (lpi-> clp->status() <= 3) && (lpi-> clp->secondaryStatus() <= 1 || lpi-> clp->secondaryStatus() == 6 || lpi-> clp->secondaryStatus() == 9) );
2563 assert(lpi-> clp != 0);
2566 if ( lpi-> clp->status() == 1 )
2568 if ( lpi-> clp->secondaryStatus() == 1 )
2574 return ( lpi-> clp->isObjectiveLimitTestValid() && (lpi-> clp->isPrimalObjectiveLimitReached() || lpi-> clp->isDualObjectiveLimitReached()) );
2595 assert(lpi-> clp != 0);
2599 return ( lpi-> clp->status() == 3 && lpi-> clp->secondaryStatus() != 9 );
2611 assert(lpi-> clp != 0);
2615 return ( lpi-> clp->status() == 3 && lpi-> clp->secondaryStatus() == 9 );
2627 assert(lpi-> clp != 0);
2629 return lpi-> clp->status();
2642 assert(lpi-> clp != 0);
2643 assert(objval != 0);
2645 *objval = lpi-> clp->objectiveValue();
2664 assert(lpi-> clp != 0);
2666 ClpSimplex* clp = lpi-> clp;
2668 *objval = clp->objectiveValue();
2672 const double* sol = clp->getColSolution();
2677 const double* dsol = clp->getRowPrice();
2682 const double* act = clp->getRowActivity();
2687 const double* red = clp->getReducedCost();
2704 assert(lpi-> clp != 0);
2708 const double* clpray = lpi-> clp->unboundedRay();
2729 assert(lpi-> clp != 0);
2730 assert(dualfarkas != 0);
2733 const double* dualray = lpi-> clp->infeasibilityRay();
2759 assert(iterations != 0);
2761 *iterations = lpi-> clp->numberIterations();
2777 assert(lpi != NULL);
2778 assert(quality != NULL);
2807 assert(lpi-> clp != 0);
2809 ClpSimplex* clp = lpi-> clp;
2814 for( int i = 0; i < clp->numberRows(); ++i )
2816 switch ( clp->getRowStatus(i) )
2818 case ClpSimplex::isFree:
2821 case ClpSimplex::basic:
2824 case ClpSimplex::atUpperBound:
2827 case ClpSimplex::atLowerBound:
2830 case ClpSimplex::superBasic:
2833 case ClpSimplex::isFixed:
2834 if (clp->getRowPrice()[i] > 0.0)
2849 for( int j = 0; j < clp->numberColumns(); ++j )
2851 switch ( clp->getColumnStatus(j) )
2853 case ClpSimplex::isFree:
2856 case ClpSimplex::basic:
2859 case ClpSimplex::atUpperBound:
2862 case ClpSimplex::atLowerBound:
2865 case ClpSimplex::superBasic:
2868 case ClpSimplex::isFixed:
2869 if (clp->getReducedCost()[j] > 0.0)
2895 assert(lpi-> clp != 0);
2901 ClpSimplex* clp = lpi-> clp;
2902 clp->createStatus();
2904 const double* lhs = clp->getRowLower();
2905 const double* rhs = clp->getRowUpper();
2907 assert( rstat != 0 || clp->numberRows() == 0 );
2908 for( int i = 0; i < clp->numberRows(); ++i )
2910 int status = rstat[i];
2911 assert( 0 <= status && status <= 3 );
2918 if (lhs[i] <= -COIN_DBL_MAX && rhs[i] >= COIN_DBL_MAX)
2919 clp->setRowStatus(i, ClpSimplex::isFree);
2921 clp->setRowStatus(i, ClpSimplex::superBasic);
2924 clp->setRowStatus(i, ClpSimplex::basic);
2927 clp->setRowStatus(i, ClpSimplex::atUpperBound);
2930 if ( EPSEQ(rhs[i], lhs[i], 1e-6) )
2931 clp->setRowStatus(i, ClpSimplex::isFixed);
2933 clp->setRowStatus(i, ClpSimplex::atLowerBound);
2942 const double* lb = clp->getColLower();
2943 const double* ub = clp->getColUpper();
2945 assert( cstat != 0 || clp->numberColumns() == 0 );
2946 for( int j = 0; j < clp->numberColumns(); ++j )
2948 int status = cstat[j];
2949 assert( 0 <= status && status <= 3 );
2956 if (lb[j] <= -COIN_DBL_MAX && ub[j] >= COIN_DBL_MAX)
2957 clp->setColumnStatus(j, ClpSimplex::isFree);
2959 clp->setColumnStatus(j, ClpSimplex::superBasic);
2962 clp->setColumnStatus(j, ClpSimplex::basic);
2965 clp->setColumnStatus(j, ClpSimplex::atUpperBound);
2968 if ( EPSEQ(ub[j], lb[j], 1e-6) )
2969 clp->setColumnStatus(j, ClpSimplex::isFixed);
2971 clp->setColumnStatus(j, ClpSimplex::atLowerBound);
2994 clp->setWhatsChanged(clp->whatsChanged() & (~512));
3010 assert(lpi-> clp != 0);
3013 ClpSimplex* clp = lpi-> clp;
3014 int nrows = clp->numberRows();
3015 int ncols = clp->numberColumns();
3023 if ( clp->secondaryStatus() == 6 )
3025 assert( clp->getNumElements() == 0 );
3026 for ( int i = 0; i < nrows; ++i)
3030 clp->getBasics(idx);
3032 for ( int i = 0; i < nrows; ++i)
3034 if ( idx[i] < ncols )
3037 bind[i] = -1 - (idx[i] - ncols);
3056 assert( lpi-> clp != 0 );
3057 assert( coef != 0 );
3058 assert( 0 <= r && r <= lpi->clp->numberRows() );
3060 ClpSimplex* clp = lpi-> clp;
3061 clp->getBInvRow(r, coef);
3081 assert( lpi-> clp != 0 );
3082 assert( coef != 0 );
3083 assert( 0 <= c && c <= lpi->clp->numberRows() );
3085 ClpSimplex* clp = lpi-> clp;
3086 clp->getBInvCol(c, coef);
3103 assert( lpi-> clp != 0 );
3104 assert( coef != 0 );
3105 assert( 0 <= r && r <= lpi->clp->numberRows() );
3107 ClpSimplex* clp = lpi-> clp;
3108 clp->getBInvARow(r, coef, 0);
3124 assert( lpi-> clp != 0 );
3125 assert( coef != 0 );
3126 assert( 0 <= c && c <= lpi->clp->numberColumns() );
3128 ClpSimplex* clp = lpi-> clp;
3129 clp->getBInvACol(c, coef);
3156 assert(blkmem != 0);
3158 assert(lpi-> clp != 0);
3159 assert(lpistate != 0);
3161 int ncols = lpi-> clp->numberColumns();
3162 int nrows = lpi-> clp->numberRows();
3177 (*lpistate)->ncols = ncols;
3178 (*lpistate)->nrows = nrows;
3201 assert(lpi-> clp != 0);
3202 assert(lpistate != 0);
3204 lpncols = lpi-> clp->numberColumns();
3205 lpnrows = lpi-> clp->numberRows();
3206 assert(lpistate-> ncols <= lpncols);
3207 assert(lpistate-> nrows <= lpnrows);
3217 for( i = lpistate-> ncols; i < lpncols; ++i )
3223 bnd = (lpi-> clp->getColUpper())[i];
3232 for( i = lpistate-> nrows; i < lpnrows; ++i )
3249 assert(lpi-> clp != 0);
3251 lpi-> clp->allSlackBasis( true);
3267 assert(lpistate != NULL);
3269 if ( *lpistate != NULL )
3281 return (lpistate != NULL);
3295 if ( lpi-> clp->readBasis(fname) < 0 )
3318 if ( lpi-> clp->writeBasis(fname, false, 0) )
3345 assert(lpinorms != NULL);
3361 assert(lpinorms == NULL);
3374 assert(lpinorms == NULL);
3402 assert(lpi-> clp != 0);
3411 if( lpi-> clp->scalingFlag() != 0 )
3423 *ival = lpi-> clp->maximumIterations();
3446 assert(lpi-> clp != 0);
3471 primalmode = 3; dualmode = 3; break;
3473 primalmode = 0; dualmode = 1; break;
3476 primalmode = 1; dualmode = 0; break;
3478 primalmode = 1; dualmode = 2; break;
3480 primalmode = 2; dualmode = 3; break;
3486 ClpPrimalColumnSteepest primalpivot(primalmode);
3487 lpi-> clp->setPrimalColumnPivotAlgorithm(primalpivot);
3488 ClpDualRowSteepest dualpivot(dualmode);
3489 lpi-> clp->setDualRowPivotAlgorithm(dualpivot);
3499 lpi-> clp->scaling(ival == TRUE ? 3 : 0);
3516 lpi-> clp->setLogLevel(2);
3518 lpi-> clp->setLogLevel(0);
3521 lpi-> clp->setMaximumIterations(ival);
3548 assert(lpi-> clp != 0);
3554 *dval = lpi-> clp->primalTolerance();
3557 *dval = lpi-> clp->dualTolerance();
3563 if ( lpi-> clp->optimizationDirection() > 0 )
3564 *dval = lpi-> clp->primalObjectiveLimit();
3566 *dval = lpi-> clp->dualObjectiveLimit();
3569 if ( lpi-> clp->optimizationDirection() > 0 )
3570 *dval = lpi-> clp->dualObjectiveLimit();
3572 *dval = lpi-> clp->primalObjectiveLimit();
3575 *dval = lpi-> clp->maximumSeconds();
3594 assert(lpi-> clp != 0);
3599 lpi-> clp->setPrimalTolerance(dval);
3602 lpi-> clp->setDualTolerance(dval);
3608 if ( lpi-> clp->optimizationDirection() > 0 )
3609 lpi-> clp->setPrimalObjectiveLimit(dval);
3611 lpi-> clp->setDualObjectiveLimit(dval);
3614 if ( lpi-> clp->optimizationDirection() > 0 )
3615 lpi-> clp->setDualObjectiveLimit(dval);
3617 lpi-> clp->setPrimalObjectiveLimit(dval);
3620 lpi-> clp->setMaximumSeconds(dval);
3648 return COIN_DBL_MAX;
3660 return (val >= COIN_DBL_MAX);
3678 const char* filename
3683 f = fopen(filename, "r");
3701 assert(lpi-> clp != 0);
3714 if ( lpi-> clp->readMps(fname, true, false) )
3729 assert(lpi-> clp != 0);
3738 if ( lpi-> clp->writeMps(fname, 0, 2, lpi-> clp->optimizationDirection()) )
|