Changeset 2366:bfbdded3763a in lemon-0.x for lemon/lp_glpk.cc
- Timestamp:
- 02/16/07 20:11:31 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3181
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lp_glpk.cc
r2364 r2366 38 38 cols = _lp_bits::LpId(1); 39 39 lp = lpx_create_prob(); 40 lpx_create_index(lp); 40 41 ///\todo control function for this: 41 42 lpx_set_int_parm(lp, LPX_K_DUAL, 1); … … 113 114 } 114 115 115 void LpGlpk::_getColName(int col, std::string & name) 116 void LpGlpk::_getColName(int col, std::string & name) const 116 117 { 117 118 … … 126 127 127 128 } 129 130 int LpGlpk::_colByName(const std::string& name) const 131 { 132 int k = lpx_find_col(lp, const_cast<char*>(name.c_str())); 133 return k > 0 ? k : -1; 134 } 135 128 136 129 137 void LpGlpk::_setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e) … … 143 151 } 144 152 145 void LpGlpk::_getRowCoeffs(int i, RowIterator b) 153 void LpGlpk::_getRowCoeffs(int i, RowIterator b) const 146 154 { 147 155 int length = lpx_get_mat_row(lp, i, 0, 0); … … 174 182 } 175 183 176 void LpGlpk::_getColCoeffs(int i, ColIterator b) 184 void LpGlpk::_getColCoeffs(int i, ColIterator b) const 177 185 { 178 186 int length = lpx_get_mat_col(lp, i, 0, 0); … … 248 256 } 249 257 250 LpGlpk::Value LpGlpk::_getCoeff(int row, int col) 258 LpGlpk::Value LpGlpk::_getCoeff(int row, int col) const 251 259 { 252 260 … … 313 321 } 314 322 315 LpGlpk::Value LpGlpk::_getColLowerBound(int i) 323 LpGlpk::Value LpGlpk::_getColLowerBound(int i) const 316 324 { 317 325 int b=lpx_get_col_type(lp, i); … … 370 378 } 371 379 372 LpGlpk::Value LpGlpk::_getColUpperBound(int i) 380 LpGlpk::Value LpGlpk::_getColUpperBound(int i) const 373 381 { 374 382 int b=lpx_get_col_type(lp, i); … … 415 423 } 416 424 417 void LpGlpk::_getRowBounds(int i, Value &lb, Value &ub) 425 void LpGlpk::_getRowBounds(int i, Value &lb, Value &ub) const 418 426 { 419 427 … … 445 453 } 446 454 447 LpGlpk::Value LpGlpk::_getObjCoeff(int i) {455 LpGlpk::Value LpGlpk::_getObjCoeff(int i) const { 448 456 //i=0 means the constant term (shift) 449 457 return lpx_get_obj_coef(lp, i); … … 473 481 } 474 482 475 LpGlpk::Value LpGlpk::_getPrimal(int i) 483 LpGlpk::Value LpGlpk::_getPrimal(int i) const 476 484 { 477 485 return lpx_get_col_prim(lp,i); 478 486 } 479 487 480 LpGlpk::Value LpGlpk::_getDual(int i) 488 LpGlpk::Value LpGlpk::_getDual(int i) const 481 489 { 482 490 return lpx_get_row_dual(lp,i); 483 491 } 484 492 485 LpGlpk::Value LpGlpk::_getPrimalValue() 493 LpGlpk::Value LpGlpk::_getPrimalValue() const 486 494 { 487 495 return lpx_get_obj_val(lp); 488 496 } 489 bool LpGlpk::_isBasicCol(int i) { 497 bool LpGlpk::_isBasicCol(int i) const 498 { 490 499 return (lpx_get_col_stat(lp, i)==LPX_BS); 491 500 } 492 501 493 502 494 LpGlpk::SolutionStatus LpGlpk::_getPrimalStatus() 503 LpGlpk::SolutionStatus LpGlpk::_getPrimalStatus() const 495 504 { 496 505 int stat= lpx_get_status(lp); … … 513 522 } 514 523 515 LpGlpk::SolutionStatus LpGlpk::_getDualStatus() 516 { 517 // std::cout<<"Itt megy: "<<lpx_get_dual_stat(lp)<<std::endl; 518 // std::cout<<"Itt a primal: "<<lpx_get_prim_stat(lp)<<std::endl; 519 524 LpGlpk::SolutionStatus LpGlpk::_getDualStatus() const 525 { 520 526 switch (lpx_get_dual_stat(lp)) { 521 527 case LPX_D_UNDEF://Undefined (no solve has been run yet) … … 539 545 } 540 546 541 LpGlpk::ProblemTypes LpGlpk::_getProblemType() 547 LpGlpk::ProblemTypes LpGlpk::_getProblemType() const 542 548 { 543 549 //int stat= lpx_get_status(lp); … … 566 572 } 567 573 568 bool LpGlpk::_isMax() 574 bool LpGlpk::_isMax() const 569 575 { 570 576 return (lpx_get_obj_dir(lp)==LPX_MAX);
Note: See TracChangeset
for help on using the changeset viewer.