941 virtual void _eraseRowId(int row) { rows.eraseIndex(row); } |
941 virtual void _eraseRowId(int row) { rows.eraseIndex(row); } |
942 |
942 |
943 virtual int _addCol() = 0; |
943 virtual int _addCol() = 0; |
944 virtual int _addRow() = 0; |
944 virtual int _addRow() = 0; |
945 |
945 |
|
946 virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u) { |
|
947 int row = _addRow(); |
|
948 _setRowCoeffs(row, b, e); |
|
949 _setRowLowerBound(row, l); |
|
950 _setRowUpperBound(row, u); |
|
951 return row; |
|
952 } |
|
953 |
946 virtual void _eraseCol(int col) = 0; |
954 virtual void _eraseCol(int col) = 0; |
947 virtual void _eraseRow(int row) = 0; |
955 virtual void _eraseRow(int row) = 0; |
948 |
956 |
949 virtual void _getColName(int col, std::string& name) const = 0; |
957 virtual void _getColName(int col, std::string& name) const = 0; |
950 virtual void _setColName(int col, const std::string& name) = 0; |
958 virtual void _setColName(int col, const std::string& name) = 0; |
1205 ///\param l is the lower bound (-\ref INF means no bound) |
1213 ///\param l is the lower bound (-\ref INF means no bound) |
1206 ///\param e is a linear expression (see \ref Expr) |
1214 ///\param e is a linear expression (see \ref Expr) |
1207 ///\param u is the upper bound (\ref INF means no bound) |
1215 ///\param u is the upper bound (\ref INF means no bound) |
1208 ///\return The created row. |
1216 ///\return The created row. |
1209 Row addRow(Value l,const Expr &e, Value u) { |
1217 Row addRow(Value l,const Expr &e, Value u) { |
1210 Row r=addRow(); |
1218 Row r; |
1211 row(r,l,e,u); |
1219 e.simplify(); |
|
1220 r._id = _addRowId(_addRow(l - *e, ExprIterator(e.comps.begin(), cols), |
|
1221 ExprIterator(e.comps.end(), cols), u - *e)); |
1212 return r; |
1222 return r; |
1213 } |
1223 } |
1214 |
1224 |
1215 ///Add a new row (i.e a new constraint) to the LP |
1225 ///Add a new row (i.e a new constraint) to the LP |
1216 |
1226 |
1217 ///\param c is a linear expression (see \ref Constr) |
1227 ///\param c is a linear expression (see \ref Constr) |
1218 ///\return The created row. |
1228 ///\return The created row. |
1219 Row addRow(const Constr &c) { |
1229 Row addRow(const Constr &c) { |
1220 Row r=addRow(); |
1230 Row r; |
1221 row(r,c); |
1231 c.expr().simplify(); |
|
1232 r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound():-INF, |
|
1233 ExprIterator(c.expr().comps.begin(), cols), |
|
1234 ExprIterator(c.expr().comps.end(), cols), |
|
1235 c.upperBounded()?c.upperBound():INF)); |
1222 return r; |
1236 return r; |
1223 } |
1237 } |
1224 ///Erase a column (i.e a variable) from the LP |
1238 ///Erase a column (i.e a variable) from the LP |
1225 |
1239 |
1226 ///\param c is the column to be deleted |
1240 ///\param c is the column to be deleted |