- setRow() added
authoralpar
Fri, 25 Mar 2005 11:03:49 +0000
changeset 125888dff8bb4bf2
parent 1257 7101e2c3a881
child 1259 11a09f1319b3
- setRow() added
- more docs
src/work/athos/lp/lp_base.h
     1.1 --- a/src/work/athos/lp/lp_base.h	Fri Mar 25 08:21:43 2005 +0000
     1.2 +++ b/src/work/athos/lp/lp_base.h	Fri Mar 25 11:03:49 2005 +0000
     1.3 @@ -259,22 +259,25 @@
     1.4      }
     1.5  #endif
     1.6      ///Add a new empty row (i.e a new constaint) to the LP
     1.7 +
     1.8 +    ///This function adds a new empty row (i.e a new constaint) to the LP.
     1.9 +    ///\return The created row
    1.10      Row addRow() { Row r; r.id=rows.insert(_addRow()); return r;}
    1.11  
    1.12 -    ///Add a new row (i.e a new constaint) to the LP
    1.13 +    ///Set a row (i.e a constaint) of the LP
    1.14  
    1.15 -    ///\param l lower bound (-INF means no bound)
    1.16 -    ///\param e a linear expression (see \ref Expr)
    1.17 -    ///\param u upper bound (INF means no bound)
    1.18 +    ///\param r is the row to be modified
    1.19 +    ///\param l is lower bound (-INF means no bound)
    1.20 +    ///\param e is a linear expression (see \ref Expr)
    1.21 +    ///\param u is the upper bound (INF means no bound)
    1.22      ///\bug This is a temportary function. The interface will change to
    1.23      ///a better one.
    1.24 -    Row addRow(Value l,Expr e, Value u) {
    1.25 -      Row r=addRow();
    1.26 +    void setRow(Row r, Value l,const Expr &e, Value u) {
    1.27        std::vector<int> indices;
    1.28        std::vector<Value> values;
    1.29        indices.push_back(0);
    1.30        values.push_back(0);
    1.31 -      for(Expr::iterator i=e.begin(); i!=e.end(); ++i)
    1.32 +      for(Expr::const_iterator i=e.begin(); i!=e.end(); ++i)
    1.33  	if((*i).second!=0) { ///\bug EPSILON would be necessary here!!!
    1.34  	  indices.push_back(cols.floatingId((*i).first.id));
    1.35  	  values.push_back((*i).second);
    1.36 @@ -283,6 +286,19 @@
    1.37  		    &indices[0],&values[0]);
    1.38        _setRowLowerBound(rows.floatingId(r.id),l-e.constComp());
    1.39        _setRowUpperBound(rows.floatingId(r.id),u-e.constComp());
    1.40 +    }
    1.41 +
    1.42 +    ///Add a new row (i.e a new constaint) to the LP
    1.43 +
    1.44 +    ///\param l is the lower bound (-INF means no bound)
    1.45 +    ///\param e is a linear expression (see \ref Expr)
    1.46 +    ///\param u is the upper bound (INF means no bound)
    1.47 +    ///\return The created row.
    1.48 +    ///\bug This is a temportary function. The interface will change to
    1.49 +    ///a better one.
    1.50 +    Row addRow(Value l,const Expr &e, Value u) {
    1.51 +      Row r=addRow();
    1.52 +      setRow(r,l,e,u);
    1.53        return r;
    1.54      }
    1.55