COIN-OR::LEMON - Graph Library

Changeset 2324:18fc834761d9 in lemon-0.x for lemon


Ignore:
Timestamp:
12/04/06 17:48:13 (13 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3100
Message:

Some query functions got implemented, but only for GLPK.

Location:
lemon
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lemon/lp_base.h

    r2312 r2324  
    704704    virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e) = 0;
    705705    virtual void _setCoeff(int row, int col, Value value) = 0;
     706    virtual Value _getCoeff(int row, int col) = 0;
     707
    706708    virtual void _setColLowerBound(int i, Value value) = 0;
    707709    virtual void _setColUpperBound(int i, Value value) = 0;
     
    710712    virtual void _setRowBounds(int i, Value lower, Value upper) = 0;
    711713    virtual void _setObjCoeff(int i, Value obj_coef) = 0;
     714    virtual Value _getObjCoeff(int i) = 0;
    712715    virtual void _clearObj()=0;
    713716
     
    726729    virtual void _setMin() = 0;
    727730   
     731
     732    virtual bool _isMax() = 0;
     733
    728734    //Own protected stuff
    729735   
     
    10011007    }
    10021008
     1009    /// Get an element of the coefficient matrix of the LP
     1010
     1011    ///\param r is the row of the element in question
     1012    ///\param c is the coloumn of the element in question
     1013    ///\return the corresponding coefficient
     1014
     1015    Value coeff(Row r, Col c){
     1016      return _getCoeff(_lpId(r),_lpId(c));
     1017    }
     1018
    10031019    /// Set the lower bound of a column (i.e a variable)
    10041020
     
    11721188    ///Set an element of the objective function
    11731189    void objCoeff(Col c, Value v) {_setObjCoeff(_lpId(c),v); };
     1190
     1191    ///Get an element of the objective function
     1192    Value objCoeff(Col c) {return _getObjCoeff(_lpId(c)); };
     1193
    11741194    ///Set the objective function
    1175    
     1195
    11761196    ///\param e is a linear expression of type \ref Expr.
    11771197    ///\bug Is should be called obj()
     
    11881208    void min() { _setMin(); }
    11891209
     1210    ///Query function: is this a maximization problem?
     1211    bool is_max() {return _isMax(); }
     1212
     1213    ///Query function: is this a minimization problem?
     1214    bool is_min() {return !is_max(); }
    11901215   
    11911216    ///@}
  • lemon/lp_glpk.cc

    r2321 r2324  
    214214  }
    215215
     216  LpGlpk::Value LpGlpk::_getCoeff(int row, int col)
     217  {
     218    ///\todo This is not yet implemented!!!
     219    return 0;
     220  }
     221
     222
    216223  void LpGlpk::_setColLowerBound(int i, Value lo)
    217224  {
     
    423430    //i=0 means the constant term (shift)
    424431    lpx_set_obj_coef(lp, i, obj_coef);
     432  }
     433
     434  LpGlpk::Value LpGlpk::_getObjCoeff(int i){
     435    //i=0 means the constant term (shift)
     436    return lpx_get_obj_coef(lp, i);
    425437  }
    426438
     
    552564  }
    553565
     566  bool LpGlpk::_isMax()
     567  {
     568    return (lpx_get_obj_dir(lp)==LPX_MAX);
     569  }
     570
    554571 
     572
    555573  void LpGlpk::messageLevel(int m)
    556574  {
  • lemon/lp_glpk.h

    r2321 r2324  
    6161    virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e);
    6262    virtual void _setCoeff(int row, int col, Value value);
     63    virtual Value _getCoeff(int row, int col);
     64
    6365    virtual void _setColLowerBound(int i, Value value);
    6466    virtual void _setColUpperBound(int i, Value value);
     
    6769    virtual void _setRowBounds(int i, Value lower, Value upper);
    6870    virtual void _setObjCoeff(int i, Value obj_coef);
     71    virtual Value _getObjCoeff(int i);
    6972    virtual void _clearObj();
    7073//     virtual void _setObj(int length,
     
    9194    virtual void _setMax();
    9295    virtual void _setMin();
     96
     97    virtual bool _isMax();
    9398
    9499  public:
  • lemon/lp_skeleton.cc

    r2312 r2324  
    6969  }
    7070
     71  LpSkeleton::Value LpSkeleton::_getCoeff(int, int)
     72  {
     73    return 0;
     74  }
     75
    7176
    7277  void LpSkeleton::_setColLowerBound(int, Value)
     
    9499  }
    95100
     101  LpSkeleton::Value LpSkeleton::_getObjCoeff(int i){
     102    return 0;
     103  }
     104
    96105  void LpSkeleton::_setMax()
    97106  {
     
    101110  {
    102111  }
     112
     113  bool LpSkeleton::_isMax()
     114  {
     115    return true;
     116  }
     117
    103118
    104119  void LpSkeleton::_clearObj()
  • lemon/lp_skeleton.h

    r2312 r2324  
    5656    virtual void _setCoeff(int row, int col, Value value);
    5757
     58    /// Get one element of the coefficient matrix
     59    virtual Value _getCoeff(int row, int col);
     60
    5861    /// The lower bound of a variable (column) have to be given by an
    5962    /// extended number of type Value, i.e. a finite number of type
     
    9194    /// \e
    9295    virtual void _setObjCoeff(int i, Value obj_coef);
     96
     97    /// \e
     98    virtual Value _getObjCoeff(int i);
    9399
    94100    ///\e
     
    135141
    136142    ///\e
     143    virtual bool _isMax();
     144
     145
     146
     147    ///\e
    137148    virtual bool _isBasicCol(int i);
    138149
Note: See TracChangeset for help on using the changeset viewer.