# HG changeset patch # User alpar # Date 1111748629 0 # Node ID 88dff8bb4bf23cfcd3372c57415cdf11671ef70e # Parent 7101e2c3a881d9e0a34f5842054d17c22750973f - setRow() added - more docs diff -r 7101e2c3a881 -r 88dff8bb4bf2 src/work/athos/lp/lp_base.h --- a/src/work/athos/lp/lp_base.h Fri Mar 25 08:21:43 2005 +0000 +++ b/src/work/athos/lp/lp_base.h Fri Mar 25 11:03:49 2005 +0000 @@ -259,22 +259,25 @@ } #endif ///Add a new empty row (i.e a new constaint) to the LP + + ///This function adds a new empty row (i.e a new constaint) to the LP. + ///\return The created row Row addRow() { Row r; r.id=rows.insert(_addRow()); return r;} - ///Add a new row (i.e a new constaint) to the LP + ///Set a row (i.e a constaint) of the LP - ///\param l lower bound (-INF means no bound) - ///\param e a linear expression (see \ref Expr) - ///\param u upper bound (INF means no bound) + ///\param r is the row to be modified + ///\param l is lower bound (-INF means no bound) + ///\param e is a linear expression (see \ref Expr) + ///\param u is the upper bound (INF means no bound) ///\bug This is a temportary function. The interface will change to ///a better one. - Row addRow(Value l,Expr e, Value u) { - Row r=addRow(); + void setRow(Row r, Value l,const Expr &e, Value u) { std::vector indices; std::vector values; indices.push_back(0); values.push_back(0); - for(Expr::iterator i=e.begin(); i!=e.end(); ++i) + for(Expr::const_iterator i=e.begin(); i!=e.end(); ++i) if((*i).second!=0) { ///\bug EPSILON would be necessary here!!! indices.push_back(cols.floatingId((*i).first.id)); values.push_back((*i).second); @@ -283,6 +286,19 @@ &indices[0],&values[0]); _setRowLowerBound(rows.floatingId(r.id),l-e.constComp()); _setRowUpperBound(rows.floatingId(r.id),u-e.constComp()); + } + + ///Add a new row (i.e a new constaint) to the LP + + ///\param l is the lower bound (-INF means no bound) + ///\param e is a linear expression (see \ref Expr) + ///\param u is the upper bound (INF means no bound) + ///\return The created row. + ///\bug This is a temportary function. The interface will change to + ///a better one. + Row addRow(Value l,const Expr &e, Value u) { + Row r=addRow(); + setRow(r,l,e,u); return r; }