| ... | ... |
@@ -1208,52 +1208,52 @@ |
| 1208 | 1208 |
return e; |
| 1209 | 1209 |
} |
| 1210 | 1210 |
|
| 1211 | 1211 |
///Add a new row (i.e a new constraint) to the LP |
| 1212 | 1212 |
|
| 1213 | 1213 |
///\param l is the lower bound (-\ref INF means no bound) |
| 1214 | 1214 |
///\param e is a linear expression (see \ref Expr) |
| 1215 | 1215 |
///\param u is the upper bound (\ref INF means no bound) |
| 1216 | 1216 |
///\return The created row. |
| 1217 | 1217 |
Row addRow(Value l,const Expr &e, Value u) {
|
| 1218 | 1218 |
Row r; |
| 1219 | 1219 |
e.simplify(); |
| 1220 | 1220 |
r._id = _addRowId(_addRow(l - *e, ExprIterator(e.comps.begin(), cols), |
| 1221 | 1221 |
ExprIterator(e.comps.end(), cols), u - *e)); |
| 1222 | 1222 |
return r; |
| 1223 | 1223 |
} |
| 1224 | 1224 |
|
| 1225 | 1225 |
///Add a new row (i.e a new constraint) to the LP |
| 1226 | 1226 |
|
| 1227 | 1227 |
///\param c is a linear expression (see \ref Constr) |
| 1228 | 1228 |
///\return The created row. |
| 1229 | 1229 |
Row addRow(const Constr &c) {
|
| 1230 | 1230 |
Row r; |
| 1231 | 1231 |
c.expr().simplify(); |
| 1232 |
r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound():-INF, |
|
| 1232 |
r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound()-*c.expr():-INF, |
|
| 1233 | 1233 |
ExprIterator(c.expr().comps.begin(), cols), |
| 1234 | 1234 |
ExprIterator(c.expr().comps.end(), cols), |
| 1235 |
c.upperBounded()?c.upperBound():INF)); |
|
| 1235 |
c.upperBounded()?c.upperBound()-*c.expr():INF)); |
|
| 1236 | 1236 |
return r; |
| 1237 | 1237 |
} |
| 1238 | 1238 |
///Erase a column (i.e a variable) from the LP |
| 1239 | 1239 |
|
| 1240 | 1240 |
///\param c is the column to be deleted |
| 1241 | 1241 |
void erase(Col c) {
|
| 1242 | 1242 |
_eraseCol(cols(id(c))); |
| 1243 | 1243 |
_eraseColId(cols(id(c))); |
| 1244 | 1244 |
} |
| 1245 | 1245 |
///Erase a row (i.e a constraint) from the LP |
| 1246 | 1246 |
|
| 1247 | 1247 |
///\param r is the row to be deleted |
| 1248 | 1248 |
void erase(Row r) {
|
| 1249 | 1249 |
_eraseRow(rows(id(r))); |
| 1250 | 1250 |
_eraseRowId(rows(id(r))); |
| 1251 | 1251 |
} |
| 1252 | 1252 |
|
| 1253 | 1253 |
/// Get the name of a column |
| 1254 | 1254 |
|
| 1255 | 1255 |
///\param c is the coresponding column |
| 1256 | 1256 |
///\return The name of the colunm |
| 1257 | 1257 |
std::string colName(Col c) const {
|
| 1258 | 1258 |
std::string name; |
| 1259 | 1259 |
_getColName(cols(id(c)), name); |
0 comments (0 inline)