diff -r 596e48d6e77b -r b4931ae52069 lemon/lp_glpk.cc --- a/lemon/lp_glpk.cc Mon Dec 04 18:09:09 2006 +0000 +++ b/lemon/lp_glpk.cc Thu Dec 07 16:10:54 2006 +0000 @@ -213,10 +213,25 @@ } } - LpGlpk::Value LpGlpk::_getCoeff(int, int) + LpGlpk::Value LpGlpk::_getCoeff(int row, int col) { - ///\todo This is not yet implemented!!! + + int length=lpx_get_mat_row(lp, row, 0, 0); + + std::vector indices(length + 2); + std::vector values(length + 2); + + lpx_get_mat_row(lp, row, &indices[0], &values[0]); + + //The following code does not suppose that the elements of the + //array indices are sorted + for (int i = 1; i <= length; ++i) { + if (indices[i]==col){ + return values[i]; + } + } return 0; + } @@ -262,6 +277,19 @@ } } + + LpGlpk::Value LpGlpk::_getColLowerBound(int i) + { + int b=lpx_get_col_type(lp, i); + switch (b) { + case LPX_LO: + case LPX_DB: + case LPX_FX: + return lpx_get_col_lb(lp, i); + default: ; + return -INF; + } + } void LpGlpk::_setColUpperBound(int i, Value up) { @@ -306,6 +334,19 @@ } } } + + LpGlpk::Value LpGlpk::_getColUpperBound(int i) + { + int b=lpx_get_col_type(lp, i); + switch (b) { + case LPX_UP: + case LPX_DB: + case LPX_FX: + return lpx_get_col_ub(lp, i); + default: ; + return INF; + } + } // void LpGlpk::_setRowLowerBound(int i, Value lo) // { @@ -424,6 +465,30 @@ } } + + void LpGlpk::_getRowBounds(int i, Value &lb, Value &ub) + { + + int b=lpx_get_row_type(lp, i); + switch (b) { + case LPX_FR: + case LPX_UP: + lb = -INF; + break; + default: + lb=lpx_get_row_lb(lp, i); + } + + switch (b) { + case LPX_FR: + case LPX_LO: + ub = INF; + break; + default: + ub=lpx_get_row_ub(lp, i); + } + + } void LpGlpk::_setObjCoeff(int i, Value obj_coef) {