29 #define FREE_LHS_RHS 1 30 #define FREE_CONSTRAINT 1 31 #define EMPTY_CONSTRAINT 1 32 #define ROW_SINGLETON 1 33 #define FORCE_CONSTRAINT 1 36 #define EMPTY_COLUMN 1 37 #define FIX_VARIABLE 1 38 #define FREE_ZERO_OBJ_VARIABLE 1 39 #define ZERO_OBJ_COL_SINGLETON 1 40 #define DOUBLETON_EQUATION 1 41 #define FREE_COL_SINGLETON 1 43 #define DOMINATED_COLUMN 1 44 #define WEAKLY_DOMINATED_COLUMN 1 45 #define MULTI_AGGREGATE 1 47 #define TRIVIAL_HEURISTICS 1 56 #define DUPLICATE_ROWS 1 57 #define DUPLICATE_COLS 1 61 #define CHECK_BASIC_DIM 70 for(
int rs = 0; rs <
nRows; ++rs)
76 for(
int cs = 0; cs <
nCols; ++cs)
81 assert(numBasis == nRows);
82 return numBasis ==
nRows;
89 assert(
isZero(s[m_i], 1e-9));
96 MSG_DEBUG( std::cout <<
"RowObjPS: removing slack column " << m_j <<
" (" << cStatus[m_j] <<
") for row " << m_i <<
" (" << rStatus[m_i] <<
").\n" );
100 switch( cStatus[m_j] )
109 rStatus[m_i] = cStatus[m_j];
116 #ifdef CHECK_BASIC_DIM 132 rStatus[m_old_i] = rStatus[m_i];
137 for (
int k = 0; k < m_row.size(); ++k)
138 slack += m_row.value(k) * x[m_row.index(k)];
148 #ifdef CHECK_BASIC_DIM 163 rStatus[m_old_i] = rStatus[m_i];
174 #ifdef CHECK_BASIC_DIM 189 rStatus[m_old_i] = rStatus[m_i];
191 Real aij = m_col[m_i];
194 s[m_i] = aij * x[m_j];
199 for(
int k = 0; k < m_col.size(); ++k)
201 if (m_col.index(k) != m_i)
202 val -= m_col.value(k) * y[m_col.index(k)];
205 Real newLo = (aij > 0) ? m_lhs/aij : m_rhs/aij;
206 Real newUp = (aij > 0) ? m_rhs/aij : m_lhs/aij;
211 if(newLo <= m_oldLo && newUp >= m_oldUp)
220 assert(
EQrel(newLo, x[m_j],
eps()));
228 else if((
EQrel(m_oldLo, x[m_j],
eps()) && r[m_j] <= -
eps())
229 || (
EQrel(m_oldUp, x[m_j],
eps()) && r[m_j] >=
eps())
249 else if(
EQrel(newLo, m_oldUp,
eps()))
264 assert(
EQrel(m_oldUp, x[m_j],
eps()));
272 else if(
EQrel(newUp, m_oldLo,
eps()))
287 assert(
EQrel(m_oldLo, x[m_j],
eps()));
350 #ifdef CHECK_BASIC_DIM 365 rStatus[m_old_i] = rStatus[m_i];
371 int cBasisCandidate = -1;
372 Real maxViolation = -1.0;
375 for(
int k = 0; k < m_row.size(); ++k)
377 int cIdx = m_row.index(k);
378 Real aij = m_row.value(k);
379 Real oldLo = m_oldLowers[k];
380 Real oldUp = m_oldUppers[k];
382 switch(cStatus[cIdx])
393 if( violation > maxViolation && ( (
EQrel(oldLo, x[cIdx],
eps()) && r[cIdx] < -
eps()) || (
EQrel(oldUp, x[cIdx],
eps()) && r[cIdx] >
eps()) ) )
395 maxViolation = violation;
396 cBasisCandidate =
cIdx;
411 if(cBasisCandidate >= 0)
415 assert(cBasisCandidate == m_row.index(bas_k));
420 Real aij = m_row.value(bas_k);
421 Real multiplier = r[cBasisCandidate]/aij;
422 r[cBasisCandidate] = 0.0;
424 for(
int k = 0; k < m_row.size(); ++k)
430 r[m_row.index(k)] -= m_row.value(k) * multiplier;
434 Real val = m_objs[bas_k];
437 for(
int k = 0; k < basis_col.
size(); ++k)
439 if (basis_col.
index(k) != m_i)
440 val -= basis_col.
value(k) * y[basis_col.
index(k)];
451 #ifdef CHECK_BASIC_DIM 468 cStatus[m_old_j] = cStatus[m_j];
474 for(
int k = 0; k < m_col.size(); ++k)
475 s[m_col.index(k)] += m_col.value(k) * x[m_j];
480 for(
int k = 0; k < m_col.size(); ++k)
481 val -= m_col.value(k) * y[m_col.index(k)];
486 if( m_lower == m_upper )
488 assert(
EQrel(m_lower, m_val));
494 assert(
EQrel(m_val, m_lower) ||
EQrel(m_val, m_upper) || m_val == 0.0);
499 #ifdef CHECK_BASIC_DIM 515 cStatus[m_j] = m_status;
525 cStatus[m_old_j] = cStatus[m_j];
527 int rIdx = m_old_i - m_col.size() + 1;
529 for(
int k = 0; k < m_col.size(); ++k)
531 int rIdx_new = m_col.index(k);
532 s[
rIdx] = s[rIdx_new];
533 y[
rIdx] = y[rIdx_new];
534 rStatus[
rIdx] = rStatus[rIdx_new];
546 for(
int k = 0; k < m_rows.size(); ++k)
549 const SVector& row = m_rows[k];
551 for(
int l = 0; l < row.
size(); ++l)
553 if (row.
index(l) != m_j)
562 Real z = (m_lRhs[k] / scale) - (val / scale);
567 Real up = z * scale / row[m_j];
577 if (m_bnd < minRowUp)
589 for(
int k = 0; k < m_rows.size(); ++k)
592 const SVector& row = m_rows[k];
594 for(
int l = 0; l < row.
size(); ++l)
596 if (row.
index(l) != m_j)
605 Real z = (m_lRhs[k] / scale) - (val / scale);
610 Real lo = z * scale / row[m_j];
620 if (m_bnd > maxRowLo)
629 for(
int k = 0; k < m_col.size(); ++k)
630 s[m_col.index(k)] = slack[k] + m_col.value(k) * x[m_j];
635 for(
int k = 0; k < m_col.size(); ++k)
637 int idx = m_col.index(k);
638 y[idx] = m_rowObj[idx];
642 for(
int k = 0; k < m_col.size(); ++k)
664 #ifdef CHECK_BASIC_DIM 679 cStatus[m_old_j] = cStatus[m_j];
682 Real aij = m_row[m_j];
688 throw SPxException(
"Simplifier: infinite activities - aborting unsimplification");
698 Real z1 = (m_lhs / scale1) - (s[m_i] / scale1);
699 Real z2 = (m_rhs / scale2) - (s[m_i] / scale2);
706 Real lo = (aij > 0) ? z1 * scale1 / aij : z2 * scale2 / aij;
707 Real up = (aij > 0) ? z2 * scale2 / aij : z1 * scale1 / aij;
714 assert(
LErel(lo, up));
719 if ( m_lower <= -infinity && m_upper >=
infinity )
724 else if ( m_lower == m_upper )
744 if ( m_lower <= -infinity && m_upper >=
infinity )
749 else if ( m_lower == m_upper )
769 if ( m_lower <= -infinity && m_upper >=
infinity )
776 assert(
EQrel(m_lower, m_upper));
814 s[m_i] += aij * x[m_j];
817 r[m_j] = -1.0 * aij * y[m_i];
821 #ifdef CHECK_BASIC_DIM 837 rStatus[m_old_i] = rStatus[m_i];
842 cStatus[m_old_j] = cStatus[m_j];
846 Real aij = m_row[m_j];
848 for(
int k = 0; k < m_row.size(); ++k)
850 if (m_row.index(k) != m_j)
851 val += m_row.value(k) * x[m_row.index(k)];
859 Real z = (m_lRhs / scale) - (val / scale);
864 x[m_j] = z * scale / aij;
868 y[m_i] = m_obj / aij;
881 #ifdef CHECK_BASIC_DIM 898 (( m_maxSense && ((r[m_j] > 0 && m_strictUp) || (r[m_j] < 0 && m_strictLo))) ||
899 (!m_maxSense && ((r[m_j] > 0 && m_strictLo) || (r[m_j] < 0 && m_strictUp)))))))
902 Real aik = m_col[m_i];
904 for(
int _k = 0; _k < m_col.size(); ++_k)
906 if (m_col.index(_k) != m_i)
907 val -= m_col.value(_k) * y[m_col.index(_k)];
913 r[m_j] = m_jObj - val * m_aij / aik;
922 if(
GT(r[m_j], 0) || (
isZero(r[m_j]) &&
EQ(x[m_j], m_Lo_j)) )
931 #ifdef CHECK_BASIC_DIM 946 for(
int i = m_perm.size() - 1; i >= 0; --i)
950 int rIdx_new = m_perm[i];
952 s[
rIdx] = s[rIdx_new];
953 y[
rIdx] = y[rIdx_new];
954 rStatus[
rIdx] = rStatus[rIdx_new];
960 for(
int k = 0; k < m_scale.size(); ++k)
962 if (m_scale.index(k) != m_i)
963 s[m_scale.index(k)] = s[m_i] / m_scale.value(k);
967 bool haveSetBasis =
false;
969 for(
int k = 0; k < m_scale.size(); ++k)
971 int i = m_scale.index(k);
977 y[i] = m_rowObj.value(k);
984 if (rStatus[m_i] ==
SPxSolver::FIXED && (i == m_maxLhsIdx || i == m_minRhsIdx))
987 y[i] = y[m_i] * m_scale.value(k);
990 if(m_isLhsEqualRhs[k])
994 else if(i == m_maxLhsIdx)
1000 assert(i == m_minRhsIdx);
1006 haveSetBasis =
true;
1011 y[i] = y[m_i] * m_scale.value(k);
1012 y[m_i] = m_i_rowObj;
1017 haveSetBasis =
true;
1022 y[i] = y[m_i] * m_scale.value(k);
1023 y[m_i] = m_i_rowObj;
1028 haveSetBasis =
true;
1033 y[i] = m_rowObj.value(k);
1038 #ifdef CHECK_BASIC_DIM 1058 #ifdef CHECK_BASIC_DIM 1071 for(
int i = m_perm.size() - 1; i >= 0; --i)
1075 int cIdx_new = m_perm[i];
1077 x[
cIdx] = x[cIdx_new];
1078 r[
cIdx] = r[cIdx_new];
1079 cStatus[
cIdx] = cStatus[cIdx_new];
1128 assert(
LErel(m_loJ, 0.0));
1129 assert(
GErel(m_upJ, 0.0));
1130 assert(
LErel(m_loK, 0.0));
1131 assert(
GErel(m_upK, 0.0));
1139 else if (
LErel(m_loK, 0.0) &&
GErel(m_upK, 0.0))
1151 else if (
LErel(m_loJ, 0.0) &&
GErel(m_upJ, 0.0))
1166 Real z1 = (x[m_k] / scale1) - (m_loK / scale1);
1167 Real z2 = (x[m_k] / scale2) - (m_upK / scale2);
1174 if( m_loJ <= -infinity && m_upJ >=
infinity && m_loK <= -infinity && m_upK >=
infinity )
1179 else if( m_scale > 0.0 )
1181 if(
GErel(x[m_k], m_upK + m_scale * m_upJ) )
1186 x[m_k] -= m_scale * x[m_j];
1188 else if(
GErel(x[m_k], m_loK + m_scale * m_upJ) && m_upJ <
infinity )
1192 x[m_k] -= m_scale * x[m_j];
1194 else if(
GErel(x[m_k], m_upK + m_scale * m_loJ) && m_upK <
infinity )
1199 x[m_j] = z2 * scale2 / m_scale;
1201 else if(
GErel(x[m_k], m_loK + m_scale * m_loJ) && m_loJ > -
infinity )
1205 x[m_k] -= m_scale * x[m_j];
1207 else if(
GErel(x[m_k], m_loK + m_scale * m_loJ) && m_loK > -
infinity )
1212 x[m_j] = z1 * scale1 / m_scale;
1214 else if(
LTrel(x[m_k], m_loK + m_scale * m_loJ) )
1219 x[m_k] -= m_scale * x[m_j];
1228 assert(m_scale < 0.0);
1230 if(
GErel(x[m_k], m_upK + m_scale * m_loJ) )
1235 x[m_k] -= m_scale * x[m_j];
1237 else if(
GErel(x[m_k], m_loK + m_scale * m_loJ) && m_loJ > -
infinity )
1241 x[m_k] -= m_scale * x[m_j];
1243 else if(
GErel(x[m_k], m_upK + m_scale * m_upJ) && m_upK <
infinity )
1248 x[m_j] = z2 * scale2 / m_scale;
1250 else if(
GErel(x[m_k], m_loK + m_scale * m_upJ) && m_upJ <
infinity )
1254 x[m_k] -= m_scale * x[m_j];
1256 else if(
GErel(x[m_k], m_loK + m_scale * m_upJ) && m_loK > -
infinity )
1261 x[m_j] = z1 * scale1 / m_scale;
1263 else if(
LTrel(x[m_k], m_loK + m_scale * m_upJ) )
1268 x[m_k] -= m_scale * x[m_j];
1278 r[m_j] = m_scale * r[m_k];
1287 s[m_old_i] = s[m_i];
1288 y[m_old_i] = y[m_i];
1289 rStatus[m_old_i] = rStatus[m_i];
1292 x[m_old_j] = x[m_j];
1293 r[m_old_j] = r[m_j];
1294 cStatus[m_old_j] = cStatus[m_j];
1298 Real aij = m_row[m_j];
1300 for(
int k = 0; k < m_row.size(); ++k)
1302 if(m_row.index(k) != m_j)
1303 val += m_row.value(k) * x[m_row.index(k)];
1311 Real z = (m_const / scale) - (val / scale);
1316 x[m_j] = z * scale / aij;
1319 assert(!isOptimal || (
GE(x[m_j], m_lower) &&
LE(x[m_j], m_upper)));
1324 for(
int k = 0; k < m_col.size(); ++k)
1326 if(m_col.index(k) != m_i)
1327 dualVal += m_col.value(k) * y[m_col.index(k)];
1330 z = m_obj - dualVal;
1345 #ifdef CHECK_BASIC_DIM 1358 switch(cStatus[m_j])
1361 if(
LT(x[m_j], m_origupper,
eps()) &&
GT(x[m_j], m_origlower,
eps()))
1363 else if(
LT(x[m_j], m_origupper,
eps()))
1365 else if(
GT(x[m_j], m_origlower,
eps()))
1370 if(
GT(x[m_j], m_origlower,
eps()))
1375 if(
LT(x[m_j], m_origupper,
eps()))
1383 #ifdef CHECK_BASIC_DIM 1393 for(
int i = lp.
nRows() - 1; i >= 0; --i )
1425 for(
int i = lp.
nRows()-1; i >= 0; --i)
1435 else if (lhs > -
infinity && lhs < -maxVal)
1440 else if (lhs < infinity && lhs > maxVal)
1454 else if (rhs > -
infinity && rhs < -maxVal)
1459 else if (rhs < infinity && rhs > maxVal)
1478 for(
int j = 0; j < lp.
nCols(); ++j)
1488 else if (lo > -
infinity && lo < -maxVal)
1493 else if (lo < infinity && lo > maxVal)
1507 else if (up > -
infinity && up < -maxVal)
1512 else if (up < infinity && up > maxVal)
1524 Real absBnd = (lo > up) ? lo : up;
1533 while(i < col.
size())
1537 if (
isZero(aij * absBnd, tol))
1540 int row_j = row.
pos(j);
1548 <<
" removed, absBnd=" << absBnd
1558 else if(
isZero(aij, tol) )
1576 else if (obj > -
infinity && obj < -maxVal)
1581 else if (obj < infinity && obj > maxVal)
1588 if (remRows + remNzos + chgLRhs + chgBnds + objCnt > 0)
1596 << remRows <<
" rows, " 1597 << remNzos <<
" non-zeros, " 1598 << chgBnds <<
" col bounds, " 1599 << chgLRhs <<
" row bounds, " 1600 << objCnt <<
" objective coefficients" << std::endl; )
1609 bool minNegInfinite =
false;
1610 bool maxInfinite =
false;
1615 for (
int l = 0; l < row.
size(); ++l)
1617 if (colNumber < 0 || row.
index(l) != colNumber)
1623 minNegInfinite =
true;
1627 else if (
LT(row.
value(l), 0.0))
1630 minNegInfinite =
true;
1643 else if (
LT(row.
value(l), 0.0))
1674 minVal = (side - minRes)/val;
1679 maxVal = (side - maxRes)/val;
1681 else if(
GT(val, 0.0))
1686 minVal = (side - maxRes)/val;
1691 maxVal = (side - minRes)/val;
1712 bool zerovalid =
true;
1720 for(
int j = lp.
nCols()-1; j >= 0; --j)
1727 for(
int k = 0; k < col.
size(); ++k)
1758 lower =
MINIMUM(-largeValue, upper);
1770 lowersol[j] = lower;
1771 uppersol[j] = upper;
1773 if(downLocks[j] > upLocks[j])
1775 else if(downLocks[j] < upLocks[j])
1778 locksol[j] = (lower + upper)/2.0;
1780 lowerObj += lp.
maxObj(j)*lowersol[j];
1781 upperObj += lp.
maxObj(j)*uppersol[j];
1782 lockObj += lp.
maxObj(j)*locksol[j];
1818 for(
int i = lp.
nRows()-1; i >= 0; --i)
1823 for(
int k = 0; k < row.
size(); k++)
1840 for(
int j = lp.
nCols()-1; j >= 0; --j )
1847 pseudoObj += val*lp.
lower(j);
1853 pseudoObj += val*lp.
upper(j);
1862 for(
int j = lp.
nCols()-1; j >= 0; --j)
1881 else if(objval > 0.0)
1906 for(
int i = lp.
nRows()-1; i >= 0; --i)
1910 if (row.
size() == 0)
1918 <<
" rhs=" << lp.
rhs(i) << std::endl; )
1934 for(
int j = lp.
nCols()-1; j >= 0; --j)
1938 if (col.
size() == 0)
1941 <<
": empty -> maxObj=" << lp.
maxObj(j)
1942 <<
" lower=" << lp.
lower(j)
1943 <<
" upper=" << lp.
upper(j); )
1992 if (remRows + remCols > 0)
1998 << remRows <<
" rows, " 1999 << remCols <<
" cols" 2008 assert(row.
size() == 1);
2011 int j = row.
index(0);
2016 <<
": singleton -> val=" << aij
2017 <<
" lhs=" << lp.
lhs(i)
2018 <<
" rhs=" << lp.
rhs(i); )
2044 <<
" (" << lp.
lower(j)
2046 <<
" (" << lp.
upper(j)
2047 <<
")" << std::endl; )
2049 bool stricterUp =
false;
2050 bool stricterLo =
false;
2100 int oldRows = lp.
nRows();
2102 bool redundantLower;
2103 bool redundantUpper;
2107 for(
int i = lp.
nRows()-1; i >= 0; --i)
2118 for(
int k = 0; k < row.
size(); ++k)
2121 int j = row.
index(k);
2125 MSG_WARNING( (*
spxout), (*
spxout) <<
"Warning: tiny nonzero coefficient " << aij <<
" in row " << i <<
"\n" );
2133 lhsBnd += aij * lp.
lower(j);
2138 rhsBnd += aij * lp.
upper(j);
2145 rhsBnd += aij * lp.
lower(j);
2150 lhsBnd += aij * lp.
upper(j);
2156 if (rhsCnt <= 1 || lhsCnt <= 1)
2158 for(
int k = 0; k < row.
size(); ++k)
2161 int j = row.
index(k);
2163 redundantLower =
false;
2164 redundantUpper =
false;
2180 Real z = (lp.
lhs(i) / scale) - (rhsBnd / scale);
2188 lo = lp.
upper(j) + z * scale / aij;
2190 lo = z * scale / aij;
2198 <<
": redundant lower bound on x" << j
2199 <<
" -> lower=" << lo
2200 <<
" (" << lp.
lower(j)
2201 <<
")" << std::endl; )
2203 redundantLower =
true;
2217 Real z = (lp.
rhs(i) / scale) - (lhsBnd / scale);
2225 up = lp.
lower(j) + z * scale / aij;
2227 up = z * scale / aij;
2235 <<
": redundant upper bound on x" << j
2236 <<
" -> upper=" << up
2237 <<
" (" << lp.
upper(j)
2238 <<
")" << std::endl; )
2240 redundantUpper =
true;
2249 lhsBnd -= aij * lp.
lower(j);
2263 rhsBnd -= aij * lp.
upper(j);
2284 Real z = (lp.
lhs(i) / scale) - (rhsBnd / scale);
2292 up = lp.
lower(j) + z * scale / aij;
2294 up = z * scale / aij;
2302 <<
": redundant upper bound on x" << j
2303 <<
" -> upper=" << up
2304 <<
" (" << lp.
upper(j)
2305 <<
")" << std::endl; )
2307 redundantUpper =
true;
2320 Real z = (lp.
rhs(i) / scale) - (lhsBnd / scale);
2328 lo = lp.
upper(j) + z * scale / aij;
2330 lo = z * scale / aij;
2338 <<
": redundant lower bound on x" << j
2339 <<
" -> lower=" << lo
2340 <<
" (" << lp.
lower(j)
2341 <<
")" << std::endl; )
2343 redundantLower =
true;
2352 lhsBnd -= aij * lp.
upper(j);
2366 rhsBnd -= aij * lp.
lower(j);
2381 redundantLhs =
false;
2382 redundantRhs =
false;
2388 <<
": redundant lhs -> lhsBnd=" << lhsBnd
2389 <<
" lhs=" << lp.
lhs(i)
2392 redundantLhs =
true;
2397 <<
": redundant rhs -> rhsBnd=" << rhsBnd
2398 <<
" rhs=" << lp.
rhs(i)
2401 redundantRhs =
true;
2433 <<
": infeasible -> lhs=" << lp.
lhs(i)
2434 <<
" rhs=" << lp.
rhs(i)
2435 <<
" lhsBnd=" << lhsBnd
2436 <<
" rhsBnd=" << rhsBnd
2446 <<
": unconstrained -> removed" << std::endl; )
2453 remNzos += row.
size();
2462 #if EMPTY_CONSTRAINT 2464 if (row.
size() == 0)
2472 <<
" rhs=" << lp.
rhs(i) << std::endl; )
2492 if (row.
size() == 1)
2499 #if FORCE_CONSTRAINT 2505 <<
": forcing constraint fix on lhs ->" 2506 <<
" lhs=" << lp.
lhs(i)
2507 <<
" rhsBnd=" << rhsBnd
2514 for(
int k = 0; k < row.
size(); ++k)
2517 int j = row.
index(k);
2521 lowers[k] = lp.
lower(j);
2522 uppers[k] = lp.
upper(j);
2537 remNzos += row.
size();
2548 <<
": forcing constraint fix on rhs ->" 2549 <<
" rhs=" << lp.
rhs(i)
2550 <<
" lhsBnd=" << lhsBnd
2557 for(
int k = 0; k < row.
size(); ++k)
2560 int j = row.
index(k);
2564 lowers[k] = lp.
lower(j);
2565 uppers[k] = lp.
upper(j);
2580 remNzos += row.
size();
2590 assert(remRows > 0 || remNzos == 0);
2592 if (remRows + chgLRhs + chgBnds > 0)
2602 << remRows <<
" rows, " 2603 << remNzos <<
" non-zeros, " 2604 << chgBnds <<
" col bounds, " 2605 << chgLRhs <<
" row bounds; kept " 2606 << keptBnds <<
" column bounds, " 2607 << keptLRhs <<
" row bounds" 2635 int oldCols = lp.
nCols();
2636 int oldRows = lp.
nRows();
2638 for(
int j = lp.
nCols()-1; j >= 0; --j)
2646 <<
": infeasible bounds on x" << j
2647 <<
" -> lower=" << lp.
lower(j)
2648 <<
" upper=" << lp.
upper(j)
2654 if (col.
size() == 0)
2658 <<
": empty -> maxObj=" << lp.
maxObj(j)
2659 <<
" lower=" << lp.
lower(j)
2660 <<
" upper=" << lp.
upper(j); )
2718 for(
int k = 0; k < col.
size(); ++k)
2720 if (!loFree && !upFree)
2723 int i = col.
index(k);
2728 if (col.
value(k) > 0.0)
2736 else if (col.
value(k) < 0.0)
2754 <<
" unconstrained above ->"; )
2775 <<
" unconstrained below ->"; )
2793 #if FREE_ZERO_OBJ_VARIABLE 2794 bool unconstrained_below = loFree && lp.
lower(j) <= -
infinity;
2795 bool unconstrained_above = upFree && lp.
upper(j) >=
infinity;
2797 if (unconstrained_below || unconstrained_above)
2801 <<
" unconstrained " 2802 << (unconstrained_below ?
"below" :
"above")
2803 <<
" with zero objective (" << lp.
maxObj(j)
2804 <<
")" << std::endl; )
2810 SPxQuicksort(col_idx_sorted.mem(), col_idx_sorted.size(), compare);
2818 remRows += col.
size();
2819 for(
int k = col_idx_sorted.size()-1; k >= 0; --k)
2826 for(
int k = 0; k < col.
size(); ++k)
2828 int l = col.
index(k);
2847 <<
" fixed -> lower=" << lp.
lower(j)
2848 <<
" upper=" << lp.
upper(j) << std::endl; )
2853 remNzos += col.
size();
2863 if (col.
size() == 1)
2866 int i = col.
index(0);
2871 #if ZERO_OBJ_COL_SINGLETON 2873 <<
": singleton in row " << i
2874 <<
" with zero objective"; )
2882 lhs = lp.
lhs(i) - aij * lp.
upper(j);
2884 rhs = lp.
rhs(i) - aij * lp.
lower(j);
2889 lhs = lp.
lhs(i) - aij * lp.
lower(j);
2891 rhs = lp.
rhs(i) - aij * lp.
upper(j);
2905 <<
" (" << lp.
lhs(i)
2907 <<
" (" << lp.
rhs(i)
2908 <<
")" << std::endl; )
2943 #if DOUBLETON_EQUATION 2945 <<
": singleton in row " << i
2946 <<
" with doubleton equation ->"; )
2955 if (row.
index(0) == j)
2960 else if (row.
index(1) == j)
2982 Real z1 = (lhs / scale1) - (aij * lp.
upper(j) / scale1);
2983 Real z2 = (lhs / scale2) - (aij * lp.
lower(j) / scale2);
3010 <<
": lower=" << lp.
lower(k)
3012 <<
") upper=" << lp.
upper(k)
3014 <<
")" << std::endl; )
3042 #if FREE_COL_SINGLETON 3049 <<
": free singleton in inequality constraint" << std::endl; )
3096 <<
": free singleton removed" << std::endl; )
3100 for (
int h = 0; h < row.size(); ++h)
3102 int k = row.
index(h);
3106 Real new_obj = lp.
obj(k) - (lp.
obj(j) * row.value(h) / aij);
3113 remNzos += row.size();
3125 if (remCols + remRows > 0)
3133 << remRows <<
" rows, " 3134 << remCols <<
" cols, " 3135 << remNzos <<
" non-zeros, " 3136 << chgBnds <<
" col bounds" 3158 int oldRows = lp.
nRows();
3159 int oldCols = lp.
nCols();
3168 for(
int i = lp.
nRows()-1; i >= 0; --i)
3174 <<
": unconstrained" << std::endl; )
3195 for(
int j = 0; j < lp.
nCols(); ++j)
3209 dualVarUp[i] = bound;
3211 dualVarLo[i] = bound;
3216 dualVarLo[i] = bound;
3218 dualVarUp[i] = bound;
3225 for(
int j = 0; j < lp.
nCols(); ++j)
3227 dualConsLo[j] = dualConsUp[j] = 0.0;
3231 for(
int k = 0; k < col.
size(); ++k)
3237 int i = col.
index(k);
3246 dualConsLo[j] += aij * dualVarLo[i];
3251 dualConsUp[j] += aij * dualVarUp[i];
3258 dualConsUp[j] += aij * dualVarLo[i];
3263 dualConsLo[j] += aij * dualVarUp[i];
3268 for(
int j = lp.
nCols()-1; j >= 0; --j)
3274 if (
LTrel(dualConsUp[j], dualConsLo[j],
opttol()))
3277 <<
": dual infeasible -> dual lhs bound=" << dualConsLo[j]
3278 <<
" dual rhs bound=" << dualConsUp[j] << std::endl; )
3288 #if DOMINATED_COLUMN 3290 <<
": dominated -> maxObj=" << obj
3291 <<
" dual rhs bound=" << dualConsUp[j] << std::endl; )
3311 #if DOMINATED_COLUMN 3313 <<
": dominated -> maxObj=" << obj
3314 <<
" dual lhs bound=" << dualConsLo[j] << std::endl; )
3336 #if WEAKLY_DOMINATED_COLUMN 3338 <<
": weakly dominated -> maxObj=" << obj
3339 <<
" dual rhs bound=" << dualConsUp[j] << std::endl; )
3351 #if WEAKLY_DOMINATED_COLUMN 3353 <<
": weakly dominated -> maxObj=" << obj
3354 <<
" dual lhs bound=" << dualConsLo[j] << std::endl; )
3381 assert(remRows > 0 || remCols > 0 || remNzos == 0);
3383 if (remCols + remRows > 0)
3390 << remRows <<
" rows, " 3391 << remCols <<
" cols, " 3392 << remNzos <<
" non-zeros" 3410 int oldRows = lp.
nRows();
3411 int oldCols = lp.
nCols();
3416 for(
int j = lp.
nCols()-1; j >= 0; --j)
3426 for(
int k = 0; k < col.
size(); ++k)
3454 if (upLocks[j] == 1 || downLocks[j] == 1)
3460 bool bestislhs =
true;
3464 for(
int k = 0; k < col.
size(); ++k)
3476 rowNumber = col.
index(k);
3477 lhs = lp.
lhs(rowNumber);
3478 rhs = lp.
rhs(rowNumber);
3487 maxOtherLocks = INT_MAX;
3496 && ((col.
value(k) > 0.0 && lp.
maxObj(j) <= 0.0 && downLocks[j] == 1 && upLocks[j] <= maxOtherLocks)
3497 || (col.
value(k) < 0.0 && lp.
maxObj(j) >= 0.0 && upLocks[j] == 1 && downLocks[j] <= maxOtherLocks));
3499 && ((col.
value(k) > 0.0 && lp.
maxObj(j) >= 0.0 && upLocks[j] == 1 && downLocks[j] <= maxOtherLocks)
3500 || (col.
value(k) < 0.0 && lp.
maxObj(j) <= 0.0 && downLocks[j] == 1 && upLocks[j] <= maxOtherLocks));
3502 if (aggLhs || aggRhs)
3519 assert(
LE(minVal, maxVal));
3525 bestpos = col.
index(k);
3540 assert(
LE(minVal, maxVal));
3545 bestpos = col.
index(k);
3558 Real aggConstant = (bestislhs ? lp.
lhs(bestpos) : lp.
rhs(bestpos));
3559 Real aggAij = bestRow[j];
3562 (*
spxout) <<
"IMAISM51 col " << j
3563 <<
": Aggregating row: " << bestpos
3564 <<
" Aggregation Constant=" << aggConstant
3565 <<
" Coefficient of aggregated col=" << aggAij << std::endl;
3572 for(
int k = 0; k < col.
size(); ++k)
3574 if(col.
index(k) != bestpos)
3576 int rowNumber = col.
index(k);
3584 for(
int l = 0; l < bestRow.
size(); l++)
3586 if(bestRow.
index(l) != j)
3590 - updateRow[j]*bestRow.
value(l)/aggAij);
3598 lp.
changeRhs(rowNumber, updateRhs - updateRow[j]*aggConstant/aggAij);
3600 lp.
changeLhs(rowNumber, updateLhs - updateRow[j]*aggConstant/aggAij);
3602 assert(
LE(lp.
lhs(rowNumber), lp.
rhs(rowNumber)));
3606 for(
int l = 0; l < bestRow.
size(); l++)
3608 if(bestRow.
index(l) != j)
3625 assert(remRows > 0 || remCols > 0 || remNzos == 0);
3627 if (remCols + remRows > 0)
3634 << remRows <<
" rows, " 3635 << remCols <<
" cols, " 3636 << remNzos <<
" non-zeros" 3658 int oldRows = lp.
nRows();
3667 for (
int i = 0; i < lp.
nRows(); ++i)
3671 if (row.
size() == 1)
3681 << rs_remRows <<
" rows, " 3682 << rs_remRows <<
" non-zeros" 3710 classSize[0] = lp.
nRows();
3712 for(
int i = 1; i < lp.
nRows(); ++i)
3723 for(
int j = 0; j < lp.
nCols(); ++j)
3727 for(
int k = 0; k < col.
size(); ++k)
3730 int i = col.
index(k);
3732 if (scale[i] == 0.0)
3736 if (--classSize[pClass[i]] == 0)
3737 idxSet.addIdx(pClass[i]);
3741 for(
int m = 0; m < col.
size(); ++m)
3743 int k = pClass[col.
index(m)];
3754 int classIdx = idxSet.index(0);
3761 classIdx = idxSet.index(0);
3766 ++classSize[classIdx];
3768 oldVal = m_classSetRows[k].value(l);
3780 for(
int k = 0; k < lp.
nRows(); ++k )
3783 for(
int k = 0; k < lp.
nRows(); ++k)
3789 const int nRowsOld_tmp = lp.
nRows();
3793 for(
int j = 0; j < nRowsOld_tmp; ++j)
3798 int idxFirstDupRows = -1;
3799 int idxLastDupRows = -1;
3802 for(
int k = 0; k < lp.
nRows(); ++k)
3808 if(idxFirstDupRows < 0)
3810 idxFirstDupRows = k;
3813 for(
int l = 1; l <
m_dupRows[k].size(); ++l)
3824 int k_tmp, j_tmp = -1;
3825 for (k_tmp = j_tmp = 0; k_tmp < nRowsOld_tmp; ++k_tmp)
3827 if (perm_tmp[k_tmp] >= 0)
3828 perm_tmp[k_tmp] = j_tmp++;
3833 bool doChangeRanges =
false;
3837 for(
int k = 0; k < lp.
nRows(); ++k)
3842 <<
" duplicate rows found" << std::endl; )
3856 for(
int l = 0; l <
m_dupRows[k].size(); ++l)
3859 isLhsEqualRhs[l] = (lp.
lhs(i) == lp.
rhs(i));
3866 maxLhs = lp.
lhs(rowIdx);
3867 minRhs = lp.
rhs(rowIdx);
3871 Real scaledLhs, scaledRhs;
3872 Real factor = scale[rowIdx] / scale[i];
3884 if (scaledLhs > maxLhs)
3889 if (scaledRhs < minRhs)
3901 Real newLhs = (maxLhs > lp.
lhs(rowIdx)) ? maxLhs : lp.
lhs(rowIdx);
3902 Real newRhs = (minRhs < lp.
rhs(rowIdx)) ? minRhs : lp.
rhs(rowIdx);
3904 if(k == idxLastDupRows)
3907 for(
int j = 0; j < nRowsOld_tmp; ++j)
3909 da_perm[j] = perm_tmp[j];
3913 m_hist.append(
new (DuplicateRowsPSptr)
DuplicateRowsPS(lp, rowIdx, maxLhsIdx, minRhsIdx,
m_dupRows[k], scale, da_perm, isLhsEqualRhs,
true,
EQrel(newLhs, newRhs), k==idxFirstDupRows));
3920 m_hist.append(
new (DuplicateRowsPSptr)
DuplicateRowsPS(lp, rowIdx, maxLhsIdx, minRhsIdx,
m_dupRows[k], scale, da_perm_empty, isLhsEqualRhs,
false,
EQrel(newLhs, newRhs), k == idxFirstDupRows));
3923 if (maxLhs > lp.
lhs(rowIdx) || minRhs < lp.
rhs(rowIdx))
3926 doChangeRanges =
true;
3930 MSG_DEBUG( (*
spxout) <<
"IMAISM55 duplicate rows yield infeasible bounds:" 3931 <<
" lhs=" << newLhs
3932 <<
" rhs=" << newRhs << std::endl; )
3937 if( newRhs < newLhs )
3940 newLhsVec[rowIdx] = newLhs;
3941 newRhsVec[rowIdx] = newRhs;
3954 const int nRowsOld = lp.
nRows();
3958 for(
int i = 0; i < nRowsOld; ++i)
3971 for(
int i = 0; i < nRowsOld; ++i)
3974 assert(perm[i] == perm_tmp[i]);
3984 if (remRows + remNzos > 0)
3990 << remRows <<
" rows, " 3991 << remNzos <<
" non-zeros" 4037 classSize[0] = lp.
nCols();
4039 for(
int j = 1; j < lp.
nCols(); ++j)
4050 for(
int i = 0; i < lp.
nRows(); ++i)
4054 for(
int k = 0; k < row.
size(); ++k)
4057 int j = row.
index(k);
4059 if (scale[j] == 0.0)
4063 if (--classSize[pClass[j]] == 0)
4064 idxSet.addIdx(pClass[j]);
4068 for(
int m = 0; m < row.
size(); ++m)
4070 int k = pClass[row.
index(m)];
4081 int classIdx = idxSet.index(0);
4089 classIdx = idxSet.index(0);
4094 ++classSize[classIdx];
4096 oldVal = m_classSetCols[k].value(l);
4109 for(
int k = 0; k < lp.
nCols(); ++k )
4112 for(
int k = 0; k < lp.
nCols(); ++k)
4115 fixAndRemCol[k] =
false;
4119 bool hasDuplicateCol =
false;
4122 for(
int k = 0; k < lp.
nCols(); ++k)
4127 <<
" duplicate columns found" << std::endl; )
4129 if (!hasDuplicateCol)
4134 hasDuplicateCol =
true;
4137 for(
int l = 0; l <
m_dupCols[k].size(); ++l)
4139 for(
int m = 0; m <
m_dupCols[k].size(); ++m)
4144 if (l != m && !remCol[j1] && !remCol[j2])
4150 Real factor = scale[j1] / scale[j2];
4151 Real objDif = cj1 - cj2 * scale[j1] / scale[j2];
4182 else if (factor < 0)
4197 <<
" replaced by one" << std::endl; )
4205 MSG_DEBUG( (*
spxout) <<
"IMAISM80 not removing two duplicate columns " << j1
4207 <<
" because zero not contained in their bounds" << std::endl; )
4216 if (factor > 0 && objDif > 0)
4227 <<
" first one fixed at upper bound=" << lp.
upper(j1) << std::endl; )
4234 else if (factor < 0 && objDif < 0)
4245 <<
" first one fixed at lower bound=" << lp.
lower(j1) << std::endl; )
4256 if (factor < 0 && objDif > 0)
4267 <<
" first one fixed at upper bound=" << lp.
upper(j1) << std::endl; )
4276 else if (factor > 0 && objDif < 0)
4287 <<
" first one fixed at lower bound=" << lp.
lower(j1) << std::endl; )
4298 fixAndRemCol[j1] =
true;
4309 for(
int j = 0; j < lp.
nCols(); ++j)
4321 const int nColsOld = lp.
nCols();
4325 for(
int j = 0; j < nColsOld; ++j)
4338 for(
int j = 0; j < nColsOld; ++j)
4345 for(
int j = 0; j < nColsOld; ++j)
4347 da_perm[j] = perm[j];
4350 if (hasDuplicateCol)
4359 assert(remCols > 0 || remNzos == 0);
4367 << remCols <<
" cols, " 4368 << remNzos <<
" non-zeros" 4387 <<
": lower=" << lp.
lower(j)
4388 <<
" upper=" << lp.
upper(j)
4393 for(
int k = 0; k < col.
size(); ++k)
4395 int i = col.
index(k);
4405 Real rhs = (lp.
rhs(i) / scale) - (y / scale);
4414 <<
" (" << lp.
rhs(i)
4415 <<
") aij=" << col.
value(k)
4428 Real lhs = (lp.
lhs(i) / scale) - (y / scale);
4437 <<
" (" << lp.
lhs(i)
4438 <<
") aij=" << col.
value(k)
4443 assert(lp.
lhs(i) <= lp.
rhs(i));
4480 for(
int k = 0; k <
m_hist.size(); ++k)
4506 int numRangedRows = 0;
4507 int numBoxedCols = 0;
4509 for(
int i = 0; i < lp.
nRows(); ++i)
4512 for(
int j = 0; j < lp.
nCols(); ++j)
4516 (*spxout) <<
"LP has " 4517 << numRangedRows <<
" ranged rows, " 4518 << numBoxedCols <<
" boxed columns" 4546 for(
int i = 0; i < lp.
nRows(); ++i)
4549 for(
int j = 0; j < lp.
nCols(); ++j)
4589 #if TRIVIAL_HEURISTICS 4616 << m_remCols <<
" columns, " 4629 << lp.
nRows() <<
" rows " 4630 << lp.
nCols() <<
" columns " 4631 << lp.
nNzos() <<
" nonzeros" 4635 int numRangedRows = 0;
4636 int numBoxedCols = 0;
4638 for(
int i = 0; i < lp.
nRows(); ++i)
4642 for(
int j = 0; j < lp.
nCols(); ++j)
4646 (*spxout) <<
"Reduced LP has " 4647 << numRangedRows <<
" ranged rows, " 4648 << numBoxedCols <<
" boxed columns" 4688 assert(x.
dim() == r.
dim());
4689 assert(y.
dim() == s.
dim());
4694 for(
int j = 0; j < x.
dim(); ++j)
4700 for(
int i = 0; i < y.
dim(); ++i)
4708 for(
int k =
m_hist.size()-1; k >= 0; --k)
4746 #ifdef CHECK_BASIC_DIM 4782 os <<
"DUAL_INFEASIBLE";
const VectorBase< R > & rhs() const
Returns right hand side vector.
DVector m_prim
unsimplified primal solution vector.
Rational spxAbs(const Rational &r)
Absolute.
bool isNotZero(Real a, Real eps=Param::epsilon())
returns true iff |a| > eps
Real m_opttol
dual feasibility tolerance.
DataArray< PostStep * > m_hist
vector of presolve history.
Postsolves multi aggregation.
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
bool LTrel(Real a, Real b, Real eps=Param::epsilon())
returns true iff relDiff(a,b) <= -eps
free variable fixed to zero.
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
friend class FreeConstraintPS
Result removeRowSingleton(SPxLP &lp, const SVector &row, int &i)
remove row singletons.
DataArray< int > m_stat
preprocessing history.
bool GE(Real a, Real b, Real eps=Param::epsilon())
returns true iff a >= b + eps
void reDim(int newdim, const bool setZero=true)
Resets DVectorBase's dimension to newdim.
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
int m_keptLRhs
number of kept left- and right-hand sides
UnitVectorBase< Real > UnitVector
const VectorBase< R > & upper() const
Returns upper bound vector.
Real m_epsilon
epsilon zero.
THREADLOCAL const Real infinity
Postsolves variable bound fixing.
Result
Result of the simplification.
the problem was so much simplified that it vanished
Postsolves duplicate rows.
int m_remNzos
number of removed nonzero coefficients
int size() const
Number of used indices.
void computeMinMaxResidualActivity(SPxLP &lp, int rowNumber, int colNumber, Real &minAct, Real &maxAct)
computes the minimum and maximum residual activity for a given row and column. If colNumber is set to...
Real m_feastol
primal feasibility tolerance.
DataArray< SPxSolver::VarStatus > m_rBasisStat
basis status of rows.
Real maxAbs(Real a, Real b)
returns max(|a|,|b|)
virtual void removeCols(int perm[])
Removes multiple columns.
bool LE(Real a, Real b, Real eps=Param::epsilon())
returns true iff a <= b + eps
bool LT(Real a, Real b, Real eps=Param::epsilon())
returns true iff a < b + eps
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
SPxLP::SPxSense m_thesense
optimization sense.
bool NE(Real a, Real b, Real eps=Param::epsilon())
returns true iff |a-b| > eps
virtual Result simplify(SPxLP &lp, Real eps, Real delta)
simplify SPxLP lp with identical primal and dual feasibility tolerance.
friend class DuplicateRowsPS
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
int cIdx(int j) const
returns for a given column index of the (reduced) LP the corresponding column index in the unsimplifi...
variable fixed to identical bounds.
DVector m_dual
unsimplified dual solution vector.
R & value(int n)
Reference to value of n 'th nonzero.
General methods in LP preprocessing.
Postsolves empty constraints.
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
int m_keptBnds
number of kept bounds
#define ASSERT_WARN(prefix, expr)
Macro to turn some assertions into warnings.
Real m_minReduction
minimal reduction (sum of removed rows/cols) to continue simplification
void remove(int n, int m)
Remove nonzeros n thru m.
void handleExtremes(SPxLP &lp)
handles extreme values by setting them to zero or infinity.
bool m_postsolved
status of postsolving.
int rIdx(int i) const
returns for a given row index of the (reduced) LP the corresponding row index in the unsimplified LP...
virtual void unsimplify(const Vector &x, const Vector &y, const Vector &s, const Vector &r, const SPxSolver::VarStatus rows[], const SPxSolver::VarStatus cols[], bool isOptimal=true)
reconstructs an optimal solution for the unsimplified LP.
SVectorBase< R > & rowVector_w(int i)
virtual void removeRows(int perm[])
Removes multiple rows.
void fixColumn(SPxLP &lp, int i, bool correctIdx=true)
handles the fixing of a variable. correctIdx is true iff the index mapping has to be updated...
virtual const std::string what() const
returns exception message
Wrapper for different output streams and verbosity levels.
int nRows() const
Returns number of rows in LP.
Exception class for out of memory exceptions.This class is derived from the SoPlex exception base cla...
virtual void start()=0
start timer, resume accounting user, system and real time.
virtual Real stop()=0
stop timer, return accounted user time.
void spx_alloc(T &p, int n=1)
Allocate memory.
simplification could be done
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
Postsolves the case when constraints are removed due to a variable with zero objective that is free i...
int nNzos() const
Returns number of nonzeros in LP.
virtual const char * getName() const
get name of simplifying step.
friend class RowSingletonPS
Timer * m_timeUsed
user time used for simplification
nothing known about basis status (possibly due to a singular basis in transformed problem) ...
Array< DSVector > m_classSetCols
stores parallel classes with non-zero row entry
Result duplicateCols(SPxLP &lp, bool &again)
removes duplicate columns
void removeCol(SPxLP &lp, int j)
removes a column in the LP.
bool GT(Real a, Real b, Real eps=Param::epsilon())
returns true iff a > b + eps
SPxSense spxSense() const
Returns the optimization sense.
int & index(int n)
Reference to index of n 'th nonzero.
Postsolves row singletons.
virtual void changeMaxObj(const VectorBase< R > &newObj, bool scale=false)
Changes objective vector to newObj. scale determines whether the new data should be scaled...
std::ostream & operator<<(std::ostream &s, const VectorBase< R > &vec)
Output operator.
Result simplifyRows(SPxLP &lp, bool &again)
performs simplification steps on the rows of the LP.
bool checkSolution(SPxLP &lp, DVector sol)
checks a solution for feasibility
#define MSG_INFO2(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO2.
friend class DoubletonEquationPS
Postsolves doubleton equations combined with a column singleton.
Postsolves free column singletons.
virtual void changeLower(const VectorBase< R > &newLower, bool scale=false)
Changes vector of lower bounds to newLower. scale determines whether the new data should be scaled...
virtual void changeRhs(const VectorBase< R > &newRhs, bool scale=false)
Changes right hand side vector for constraints to newRhs. scale determines whether the new data shoul...
comparator for class SVector::Element: compare nonzeros according to value
R obj(int i) const
Returns objective value of column i.
const VectorBase< R > & lhs() const
Returns left hand side vector.
DataArray< int > m_cIdx
column index vector in original LP.
Result m_result
result of the simplification.
variable set to its upper bound.
bool GTrel(Real a, Real b, Real eps=Param::epsilon())
returns true iff relDiff(a,b) > eps
void SPxQuicksort(T *keys, int end, COMPARATOR &compare, int start=0, bool type=true)
Generic QuickSort implementation.
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
virtual void changeBounds(const VectorBase< R > &newLower, const VectorBase< R > &newUpper, bool scale=false)
Changes variable bounds to newLower and newUpper. scale determines whether the new data should be sca...
primal infeasibility was detected
const VectorBase< R > & maxRowObj() const
bool GErel(Real a, Real b, Real eps=Param::epsilon())
returns true iff relDiff(a,b) > -eps
variable set to its lower bound.
Generic QuickSort implementation.
Array< DSVector > m_dupCols
arrange duplicate columns w.r.t. their pClass values
int m_remRows
number of removed rows
void add(int i, const R &v)
Append one nonzero (i,v).
virtual void changeUpper(const VectorBase< R > &newUpper, bool scale=false)
Changes vector of upper bounds to newUpper. scale determines whether the new data should be scaled...
Postsolves row objectives.
bool EQ(Real a, Real b, Real eps=Param::epsilon())
returns true iff |a-b| <= eps
virtual void changeObj(const VectorBase< R > &newObj, bool scale=false)
Changes objective vector to newObj. scale determines whether the new data should be scaled...
DataArray< int > m_rIdx
row index vector in original LP.
Postsolves column singletons with zero objective.
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
virtual void addCol(const LPColBase< R > &col, bool scale=false)
int dim() const
Dimension of vector.
Exception base class.This class implements a base class for our SoPlex exceptions We provide a what()...
bool m_keepbounds
keep some bounds (for boundflipping)
Everything should be within this namespace.
virtual void changeRange(const VectorBase< R > &newLhs, const VectorBase< R > &newRhs, bool scale=false)
Changes left and right hand side vectors. scale determines whether the new data should be scaled...
bool EQrel(Real a, Real b, Real eps=Param::epsilon())
returns true iff |relDiff(a,b)| <= eps
virtual bool checkBasisDim(DataArray< SPxSolver::VarStatus > rows, DataArray< SPxSolver::VarStatus > cols) const
friend class ForceConstraintPS
void handleRowObjectives(SPxLP &lp)
handle row objectives
primal unboundedness was detected
#define MSG_WARNING(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::WARNING.
Result duplicateRows(SPxLP &lp, bool &again)
removes duplicate rows.
Real m_cutoffbound
the cutoff bound that is found by heuristics
const VectorBase< R > & maxObj() const
Returns objective vector for maximization problem.
Exception class for incorrect usage of interface methods.
Result multiaggregation(SPxLP &lp, bool &again)
performs multi-aggregations of variable based upon constraint activitu.
Save arrays of arbitrary types.
Real m_objoffset
objective offset
friend class DuplicateColsPS
bool NErel(Real a, Real b, Real eps=Param::epsilon())
returns true iff |relDiff(a,b)| > eps
const SVectorBase< R > & rowVector(int i) const
Gets row vector of row i.
comparator for class SVector::Element: compare nonzeros according to index
virtual void changeRowObj(const VectorBase< R > &newRowObj, bool scale=false)
Changes row objective function vector to newRowObj. scale determines whether the new data should be s...
void trivialHeuristic(SPxLP &lp)
tries to find good lower bound solutions by applying some trivial heuristics
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
int m_chgBnds
number of changed bounds
Postsolves duplicate columns.
Result removeEmpty(SPxLP &lp)
removed empty rows and empty columns.
int size() const
return nr. of elements.
Postsolves forcing constraints.
Result simplifyDual(SPxLP &lp, bool &again)
performs simplification steps on the LP based on dual concepts.
Postsolves unconstraint constraints.
int pos(int i) const
Position of index i.
bool isConsistent() const
Consistency check.
Postsolves variable bound tightening from pseudo objective propagation.
#define MSG_INFO1(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO1.
int m_remCols
number of removed columns
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
const SVectorBase< R > & colVector(int i) const
Returns column vector of column i.
Postsolves variable fixing.
int nCols() const
Returns number of columns in LP.
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
virtual void changeElement(int i, int j, const R &val, bool scale=false)
Changes LP element (i, j) to val. scale determines whether the new data should be scaled...
friend class FreeColSingletonPS
bool LErel(Real a, Real b, Real eps=Param::epsilon())
returns true iff relDiff(a,b) <= eps
virtual void changeLhs(const VectorBase< R > &newLhs, bool scale=false)
Changes left hand side vector for constraints to newLhs. scale determines whether the new data should...
Real m_pseudoobj
the pseudo objective function value
friend class FreeZeroObjVariablePS
void computeMinMaxValues(SPxLP &lp, Real side, Real val, Real minRes, Real maxRes, Real &minVal, Real &maxVal)
calculate min/max value for the multi aggregated variables
int m_addedcols
columns added by handleRowObjectives()
friend class ZeroObjColSingletonPS
bool isZero(Real a, Real eps=Param::epsilon())
returns true iff |a| <= eps
void removeRow(SPxLP &lp, int i)
removes a row in the LP.
friend class EmptyConstraintPS
virtual void reset()=0
initialize timer, set timing accounts to zero.
SPxOut * spxout
message handler
Save arrays of data objects.
SVectorBase< R > & colVector_w(int i)
Returns the LP as an LPRowSet.
int m_chgLRhs
number of change right-hand sides
Result simplifyCols(SPxLP &lp, bool &again)
performs simplification steps on the columns of the LP.
Array< DSVector > m_dupRows
arrange duplicate rows using bucket sort w.r.t. their pClass values
void reSize(int newsize)
reset size to newsize.
DVector m_slack
unsimplified slack vector.
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
const VectorBase< R > & lower() const
Returns (internal and possibly scaled) lower bound vector.
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const
Set of indices.Class IdxSet provides a set of indices. At construction it must be given an array of i...
void spx_free(T &p)
Release memory.
DataArray< SPxSolver::VarStatus > m_cBasisStat
basis status of columns.
void propagatePseudoobj(SPxLP &lp)
tightens variable bounds by propagating the pseudo objective function value.
dual infeasibility was detected
Array< DSVector > m_classSetRows
stores parallel classes with non-zero colum entry
friend class FixVariablePS
DVector m_redCost
unsimplified reduced cost vector.