[Lemon-commits] [lemon_svn] alpar: r1685 - hugo/trunk/src/work/athos/lp
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:46:59 CET 2006
Author: alpar
Date: Fri Mar 25 12:03:49 2005
New Revision: 1685
Modified:
hugo/trunk/src/work/athos/lp/lp_base.h
Log:
- setRow() added
- more docs
Modified: hugo/trunk/src/work/athos/lp/lp_base.h
==============================================================================
--- hugo/trunk/src/work/athos/lp/lp_base.h (original)
+++ hugo/trunk/src/work/athos/lp/lp_base.h Fri Mar 25 12:03:49 2005
@@ -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<int> indices;
std::vector<Value> 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;
}
More information about the Lemon-commits
mailing list