Changeset 2328:b4931ae52069 in lemon-0.x for lemon/lp_glpk.cc
- Timestamp:
- 12/07/06 17:10:54 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3104
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lp_glpk.cc
r2326 r2328 214 214 } 215 215 216 LpGlpk::Value LpGlpk::_getCoeff(int, int) 217 { 218 ///\todo This is not yet implemented!!! 216 LpGlpk::Value LpGlpk::_getCoeff(int row, int col) 217 { 218 219 int length=lpx_get_mat_row(lp, row, 0, 0); 220 221 std::vector<int> indices(length + 2); 222 std::vector<Value> values(length + 2); 223 224 lpx_get_mat_row(lp, row, &indices[0], &values[0]); 225 226 //The following code does not suppose that the elements of the 227 //array indices are sorted 228 for (int i = 1; i <= length; ++i) { 229 if (indices[i]==col){ 230 return values[i]; 231 } 232 } 219 233 return 0; 234 220 235 } 221 236 … … 263 278 264 279 } 280 281 LpGlpk::Value LpGlpk::_getColLowerBound(int i) 282 { 283 int b=lpx_get_col_type(lp, i); 284 switch (b) { 285 case LPX_LO: 286 case LPX_DB: 287 case LPX_FX: 288 return lpx_get_col_lb(lp, i); 289 default: ; 290 return -INF; 291 } 292 } 265 293 266 294 void LpGlpk::_setColUpperBound(int i, Value up) … … 306 334 } 307 335 } 336 } 337 338 LpGlpk::Value LpGlpk::_getColUpperBound(int i) 339 { 340 int b=lpx_get_col_type(lp, i); 341 switch (b) { 342 case LPX_UP: 343 case LPX_DB: 344 case LPX_FX: 345 return lpx_get_col_ub(lp, i); 346 default: ; 347 return INF; 348 } 308 349 } 309 350 … … 424 465 } 425 466 467 } 468 469 void LpGlpk::_getRowBounds(int i, Value &lb, Value &ub) 470 { 471 472 int b=lpx_get_row_type(lp, i); 473 switch (b) { 474 case LPX_FR: 475 case LPX_UP: 476 lb = -INF; 477 break; 478 default: 479 lb=lpx_get_row_lb(lp, i); 480 } 481 482 switch (b) { 483 case LPX_FR: 484 case LPX_LO: 485 ub = INF; 486 break; 487 default: 488 ub=lpx_get_row_ub(lp, i); 489 } 490 426 491 } 427 492
Note: See TracChangeset
for help on using the changeset viewer.