COIN-OR::LEMON - Graph Library

Changeset 2366:bfbdded3763a in lemon-0.x for lemon/lp_glpk.cc


Ignore:
Timestamp:
02/16/07 20:11:31 (13 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3181
Message:

Using const in lp interface
colByName functionality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lp_glpk.cc

    r2364 r2366  
    3838    cols = _lp_bits::LpId(1);
    3939    lp = lpx_create_prob();
     40    lpx_create_index(lp);
    4041    ///\todo control function for this:
    4142    lpx_set_int_parm(lp, LPX_K_DUAL, 1);
     
    113114  }
    114115
    115   void LpGlpk::_getColName(int col, std::string & name)
     116  void LpGlpk::_getColName(int col, std::string & name) const
    116117  {
    117118   
     
    126127
    127128  }
     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
    128136 
    129137  void LpGlpk::_setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e)
     
    143151  }
    144152
    145   void LpGlpk::_getRowCoeffs(int i, RowIterator b)
     153  void LpGlpk::_getRowCoeffs(int i, RowIterator b) const
    146154  {
    147155    int length = lpx_get_mat_row(lp, i, 0, 0);
     
    174182  }
    175183
    176   void LpGlpk::_getColCoeffs(int i, ColIterator b)
     184  void LpGlpk::_getColCoeffs(int i, ColIterator b) const
    177185  {
    178186    int length = lpx_get_mat_col(lp, i, 0, 0);
     
    248256  }
    249257
    250   LpGlpk::Value LpGlpk::_getCoeff(int row, int col)
     258  LpGlpk::Value LpGlpk::_getCoeff(int row, int col) const
    251259  {
    252260
     
    313321  }
    314322
    315   LpGlpk::Value LpGlpk::_getColLowerBound(int i)
     323  LpGlpk::Value LpGlpk::_getColLowerBound(int i) const
    316324  {
    317325    int b=lpx_get_col_type(lp, i);
     
    370378  }
    371379
    372   LpGlpk::Value LpGlpk::_getColUpperBound(int i)
     380  LpGlpk::Value LpGlpk::_getColUpperBound(int i) const
    373381  {
    374382    int b=lpx_get_col_type(lp, i);
     
    415423  }
    416424
    417   void LpGlpk::_getRowBounds(int i, Value &lb, Value &ub)
     425  void LpGlpk::_getRowBounds(int i, Value &lb, Value &ub) const
    418426  {
    419427
     
    445453  }
    446454
    447   LpGlpk::Value LpGlpk::_getObjCoeff(int i){
     455  LpGlpk::Value LpGlpk::_getObjCoeff(int i) const {
    448456    //i=0 means the constant term (shift)
    449457    return lpx_get_obj_coef(lp, i);
     
    473481  }
    474482
    475   LpGlpk::Value LpGlpk::_getPrimal(int i)
     483  LpGlpk::Value LpGlpk::_getPrimal(int i) const
    476484  {
    477485    return lpx_get_col_prim(lp,i);
    478486  }
    479487
    480   LpGlpk::Value LpGlpk::_getDual(int i)
     488  LpGlpk::Value LpGlpk::_getDual(int i) const
    481489  {
    482490    return lpx_get_row_dual(lp,i);
    483491  }
    484492 
    485   LpGlpk::Value LpGlpk::_getPrimalValue()
     493  LpGlpk::Value LpGlpk::_getPrimalValue() const
    486494  {
    487495    return lpx_get_obj_val(lp);
    488496  }
    489   bool LpGlpk::_isBasicCol(int i) {
     497  bool LpGlpk::_isBasicCol(int i) const
     498  {
    490499    return (lpx_get_col_stat(lp, i)==LPX_BS);
    491500  }
    492501 
    493502 
    494   LpGlpk::SolutionStatus LpGlpk::_getPrimalStatus()
     503  LpGlpk::SolutionStatus LpGlpk::_getPrimalStatus() const
    495504  {
    496505    int stat=  lpx_get_status(lp);
     
    513522  }
    514523
    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  {
    520526    switch (lpx_get_dual_stat(lp)) {
    521527    case LPX_D_UNDEF://Undefined (no solve has been run yet)
     
    539545  }
    540546
    541   LpGlpk::ProblemTypes LpGlpk::_getProblemType()
     547  LpGlpk::ProblemTypes LpGlpk::_getProblemType() const
    542548  {
    543549      //int stat=  lpx_get_status(lp);
     
    566572  }
    567573
    568   bool LpGlpk::_isMax()
     574  bool LpGlpk::_isMax() const
    569575  {
    570576    return (lpx_get_obj_dir(lp)==LPX_MAX);
Note: See TracChangeset for help on using the changeset viewer.