1.1 --- a/lemon/lp_base.h Thu Nov 05 10:01:02 2009 +0100
1.2 +++ b/lemon/lp_base.h Thu Nov 05 10:23:16 2009 +0100
1.3 @@ -943,6 +943,14 @@
1.4 virtual int _addCol() = 0;
1.5 virtual int _addRow() = 0;
1.6
1.7 + virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u) {
1.8 + int row = _addRow();
1.9 + _setRowCoeffs(row, b, e);
1.10 + _setRowLowerBound(row, l);
1.11 + _setRowUpperBound(row, u);
1.12 + return row;
1.13 + }
1.14 +
1.15 virtual void _eraseCol(int col) = 0;
1.16 virtual void _eraseRow(int row) = 0;
1.17
1.18 @@ -1207,8 +1215,10 @@
1.19 ///\param u is the upper bound (\ref INF means no bound)
1.20 ///\return The created row.
1.21 Row addRow(Value l,const Expr &e, Value u) {
1.22 - Row r=addRow();
1.23 - row(r,l,e,u);
1.24 + Row r;
1.25 + e.simplify();
1.26 + r._id = _addRowId(_addRow(l - *e, ExprIterator(e.comps.begin(), cols),
1.27 + ExprIterator(e.comps.end(), cols), u - *e));
1.28 return r;
1.29 }
1.30
1.31 @@ -1217,8 +1227,12 @@
1.32 ///\param c is a linear expression (see \ref Constr)
1.33 ///\return The created row.
1.34 Row addRow(const Constr &c) {
1.35 - Row r=addRow();
1.36 - row(r,c);
1.37 + Row r;
1.38 + c.expr().simplify();
1.39 + r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound():-INF,
1.40 + ExprIterator(c.expr().comps.begin(), cols),
1.41 + ExprIterator(c.expr().comps.end(), cols),
1.42 + c.upperBounded()?c.upperBound():INF));
1.43 return r;
1.44 }
1.45 ///Erase a column (i.e a variable) from the LP