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)
636 y[m_col.index(k)] = m_rowObj.value(k);
639 for(
int k = 0; k < m_col.size(); ++k)
661 #ifdef CHECK_BASIC_DIM 676 cStatus[m_old_j] = cStatus[m_j];
679 Real aij = m_row[m_j];
685 throw SPxException(
"Simplifier: infinite activities - aborting unsimplification");
695 Real z1 = (m_lhs / scale1) - (s[m_i] / scale1);
696 Real z2 = (m_rhs / scale2) - (s[m_i] / scale2);
703 Real lo = (aij > 0) ? z1 * scale1 / aij : z2 * scale2 / aij;
704 Real up = (aij > 0) ? z2 * scale2 / aij : z1 * scale1 / aij;
711 assert(
LErel(lo, up));
716 if ( m_lower == m_upper )
736 if ( m_lower == m_upper )
756 assert(
EQrel(m_lower, m_upper));
793 s[m_i] += aij * x[m_j];
796 r[m_j] = -1.0 * aij * y[m_i];
800 #ifdef CHECK_BASIC_DIM 816 rStatus[m_old_i] = rStatus[m_i];
821 cStatus[m_old_j] = cStatus[m_j];
825 Real aij = m_row[m_j];
827 for(
int k = 0; k < m_row.size(); ++k)
829 if (m_row.index(k) != m_j)
830 val += m_row.value(k) * x[m_row.index(k)];
838 Real z = (m_lRhs / scale) - (val / scale);
843 x[m_j] = z * scale / aij;
847 y[m_i] = m_obj / aij;
860 #ifdef CHECK_BASIC_DIM 877 (( m_maxSense && ((r[m_j] > 0 && m_strictUp) || (r[m_j] < 0 && m_strictLo))) ||
878 (!m_maxSense && ((r[m_j] > 0 && m_strictLo) || (r[m_j] < 0 && m_strictUp)))))))
881 Real aik = m_col[m_i];
883 for(
int _k = 0; _k < m_col.size(); ++_k)
885 if (m_col.index(_k) != m_i)
886 val -= m_col.value(_k) * y[m_col.index(_k)];
892 r[m_j] = m_jObj - val * m_aij / aik;
901 if(
GT(r[m_j], 0) || (
isZero(r[m_j]) &&
EQ(x[m_j], m_Lo_j)) )
910 #ifdef CHECK_BASIC_DIM 925 for(
int i = m_perm.size() - 1; i >= 0; --i)
929 int rIdx_new = m_perm[i];
931 s[
rIdx] = s[rIdx_new];
932 y[
rIdx] = y[rIdx_new];
933 rStatus[
rIdx] = rStatus[rIdx_new];
939 for(
int k = 0; k < m_scale.size(); ++k)
941 if (m_scale.index(k) != m_i)
942 s[m_scale.index(k)] = s[m_i] / m_scale.value(k);
946 bool haveSetBasis =
false;
948 for(
int k = 0; k < m_scale.size(); ++k)
950 int i = m_scale.index(k);
956 y[i] = m_rowObj.value(k);
963 if (rStatus[m_i] ==
SPxSolver::FIXED && (i == m_maxLhsIdx || i == m_minRhsIdx))
966 y[i] = y[m_i] * m_scale.value(k);
969 if(m_isLhsEqualRhs[k])
973 else if(i == m_maxLhsIdx)
979 assert(i == m_minRhsIdx);
990 y[i] = y[m_i] * m_scale.value(k);
1001 y[i] = y[m_i] * m_scale.value(k);
1002 y[m_i] = m_i_rowObj;
1007 haveSetBasis =
true;
1012 y[i] = m_rowObj.value(k);
1017 #ifdef CHECK_BASIC_DIM 1037 #ifdef CHECK_BASIC_DIM 1050 for(
int i = m_perm.size() - 1; i >= 0; --i)
1054 int cIdx_new = m_perm[i];
1056 x[
cIdx] = x[cIdx_new];
1057 r[
cIdx] = r[cIdx_new];
1058 cStatus[
cIdx] = cStatus[cIdx_new];
1107 assert(
LErel(m_loJ, 0.0));
1108 assert(
GErel(m_upJ, 0.0));
1109 assert(
LErel(m_loK, 0.0));
1110 assert(
GErel(m_upK, 0.0));
1118 else if (
LErel(m_loK, 0.0) &&
GErel(m_upK, 0.0))
1130 else if (
LErel(m_loJ, 0.0) &&
GErel(m_upJ, 0.0))
1145 Real z1 = (x[m_k] / scale1) - (m_loK / scale1);
1146 Real z2 = (x[m_k] / scale2) - (m_upK / scale2);
1153 if( m_loJ <= -infinity && m_upJ >=
infinity && m_loK <= -infinity && m_upK >=
infinity )
1158 else if( m_scale > 0.0 )
1160 if(
GErel(x[m_k], m_upK + m_scale * m_upJ) )
1165 x[m_k] -= m_scale * x[m_j];
1167 else if(
GErel(x[m_k], m_loK + m_scale * m_upJ) && m_upJ <
infinity )
1171 x[m_k] -= m_scale * x[m_j];
1173 else if(
GErel(x[m_k], m_upK + m_scale * m_loJ) && m_upK <
infinity )
1178 x[m_j] = z2 * scale2 / m_scale;
1180 else if(
GErel(x[m_k], m_loK + m_scale * m_loJ) && m_loJ > -
infinity )
1184 x[m_k] -= m_scale * x[m_j];
1186 else if(
GErel(x[m_k], m_loK + m_scale * m_loJ) && m_loK > -
infinity )
1191 x[m_j] = z1 * scale1 / m_scale;
1193 else if(
LTrel(x[m_k], m_loK + m_scale * m_loJ) )
1198 x[m_k] -= m_scale * x[m_j];
1207 assert(m_scale < 0.0);
1209 if(
GErel(x[m_k], m_upK + m_scale * m_loJ) )
1214 x[m_k] -= m_scale * x[m_j];
1216 else if(
GErel(x[m_k], m_loK + m_scale * m_loJ) && m_loJ > -
infinity )
1220 x[m_k] -= m_scale * x[m_j];
1222 else if(
GErel(x[m_k], m_upK + m_scale * m_upJ) && m_upK <
infinity )
1227 x[m_j] = z2 * scale2 / m_scale;
1229 else if(
GErel(x[m_k], m_loK + m_scale * m_upJ) && m_upJ <
infinity )
1233 x[m_k] -= m_scale * x[m_j];
1235 else if(
GErel(x[m_k], m_loK + m_scale * m_upJ) && m_loK > -
infinity )
1240 x[m_j] = z1 * scale1 / m_scale;
1242 else if(
LTrel(x[m_k], m_loK + m_scale * m_upJ) )
1247 x[m_k] -= m_scale * x[m_j];
1257 r[m_j] = m_scale * r[m_k];
1266 s[m_old_i] = s[m_i];
1267 y[m_old_i] = y[m_i];
1268 rStatus[m_old_i] = rStatus[m_i];
1271 x[m_old_j] = x[m_j];
1272 r[m_old_j] = r[m_j];
1273 cStatus[m_old_j] = cStatus[m_j];
1277 Real aij = m_row[m_j];
1279 for(
int k = 0; k < m_row.size(); ++k)
1281 if(m_row.index(k) != m_j)
1282 val += m_row.value(k) * x[m_row.index(k)];
1290 Real z = (m_const / scale) - (val / scale);
1295 x[m_j] = z * scale / aij;
1298 assert(!isOptimal || (
GE(x[m_j], m_lower) &&
LE(x[m_j], m_upper)));
1303 for(
int k = 0; k < m_col.size(); ++k)
1305 if(m_col.index(k) != m_i)
1306 dualVal += m_col.value(k) * y[m_col.index(k)];
1309 z = m_obj - dualVal;
1324 #ifdef CHECK_BASIC_DIM 1337 switch(cStatus[m_j])
1340 if(
LT(x[m_j], m_origupper,
eps()) &&
GT(x[m_j], m_origlower,
eps()))
1342 else if(
LT(x[m_j], m_origupper,
eps()))
1344 else if(
GT(x[m_j], m_origlower,
eps()))
1349 if(
GT(x[m_j], m_origlower,
eps()))
1354 if(
LT(x[m_j], m_origupper,
eps()))
1362 #ifdef CHECK_BASIC_DIM 1372 for(
int i = lp.
nRows() - 1; i >= 0; --i )
1404 for(
int i = lp.
nRows()-1; i >= 0; --i)
1414 else if (lhs > -
infinity && lhs < -maxVal)
1419 else if (lhs < infinity && lhs > maxVal)
1433 else if (rhs > -
infinity && rhs < -maxVal)
1438 else if (rhs < infinity && rhs > maxVal)
1457 for(
int j = 0; j < lp.
nCols(); ++j)
1467 else if (lo > -
infinity && lo < -maxVal)
1472 else if (lo < infinity && lo > maxVal)
1486 else if (up > -
infinity && up < -maxVal)
1491 else if (up < infinity && up > maxVal)
1503 Real absBnd = (lo > up) ? lo : up;
1512 while(i < col.
size())
1516 if (
isZero(aij * absBnd, tol))
1525 <<
" removed, absBnd=" << absBnd
1535 else if(
isZero(aij, tol) )
1553 else if (obj > -
infinity && obj < -maxVal)
1558 else if (obj < infinity && obj > maxVal)
1565 if (remRows + remNzos + chgLRhs + chgBnds + objCnt > 0)
1573 << remRows <<
" rows, " 1574 << remNzos <<
" non-zeros, " 1575 << chgBnds <<
" col bounds, " 1576 << chgLRhs <<
" row bounds, " 1577 << objCnt <<
" objective coefficients" << std::endl; )
1586 bool minNegInfinite =
false;
1587 bool maxInfinite =
false;
1592 for (
int l = 0; l < row.
size(); ++l)
1594 if (colNumber < 0 || row.
index(l) != colNumber)
1600 minNegInfinite =
true;
1604 else if (
LT(row.
value(l), 0.0))
1607 minNegInfinite =
true;
1620 else if (
LT(row.
value(l), 0.0))
1651 minVal = (side - minRes)/val;
1656 maxVal = (side - maxRes)/val;
1658 else if(
GT(val, 0.0))
1663 minVal = (side - maxRes)/val;
1668 maxVal = (side - minRes)/val;
1689 bool zerovalid =
true;
1697 for(
int j = lp.
nCols()-1; j >= 0; --j)
1704 for(
int k = 0; k < col.
size(); ++k)
1735 lower =
MINIMUM(-largeValue, upper);
1747 lowersol[j] = lower;
1748 uppersol[j] = upper;
1750 if(downLocks[j] > upLocks[j])
1752 else if(downLocks[j] < upLocks[j])
1755 locksol[j] = (lower + upper)/2.0;
1757 lowerObj += lp.
maxObj(j)*lowersol[j];
1758 upperObj += lp.
maxObj(j)*uppersol[j];
1759 lockObj += lp.
maxObj(j)*locksol[j];
1795 for(
int i = lp.
nRows()-1; i >= 0; --i)
1800 for(
int k = 0; k < row.
size(); k++)
1817 for(
int j = lp.
nCols()-1; j >= 0; --j)
1821 pseudoObj += val*lp.
lower(j);
1823 pseudoObj += val*lp.
upper(j);
1831 for(
int j = lp.
nCols()-1; j >= 0; --j)
1850 else if(objval > 0.0)
1875 for(
int i = lp.
nRows()-1; i >= 0; --i)
1879 if (row.
size() == 0)
1887 <<
" rhs=" << lp.
rhs(i) << std::endl; )
1903 for(
int j = lp.
nCols()-1; j >= 0; --j)
1907 if (col.
size() == 0)
1910 <<
": empty -> maxObj=" << lp.
maxObj(j)
1911 <<
" lower=" << lp.
lower(j)
1912 <<
" upper=" << lp.
upper(j); )
1961 if (remRows + remCols > 0)
1967 << remRows <<
" rows, " 1968 << remCols <<
" cols" 1977 assert(row.
size() == 1);
1980 int j = row.
index(0);
1985 <<
": singleton -> val=" << aij
1986 <<
" lhs=" << lp.
lhs(i)
1987 <<
" rhs=" << lp.
rhs(i); )
2013 <<
" (" << lp.
lower(j)
2015 <<
" (" << lp.
upper(j)
2016 <<
")" << std::endl; )
2018 bool stricterUp =
false;
2019 bool stricterLo =
false;
2069 int oldRows = lp.
nRows();
2071 bool redundantLower;
2072 bool redundantUpper;
2076 for(
int i = lp.
nRows()-1; i >= 0; --i)
2087 for(
int k = 0; k < row.
size(); ++k)
2090 int j = row.
index(k);
2094 MSG_WARNING( (*
spxout), (*
spxout) <<
"Warning: tiny nonzero coefficient " << aij <<
" in row " << i <<
"\n" );
2102 lhsBnd += aij * lp.
lower(j);
2107 rhsBnd += aij * lp.
upper(j);
2114 rhsBnd += aij * lp.
lower(j);
2119 lhsBnd += aij * lp.
upper(j);
2125 if (rhsCnt <= 1 || lhsCnt <= 1)
2127 for(
int k = 0; k < row.
size(); ++k)
2130 int j = row.
index(k);
2132 redundantLower =
false;
2133 redundantUpper =
false;
2149 Real z = (lp.
lhs(i) / scale) - (rhsBnd / scale);
2157 lo = lp.
upper(j) + z * scale / aij;
2159 lo = z * scale / aij;
2167 <<
": redundant lower bound on x" << j
2168 <<
" -> lower=" << lo
2169 <<
" (" << lp.
lower(j)
2170 <<
")" << std::endl; )
2172 redundantLower =
true;
2186 Real z = (lp.
rhs(i) / scale) - (lhsBnd / scale);
2194 up = lp.
lower(j) + z * scale / aij;
2196 up = z * scale / aij;
2204 <<
": redundant upper bound on x" << j
2205 <<
" -> upper=" << up
2206 <<
" (" << lp.
upper(j)
2207 <<
")" << std::endl; )
2209 redundantUpper =
true;
2218 lhsBnd -= aij * lp.
lower(j);
2232 rhsBnd -= aij * lp.
upper(j);
2253 Real z = (lp.
lhs(i) / scale) - (rhsBnd / scale);
2261 up = lp.
lower(j) + z * scale / aij;
2263 up = z * scale / aij;
2271 <<
": redundant upper bound on x" << j
2272 <<
" -> upper=" << up
2273 <<
" (" << lp.
upper(j)
2274 <<
")" << std::endl; )
2276 redundantUpper =
true;
2289 Real z = (lp.
rhs(i) / scale) - (lhsBnd / scale);
2297 lo = lp.
upper(j) + z * scale / aij;
2299 lo = z * scale / aij;
2307 <<
": redundant lower bound on x" << j
2308 <<
" -> lower=" << lo
2309 <<
" (" << lp.
lower(j)
2310 <<
")" << std::endl; )
2312 redundantLower =
true;
2321 lhsBnd -= aij * lp.
upper(j);
2335 rhsBnd -= aij * lp.
lower(j);
2350 redundantLhs =
false;
2351 redundantRhs =
false;
2357 <<
": redundant lhs -> lhsBnd=" << lhsBnd
2358 <<
" lhs=" << lp.
lhs(i)
2361 redundantLhs =
true;
2366 <<
": redundant rhs -> rhsBnd=" << rhsBnd
2367 <<
" rhs=" << lp.
rhs(i)
2370 redundantRhs =
true;
2402 <<
": infeasible -> lhs=" << lp.
lhs(i)
2403 <<
" rhs=" << lp.
rhs(i)
2404 <<
" lhsBnd=" << lhsBnd
2405 <<
" rhsBnd=" << rhsBnd
2415 <<
": unconstrained -> removed" << std::endl; )
2422 remNzos += row.
size();
2431 #if EMPTY_CONSTRAINT 2433 if (row.
size() == 0)
2441 <<
" rhs=" << lp.
rhs(i) << std::endl; )
2461 if (row.
size() == 1)
2468 #if FORCE_CONSTRAINT 2474 <<
": forcing constraint fix on lhs ->" 2475 <<
" lhs=" << lp.
lhs(i)
2476 <<
" rhsBnd=" << rhsBnd
2483 for(
int k = 0; k < row.
size(); ++k)
2486 int j = row.
index(k);
2490 lowers[k] = lp.
lower(j);
2491 uppers[k] = lp.
upper(j);
2506 remNzos += row.
size();
2517 <<
": forcing constraint fix on rhs ->" 2518 <<
" rhs=" << lp.
rhs(i)
2519 <<
" lhsBnd=" << lhsBnd
2526 for(
int k = 0; k < row.
size(); ++k)
2529 int j = row.
index(k);
2533 lowers[k] = lp.
lower(j);
2534 uppers[k] = lp.
upper(j);
2549 remNzos += row.
size();
2559 assert(remRows > 0 || remNzos == 0);
2561 if (remRows + chgLRhs + chgBnds > 0)
2571 << remRows <<
" rows, " 2572 << remNzos <<
" non-zeros, " 2573 << chgBnds <<
" col bounds, " 2574 << chgLRhs <<
" row bounds; kept " 2575 << keptBnds <<
" column bounds, " 2576 << keptLRhs <<
" row bounds" 2604 int oldCols = lp.
nCols();
2605 int oldRows = lp.
nRows();
2607 for(
int j = lp.
nCols()-1; j >= 0; --j)
2615 <<
": infeasible bounds on x" << j
2616 <<
" -> lower=" << lp.
lower(j)
2617 <<
" upper=" << lp.
upper(j)
2623 if (col.
size() == 0)
2627 <<
": empty -> maxObj=" << lp.
maxObj(j)
2628 <<
" lower=" << lp.
lower(j)
2629 <<
" upper=" << lp.
upper(j); )
2687 for(
int k = 0; k < col.
size(); ++k)
2689 if (!loFree && !upFree)
2692 int i = col.
index(k);
2697 if (col.
value(k) > 0.0)
2705 else if (col.
value(k) < 0.0)
2723 <<
" unconstrained above ->"; )
2744 <<
" unconstrained below ->"; )
2762 #if FREE_ZERO_OBJ_VARIABLE 2763 bool unconstrained_below = loFree && lp.
lower(j) <= -
infinity;
2764 bool unconstrained_above = upFree && lp.
upper(j) >=
infinity;
2766 if (unconstrained_below || unconstrained_above)
2770 <<
" unconstrained " 2771 << (unconstrained_below ?
"below" :
"above")
2772 <<
" with zero objective (" << lp.
maxObj(j)
2773 <<
")" << std::endl; )
2779 SPxQuicksort(col_idx_sorted.mem(), col_idx_sorted.size(), compare);
2787 remRows += col.
size();
2788 for(
int k = col_idx_sorted.size()-1; k >= 0; --k)
2795 for(
int k = 0; k < col.
size(); ++k)
2797 int l = col.
index(k);
2816 <<
" fixed -> lower=" << lp.
lower(j)
2817 <<
" upper=" << lp.
upper(j) << std::endl; )
2822 remNzos += col.
size();
2832 if (col.
size() == 1)
2835 int i = col.
index(0);
2840 #if ZERO_OBJ_COL_SINGLETON 2842 <<
": singleton in row " << i
2843 <<
" with zero objective"; )
2851 lhs = lp.
lhs(i) - aij * lp.
upper(j);
2853 rhs = lp.
rhs(i) - aij * lp.
lower(j);
2858 lhs = lp.
lhs(i) - aij * lp.
lower(j);
2860 rhs = lp.
rhs(i) - aij * lp.
upper(j);
2874 <<
" (" << lp.
lhs(i)
2876 <<
" (" << lp.
rhs(i)
2877 <<
")" << std::endl; )
2912 #if DOUBLETON_EQUATION 2914 <<
": singleton in row " << i
2915 <<
" with doubleton equation ->"; )
2924 if (row.
index(0) == j)
2929 else if (row.
index(1) == j)
2951 Real z1 = (lhs / scale1) - (aij * lp.
upper(j) / scale1);
2952 Real z2 = (lhs / scale2) - (aij * lp.
lower(j) / scale2);
2979 <<
": lower=" << lp.
lower(k)
2981 <<
") upper=" << lp.
upper(k)
2983 <<
")" << std::endl; )
3011 #if FREE_COL_SINGLETON 3018 <<
": free singleton in inequality constraint" << std::endl; )
3065 <<
": free singleton removed" << std::endl; )
3069 for (
int h = 0; h < row.size(); ++h)
3071 int k = row.
index(h);
3075 Real new_obj = lp.
obj(k) - (lp.
obj(j) * row.value(h) / aij);
3082 remNzos += row.size();
3094 if (remCols + remRows > 0)
3102 << remRows <<
" rows, " 3103 << remCols <<
" cols, " 3104 << remNzos <<
" non-zeros, " 3105 << chgBnds <<
" col bounds" 3127 int oldRows = lp.
nRows();
3128 int oldCols = lp.
nCols();
3137 for(
int i = lp.
nRows()-1; i >= 0; --i)
3143 <<
": unconstrained" << std::endl; )
3164 for(
int j = 0; j < lp.
nCols(); ++j)
3178 dualVarUp[i] = bound;
3180 dualVarLo[i] = bound;
3185 dualVarLo[i] = bound;
3187 dualVarUp[i] = bound;
3194 for(
int j = 0; j < lp.
nCols(); ++j)
3196 dualConsLo[j] = dualConsUp[j] = 0.0;
3200 for(
int k = 0; k < col.
size(); ++k)
3206 int i = col.
index(k);
3215 dualConsLo[j] += aij * dualVarLo[i];
3220 dualConsUp[j] += aij * dualVarUp[i];
3227 dualConsUp[j] += aij * dualVarLo[i];
3232 dualConsLo[j] += aij * dualVarUp[i];
3237 for(
int j = lp.
nCols()-1; j >= 0; --j)
3243 if (
LTrel(dualConsUp[j], dualConsLo[j],
opttol()))
3246 <<
": dual infeasible -> dual lhs bound=" << dualConsLo[j]
3247 <<
" dual rhs bound=" << dualConsUp[j] << std::endl; )
3257 #if DOMINATED_COLUMN 3259 <<
": dominated -> maxObj=" << obj
3260 <<
" dual rhs bound=" << dualConsUp[j] << std::endl; )
3280 #if DOMINATED_COLUMN 3282 <<
": dominated -> maxObj=" << obj
3283 <<
" dual lhs bound=" << dualConsLo[j] << std::endl; )
3305 #if WEAKLY_DOMINATED_COLUMN 3307 <<
": weakly dominated -> maxObj=" << obj
3308 <<
" dual rhs bound=" << dualConsUp[j] << std::endl; )
3320 #if WEAKLY_DOMINATED_COLUMN 3322 <<
": weakly dominated -> maxObj=" << obj
3323 <<
" dual lhs bound=" << dualConsLo[j] << std::endl; )
3350 assert(remRows > 0 || remCols > 0 || remNzos == 0);
3352 if (remCols + remRows > 0)
3359 << remRows <<
" rows, " 3360 << remCols <<
" cols, " 3361 << remNzos <<
" non-zeros" 3379 int oldRows = lp.
nRows();
3380 int oldCols = lp.
nCols();
3385 for(
int j = lp.
nCols()-1; j >= 0; --j)
3395 for(
int k = 0; k < col.
size(); ++k)
3423 if (upLocks[j] == 1 || downLocks[j] == 1)
3429 bool bestislhs =
true;
3433 for(
int k = 0; k < col.
size(); ++k)
3445 rowNumber = col.
index(k);
3446 lhs = lp.
lhs(rowNumber);
3447 rhs = lp.
rhs(rowNumber);
3456 maxOtherLocks = INT_MAX;
3465 && ((col.
value(k) > 0.0 && lp.
maxObj(j) <= 0.0 && downLocks[j] == 1 && upLocks[j] <= maxOtherLocks)
3466 || (col.
value(k) < 0.0 && lp.
maxObj(j) >= 0.0 && upLocks[j] == 1 && downLocks[j] <= maxOtherLocks));
3468 && ((col.
value(k) > 0.0 && lp.
maxObj(j) >= 0.0 && upLocks[j] == 1 && downLocks[j] <= maxOtherLocks)
3469 || (col.
value(k) < 0.0 && lp.
maxObj(j) <= 0.0 && downLocks[j] == 1 && upLocks[j] <= maxOtherLocks));
3471 if (aggLhs || aggRhs)
3488 assert(
LE(minVal, maxVal));
3494 bestpos = col.
index(k);
3509 assert(
LE(minVal, maxVal));
3514 bestpos = col.
index(k);
3527 Real aggConstant = (bestislhs ? lp.
lhs(bestpos) : lp.
rhs(bestpos));
3528 Real aggAij = bestRow[j];
3531 (*
spxout) <<
"IMAISM51 col " << j
3532 <<
": Aggregating row: " << bestpos
3533 <<
" Aggregation Constant=" << aggConstant
3534 <<
" Coefficient of aggregated col=" << aggAij << std::endl;
3541 for(
int k = 0; k < col.
size(); ++k)
3543 if(col.
index(k) != bestpos)
3545 int rowNumber = col.
index(k);
3553 for(
int l = 0; l < bestRow.
size(); l++)
3555 if(bestRow.
index(l) != j)
3559 - updateRow[j]*bestRow.
value(l)/aggAij);
3567 lp.
changeRhs(rowNumber, updateRhs - updateRow[j]*aggConstant/aggAij);
3569 lp.
changeLhs(rowNumber, updateLhs - updateRow[j]*aggConstant/aggAij);
3571 assert(
LE(lp.
lhs(rowNumber), lp.
rhs(rowNumber)));
3575 for(
int l = 0; l < bestRow.
size(); l++)
3577 if(bestRow.
index(l) != j)
3594 assert(remRows > 0 || remCols > 0 || remNzos == 0);
3596 if (remCols + remRows > 0)
3603 << remRows <<
" rows, " 3604 << remCols <<
" cols, " 3605 << remNzos <<
" non-zeros" 3627 int oldRows = lp.
nRows();
3636 for (
int i = 0; i < lp.
nRows(); ++i)
3640 if (row.
size() == 1)
3650 << rs_remRows <<
" rows, " 3651 << rs_remRows <<
" non-zeros" 3679 classSize[0] = lp.
nRows();
3681 for(
int i = 1; i < lp.
nRows(); ++i)
3692 for(
int j = 0; j < lp.
nCols(); ++j)
3696 for(
int k = 0; k < col.
size(); ++k)
3699 int i = col.
index(k);
3701 if (scale[i] == 0.0)
3705 if (--classSize[pClass[i]] == 0)
3706 idxSet.addIdx(pClass[i]);
3710 for(
int m = 0; m < col.
size(); ++m)
3712 int k = pClass[col.
index(m)];
3723 int classIdx = idxSet.index(0);
3730 classIdx = idxSet.index(0);
3735 ++classSize[classIdx];
3737 oldVal = m_classSetRows[k].value(l);
3749 for(
int k = 0; k < lp.
nRows(); ++k )
3752 for(
int k = 0; k < lp.
nRows(); ++k)
3758 const int nRowsOld_tmp = lp.
nRows();
3762 for(
int j = 0; j < nRowsOld_tmp; ++j)
3767 int idxFirstDupRows = -1;
3768 int idxLastDupRows = -1;
3771 for(
int k = 0; k < lp.
nRows(); ++k)
3777 if(idxFirstDupRows < 0)
3779 idxFirstDupRows = k;
3782 for(
int l = 1; l <
m_dupRows[k].size(); ++l)
3793 int k_tmp, j_tmp = -1;
3794 for (k_tmp = j_tmp = 0; k_tmp < nRowsOld_tmp; ++k_tmp)
3796 if (perm_tmp[k_tmp] >= 0)
3797 perm_tmp[k_tmp] = j_tmp++;
3802 bool doChangeRanges =
false;
3806 for(
int k = 0; k < lp.
nRows(); ++k)
3811 <<
" duplicate rows found" << std::endl; )
3825 for(
int l = 0; l <
m_dupRows[k].size(); ++l)
3828 isLhsEqualRhs[l] = (lp.
lhs(i) == lp.
rhs(i));
3835 maxLhs = lp.
lhs(rowIdx);
3836 minRhs = lp.
rhs(rowIdx);
3840 Real scaledLhs, scaledRhs;
3841 Real factor = scale[rowIdx] / scale[i];
3853 if (scaledLhs > maxLhs)
3858 if (scaledRhs < minRhs)
3870 Real newLhs = (maxLhs > lp.
lhs(rowIdx)) ? maxLhs : lp.
lhs(rowIdx);
3871 Real newRhs = (minRhs < lp.
rhs(rowIdx)) ? minRhs : lp.
rhs(rowIdx);
3873 if(k == idxLastDupRows)
3876 for(
int j = 0; j < nRowsOld_tmp; ++j)
3878 da_perm[j] = perm_tmp[j];
3882 m_hist.append(
new (DuplicateRowsPSptr)
DuplicateRowsPS(lp, rowIdx, maxLhsIdx, minRhsIdx,
m_dupRows[k], scale, da_perm, isLhsEqualRhs,
true,
EQrel(newLhs, newRhs), k==idxFirstDupRows));
3889 m_hist.append(
new (DuplicateRowsPSptr)
DuplicateRowsPS(lp, rowIdx, maxLhsIdx, minRhsIdx,
m_dupRows[k], scale, da_perm_empty, isLhsEqualRhs,
false,
EQrel(newLhs, newRhs), k == idxFirstDupRows));
3892 if (maxLhs > lp.
lhs(rowIdx) || minRhs < lp.
rhs(rowIdx))
3895 doChangeRanges =
true;
3899 MSG_DEBUG( (*
spxout) <<
"IMAISM55 duplicate rows yield infeasible bounds:" 3900 <<
" lhs=" << newLhs
3901 <<
" rhs=" << newRhs << std::endl; )
3906 if( newRhs < newLhs )
3909 newLhsVec[rowIdx] = newLhs;
3910 newRhsVec[rowIdx] = newRhs;
3923 const int nRowsOld = lp.
nRows();
3927 for(
int i = 0; i < nRowsOld; ++i)
3940 for(
int i = 0; i < nRowsOld; ++i)
3943 assert(perm[i] == perm_tmp[i]);
3953 if (remRows + remNzos > 0)
3959 << remRows <<
" rows, " 3960 << remNzos <<
" non-zeros" 4006 classSize[0] = lp.
nCols();
4008 for(
int j = 1; j < lp.
nCols(); ++j)
4019 for(
int i = 0; i < lp.
nRows(); ++i)
4023 for(
int k = 0; k < row.
size(); ++k)
4026 int j = row.
index(k);
4028 if (scale[j] == 0.0)
4032 if (--classSize[pClass[j]] == 0)
4033 idxSet.addIdx(pClass[j]);
4037 for(
int m = 0; m < row.
size(); ++m)
4039 int k = pClass[row.
index(m)];
4050 int classIdx = idxSet.index(0);
4058 classIdx = idxSet.index(0);
4063 ++classSize[classIdx];
4065 oldVal = m_classSetCols[k].value(l);
4078 for(
int k = 0; k < lp.
nCols(); ++k )
4081 for(
int k = 0; k < lp.
nCols(); ++k)
4084 fixAndRemCol[k] =
false;
4088 bool hasDuplicateCol =
false;
4091 for(
int k = 0; k < lp.
nCols(); ++k)
4096 <<
" duplicate columns found" << std::endl; )
4098 if (!hasDuplicateCol)
4103 hasDuplicateCol =
true;
4106 for(
int l = 0; l <
m_dupCols[k].size(); ++l)
4108 for(
int m = 0; m <
m_dupCols[k].size(); ++m)
4113 if (l != m && !remCol[j1] && !remCol[j2])
4119 Real factor = scale[j1] / scale[j2];
4120 Real objDif = cj1 - cj2 * scale[j1] / scale[j2];
4151 else if (factor < 0)
4166 <<
" replaced by one" << std::endl; )
4174 MSG_DEBUG( (*
spxout) <<
"IMAISM80 not removing two duplicate columns " << j1
4176 <<
" because zero not contained in their bounds" << std::endl; )
4185 if (factor > 0 && objDif > 0)
4196 <<
" first one fixed at upper bound=" << lp.
upper(j1) << std::endl; )
4203 else if (factor < 0 && objDif < 0)
4214 <<
" first one fixed at lower bound=" << lp.
lower(j1) << std::endl; )
4225 if (factor < 0 && objDif > 0)
4236 <<
" first one fixed at upper bound=" << lp.
upper(j1) << std::endl; )
4245 else if (factor > 0 && objDif < 0)
4256 <<
" first one fixed at lower bound=" << lp.
lower(j1) << std::endl; )
4267 fixAndRemCol[j1] =
true;
4278 for(
int j = 0; j < lp.
nCols(); ++j)
4290 const int nColsOld = lp.
nCols();
4294 for(
int j = 0; j < nColsOld; ++j)
4307 for(
int j = 0; j < nColsOld; ++j)
4314 for(
int j = 0; j < nColsOld; ++j)
4316 da_perm[j] = perm[j];
4319 if (hasDuplicateCol)
4328 assert(remCols > 0 || remNzos == 0);
4336 << remCols <<
" cols, " 4337 << remNzos <<
" non-zeros" 4356 <<
": lower=" << lp.
lower(j)
4357 <<
" upper=" << lp.
upper(j)
4362 for(
int k = 0; k < col.
size(); ++k)
4364 int i = col.
index(k);
4374 Real rhs = (lp.
rhs(i) / scale) - (y / scale);
4383 <<
" (" << lp.
rhs(i)
4384 <<
") aij=" << col.
value(k)
4397 Real lhs = (lp.
lhs(i) / scale) - (y / scale);
4406 <<
" (" << lp.
lhs(i)
4407 <<
") aij=" << col.
value(k)
4412 assert(lp.
lhs(i) <= lp.
rhs(i));
4449 for(
int k = 0; k <
m_hist.size(); ++k)
4475 int numRangedRows = 0;
4476 int numBoxedCols = 0;
4478 for(
int i = 0; i < lp.
nRows(); ++i)
4481 for(
int j = 0; j < lp.
nCols(); ++j)
4485 (*spxout) <<
"LP has " 4486 << numRangedRows <<
" ranged rows, " 4487 << numBoxedCols <<
" boxed columns" 4515 for(
int i = 0; i < lp.
nRows(); ++i)
4518 for(
int j = 0; j < lp.
nCols(); ++j)
4558 #if TRIVIAL_HEURISTICS 4585 << m_remCols <<
" columns, " 4598 << lp.
nRows() <<
" rows " 4599 << lp.
nCols() <<
" columns " 4600 << lp.
nNzos() <<
" nonzeros" 4604 int numRangedRows = 0;
4605 int numBoxedCols = 0;
4607 for(
int i = 0; i < lp.
nRows(); ++i)
4611 for(
int j = 0; j < lp.
nCols(); ++j)
4615 (*spxout) <<
"Reduced LP has " 4616 << numRangedRows <<
" ranged rows, " 4617 << numBoxedCols <<
" boxed columns" 4657 assert(x.
dim() == r.
dim());
4658 assert(y.
dim() == s.
dim());
4663 for(
int j = 0; j < x.
dim(); ++j)
4669 for(
int i = 0; i < y.
dim(); ++i)
4677 for(
int k =
m_hist.size()-1; k >= 0; --k)
4715 #ifdef CHECK_BASIC_DIM 4751 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.