lemon/lp_base.h
changeset 2324 18fc834761d9
parent 2312 07e46cbb7d85
child 2328 b4931ae52069
     1.1 --- a/lemon/lp_base.h	Mon Dec 04 15:00:24 2006 +0000
     1.2 +++ b/lemon/lp_base.h	Mon Dec 04 16:48:13 2006 +0000
     1.3 @@ -703,12 +703,15 @@
     1.4      virtual void _setRowCoeffs(int i, LpRowIterator b, LpRowIterator e) = 0;
     1.5      virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e) = 0;
     1.6      virtual void _setCoeff(int row, int col, Value value) = 0;
     1.7 +    virtual Value _getCoeff(int row, int col) = 0;
     1.8 +
     1.9      virtual void _setColLowerBound(int i, Value value) = 0;
    1.10      virtual void _setColUpperBound(int i, Value value) = 0;
    1.11  //     virtual void _setRowLowerBound(int i, Value value) = 0;
    1.12  //     virtual void _setRowUpperBound(int i, Value value) = 0;
    1.13      virtual void _setRowBounds(int i, Value lower, Value upper) = 0;
    1.14      virtual void _setObjCoeff(int i, Value obj_coef) = 0;
    1.15 +    virtual Value _getObjCoeff(int i) = 0;
    1.16      virtual void _clearObj()=0;
    1.17  
    1.18      virtual SolveExitStatus _solve() = 0;
    1.19 @@ -725,6 +728,9 @@
    1.20      virtual void _setMax() = 0;
    1.21      virtual void _setMin() = 0;
    1.22      
    1.23 +
    1.24 +    virtual bool _isMax() = 0;
    1.25 +
    1.26      //Own protected stuff
    1.27      
    1.28      //Constant component of the objective function
    1.29 @@ -1000,6 +1006,16 @@
    1.30        _setCoeff(_lpId(r),_lpId(c), val);
    1.31      }
    1.32  
    1.33 +    /// Get an element of the coefficient matrix of the LP
    1.34 +
    1.35 +    ///\param r is the row of the element in question
    1.36 +    ///\param c is the coloumn of the element in question
    1.37 +    ///\return the corresponding coefficient
    1.38 +
    1.39 +    Value coeff(Row r, Col c){
    1.40 +      return _getCoeff(_lpId(r),_lpId(c));
    1.41 +    }
    1.42 +
    1.43      /// Set the lower bound of a column (i.e a variable)
    1.44  
    1.45      /// The lower bound of a variable (column) has to be given by an 
    1.46 @@ -1171,8 +1187,12 @@
    1.47      
    1.48      ///Set an element of the objective function
    1.49      void objCoeff(Col c, Value v) {_setObjCoeff(_lpId(c),v); };
    1.50 +
    1.51 +    ///Get an element of the objective function
    1.52 +    Value objCoeff(Col c) {return _getObjCoeff(_lpId(c)); };
    1.53 +
    1.54      ///Set the objective function
    1.55 -    
    1.56 +
    1.57      ///\param e is a linear expression of type \ref Expr.
    1.58      ///\bug Is should be called obj()
    1.59      void setObj(Expr e) {
    1.60 @@ -1187,6 +1207,11 @@
    1.61      ///Minimize
    1.62      void min() { _setMin(); }
    1.63  
    1.64 +    ///Query function: is this a maximization problem?
    1.65 +    bool is_max() {return _isMax(); }
    1.66 +
    1.67 +    ///Query function: is this a minimization problem?
    1.68 +    bool is_min() {return !is_max(); }
    1.69      
    1.70      ///@}
    1.71