Changeset 2324:18fc834761d9 in lemon-0.x

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

Some query functions got implemented, but only for GLPK.

Files:
6 edited

Unmodified
Added
Removed
• lemon/lp_base.h

 r2312 virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e) = 0; virtual void _setCoeff(int row, int col, Value value) = 0; virtual Value _getCoeff(int row, int col) = 0; virtual void _setColLowerBound(int i, Value value) = 0; virtual void _setColUpperBound(int i, Value value) = 0; virtual void _setRowBounds(int i, Value lower, Value upper) = 0; virtual void _setObjCoeff(int i, Value obj_coef) = 0; virtual Value _getObjCoeff(int i) = 0; virtual void _clearObj()=0; virtual void _setMin() = 0; virtual bool _isMax() = 0; //Own protected stuff } /// Get an element of the coefficient matrix of the LP ///\param r is the row of the element in question ///\param c is the coloumn of the element in question ///\return the corresponding coefficient Value coeff(Row r, Col c){ return _getCoeff(_lpId(r),_lpId(c)); } /// Set the lower bound of a column (i.e a variable) ///Set an element of the objective function void objCoeff(Col c, Value v) {_setObjCoeff(_lpId(c),v); }; ///Get an element of the objective function Value objCoeff(Col c) {return _getObjCoeff(_lpId(c)); }; ///Set the objective function ///\param e is a linear expression of type \ref Expr. ///\bug Is should be called obj() void min() { _setMin(); } ///Query function: is this a maximization problem? bool is_max() {return _isMax(); } ///Query function: is this a minimization problem? bool is_min() {return !is_max(); } ///@}
• lemon/lp_glpk.cc

 r2321 } LpGlpk::Value LpGlpk::_getCoeff(int row, int col) { ///\todo This is not yet implemented!!! return 0; } void LpGlpk::_setColLowerBound(int i, Value lo) { //i=0 means the constant term (shift) lpx_set_obj_coef(lp, i, obj_coef); } LpGlpk::Value LpGlpk::_getObjCoeff(int i){ //i=0 means the constant term (shift) return lpx_get_obj_coef(lp, i); } } bool LpGlpk::_isMax() { return (lpx_get_obj_dir(lp)==LPX_MAX); } void LpGlpk::messageLevel(int m) {
• lemon/lp_glpk.h

 r2321 virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e); virtual void _setCoeff(int row, int col, Value value); virtual Value _getCoeff(int row, int col); virtual void _setColLowerBound(int i, Value value); virtual void _setColUpperBound(int i, Value value); virtual void _setRowBounds(int i, Value lower, Value upper); virtual void _setObjCoeff(int i, Value obj_coef); virtual Value _getObjCoeff(int i); virtual void _clearObj(); //     virtual void _setObj(int length, virtual void _setMax(); virtual void _setMin(); virtual bool _isMax(); public:
• lemon/lp_skeleton.cc

 r2312 } LpSkeleton::Value LpSkeleton::_getCoeff(int, int) { return 0; } void LpSkeleton::_setColLowerBound(int, Value) } LpSkeleton::Value LpSkeleton::_getObjCoeff(int i){ return 0; } void LpSkeleton::_setMax() { { } bool LpSkeleton::_isMax() { return true; } void LpSkeleton::_clearObj()
• lemon/lp_skeleton.h

 r2312 virtual void _setCoeff(int row, int col, Value value); /// Get one element of the coefficient matrix virtual Value _getCoeff(int row, int col); /// The lower bound of a variable (column) have to be given by an /// extended number of type Value, i.e. a finite number of type /// \e virtual void _setObjCoeff(int i, Value obj_coef); /// \e virtual Value _getObjCoeff(int i); ///\e ///\e virtual bool _isMax(); ///\e virtual bool _isBasicCol(int i);
• test/lp_test.cc

 r2314 lp.max(); //Testing the problem retrieving routines check(lp.objCoeff(x1)==1,"First term should be 1 in the obj function!"); check(lp.is_max(),"This is a maximization!"); check(lp.coeff(upright,x1)==1,"The coefficient in question is 1!"); //Maximization of x1+x2 //over the triangle with vertices (0,0) (0,1) (1,0)
Note: See TracChangeset for help on using the changeset viewer.