COIN-OR::LEMON - Graph Library

Changeset 1264:92ba3e62825d in lemon-0.x for src/work/athos/lp/lp_base.h


Ignore:
Timestamp:
03/25/05 19:56:07 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1691
Message:

Constraints (expressions containing <= or >=) can be passed to addRow()
and setRow()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/athos/lp/lp_base.h

    r1263 r1264  
    117117    ///The infinity constant
    118118    static const Value INF;
     119    ///The not a number constant
     120    static const Value NaN;
    119121   
    120122    ///Refer to a column of the LP.
     
    168170    ///Linear expression
    169171    typedef SparseLinExpr<Col> Expr;
     172    ///Linear constraint
     173    typedef LinConstr<Expr> Constr;
    170174
    171175  protected:
     
    319323    }
    320324
     325    ///Set a row (i.e a constaint) of the LP
     326
     327    ///\param r is the row to be modified
     328    ///\param c is a linear expression (see \ref Constr)
     329    ///\bug This is a temportary function. The interface will change to
     330    ///a better one.
     331    void setRow(Row r, const Constr &c) {
     332      Value lb= c.lb==NaN?-INF:lb;
     333      Value ub= c.ub==NaN?INF:lb;
     334      setRow(r,lb,c.expr,ub);
     335    }
     336
    321337    ///Add a new row (i.e a new constaint) to the LP
    322338
     
    333349    }
    334350
     351    ///Add a new row (i.e a new constaint) to the LP
     352
     353    ///\param c is a linear expression (see \ref Constr)
     354    ///\return The created row.
     355    ///\bug This is a temportary function. The interface will change to
     356    ///a better one.
     357    Row addRow(const Constr &c) {
     358      Row r=addRow();
     359      setRow(r,c);
     360      return r;
     361    }
     362
    335363    /// Set the lower bound of a column (i.e a variable)
    336364
Note: See TracChangeset for help on using the changeset viewer.